Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

theoretically difference between two cv::mat frames (with 4 sec. interval) should be zero

i would not bet on it being exactly zero.

then, -- please do NOT write for loops here, use existing opencv functions like absdiff() and sum() (and find a nice threshold value for the decision)

theoretically difference between two cv::mat frames (with 4 sec. interval) should be zero

i would not bet on it being exactly zero.

then, -- please do NOT write for loops here, use existing opencv functions like absdiff() and sum() (and find a nice threshold value for the decision)

also: https://docs.opencv.org/master/d5/dc4/tutorial_video_input_psnr_ssim.html

theoretically difference between two cv::mat frames (with 4 sec. interval) should be zero

i would not no, that will almose NEVER happen.

there will always be noise, and ipcams usually send (lossy) jpg images, so you also have compression artefacts. you can't bet on it being exactly zero.zero. (you'll be amazed, how large it is in reality)

then, -- please do NOT write for loops here, here (or even use Qt images), use existing opencv functions like absdiff() and sum() (and find a nice threshold value for the decision)

also: https://docs.opencv.org/master/d5/dc4/tutorial_video_input_psnr_ssim.html

so in short:

double CompareWorker::compareFrames(Mat frame1, Mat frame2) {
    Mat diff;
    cv::absdiff(frame1, frame2, diff);
    Scalar s = cv::sum(diff);
    return s[0] + s[1] + s[2];
}

theoretically difference between two cv::mat frames (with 4 sec. interval) should be zero

no, that will almose almost NEVER happen.

there will always be noise, and ipcams usually send (lossy) jpg images, so you also have compression artefacts. you can't bet on it being exactly zero. (you'll be amazed, how large it is in reality)

then, -- please do NOT write for loops here (or even use Qt images), use existing opencv functions like absdiff() and sum() (and find a nice threshold value for the decision)

also: https://docs.opencv.org/master/d5/dc4/tutorial_video_input_psnr_ssim.html

so in short:

double CompareWorker::compareFrames(Mat frame1, Mat frame2) {
    Mat diff;
    cv::absdiff(frame1, frame2, diff);
    Scalar s = cv::sum(diff);
    return s[0] + s[1] + s[2];
}