Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Background Scene Modeling Problem on Foreground Extraction

I am using Backgroundsubstraction method to human body extraction.When it comes to detect moving bodies this algorithm work well but if the body does not move, this algorithm does not work.How can i solve this problem?What can i add this algorithm?

For example If we’re watching anyone comes in to the park, then this person is a new foreground object. But should it stay foreground forever? In areas where there was no foreground object a given(a foreground object does not move but still there) , I could continue updating our background model.How can i keep unmoving person to the extracting foreground?

My foreground extraction code:

let video = document.getElementById('videoInput');
let cap = new cv.VideoCapture(video);

let frame = new cv.Mat(video.height, video.width, cv.CV_8UC4);
let fgmask = new cv.Mat(video.height, video.width, cv.CV_8UC1);
let fgbg = new cv.BackgroundSubtractorMOG2(500, 16, true);

const FPS = 30;
function processVideo() {
    try {
        if (!streaming) {
            // clean and stop.
            frame.delete(); fgmask.delete(); fgbg.delete();
            return;
        }
        let begin = Date.now();
        // start processing.
        cap.read(frame);
        fgbg.apply(frame, fgmask);

        frame.copyTo(fgmask, fgmask);
        cv.imshow('canvasOutput', fgmask);
        // schedule the next one.
        let delay = 1000/FPS - (Date.now() - begin);
        setTimeout(processVideo, delay);
    } catch (err) {
        utils.printError(err);
    }
};

// schedule the first one.
setTimeout(processVideo, 0);

Background Scene Modeling Problem on Foreground Extraction

I am using Backgroundsubstraction method to human body extraction.When it comes to detect moving bodies this algorithm work well but if the body does not move, this algorithm does not work.How can i solve this problem?What can i add this algorithm?

For example If we’re watching anyone comes in to the park, then this person is a new foreground object. But should it stay foreground forever? In areas where there was no foreground object a given(a foreground object does not move but still there) , I could continue updating our background model.How can i keep this unmoving person to the on extracting foreground?

My foreground extraction code:

let video = document.getElementById('videoInput');
let cap = new cv.VideoCapture(video);

let frame = new cv.Mat(video.height, video.width, cv.CV_8UC4);
let fgmask = new cv.Mat(video.height, video.width, cv.CV_8UC1);
let fgbg = new cv.BackgroundSubtractorMOG2(500, 16, true);

const FPS = 30;
function processVideo() {
    try {
        if (!streaming) {
            // clean and stop.
            frame.delete(); fgmask.delete(); fgbg.delete();
            return;
        }
        let begin = Date.now();
        // start processing.
        cap.read(frame);
        fgbg.apply(frame, fgmask);

        frame.copyTo(fgmask, fgmask);
        cv.imshow('canvasOutput', fgmask);
        // schedule the next one.
        let delay = 1000/FPS - (Date.now() - begin);
        setTimeout(processVideo, delay);
    } catch (err) {
        utils.printError(err);
    }
};

// schedule the first one.
setTimeout(processVideo, 0);

Background Scene Modeling Problem on Foreground Extraction

I am using Backgroundsubstraction method to human body extraction.When it comes to detect moving bodies this algorithm work well but if the body does not move, this algorithm does not work.How can i solve this problem?What can i add this algorithm?

For example If we’re watching anyone comes in to the park, then this person is a new foreground object. But should it stay foreground forever? In areas where there was no foreground object a given(a foreground object does not move and exit the foreground but object is still there) , I could continue updating our background model.How can i keep this unmoving person on extracting foreground?

My foreground extraction code:

let video = document.getElementById('videoInput');
let cap = new cv.VideoCapture(video);

let frame = new cv.Mat(video.height, video.width, cv.CV_8UC4);
let fgmask = new cv.Mat(video.height, video.width, cv.CV_8UC1);
let fgbg = new cv.BackgroundSubtractorMOG2(500, 16, true);

const FPS = 30;
function processVideo() {
    try {
        if (!streaming) {
            // clean and stop.
            frame.delete(); fgmask.delete(); fgbg.delete();
            return;
        }
        let begin = Date.now();
        // start processing.
        cap.read(frame);
        fgbg.apply(frame, fgmask);

        frame.copyTo(fgmask, fgmask);
        cv.imshow('canvasOutput', fgmask);
        // schedule the next one.
        let delay = 1000/FPS - (Date.now() - begin);
        setTimeout(processVideo, delay);
    } catch (err) {
        utils.printError(err);
    }
};

// schedule the first one.
setTimeout(processVideo, 0);

Background Scene Modeling Problem on Foreground Extraction

I am using Backgroundsubstraction method to human body extraction.When it comes to detect moving bodies this algorithm work well but if the body does not move, this algorithm does not work.How can i solve this problem?What can i add this algorithm?

For example If we’re watching anyone comes in to the park, then this person is a new foreground object. But should it stay foreground forever? In areas where there was no foreground object a given(a foreground object does not move and exit the foreground but object is still there) , I could continue updating our background model.How can i keep this unmoving person on extracting foreground?

My foreground extraction code:Here is my code.It can't detect objects that doesn't move as i mentioned above.

let video = document.getElementById('videoInput');
let cap = new cv.VideoCapture(video);

let frame = new cv.Mat(video.height, video.width, cv.CV_8UC4);
let fgmask = new cv.Mat(video.height, video.width, cv.CV_8UC1);
let fgbg = new cv.BackgroundSubtractorMOG2(500, 16, true);

const FPS = 30;
function processVideo() {
    try {
        if (!streaming) {
            // clean and stop.
            frame.delete(); fgmask.delete(); fgbg.delete();
            return;
        }
        let begin = Date.now();
        // start processing.
        cap.read(frame);
        fgbg.apply(frame, fgmask);

        frame.copyTo(fgmask, fgmask);
        cv.imshow('canvasOutput', fgmask);
        // schedule the next one.
        let delay = 1000/FPS - (Date.now() - begin);
        setTimeout(processVideo, delay);
    } catch (err) {
        utils.printError(err);
    }
};

// schedule the first one.
setTimeout(processVideo, 0);

Background Scene Modeling Problem on Foreground Extraction

I am using Backgroundsubstraction method to human body extraction.When it comes to detect moving bodies this algorithm work well but if the body does not move, this algorithm does not work.How can i solve this problem?What can i add this algorithm?

For example If we’re watching anyone comes in to the park, then this person is a new foreground object. But should it stay foreground forever? In areas where there was no foreground object a given(a foreground object person does not move and exit the foreground but object is still there) , I could continue updating our background model.How can i keep this unmoving person on extracting foreground?

Here is my code.It can't detect objects that doesn't move as i mentioned above.

let video = document.getElementById('videoInput');
let cap = new cv.VideoCapture(video);

let frame = new cv.Mat(video.height, video.width, cv.CV_8UC4);
let fgmask = new cv.Mat(video.height, video.width, cv.CV_8UC1);
let fgbg = new cv.BackgroundSubtractorMOG2(500, 16, true);

const FPS = 30;
function processVideo() {
    try {
        if (!streaming) {
            // clean and stop.
            frame.delete(); fgmask.delete(); fgbg.delete();
            return;
        }
        let begin = Date.now();
        // start processing.
        cap.read(frame);
        fgbg.apply(frame, fgmask);

        frame.copyTo(fgmask, fgmask);
        cv.imshow('canvasOutput', fgmask);
        // schedule the next one.
        let delay = 1000/FPS - (Date.now() - begin);
        setTimeout(processVideo, delay);
    } catch (err) {
        utils.printError(err);
    }
};

// schedule the first one.
setTimeout(processVideo, 0);

Background Scene Modeling Problem on Foreground Extraction

I am using Backgroundsubstraction method to human body extraction.When it comes to detect moving bodies this algorithm work well but if the body does scenes that do not move, this algorithm does not work.How contain moving foreground it fail to detect bodies. How can i solve this problem?What can i add this algorithm?

For example If we’re watching anyone comes in to the park, then this person is a new foreground object. But should it stay foreground forever? In areas where there was no foreground object a given(a foreground person does not move and exit the foreground but object is still there) , I could continue updating our background model.How can i keep this unmoving person on extracting foreground?

Here is my code.It can't detect objects that doesn't move as i mentioned above.

