Reputation: 3145
I have an opencv application that uses blob detection to find the centers of white circles.
I run the detection, and end up with my image (at 1920 x 1080 resolution), and a std::vector<KeyPoint>
of my 2d points.
Mapping the points onto the image, I get this:
What i need to do now is resize my image to 320 x 240, and scale the 2d points to match.
I use this code:
cv::Size imgSize(frame.cols, frame.rows); //original frame size
cv::Size resz(320, 240); //resized frame size
cv::Size scaleVal(imgSize.width / resz.width, imgSize.height / resz.height); //the scale value
//resize the frame
cv::resize(frame, frame, cv::Size(resz));
//Scale and draw the points:
for (int i = 0; i < keypoints.size(); i++)
{
cv::drawMarker(frame, cv::Point(keypoints[i].pt.x / scaleVal.width, keypoints[i].pt.y / scaleVal.height), Scalar(0, 0, 255), cv::MARKER_CROSS);
}
However this gives me:
How can i scale a vector of points to match a resized cv::Mat
image?
Upvotes: 0
Views: 462