yuv

OpenCV : how to get raw YUY2 image from webcam?

让人想犯罪 __ 提交于 2020-01-14 12:53:52
问题 Do you know how to get raw YUY2 image from webcam, using OpenCV-DirectShow (no VFW) ? http://opencv.willowgarage.com/wiki/CameraCapture : I succeed getting IPL image (Intel Processing Library image) using the example. Using the function cvShowImage() in the code, the image is nice on the screen. But I don't want to show image on the screen, nor IPL format, I just want YUYV raw data... The second part of the wiki page would be what I want, but deviceSetupWithSubtype() does not seem to exist

How to write YUV 420 video frames from RGB data using OpenCV or other image processing library?

痞子三分冷 提交于 2020-01-13 05:47:11
问题 I have an array of rgb data generated from glReadPixels(). Note that RGB data is pixel packed (r1,g1,b1,r2,g2,b2,...). How can I quickly write a YUV video frame using OpenCV or another C++ library, so that I can stream them to FFMPEG? Converting RGB pixel to YUV pixel is not a problem, as there are many conversion formula available online. However writing the YUV frame is the main problem for me. I have been trying to write the YUV video frame since the last few days and were not successful

YUV420 to RGB color conversion Error

只谈情不闲聊 提交于 2020-01-12 03:53:28
问题 I am converting an image in YUV420 format to RGB image in opencv but im getting an Orange colored image after conversion. I used following code to do that. Is there any problem in my code ?? int step = origImage->widthStep; uchar *data = (uchar *)origImage->imageData; int size = origImage->width * origImage->height; IplImage* img1 = cvCreateImage(cvGetSize(origImage), IPL_DEPTH_8U, 3); for (int i = 0; i<origImage->height; i++) { for (int j=0; j<origImage->width; j++) { float Y = data[i*step +

Convert android.media.Image (YUV_420_888) to Bitmap

依然范特西╮ 提交于 2020-01-09 10:06:39
问题 I'm trying to implement camera preview image data processing using camera2 api as proposed here: Camera preview image data processing with Android L and Camera2 API. I successfully receive callbacks using onImageAvailableListener, but for future processing I need to obtain bitmap from YUV_420_888 android.media.Image. I searched for similar questions, but none of them helped. Could you please suggest me how to convert android.media.Image (YUV_420_888) to Bitmap or maybe there's a better way of

Convert android.media.Image (YUV_420_888) to Bitmap

蹲街弑〆低调 提交于 2020-01-09 10:05:15
问题 I'm trying to implement camera preview image data processing using camera2 api as proposed here: Camera preview image data processing with Android L and Camera2 API. I successfully receive callbacks using onImageAvailableListener, but for future processing I need to obtain bitmap from YUV_420_888 android.media.Image. I searched for similar questions, but none of them helped. Could you please suggest me how to convert android.media.Image (YUV_420_888) to Bitmap or maybe there's a better way of

FFMPEG: RGB to YUV conversion by binary ffmpeg and by code C++ give different results

荒凉一梦 提交于 2020-01-06 09:53:52
问题 I am trying to convert RGB frames (ppm format) to YUV420P format using ffmpeg. To make sure that my code C++ is good , I compared the output with the one created by this command (the same filer BILINEAR): ffmpeg -start_number 1 -i data/test512x512%d.ppm -sws_flags 'bilinear' -pix_fmt yuv420p data/test-yuv420p.yuv My code : static unsigned char *readPPM(int i) { FILE *pF; unsigned char *imgRGB; unsigned char *imgBGR; int w,h; int c; int bit; char buff[16]; char *filename; asprintf(&filename,

How to read yuv videos in matlab?

廉价感情. 提交于 2020-01-05 08:46:49
问题 I have a yuv video and I have to read it in Matlab for video processing. I have used mmreader but it appears that it only accepts avi and mpg files. VideoReader is not available in my version of Matlab and I don't think it supports yuv file extension. 回答1: do these code solve your problems? http://www.mathworks.com/matlabcentral/fileexchange/6318-convert-yuv-cif-420-video-file-to-image-files http://www.mathworks.com/matlabcentral/fileexchange/11252-yuv-file-to-matlab-movie 来源: https:/

How to convert a YCbCr(YUV) 4:4:4 image to 4:2:2 in java?

流过昼夜 提交于 2020-01-05 04:23:12
问题 I can convert a rgb image to a YCbCr image, but i have no clue how to put it in 4:2:2 The objective is to create a lossy compreession program any help? 回答1: you could try this way , but this is how you can solve it using ffmpeg ffmpeg -i in.avi -vcodec rawvideo -pix_fmt yuv420p -o out.yuv 来源: https://stackoverflow.com/questions/6066171/how-to-convert-a-ycbcryuv-444-image-to-422-in-java

Wrong conversion from YUV to BGR using Color_YUV2BGR in opencv

穿精又带淫゛_ 提交于 2020-01-05 02:47:27
问题 I want to convert a single set of YUV value to BGR. My code is as follows: yuv = [100, 50, 150] cv::Mat bgr_mat; cv::Mat yuv_mat(1,1,CV_8UC3,cv::Scalar(yuv[0],yuv[1],yuv[2])); cv::cvtColor(yuv_mat,bgr_mat,cv::COLOR_YUV2BGR); cv::Vec3b bgr = bgr_mat.at<cv::Vec3b>(0,0); cout << "b: " << (float)bgr.val[0] << " , g: " << (float)bgr.val[1] << " , r: " << (float)bgr.val[2] << endl; The output I get is - b: 125, g: 118, r: 0 But the expected output is b: 0, g: 112, r: 128 Can somebody please tell me

Convert YUVj420p pixel format to RGB888 using gstreamer

ⅰ亾dé卋堺 提交于 2020-01-02 10:08:29
问题 im using gstreamer 1.2 to feed frames from my IP camera to opencv program the stream is (640*368 YUVj420p) and i want to convert it to RBG888 to be able to use it in my opencv program so is there a way to use gstreamer to do that conversion ? or do i have to do it by myself? if so please give me the equation that do this conversion 回答1: After some trials with gstreamer i decided to do the conversion myself and it worked First we have to understand the YUVj420p pixel format As shown in the