Updates the bitmap data using the YUV data from an input buffer. The YUV data is converted to grayscale/BGR before being set in the BITMAPHANDLE.
#include "l_bitmap.h"
L_LTKRN_API L_INT L_SetBitmapYUVData(pBitmap, pYuvData, uYuvDataSize, yuvFormat, uFlags)
Pointer to the bitmap handle that references the bitmap whose data pointer will be set.
Pointer to a buffer that contains the YUV data (cannot be NULL).
Size of the data buffer pointed to by pYuvData. If uYuvDataSize is incorrect, this function fails and displays the ERROR_INVALID_YUV_SIZE error.
Specifies the YUV data format. See L_YUV.
Unused, reserved for future use. Pass 0.
Value | Meaning |
---|---|
SUCCESS | The function was successful. |
ERROR_NULL_PTR | pBitmap or pYuvData is NULL. |
ERROR_BITPERPIXEL | pBitmap is not 8-, 24-, or 32-bits per pixel. |
ERROR_NO_MEMORY | Not enough memory. |
ERROR_INV_RANGE | Invalid bitmap width or height (usually because they are not multiple of 2). |
ERROR_INVALID_YUV_SIZE | The size of the YUV data (uYuvDataSize ) does not match the width and height values from pBitmap. |
ERROR_INVALID_YUV_FORMAT | The color space in yuvFormat does not match one of the supported values. |
< 1 | An error occurred. Refer to Return Codes. |
This function is designed to be used mainly for use in mobile imaging to facilitate filling a BITMAPHANDLE structure using live frames from the mobile device's camera.
If the bitmap is not allocated, it will be allocated using conventional memory. There are restrictions on the bitmap width and height. For 4:1:1 (4:2:0) YUV data, both the bitmap width and height should be multiple of 2. For 4:2:2 YUV data, the bitmap width should be multiple of two.
The function ignores the bitmap's view perspective, so it must match the orientation of the YUV buffer. In most cases, the YUV buffer is top-to-bottom, so the ViewPerspective should be TOP_LEFT. If the YUV buffer is flipped, the ViewPerspective should be BOTTOM_LEFT, so it will be automatically flipped before saving or painting.
The YUV data should contain studio video YUV, with Y values ranging from 16 to 235 and U,V values ranging from 16 to 240. Values outside this range are clipped: values below 16 will be considered as if they were 16. Y values above 235 will be clipped to 235, U/V values above 240 will be clipped to 240.
Win32, x64, Linux.
For an example, refer to L_GetBitmapYUVData.
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document