Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

your current addWeighted() approach seems to consider all images while the program is running, while this probably requires a constant number of images to interpret

for a fixed camera, you could use a ringbuffer/fifo/lifo to calculate a "moving average over time" like:

std::deque<cv::Mat> queue;
int N=8;
while (1) {
    cv::Mat new_depth_frame = .... // from zed cam
    queue.push_back(new_depth_frame / N);
    cv::Mat avg;
    if (queue.size() >= N) {
        for (cv::Mat q : queue) 
            avg += q;
        queue.pop_front();
    }
    if (! avg.empty()) { queue not full yet
        // now use avg ...
   }
}

your current addWeighted() approach seems to consider all images while during the program is running, runtime of the program, while this probably requires a constant constant number of images to interpretinterpolate

for a fixed camera, you could use a ringbuffer/fifo/lifo to calculate a "moving average over time" like:

std::deque<cv::Mat> queue;
int N=8;
while (1) {
    cv::Mat new_depth_frame = .... // from zed cam
    queue.push_back(new_depth_frame / N);
    cv::Mat avg;
    if (queue.size() >= N) {
        for (cv::Mat q : queue) 
            avg += q;
        queue.pop_front();
    }
    if (! avg.empty()) { queue not full yet
        // now use avg ...
   }
}

your current addWeighted() approach seems to consider all images during the runtime of the program, while this probably requires a constant number of images to interpolate

for a fixed camera, you could use a ringbuffer/fifo/lifo to calculate a "moving average over time" like:

std::deque<cv::Mat> queue;
int N=8;
while (1) {
    cv::Mat new_depth_frame = .... // from zed cam
    queue.push_back(new_depth_frame / N);
    cv::Mat avg;
    if (queue.size() >= N) {
        for (cv::Mat q : queue) 
            avg += q;
        queue.pop_front();
    }
    if (! avg.empty()) { queue //queue not full yet
        // now use avg ...
   }
}

your current addWeighted() approach seems to consider all images during the runtime of the program, while this probably requires a constant number of images to interpolate

for a fixed camera, you could use a ringbuffer/fifo/lifo to calculate a "moving average over time" like:

std::deque<cv::Mat> queue;
int N=8;
while (1) {
    cv::Mat new_depth_frame = .... // from zed cam
    queue.push_back(new_depth_frame / N);
    cv::Mat avg;
    if (queue.size() >= > N) {
        queue.pop_front();
        for (cv::Mat q : queue) 
            avg += q;
        queue.pop_front();
    }
    if (! avg.empty()) { //queue not full yet
        // now use avg ...
   }
}

your current addWeighted() approach seems to consider all images during the runtime of the program, while this probably requires a constant number of images to interpolate

for a fixed camera, you could use a ringbuffer/fifo/lifo to calculate a "moving average over time" like:

std::deque<cv::Mat> queue;
int N=8;
while (1) {
    cv::Mat new_depth_frame = .... // from zed cam
    queue.push_back(new_depth_frame / N);
    cv::Mat avg;
avg = Mat::zeros(new_depth_frame.size(), CV_32F); // EDIT!
    if (queue.size() > N) {
        queue.pop_front();
        for (cv::Mat q : queue) 
            avg += q;
    }
    if (! avg.empty()) { //queue not full yet
        // now use avg ...
   }
}