RGB转换HSV空间,提取前景

the source image:

104354_TRsX_1762077.jpg

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,

104428_JuwM_1762077.jpg


转载于:https://my.oschina.net/u/1762077/blog/228407

你可能感兴趣的:(RGB转换HSV空间,提取前景)