Answer the question
In order to leave comments, you need to log in
What is the right way to rewrite this code?
Good afternoon. There is the following code.
int win_size = 100;
const string test_image = "C:\\Users\\Roman\\Desktop\\group.bmp";
Mat test_im = imread(test_image, 0);
for (int i = 0; i < test_im.rows-200; i = i + 50)
{
for (int j = 0; j < test_im.cols-200; j = j + 50)
{
Mat testHog = hog(test_im (Range(i, i + win_size), Range(j, j + win_size)));
testHog.convertTo(testHog, CV_32FC1);
int response = svm->predict(testHog);
if (response == 1)
{
rectangle(test_im, Point(i, j), Point(i + win_size, j + win_size), Scalar(), 2);
}
}
}
imshow("win", test_im);
waitKey();
Implemented the hog method, now I'm trying to look for a person in a sliding window. To test, I took 5 small images, which the hog recognized as people during testing, collected them on a white background at intervals between themselves and gave them to the sliding window. As a result: 1) for some reason, on a rectangular image, the sliding window runs only over a square approximately equal to the height of the image 2) does not select people where they are and selects a white background in some places
Tell me what is wrong with my code
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question