Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

erasing the rectangle drawn in image

I am doing object tracking. At sometimes if object is going out of frame i want to clear the rectangle which i have drawn. is it possible to clear rectangle after it is drawn?

erasing the rectangle drawn in image

I am doing object tracking. At sometimes if object is going out of frame i want to clear the rectangle which i have drawn. is it possible to clear rectangle after it is drawn?drawn? VideoCapture cap(0); Mat frame; bool trackerUptated,isObjectdetected; Rect2d roi; tracker->init(frame, roi); for (;;) { cap >> frame; trackerUptated = tracker->update(frame, roi); if (trackerUptated) {
rectangle(frame, roi, Scalar(255, 255, 255), 2, 1); } else if (!trackerUptated) { cap >> frame; detectObject(&cap, &roi, &center, &detectedObject, &isObjectdetected); tracker->update(frame, roi); rectangle(frame, roi, Scalar(255, 255, 255), 2, 1); if ((roi.x > 490 || roi.x < -10) || (roi.y > 650 || roi.y < -10)) { cout << "outside" << endl; detectObject(&cap, &roi, &center, &detectedObject, &isObjectdetected); } } imshow("tracker", frame); //quit on ESC button if (waitKey(1) == 27)break; }

erasing the rectangle drawn in image

I am doing object tracking. At sometimes if object is going out of frame i want to clear the rectangle which i have drawn. is it possible to clear rectangle after it is drawn? drawn?

VideoCapture cap(0); Mat frame; bool trackerUptated,isObjectdetected; Rect2d roi; tracker->init(frame, roi); for (;;) { cap >> frame; trackerUptated = tracker->update(frame, roi); if (trackerUptated) {
rectangle(frame, roi, Scalar(255, 255, 255), 2, 1); } else if (!trackerUptated) { cap >> frame; detectObject(&cap, &roi, &center, &detectedObject, &isObjectdetected); tracker->update(frame, roi); rectangle(frame, roi, Scalar(255, 255, 255), 2, 1); if ((roi.x > 490 || roi.x < -10) || (roi.y > 650 || roi.y < -10)) { cout << "outside" << endl; detectObject(&cap, &roi, &center, &detectedObject, &isObjectdetected); } } imshow("tracker", frame); //quit on ESC button if (waitKey(1) == 27)break; }

erasing the rectangle drawn in image

I am doing object tracking. At sometimes if object is going out of frame i want to clear the rectangle which i have drawn. is it possible to clear rectangle after it is drawn?

I am doing object tracking. At sometimes if object is going out of frame i want to clear the rectangle which i have drawn. is it possible to clear rectangle after it is drawn?

VideoCapture cap(0); cap(0);

Mat frame; frame;

bool trackerUptated,isObjectdetected; trackerUptated,isObjectdetected;

Rect2d roi; roi;

tracker->init(frame, roi); roi);

for (;;) {

{

cap >> frame; frame;

trackerUptated = tracker->update(frame, roi);

if (trackerUptated)

{

rectangle(frame, roi, Scalar(255, 255, 255), 2, 1);

}

else if (!trackerUptated)

{ cap >> frame;

detectObject(&cap, &roi, &center, &detectedObject, &isObjectdetected);

tracker->update(frame, roi);
if (trackerUptated)
{ 
rectangle(frame, roi, Scalar(255, 255, 255), 2, 1); } else if (!trackerUptated) { cap >> frame; detectObject(&cap, &roi, &center, &detectedObject, &isObjectdetected); tracker->update(frame, roi); rectangle(frame, roi, Scalar(255, 255, 255), 2, 1); if ((roi.x > 490 || roi.x < -10) || (roi.y > 650 || roi.y < -10)) { cout << "outside" << endl; detectObject(&cap, &roi, &center, &detectedObject, &isObjectdetected); } }

}

imshow("tracker", frame);
        //quit on ESC button
         if (waitKey(1) == 27)break;

}

erasing the rectangle drawn in image

I am doing object tracking. At sometimes if object is going out of frame i want to clear the rectangle which i have drawn. is it possible to clear rectangle after it is drawn?

I am doing object tracking. At sometimes if object is going out of frame i want to clear the rectangle which i have drawn. is it possible to clear rectangle after it is drawn?

VideoCapture cap(0);

cap(0);
Mat frame;

frame;
bool trackerUptated,isObjectdetected;

trackerUptated,isObjectdetected;
Rect2d roi;

roi;
tracker->init(frame, roi);

roi);
for (;;)

{


{
cap >> frame;

frame;
trackerUptated = tracker->update(frame, roi);

if (trackerUptated)

{

roi);
if (trackerUptated)
{
rectangle(frame, roi, Scalar(255, 255, 255), 2, 1);

}

1);
}
else if (!trackerUptated)

{ (!trackerUptated)
{
cap >> frame;

frame; 
detectObject(&cap, &roi, &center, &detectedObject, &isObjectdetected); &isObjectdetected);
tracker->update(frame, roi); roi);
rectangle(frame, roi, Scalar(255, 255, 255), 2, 1); 1);
if ((roi.x > 490 || roi.x < -10) || (roi.y > 650 || roi.y < -10)) { {
cout << "outside" << endl; endl;
detectObject(&cap, &roi, &center, &detectedObject, &isObjectdetected); }

&isObjectdetected);
}
}
imshow("tracker", frame);
if (waitKey(1) == 27)break;
}

imshow("tracker", frame);


    if (waitKey(1) == 27)break;

}

click to hide/show revision 6
None

updated 2018-08-22 02:54:41 -0500

berak gravatar image

erasing the rectangle drawn in image

I am doing object tracking. At sometimes if object is going out of frame i want to clear the rectangle which i have drawn. is it possible to clear rectangle after it is drawn?

VideoCapture cap(0); 
Mat frame;
bool trackerUptated,isObjectdetected;
Rect2d roi;
tracker->init(frame, roi);
for (;;)
{
{ cap >> frame;
trackerUptated = tracker->update(frame, roi);
if (trackerUptated)
{
{ rectangle(frame, roi, Scalar(255, 255, 255), 2, 1);
}
else if (!trackerUptated)
{
{ cap >> frame;
detectObject(&cap, &roi, &center, &detectedObject, &isObjectdetected);
tracker->update(frame, roi);
rectangle(frame, roi, Scalar(255, 255, 255), 2, 1);
if ((roi.x > 490 || roi.x < -10) || (roi.y > 650 || roi.y < -10)) {
cout << "outside" << endl;
detectObject(&cap, &roi, &center, &detectedObject, &isObjectdetected);
}
}
imshow("tracker", frame);
if (waitKey(1) == 27)break;
}

}