Quantcast
Channel: OpenCV Q&A Forum - RSS feed
Viewing all articles
Browse latest Browse all 41027

Capturing a blob of white pixels

$
0
0
Hi, I want to bound the foreground object by a rectangle, how shall I go about doing it? I tried bounding the rectangle by collecting the white pixels , but it bounds the whole screen... ![image description](/upfiles/14368944553112866.png) #include #include "opencv2/imgcodecs.hpp" #include "opencv2/imgproc.hpp" #include "opencv2/videoio.hpp" #include #include #include //C++ #include #include using namespace cv; using namespace std; //defined later vector points; RNG rng(12345); // Global variables Mat frame; //current frame Mat fgMaskMOG2; //fg mask fg mask generated by MOG2 method Mat frame_check; Ptr pMOG2; //MOG2 Background subtractor int keyboard; //input from keyboard void help(); //void processVideo(char* videoFilename); void processVideo(); void processImages(char* firstFrameFilename); void help() { cout<< "--------------------------------------------------------------------------" << endl<< "This program shows how to use background subtraction methods provided by " << endl<< " OpenCV. You can process both videos (-vid) and images (-img)." << endl<< endl<< "Usage:" << endl<< "./bs {-vid

Viewing all articles
Browse latest Browse all 41027

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>