Ask Your Question

KateSt's profile - activity

2016-06-04 09:15:40 -0600 commented question problems with using Haar Cascade

Thank you. Maybe there is some kind of algorithm to solve this task?

2016-06-04 01:44:11 -0600 commented question problems with using Haar Cascade

Thank you very much for your answer!   The problem is that the bird can be depicted below, above or in flight. To make each separate stage?

2016-06-03 13:08:52 -0600 received badge  Editor (source)
2016-06-03 12:03:41 -0600 asked a question problems with using Haar Cascade

I have problems with using Haar Cascade. I'd like to train каскад to find certain birds(Toucan) on the photos.. Cascade works if I just cut out Toucan with frame and background, but with bird it finds part of the background. If I cut out only the bird with grabcut ( and fill background with white, the program doesn't work even with original(white) images. Tell me please what to do?

Added: visualization problems The pictures with a simple background works well (though I must devote toucan fully, not in part) image description

In all complex background it is terribly: image description

Haar cascade is formed from good and bad images. Solving the problem in the background of good pictures, I decided to clean the background. Leaving only a bird, and all colored background cut and flooded white. After that, the search program has ceased to find any birds.

Haar cascade Standard code opencv (opencv_createsamples.exe) Finding birds on the basis of the cascade:

int main() { cv::Mat gray = cv::imread("7.jpg", 1); cv::CascadeClassifier cascadeSymbol; bool cascadeSymbolLoad = cascadeSymbol.load("cascade.xml");

if (!cascadeSymbolLoad)
{
    std::cerr << "Cascade not load. Check your directory \"haarcascade_russian_plate_number_symbol.xml\"" << std::endl;
    return false;
}

std::vector<cv::Rect> symbols;
cascadeSymbol.detectMultiScale(gray, symbols); 
for (auto& p : symbols)
{
    cv::Point symbolBegin = cv::Point(p.x, p.y);
    cv::Point symbolEnd = cv::Point(p.x + p.width, p.y + p.height);

    std::cout << "X: " << p.x << " Y: " << p.y << " Width: " << p.width << " Height: " << p.height << std::endl;
    rectangle(gray, symbolBegin, symbolEnd, cv::Scalar(0, 255, 0), 2);
}

cv::imshow("Test", gray);
cv::waitKey(0);
return 0;

}