How should I find edges in the hue channel of an HSV image?

asked 2016-03-21 14:42:26 -0600

pthacker gravatar image

updated 2016-03-21 15:05:01 -0600

I'm trying to find edges in a color image--particularly to distinguish between a person and a background. I'll use them to refine the results from a depth sensor. I know that I can convert the image to grayscale and use Canny on that, but that sometimes misses important edges. I believe I could get better results by also using chroma information. I've experimented with different color spaces, and the best one I've found is HSV. However, there's an issue with detecting edges in the H channel. Because hue in HSV is an angular measurement from 0 to 179 inclusive (360 divided by 2 so it fits into 8 bits), the values wrap around, and the difference between different values isn't simply a subtraction. The difference between 0 and 179 is 1. The difference between 20 and 160 is 40. So, in the attached image, you can see a very strong boundary between the head and the background (around 15 vs. 105), which is real. But if you look around the mouth, there’s what looks to be a strong boundary, but since it’s around 5 vs. 175, it’s actually not a very large change.

Is there a way to detect edges in OpenCV that takes this into account? Or, is anyone aware of an open source program that implements this? Otherwise, the only thing I can think of would be to write a custom implementation of Canny or some other edge detection algorithm

C:\fakepath\srcImageH.png

edit retag flag offensive close merge delete

Comments

1

if you have a live camera stream maybe you will use a medhod based on background subtraction

sturkmen gravatar imagesturkmen ( 2016-03-21 15:08:47 -0600 )edit

@pthacker did you ever find a solution to this problem?

alwilcox gravatar imagealwilcox ( 2018-04-15 06:13:06 -0600 )edit