how to increase image sharpness with out losing it's colors by using android opencv

asked 2015-06-09 03:07:59 -0600

nagesh.telivo gravatar image

updated 2015-06-09 04:55:20 -0600

I am increasing image sharpness by using fallowing code

Mat source = Imgcodecs.imread(path, Imgcodecs.CV_LOAD_IMAGE_COLOR);
Mat destination=newMat(source.rows(),source.cols(),source.type());
Imgproc.GaussianBlur(source, destination, new Size(0,0), 10);
Core.addWeighted(source, 2.5, destination, -0.5, 0, destination);
bitmap = Bitmap.createBitmap(destination.cols(),
destination.rows(),Bitmap.Config.ARGB_8888);
Utils.matToBitmap(destination, bitmap);
image_view2.setImageBitmap(bm);

it is displaying some quality image but displayed image is only black & white, lost it's original colors

but I need to display the original colour

How to do it? Thank's for helping

edit retag flag offensive close merge delete

Comments

Hmm you are reading an image as color, which is a 3 channel 8 bit image. Then you are pushing that data to a bitmap that uses 4 bytes according to the documentation. To me that seems the exact reason of your problem...

StevenPuttemans gravatar imageStevenPuttemans ( 2015-06-09 04:25:41 -0600 )edit

Also, your mat is defined as rows cols type, while your bitmap is cols rows type ... isnt that wrong?

StevenPuttemans gravatar imageStevenPuttemans ( 2015-06-09 04:26:55 -0600 )edit

Thank for response.i am beginer to the opencv,what is the right way for doing this(i have just image path,i need to increase sharpness with out losing it's colors).Thanks.....

nagesh.telivo gravatar imagenagesh.telivo ( 2015-06-09 04:48:36 -0600 )edit

I do not have experience with android/java programming myself, so will need to wait on someone who does!

StevenPuttemans gravatar imageStevenPuttemans ( 2015-06-09 06:02:25 -0600 )edit

Convert it to HSV color space and then increase the luminance value of each pixel. That's just my two cents.

cv_new gravatar imagecv_new ( 2015-06-15 21:19:42 -0600 )edit