Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How to copy cv::Mat *img to cv::Mat img

Hi I have started exploring somthing in Darkent YOLO object detection. Where Video capture is done as below

mat_cv* get_capture_frame_cv(cap_cv *cap) {
    cv::Mat *mat = new cv::Mat();
    try {
        if (cap) {
            cv::VideoCapture &cpp_cap = *(cv::VideoCapture *)cap;
            if (cpp_cap.isOpened())
            {
                cpp_cap >> *mat;
            }
            else std::cout << " Video-stream stopped! \n";
        }
        else cerr << " cv::VideoCapture isn't created \n";
    }
    catch (...) {
        std::cout << " OpenCV exception: Video-stream stoped! \n";
    }
    return (mat_cv *)mat;
}

Where cpp_cap >> *mat; cature the frame where I want to take Perspective and returns output at return (mat_cv *)mat;

Please help me.

Regards, Prabhakar M

How to copy cv::Mat *img to cv::Mat img

Hi I have started exploring somthing something in Darkent YOLO object detection. Where Video capture is done as below

mat_cv* get_capture_frame_cv(cap_cv *cap) {
    cv::Mat *mat = new cv::Mat();
    try {
        if (cap) {
            cv::VideoCapture &cpp_cap = *(cv::VideoCapture *)cap;
            if (cpp_cap.isOpened())
            {
                cpp_cap >> *mat;
            }
            else std::cout << " Video-stream stopped! \n";
        }
        else cerr << " cv::VideoCapture isn't created \n";
    }
    catch (...) {
        std::cout << " OpenCV exception: Video-stream stoped! \n";
    }
    return (mat_cv *)mat;
}

Where cpp_cap >> *mat; cature catures the frame where I want to take Perspective and returns output at return (mat_cv *)mat;

Here I stuck how to pass cv::Mat *mat to warpPerspective function where its input is Mat type. Please help me.

Regards, Prabhakar M