how to convert vsdk::Mat to cv::Mat?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

how to convert vsdk::Mat to cv::Mat?

1,168 Views
justforfunl
Contributor II

I am using SDK to Get the Camera Capture, but My Application is written by OpenCV,  I need to deal with the cv::Mat data , but I don't know how to do this. 

4 Replies

702 Views
jiri_kral
NXP Employee
NXP Employee

Hi, 

for more info  you can look at VisionSDK_UMat.pdf file. File is located [S32DS_VISION_INSTALL_PATH]\S32DS\s32v234_sdk\docs\vsdk\

I think that also GDI_Mat class can handle cv::Mat data.

Jiri

0 Kudos

702 Views
justforfunl
Contributor II

I test the following codes.

vsdk::Mat frame_map = lFrame.mUMat.getMat(vsdk::ACCESS_READ | OAL_USAGE_CACHED);

printf("channel is d%",frame_map.channels());

printf("rows is d%",frame_map.rows);

printf("cols is d%",frame_map.cols);

printf("depth is d%",frame_map.depth());

printf("elemSize is d%",frame_map.elemSize());

printf("elemSize1 is d%",frame_map.elemSize1());

printf("total is d%",frame_map.total());

printf("type is d%",frame_map.type());

result is:

channel is 2

rows is 960

cols is 1280

depth is 0

elemSize is 2

elemSize1 is 1

total is 1228800

type is 8

what’s meaning of “channel is 2”

 

OpenCV Error: Assertion failed (image.channels() == 1 || image.channels() == 3 || image.channels() == 4) in imwrite_, file /home/b45336/git/vsdk/opencv_src/modules/imgcodecs/src/loadsave.cpp, line 455

../src/sdi.cpp:1548/SeqEventHandler : [Note]: Grabber got Sequencer event number 4098.

Frame done message arrived #3.

../src/sdi.cpp:1566/SeqEventHandler : [Note]: Frame done.

terminate called after throwing an instance of 'cv::Exception'

  what():  /home/b45336/git/vsdk/opencv_src/modules/imgcodecs/src/loadsave.cpp:455: error: (-215) image.channels() == 1 || image.channels() == 3 || image.channels() == 4 in function imwrite_

 

Aborted

 

Thanks,

0 Kudos

702 Views
jiri_kral
NXP Employee
NXP Employee

Hi, 

it is possible share your project?  If you can't share it on community, you can send it to my email address. 

Jiri

702 Views
justforfunl
Contributor II

Dear Jiri Kral, Thanks for your help. I find the error that is confused to understand the image format, I try to use the UYVY format data " = "  CV_16UC1 format data. so It's error.