OpenCV Hu moments extraction

Viewed 3501

I'm trying to make a fire detection using Machine learning. My features are mean RGB, variance RGB, and Hu moments. So what I'm doing right now is I first segment an image based on this paper

According to the paper I use the rules

r > g && g > b
r > 190 && g > 100 && b < 140

here is the result of my color segmentation for the negative and positive images

1 2 3 4 5 6

The pictures on the right are now in

vector<Mat> processedImage

After that I get the hu moments of each picture by converting it into gray scale and blurring it.

cvtColor(processedImage[x], gray_image, CV_BGR2GRAY);
blur(gray_image, gray_image, Size(3, 3));
Canny(gray_image, canny_output, thresh, thresh * 2, 3);
findContours(canny_output, contours, hierarchy, CV_RETR_TREE,CV_CHAIN_APPROX_SIMPLE, Point(0, 0));
cv::Moments mom = cv::moments(contours[0]);
cv::HuMoments(mom, hu); // now in hu are your 7 Hu-Moments

Now I am stuck I'm not sure if my images are okay to obtain useful hu moments because the negative images are so scattered. Am I on the right track with regards to Hu moments extraction? Will I do the same on testing where I do color segmentation before extracting hu moments?

1 Answers
Related