简体   繁体   中英

Opencv storing Yuyv (YCrCb) in cv::Mat

I'm the data I get out of my webcam is yuv422. I'd like to store this yuv422 into a cv::Mat without converting it to RGB... Is this possible?

Thanks.

Yes, just create a 3 channel matrix. Please take a look at the basic Mat tutorial

Given the chroma subsampling, it's probably going to be simpler if you unpack the YUYV data into a YUV matrix (3 channels of 8-bit data), then perform your filtering with cv::inRange etc. You just need to interpolate the U and V samples for each Y.

Another alternative would be to treat the matrix as 4 channels of 8-bit data, and then in your filter results, combine the results from the two Y sample channels.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM