Intensity value based tracking
I want to draw a rectangle in opencv according to the pixel intensity i.e. i don't want to give a static values to cvRectangle like cv::point1 or cv::point2. I want that whenever specific intensity value is encountered it draws a rectangle around that object. I got a sample like this but it's not what i want how should i modify this
pMOG->operator()(frame, fgMaskMOG);
while(frame.data!=NULL)
{
for(int i=0;i<frame.row;i++)
{
for(int j=0;j<frame.col;j++)
{
if(frame.at<uchar>(i,j)=='0')
//std::vector<Rect> frame;
cv::rectangle(frame, // the dest image
cvPoint(100, 100), // top left point
cvPoint(300, 30), // bottom right point
cvScalar(255, 0, 0, 0), // the color; blue
3, 8, 0); // thickness, line type, shift
}
}
could you edit that post, and format the code properly ?
Is it better now??
yes, a lot ;)
sorry, but I don't think that I understand your question properly: do you want to draw a rectangle _around a pixel of certain value_ or around an _object_? It the latter one, how do you get/define that _object_?