can someone please code this simple background subtraction but with height and w
ID: 3821110 • Letter: C
Question
can someone please code this simple background subtraction but with height and width ratio to detect a human being.Please! I so badly need it for my dissertation,, cant make a loop that would subtract the every frame from background and at the same time when an object is detected it would checked if it satisfy the given height and width ratio..that would lead to detecting if its a human being or not. THANK YOU IN ADVANCE..
Algorithm for human detection
1. Begin
2. Read the original and background eliminated videos using mmreaderfunction in MATLAB.
3. Extract the number of frames and frame size.
4. Pre-allocate output video structure assigning zeros to all its elements.
5. Make the pixels corresponding to moving object white and the rest black.
6. For each frame number of blocks containing moving object are checked to satisfy H/W ratio depending on area covered by camera.
7. Draw top, bottom, left and right lines in red color to highlight the detected human.
8. End
Explanation / Answer
#include #include using namespace std; using namespace cv; int main (int argc, const char * argv[]) { VideoCapture cap(CV_CAP_ANY); cap.set(CV_CAP_PROP_FRAME_WIDTH, 320); cap.set(CV_CAP_PROP_FRAME_HEIGHT, 240); if (!cap.isOpened()) return -1; Mat img; HOGDescriptor hog; hog.setSVMDetector(HOGDescriptor::getDefaultPeopleDetector()); namedWindow("video capture", CV_WINDOW_AUTOSIZE); while (true) { cap >> img; if (!img.data) continue; vector found, found_filtered; hog.detectMultiScale(img, found, 0, Size(8,8), Size(32,32), 1.05, 2); size_t i, j; for (i=0; iRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.