您的位置:首页 > 运维架构

RGB转换HSV空间,提取前景

2014-04-29 00:00 260 查看
摘要: 相近颜色在RGB空间中值可能相距很远,通过将转换为HSV空间,可以方便地提取前景

the source image:



If the letter is always with specific colour you can use colour based segmentation,

Convert source to hsv colour space.

Perform inRange() between lower and upper threshold for the particular colour.

For the above image you culd use some thing like

Mat src=imread("l.jpg",1);
Mat hsv,thr;
cvtColor(src,hsv,CV_BGR2HSV);
inRange(hsv,Scalar(76,84,86),Scalar(135,255,255),thr);
imshow("thr",thr);

See the result,

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  opencv hsv