Ask Your Question

color detect

asked 2016-01-12 08:52:25 -0500

baro gravatar image

Hello at all! I'm trying to do a people detect using color histogram to realize it. I would know if exists a function of openCV that works as Canny but not with grayscale. More precisely a funtion that works with color directly. I think that, if exists it, is much more robust that Canny. Could you show me one example? I use histograms to calculate the differences between two images. thank you so much for your help!

edit retag flag offensive close merge delete


sturkmen gravatar imagesturkmen ( 2016-01-12 08:59:44 -0500 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2016-01-12 12:08:44 -0500

Kellerspeicher gravatar image

updated 2016-01-12 13:04:45 -0500

There are good examples for face detection and I am not sure if Canny on colour will make sense. But if you want to try:

// Transform Blue, Green, Red to Hue, Saturation, Value
cv::Mat hsv;
cv::cvtColor( frame, hsv, cv::COLOR_BGR2HSV );
// Split the three channels
std::vector< cv::Mat > hsvChannels;
cv::split( hsv, hsvChannels );
// Blur the hue channel
cv::Mat blured;
cv::blur( hsvChannels[0], blured, cv::Size(3,3) );
// Canny the hue channel
cv::Mat canny;
cv::Canny( blured, canny, 100, 300, 3 );

For a good face detection example e.g. look here.

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower


Asked: 2016-01-12 08:52:25 -0500

Seen: 89 times

Last updated: Jan 12 '16