yuv

How to find out resolution and count of frames in YUV 4:2:0 file?

こ雲淡風輕ζ 提交于 2019-11-28 07:49:55
How to find out resolution and count of frames in YUV 4:2:0 file if i know how many pixel(luma samples) in the image? YUV 4:2:0 planar looks like this: ---------------------- | Y | Cb|Cr | ---------------------- where: Y = width x height pixels (bytes) Cb = Y / 4 pixels (bytes) Cr = Y / 4 pixels (bytes) Total num pixels (bytes) = width * height * 3 / 2 This is how pixels are placed in 4:2:0 sub-sampling: As you can see, each chroma value is shared between 4 luma-pixels. Basically, the only thing you can do is to see which frame-sizes divides the total file-size evenly. As an example, consider

How to deal with RGB to YUV conversion

删除回忆录丶 提交于 2019-11-28 06:55:46
The formula says: Y = 0.299 * R + 0.587 * G + 0.114 * B; U = -0.14713 * R - 0.28886 * G + 0.436 * B; V = 0.615 * R - 0.51499 * G - 0.10001 * B; What if, for example, the U variable becomes negative? U = -0.14713 * R - 0.28886 * G + 0.436 * B; Assume maximum values for R and G (ones) and B = 0 So, I am interested in implementing this convetion function in OpenCV, So, how to deal with negative values? Using float image? anyway please explain me, may be I don't understand something.. You can convert RGB<->YUV in OpenCV with cvtColor using the code CV_YCrCb2RGB for YUV->RGB and CV_RGBYCrCb for RGB

Problems converting YV12 to RGB through GLSL

99封情书 提交于 2019-11-28 03:49:27
问题 I'm trying to accomplish YV12 to RGB conversion mentioned in this post with GLSL shaders. My application loads a raw YV12 frame from the disk and tries to perform the conversion using GLSL shaders. However, the resulting image is flipped vertically and has some color issues. I think the problem may be that the image is being read as an array of char (1 byte) and then converted to an array of GLushort (2 bytes). What do you think? This is how the raw YUV frame looks like: and the raw frame

Converting from YUV colour space to RGB using OpenCV

自闭症网瘾萝莉.ら 提交于 2019-11-28 01:37:09
问题 I am trying to convert a YUV image to RGB using OpenCV. I am a complete novice at this. I have created a function which takes a YUV image as source and converts it into RGB. It is like this : void ConvertYUVtoRGBA(const unsigned char *src, unsigned char *dest, int width, int height) { cv::Mat myuv(height + height/2, width, CV_8UC1, &src); cv::Mat mrgb(height, width, CV_8UC4, &dest); cv::cvtColor(myuv, mrgb, CV_YCrCb2RGB); return; } Should this work? Do I need to convert the Mat into char*

QOMX_COLOR_FormatYUV420PackedSemiPlanar64x32Tile2m8ka color format

ぐ巨炮叔叔 提交于 2019-11-28 00:17:05
all Does anybody know details about QOMX_COLOR_FormatYUV420PackedSemiPlanar64x32Tile2m8ka format, it's the output format of qcom 7x30 h/w decoder, how data is stored in such color format? thanks Denbian This is my research on this, about QOMX_COLOR_FormatYUV420PackedSemiPlanar64x32Tile2m8ka converting to YUV420Planar (I420) . As far as QOMX_COLOR_FormatYUV420PackedSemiPlanar64x32Tile2m8ka format is concerned, you can refer to ($your_android_native_sdk_dir)/WORKING_DIRECTORY/hardware/qcom/media/mm-core/inc/QOMX_IVCommonExtensions.h source code. This function might idealy support generic

CVOpenGLESTextureCacheCreateTextureFromImage returns error 6683

纵然是瞬间 提交于 2019-11-27 21:24:12
问题 I am currently attempting to draw an image in openGL using YUV420 format (bi-planar). I receive raw data, and am attempting to parse it into a CVPixelBuffer, and then pass said buffer using CVOpenGLESTextureCacheCreateTextureFromImage. While I receive no errors when parsing into the CVPixelBuffer, I receive an error (-6683) when trying to pass into CVOpenGLESTextureCacheCreateTextureFromImage. I'm trying my best to follow apple's GLCameraRipple sample code - except again, I'm using raw image

How to perform RGB->YUV conversion in C/C++?

拜拜、爱过 提交于 2019-11-27 20:48:57
How to perform RGB->YUV conversion in C/C++? I have some Bitmap.. RGB I need to convert it to YUV Libs? Tuts? Articles? ImageMagick ? You might also want to try these integer only calculations (should be faster than floats) #define CLIP(X) ( (X) > 255 ? 255 : (X) < 0 ? 0 : X) // RGB -> YUV #define RGB2Y(R, G, B) CLIP(( ( 66 * (R) + 129 * (G) + 25 * (B) + 128) >> 8) + 16) #define RGB2U(R, G, B) CLIP(( ( -38 * (R) - 74 * (G) + 112 * (B) + 128) >> 8) + 128) #define RGB2V(R, G, B) CLIP(( ( 112 * (R) - 94 * (G) - 18 * (B) + 128) >> 8) + 128) // YUV -> RGB #define C(Y) ( (Y) - 16 ) #define D(U) ( (U

Yuv (NV21) image converting to bitmap [duplicate]

痞子三分冷 提交于 2019-11-27 18:56:54
问题 This question already has answers here : Convert NV21 byte array into bitmap readable format [duplicate] (2 answers) Closed 2 years ago . I am trying to capture images from camera preview and do some drawing on it. The problem is, I have only about 3-4 fps of drawing, and half of the frame processing time is receiving and decoding NV21 image from camera preview and converting to bitmap . I have a code to do this task, which I found on another stack question. It does not seem to be fast, but I

sws_scale YUV --> RGB distorted image

情到浓时终转凉″ 提交于 2019-11-27 16:27:35
问题 I want to convert YUV420P image (received from H.264 stream) to RGB , while also resizing it, using sws_scale . The size of the original image is 480 × 800 . Just converting with same dimensions works fine. But when I try to change the dimensions, I get a distorted image, with the following pattern: changing to 481 × 800 will yield a distorted B&W image which looks like it's cut in the middle 482 × 800 will be even more distorted 483 × 800 is distorted but in color 484 × 800 is ok (scaled

Rotate YUV420/NV21 Image in android

橙三吉。 提交于 2019-11-27 15:17:49
问题 In PreviewCall back of surface we are getting YUV420SP format in camera Preview but due to wrong rotation of that image I want to perform correct rotation of YUV image as I need to send it through network.so correct rotation need to be applied. I found this link it does correct rotation but image loose the color. http://www.wordsaretoys.com/2013/10/25/roll-that-camera-zombie-rotation-and-coversion-from-yv12-to-yuv420planar/ also checked Rotate an YUV byte array on Android but it does not show