let video = document.getElementById('videoInput');
let cap = new cv.VideoCapture(video);

let frame = new cv.Mat(video.height, video.width, cv.CV_8UC4);
let fgmask = new cv.Mat(video.height, video.width, cv.CV_8UC1);
let fgbg = new cv.BackgroundSubtractorMOG2(500, 16, true);

const FPS = 30;
function processVideo() {
    try {
        if (!streaming) {
            // clean and stop.
            frame.delete(); fgmask.delete(); fgbg.delete();
            return;
        }
        let begin = Date.now();
        // start processing.
        cap.read(frame);
        fgbg.apply(frame, fgmask);

        frame.copyTo(fgmask, fgmask);
        cv.imshow('canvasOutput', fgmask);
        // schedule the next one.
        let delay = 1000/FPS - (Date.now() - begin);
        setTimeout(processVideo, delay);
    } catch (err) {
        utils.printError(err);
    }
};

// schedule the first one.
setTimeout(processVideo, 0);

Background Scene Modeling Problem on Foreground Extraction

I am using Backgroundsubstraction method to human body extraction.When it comes to detect moving bodies this algorithm work well but if scenes that do not contain moving foreground it fail to detect bodies. How can i solve this problem?What can i add this algorithm?

For example If we’re watching anyone comes in to the park, then this person is a new foreground object. But should it stay foreground forever? In areas where there was no foreground object a given(a do not contain moving foreground(a foreground person does not move and exit the foreground but object person is still there) , I could continue updating our background model.How can i keep this unmoving person on extracting foreground?

Here is my code.It can't detect objects that doesn't move as i mentioned above.

let video = document.getElementById('videoInput');
let cap = new cv.VideoCapture(video);

let frame = new cv.Mat(video.height, video.width, cv.CV_8UC4);
let fgmask = new cv.Mat(video.height, video.width, cv.CV_8UC1);
let fgbg = new cv.BackgroundSubtractorMOG2(500, 16, true);

const FPS = 30;
function processVideo() {
    try {
        if (!streaming) {
            // clean and stop.
            frame.delete(); fgmask.delete(); fgbg.delete();
            return;
        }
        let begin = Date.now();
        // start processing.
        cap.read(frame);
        fgbg.apply(frame, fgmask);

        frame.copyTo(fgmask, fgmask);
        cv.imshow('canvasOutput', fgmask);
        // schedule the next one.
        let delay = 1000/FPS - (Date.now() - begin);
        setTimeout(processVideo, delay);
    } catch (err) {
        utils.printError(err);
    }
};

// schedule the first one.
setTimeout(processVideo, 0);

Background Scene Modeling Problem on Foreground Extraction

I am using Backgroundsubstraction method to human body extraction.When it comes to detect moving bodies this algorithm work well but if scenes that do not contain moving foreground it fail to detect bodies. How can i solve this problem?What can i add this algorithm?

For example If we’re watching anyone comes in to the park, then this person is a new foreground object. But should it stay foreground forever? In areas where do not contain moving foreground(a foreground person does not move but person is still there) , I could continue updating our background model.How foreground bject.How can i keep this unmoving person on extracting foreground?foreground extraction ?

Here is my code.It can't detect objects that doesn't move as i mentioned above.

let video = document.getElementById('videoInput');
let cap = new cv.VideoCapture(video);

let frame = new cv.Mat(video.height, video.width, cv.CV_8UC4);
let fgmask = new cv.Mat(video.height, video.width, cv.CV_8UC1);
let fgbg = new cv.BackgroundSubtractorMOG2(500, 16, true);

const FPS = 30;
function processVideo() {
    try {
        if (!streaming) {
            // clean and stop.
            frame.delete(); fgmask.delete(); fgbg.delete();
            return;
        }
        let begin = Date.now();
        // start processing.
        cap.read(frame);
        fgbg.apply(frame, fgmask);

        frame.copyTo(fgmask, fgmask);
        cv.imshow('canvasOutput', fgmask);
        // schedule the next one.
        let delay = 1000/FPS - (Date.now() - begin);
        setTimeout(processVideo, delay);
    } catch (err) {
        utils.printError(err);
    }
};

// schedule the first one.
setTimeout(processVideo, 0);