Having used the matlab to do programming for some time, I decided to learn Opencv to improve my programming skill. I started from the computer vision application cookbook. It is really helpful and the knowledge is not that horrible or mistery as I thought before. By typing the codes by myself, I find it can enhance my memory of the method and it is really interesting when the result comes out, although there are still some problems and opinions that I could not understand. I know I am making improvement, and that is enough. I won't compare with others. Everyone has his own journey and you have no idea where his journey will lead him. But I know mine is the best and most suitful for me .BE good DO right~~~ I will record the learning trace of OpenCV and some of my comprehension. if there are any mistakes, please inform me.
Chapter 4 Histogram
backprojecting a histogram to detect specific image content
normalize(his, his, 1)
the function calculate each element so that the norm is 1. but as to the digital image processing, to normalize the histgram, the equation is h(i) / NM. I design the code to normalize the histogram
Mat m1=(Mat_<double>(1,3)<<1,2,3);
Scalar s1=sum(m1);
Mat m2=m1/s1[0];
cout<<m2<<endl<<s1[0]<<endl;
Scalar is a container for 4 doubles. (sometimes I feel that initial a mat is really much more complex uing Opencv than using matlab.╮(╯_╰)╭)
for the image, s1 is the size