Domanda

I'm using compareHist() function to compare the histograms of two images.

My question is: Does the size of the image has a considerable influence on the results? Should I resize the images or normalize the histograms before comparing? I'm using the CV_COMP_CORREL method.

È stato utile?

Soluzione

You have to normalize histograms before comparision.

Imagine you have non noramlized histograms, e.g. one of them has a bins values in interval [0..1000] and other in [0..1]. How can you compare them? Of course every mathematical operation like addition makes no sense, because what is the result of this addition?

Then in practice a size of an image does not really matters.

In practice means that if you hava an Image A and you scale it lets say two times and you've got an image B, then if you compute hist(A) and hist(B), normalize both then histograms will be practically the same. It is because of the fact if you are scaling an image by factor k, and you have n pixels in color c in image A, then in image B you have approximately k*k*n pixels in color c (depends of interpolation). So every color amount also "scale" proportionally, so if you normalize hist(A)and hist(B), results will be approximately the same (also if your bins have sizes greater than 1 like 16 etc.)

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top