码迷,mamicode.com
首页 > 其他好文 > 详细

opencv inrange 和 mix

时间:2017-10-07 14:24:54      阅读:181      评论:0      收藏:0      [点我收藏+]

标签:unless   range   ann   lang   open   rect   blog   channels   har   

opencv inrange:

http://blog.csdn.net/xiaoyufei117122/article/details/53572904

http://blog.csdn.net/wejoncy/article/details/50599640?locationNum=2&fps=1

Python中如果是单通道,假设lower=[0],upper=[128],那么,对每个数在0-128之间为255,否则为0;

如果是多通道,假设lower=[0,0,0],upper=[128,128,128,128],那么,对每一行,对任意一个数,如果在范围内,则255,否则0,最后的几个数相与,因此如果都是255,为255,否则为0

opencv mixchannels:

http://www.cnblogs.com/ruic/archive/2015/10/31/4926254.html

opencv calchist:

http://blog.csdn.net/ubunfans/article/details/23619771

 // Object has been selected by user, set up CAMShift search properties once
                    Mat roi(hue, selection), maskroi(mask, selection);
                    calcHist(&roi, 1, 0, maskroi, hist, 1, &hsize, &phranges);
                    normalize(hist, hist, 0, 255, NORM_MINMAX);

                    trackWindow = selection;
                    trackObject = 1; // Don‘t set up again, unless user selects new ROI

                    histimg = Scalar::all(0);
                    int binW = histimg.cols / hsize;
                    Mat buf(1, hsize, CV_8UC3);
                    for( int i = 0; i < hsize; i++ )
                        buf.at<Vec3b>(i) = Vec3b(saturate_cast<uchar>(i*180./hsize), 255, 255);
                    cvtColor(buf, buf, COLOR_HSV2BGR);

                    for( int i = 0; i < hsize; i++ )
                    {
                        int val = saturate_cast<int>(hist.at<float>(i)*histimg.rows/255);
                        rectangle( histimg, Point(i*binW,histimg.rows),
                                   Point((i+1)*binW,histimg.rows - val),
                                   Scalar(buf.at<Vec3b>(i)), -1, 8 );
                    }

  

opencv inrange 和 mix

标签:unless   range   ann   lang   open   rect   blog   channels   har   

原文地址:http://www.cnblogs.com/hong2016/p/7634444.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!