Ask Your Question
0

what is normalize in opencv

asked 2017-07-03 03:55:26 -0600

jjabaram gravatar image

I'm trying to understand what is normalize do. I have 2 images:

Image 1 :

image description

Image 2 :

image description

and then i try to divide it with

divide(image1, image2, div);

and i try to print it (10x10) :

image description

all value will become 1 or 0. and when show it, it will be like this :

image description

but when i normalize it :

normalize(div, nom, 0, 255, NORM_MINMAX, CV_8U);

it wil show like this :

image description

when i try print all the pixel value, the value is only 85, but in image there is white dot area.

can someone please explain to me what happen ?

Thank you.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2017-07-03 05:15:13 -0600

KjMag gravatar image

CV_8U corresponds to grayscale image, so all you're gonna see is black or various shades of grey that becomes more white as the values get higher. The value of 85 may appear white compared to black background.

BTW normalization doesn't change all the values to 0 or 1. This is what binarization does.

edit flag offensive delete link more

Comments

Thank you for your answer @KjMag, actually I'm using greyscale image and without normalize all the screen is black, but when i normalize it, it become grey and when i print all the pixel value, the value only 85 there is no higher number or other number than 85, but there are couple white spot. that's why I'm confused right now.

jjabaram gravatar imagejjabaram ( 2017-07-03 05:25:46 -0600 )edit

You have already post a question on this subject. divide(image1, image2, div); will give a result with same type of image1. Results will be CV_8U and 135/168 is equal to 0 with unsigned char. You have to use divide(image1, image2, div, 1,CV_32F); and then normalize(div,result,255,0,NORM_MINMAX,CV_8U);

LBerger gravatar imageLBerger ( 2017-07-03 06:45:42 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2017-07-03 03:55:26 -0600

Seen: 1,726 times

Last updated: Jul 03 '17