cvCvtColor nv12 from V4l buffer

asked 2015-09-01 18:32:24 -0500

Hi people i have a problem when i try con conver nv12 buffer to BGR and write to jpeg.

This is the code

void* detect(void  * ptr_data)
        LOGI("enter to detect");
        CvMat cvmat;
        CvMat cvMatConverted;
        cvmat = cvMat(720, 1280,  CV_8UC3, ptr_data);
        LOGI("cvmat: cols %d, rows %d, ptr %u\n", cvmat.cols, cvmat.rows,;
        LOGI("before converted");
        cvMatConverted = cvMat(720,1280, CV_8UC3, &ptr_data);
        LOGI("before cvtcolor");
        LOGI("after cvtcolor");
        return NULL ;

the error says that can not convert because:

E/cv::error()( 1749): OpenCV Error: Assertion failed ( == in void cvCvtColor(const CvArr, CvArr, int), file /hdd2/buildbot/slaves/slave_ardbeg1/50-SDK/opencv/modules/imgproc/src/color.cpp, line 4424

edit retag flag offensive close merge delete



please use cv::Mat and cv::cvtColor, not the deprecated c-api.

berak gravatar imageberak ( 2015-09-02 00:57:15 -0500 )edit

i use the cv::cvtColor from cpp lib and now i have an image broken equally this is the code now and this is the result image

gonzafirewall gravatar imagegonzafirewall ( 2015-09-02 12:12:11 -0500 )edit

I resolved using opencv in c++ and before to saving use a sws_scale conversion from NV12 to BGR24 before i show you the code resulting

gonzafirewall gravatar imagegonzafirewall ( 2015-09-02 15:11:01 -0500 )edit