Convert IUncompressedVideoFrame to OpenCV Mat

Answered

Comments

3 comments

  • Avatar
    Roman Inflianskas

    Anubhav,

    Here is how we (the Nx) do this:

    cv::Mat img(
        /*_rows*/ frame->height(),
        /*_cols*/ frame->width(),
        /*_type*/ CV_8UC3, //< BGR color space (default for OpenCV)
        /*_data*/ (void*) frame->data(0),
        /*_step*/ (size_t) frame->lineSize(0))
    0
    Comment actions Permalink
  • Avatar
    Anubhav Rohatgi

    How about if I choose to use yuv420 only. I believe my camera is not allowing bgr, or is there any alternative.

    0
    Comment actions Permalink
  • Avatar
    Evgeny Balashov

    The server will transcode video into a requested pixel format, it doesn't matter what specifically camera is streaming.

    Most likely you just need to choose the pixel format required for your neural network or video analytics algorithm.

    0
    Comment actions Permalink

Please sign in to leave a comment.