I have a video where I am supposed to choose the tracking points. I would like to know how I zoomed in and zoomed out to get closer to the place where I wanted to choose the points, to be more visible
The basic idea is deciding the scale changed every time on mouse wheel. After you get the current scale (vs origin image) and correct region of image you want to show on screen, you can get the position and length of rectangle on scaled image. So you can draw this rectangle on scaled image.
In my github ,checking class COpenCVWindowExt is enough, and focus on how I change the scale and how the new rectangle to be draw in scaled image will be enough.
Besides, what you should do is continually getting image source from video, and use the same scale and region to show certain section of the image.
Part of the code:
void COpenCVWindowExt::RefreshImage ()
{
if (m_matSrc.empty ())
return;
Mat matResize;
Size size (int (m_dNewScale * m_matSrc.cols), int (m_dNewScale * m_matSrc.rows));
resize (m_matSrc, matResize, size);
int iW = int (m_matSrc.cols * m_dInitialScale), iH = int (m_matSrc.rows * m_dInitialScale);
Rect rectShow (Point (m_iHorzScrollBarPos, m_iVertScrollBarPos), Size (iW, iH));
imshow (m_strWindowName, matResize (rectShow));
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.