Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

I can use updateHistoryImage with a stereo image?

I am working with a 8UC3 stereo image, but the function updateHistoryImage works only with 8UC1 and 32UF1...

The error: OpenCV(4.0.1-dev) Error: Assertion failed (_silhouette.type() == CV_8UC1 && _mhi.type() == CV_32FC1) in cv::motempl::updateMotionHistory, file C:\opencv4\opencv_contrib-master\modules\optflow\src\motempl.cpp, line 76

I tried to convert the stereo image to 1 level but nothing... How can I make it work?

I can use updateHistoryImage with a stereo image?

I am working with a 8UC3 stereo image, but the function updateHistoryImage works only with 8UC1 and 32UF1...

The error: OpenCV(4.0.1-dev) Error: Assertion failed (_silhouette.type() == CV_8UC1 && _mhi.type() == CV_32FC1) in cv::motempl::updateMotionHistory, file C:\opencv4\opencv_contrib-master\modules\optflow\src\motempl.cpp, line 76

I tried to convert the stereo image to 1 level but nothing... How can I make it work?

frameset data = pipe.wait_for_frames(); // Wait for next set of frames from the camera
    frame depth = data.get_depth_frame().apply_filter(color_map);
    const int w = depth.as<video_frame>().get_width();
    const int h = depth.as<video_frame>().get_height();
    Mat image(Size(w, h), CV_8UC3, (void*)depth.get_data(), Mat::AUTO_STEP);
    Mat image2(Size(w, h), CV_8UC3, (void*)depth.get_data(), Mat::AUTO_STEP);
    absdiff(image, image2, differenceImage);
    threshold(differenceImage, silhouette, 127, 255, THRESH_BINARY);

    mhi = Mat::zeros(image.size(), CV_32FC1);
    updateMotionHistory(silhouette, mhi, timestamp, MHI_DURATION);