Ask Your Question

OpenCV RGB to HSV wrong colors, detection by color

asked 2015-02-05 11:41:32 -0600

Nemesis gravatar image

updated 2015-02-05 12:10:02 -0600

berak gravatar image

Hi, I am working on project what detect hematoma from skin. I am having issue with color after convertion from RGB to HSV. My algorithm detect hematoma by its color.

With some images I have good results like here:

Original img: Result img:

But with some images i have bad result like this:

Original img: Result img:

The same original image after convertion to HSV:

Do you have any ideas how to fix it?


edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2015-02-05 13:14:40 -0600

Before answering for your question first make an application to find the right HSV values for your Function. You can refer this example.

Now use the HSV Range : Min: (140,20,0) Max: (180,200,200) for filtering that color alone. Also please read this faq.

edit flag offensive delete link more


thank you for yout answer. I was using just H value and I solve it by binarize both H and S images and with an AND operation I execute filtering. But I have done some tests and I found out that my simple binarization threshold( planes[0], img, 108, 255,THRESH_BINARY ); with set values are not so good with other images. Is there some smart threshold that can calculate it automatically from input image?

Nemesis gravatar imageNemesis ( 2015-02-07 13:43:09 -0600 )edit

Question Tools

1 follower


Asked: 2015-02-05 11:41:32 -0600

Seen: 2,172 times

Last updated: Feb 05 '15