learning Opencv

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

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值