1 | initial version |
you need to clone() the image (so you can draw things independantly), and call imshow() with different window names, like:
for(unsigned i=0; i<trackers.getObjects().size(); i++)
{
Mat img = frame.clone();
rectangle(img, trackers.getObjects()[i], Scalar::all(255), 2);
imshow(format("tracker_%d", i), img);
}
waitKey(30);
2 | No.2 Revision |
you need to clone() the image (so you can draw things independantly), and call imshow() with different window names, like:
for(unsigned i=0; i<trackers.getObjects().size(); i++)
{
Mat img = frame.clone();
rectangle(img, trackers.getObjects()[i], Scalar::all(255), 2);
imshow(format("tracker_%d", i), img);
}
waitKey(30);
if you're mainly interested in the content of the roi's you also could try like this:
Size sz(100,100);
Mat rois;
vector<Rect2d> rects = trackers.getObjects();
for(unsigned i=0; i<rects.size(); i++)
{
Mat patch;
resize(frame(rects[i]), patch, sz);
if (rois.empty())
rois = patch;
else
hconcat(rois, patch, rois);
}
imshow("ROIS", rois);
waitKey(30);
3 | No.3 Revision |
you need to clone() the image (so you can draw things independantly), and call imshow() with different window names, like:
for(unsigned i=0; i<trackers.getObjects().size(); i++)
{
Mat img = frame.clone();
rectangle(img, trackers.getObjects()[i], Scalar::all(255), 2);
imshow(format("tracker_%d", i), img);
}
waitKey(30);
if you're mainly interested in the content of the roi's you also could try like this:
Size sz(100,100);
Mat rois;
vector<Rect2d> rects = trackers.getObjects();
for(unsigned i=0; i<rects.size(); i++)
{
Mat patch;
resize(frame(rects[i]), patch, sz);
if (rois.empty())
rois = patch;
patch.clone();
else
hconcat(rois, patch, rois);
}
imshow("ROIS", rois);
waitKey(30);