将效果应用于HD图像



我正在开发一个处理图像并对图像应用过滤器、边框等的应用程序。。(就像照片编辑应用程序)。

我在对高清图像应用滤镜或边框时遇到了问题(因为图像的大小和分辨率不同)。

我的问题是如何在不更改图像大小或尺寸的情况下应用过滤器。请帮忙,提前谢谢。

正如我在代码的注释部分所提到的,对于较小大小的图像,getDrawingCache返回一个值,但对于较大大小的图像则返回null。

public Bitmap getBorderAppliedBitmap(PorterShapeImageView imgView , GPUImage gpuImage)
{
    Bitmap bmp = gpuImage.getBitmapWithFilterApplied();
    imgView.setImageBitmap(bmp);
    imgView.setDrawingCacheEnabled(true);
    imgView.measure(View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED),
            View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED));
    imgView.layout(0, 0,
            imgView.getMeasuredWidth(), imgView.getMeasuredHeight());
    imgView.buildDrawingCache(true);
    Bitmap bmap = Bitmap.createBitmap(imgView.getDrawingCache());
 <!-- getting null from the method imgView.getDraingCache() only for the bigger size Images -->
    imgView.setDrawingCacheEnabled(false);
    return bmap;
}

您必须面对的是图像处理技术的Android资源有限问题。最好的建议是转向NDK,并使用OpenCV在JNI中编写图像过滤器。

它是在高清图像中获得更快结果的最佳选择。由于所有专业应用程序都会创建自己的边界参数,因此图像处理的分辨率必须有边界。

最新更新