📄 lvimgproc.h
字号:
*/
U8BIT* pData;
/** If the @ref LVIP_IMG_ATTR_COLOR_PLANES flag is set, this member points to the Red plane data of the image.
* Use lvip_AllocateImageData() to allocate the buffer for the image. If you set the pointer to an existing image,
* which is not owned by this @ref lvip_ImgInfo, use the @ref LVIP_IMG_ATTR_NOT_DATA_OWNER flag.
*/
U8BIT* pDataR;
/** If the @ref LVIP_IMG_ATTR_COLOR_PLANES flag is set, this member points to the Green plane data of the image.
* Use lvip_AllocateImageData() to allocate the buffer for the image. If you set the pointer to an existing image,
* which is not owned by this @ref lvip_ImgInfo, use the @ref LVIP_IMG_ATTR_NOT_DATA_OWNER flag.
*/
U8BIT* pDataG;
/** If the @ref LVIP_IMG_ATTR_COLOR_PLANES flag is set, this member points to the Blue plane data of the image.
* Use lvip_AllocateImageData() to allocate the buffer for the image. If you set the pointer to an existing image,
* which is not owned by this @ref lvip_ImgInfo, use the @ref LVIP_IMG_ATTR_NOT_DATA_OWNER flag.
*/
U8BIT* pDataB;
BOOL bInUse; // for internal use
} lvip_ImgInfo;
/** @defgroup Functions ImgProcLib functions. */
/** @defgroup FunctionsLut Lookup Table (LUT) functions.
* @ingroup Functions
*/
/** @defgroup FunctionsBayer Bayer decoding/encoding functions.
* @ingroup Functions
*/
/** @defgroup FunctionsDisplay Displaying functions.
* @ingroup Functions
*/
/** @defgroup FunctionsRotate Rotating functions
* @ingroup Functions
*/
/** @defgroup FunctionsConversion Conversion functions
* @ingroup Functions
*/
/** @defgroup FunctionsSaveLoad Saving/loading functions
* @ingroup Functions
*/
/** @defgroup FunctionsOverlay Overlay functions.
* @ingroup Functions
*/
/** Returns the status after the last called function.
* Use it for checking of the success of the operation.
* @ingroup Functions
* @return The status after last called function. Success is indicated by zero.
* @sa @ref StatusDefinitions
*/
LVIP_DLLENTRY U32BIT WINAPI lvip_GetLastStatus ();
/** Retrieves a text desctibing the current status indicated by the lvip_GetLastStatus().
* @ingroup Functions
* @param pszMsg pointer to buffer for the error message
* @param iMsgBufSize size of the buffer.
*/
LVIP_DLLENTRY void WINAPI lvip_GetLastStatusMsg (char* pszMsg, int iMsgBufSize);
/** Initializes the @ref lvip_ImgInfo to specified values, calculates the line increment and sets pData to NULL
* (be sure to deallocate the image buffers if were allocated, before this function call).
* If pData of other owner is used, set the @ref LVIP_IMG_ATTR_NOT_DATA_OWNER flag
* so that the data are not deallocated when lvip_DeallocateImageData() is applied to this ImgInfo.\n
* @ingroup Functions
* @param pImgInfo pointer to @ref lvip_ImgInfo structure which is to be initialized
* @param dwWidth width of image in pixels
* @param dwHeight height of image in pixels
* @param dwPixelFormat pixel format; one of the @ref PixelFormats "pixel format"
* @param dwImgFlags image flags; OR-ed combination of the @ref ImageFlags
* @return \b TRUE in case of success, otherwise \b FALSE - use lvip_GetLastStatus() for details
*/
LVIP_DLLENTRY BOOL WINAPI lvip_InitImgInfo (lvip_ImgInfo* pImgInfo, U32BIT dwWidth,
U32BIT dwHeight, U32BIT dwPixelFormat, U32BIT dwImgFlags);
/** Returns the data size required for the image.
* Expects the Height and LineIncrement are
* already calculated. In case of color planes returns the size of one plane
* @ingroup Functions
* @param pImgInfo pointer to the @ref lvip_ImgInfo of the image.
* @return The data size required for the image in bytes.
*/
LVIP_DLLENTRY U32BIT WINAPI lvip_GetImageDataSize (lvip_ImgInfo* pImgInfo);
/** Allocates appropriate space to pData or color planes, according to the Height and LineIncrement.
* @ingroup Functions
* @param pImgInfo pointer to the @ref lvip_ImgInfo of the image.
* @return \b TRUE in case of success, otherwise \b FALSE - use lvip_GetLastStatus() for details
*/
LVIP_DLLENTRY BOOL WINAPI lvip_AllocateImageData(lvip_ImgInfo* pImgInfo);
/** Deallocates the image data buffer(s)
* If the flags is not containing @ref LVIP_IMG_ATTR_NOT_DATA_OWNER, deallocates pData or color
* planes and sets them to NULL.
* @ingroup Functions
* @return \b TRUE in case of success, otherwise \b FALSE - use lvip_GetLastStatus() for details
*/
LVIP_DLLENTRY BOOL WINAPI lvip_DeallocateImageData(lvip_ImgInfo* pImgInfo);
/** Converts the header from Windows BITMAPINFO to @ref lvip_ImgInfo.
* @ingroup FunctionsConversion
* @param pBmpInfo pointer to BITMAPINFO
* @param pImgInfo pointer to Image info structure
* @return \b TRUE in case of success, otherwise \b FALSE - use lvip_GetLastStatus() for details
*/
LVIP_DLLENTRY BOOL WINAPI lvip_BmpInfoToImgInfo (BITMAPINFO* pBmpInfo, lvip_ImgInfo* pImgInfo);
/** Converts @ref lvip_ImgInfo to BITMAPINFO Info.
* The typical usage of this function is when you need to use Windows API functions for image display;
* these functions usually require a pointer to BITMAPINFO and a pointer to image data.\n
* Note that Windows Device Independent Bitmap format does cover all the possible image formats of @ref lvip_ImgInfo
* (for example 9- to 16-bit mono formats, incompatible line increments etc.); in such case the conversion of the header fails
* and you will have to convert the image using the lvip_ConvertToPixelFormat() function first.
* @ingroup FunctionsConversion
* Expects the BitmapInfo to have appropriate size, i.e. for example
* @code
* sizeof(BITAMAPINFOHEADER) + 256*sizeof(RGBQUAD) for 8-bit image
* @endcode
* @param pImgInfo The source @ref lvip_ImgInfo which will be converted to BITMAPINFO
* @param pBmpInfo The address of the destination BITMAPINFO structure
* @return \b TRUE if conversion was successfull \n \b FALSE if conversion was not successful - use lvip_GetLastStatus() to get details.
*/
LVIP_DLLENTRY BOOL WINAPI lvip_ImgInfoToBmpInfo (lvip_ImgInfo* pImgInfo, BITMAPINFO* pBmpInfo);
/** Fills image data with specified color.
* @ingroup Functions
* @param pImgInfo pointer to @ref lvip_ImgInfo structure, the data of which has to be filled with the selected color
* @param cRed 8bit Red value
* @param cGreen 8bit Green value
* @param cBlue 8bit Blue value
* @param dwFlags should be set to 0
* @return \b TRUE in case of success, otherwise \b FALSE - use lvip_GetLastStatus() for details
*/
LVIP_DLLENTRY BOOL WINAPI lvip_FillWithColor (lvip_ImgInfo* pImgInfo,
U8BIT cRed, U8BIT cGreen, U8BIT cBlue,
U32BIT dwFlags);
/** @defgroup LUT_TYPES LUT types definitions. */
//@{
/** 8-bit LUT type, used for images with @ref LVIP_PIXEL_FORMAT_MONO8, @ref LVIP_PIXEL_FORMAT_RGB8_PACKED or @ref LVIP_PIXEL_FORMAT_RGBA8_PACKED. */
#define LVIP_LUT_8BIT 8
/** 10-bit LUT type, used for images with @ref LVIP_PIXEL_FORMAT_MONO10. */
#define LVIP_LUT_10BIT 10
/** 12-bit LUT type, used for images with @ref LVIP_PIXEL_FORMAT_MONO12 */
#define LVIP_LUT_12BIT 12
/** If the LUT is to be used in @ref FunctionsBayer, this flag is to be specified in the lvip_AllocateLut() function
* Bayer LUT requires bigger size - is needed for the bilinear
* interpolation and for 10- and 12-bit source formats
*/
#define LVIP_LUT_BAYER 0x00110000ul
/** Bayer16 is a subset of Bayer, suitable for all 10- and 12-bit
decoding, with the exception of lvip_BdBilinearInterpolation() function.
*/
#define LVIP_LUT_BAYER_16 0x00010000ul
//@}
/** @defgroup LUT_TYPES_SIZE Size of LUTs. */
//@{
/** Size of 8-bit LUT type. */
#define LVIP_LUT_8BIT_SIZE 256
/** Size of 10-bit LUT type. */
#define LVIP_LUT_10BIT_SIZE 1024
/** Size of 12-bit LUT type. */
#define LVIP_LUT_12BIT_SIZE 4096
//@}
/** Handle to the LUT.
* Application should not access LUT data directly, the LUT is to be always modified by
* LUT functions. Thus, instead of a pointer to a structure, a handle is used for
* manipulating with LUT
*/
#define LVIP_LUT_HANDLE U32BIT*
/** Constant specifying a handle to the global LUT.
* Can be passed as a parameter wherever the @ref LVIP_LUT_HANDLE is expected.
* The global LUT is easier to use, because you do not need to take care about
* allocating and freeing the appropriate type of LUT. However, keep on mind
* that the global LUT is a single LUT, so it might not be sufficient in cases
* of working simultaneously with multiple images or in multithreading environment.
*/
#define LVIP_LUT_GLOBAL ((LVIP_LUT_HANDLE)0x00000001ul)
#define LVIP_DO_NOT_NORMALIZE_FOR_SAT_PIX 0x00000001ul // internal use
/** Allocates the LUT.
* @ingroup FunctionsLut
* @param dwLutType type of LUT which has to be allocated. One of @ref LUT_TYPES, this value could be optionally OR-ed with
* the LVIP_LUT_BAYER flag
* @return handle to the allocated LUT
* @note LUT has to be freed up before end using lvip_FreeLut() function
*/
LVIP_DLLENTRY LVIP_LUT_HANDLE WINAPI lvip_AllocateLut (U32BIT dwLutType);
/** Deallocates the LUT.
* @ingroup FunctionsLut
* @param hLut Handle to LUT (which had been allocated by the lvip_AllocateLut() function)
* @return \b TRUE in case of success, otherwise \b FALSE - use lvip_GetLastStatus() for details
*/
LVIP_DLLENTRY BOOL WINAPI lvip_FreeLut (LVIP_LUT_HANDLE hLut);
/** Resets the LUT data to the linear order.
* @ingroup FunctionsLut
* @param hLut Handle to LUT allocated using the lvip_AllocateLut() function
* @return \b TRUE in case of success, otherwise \b FALSE - use lvip_GetLastStatus() for details
*/
LVIP_DLLENTRY BOOL WINAPI lvip_ResetLut (LVIP_LUT_HANDLE hLut);
/** Sets up the 8-bit LUT data.
* Sets the LUT from 3 arrays of @ref LVIP_LUT_8BIT_SIZE U8BIT values. For processing the monochrome images only the green is
* used.\n
* @ingroup FunctionsLut
* @param hLut Handle to LUT
* @param pucRed pointer to an array of @ref LVIP_LUT_8BIT_SIZE size with red LUT values
* @param pucGreen pointer to an array of LVIP_LUT_8BIT_SIZE size with green LUT values
* @param pucBlue pointer to an array of LVIP_LUT_8BIT_SIZE size with blue LUT values
* @return \b TRUE in case of success, otherwise \b FALSE - use lvip_GetLastStatus() for details
*/
LVIP_DLLENTRY BOOL WINAPI lvip_Set8BitLut (LVIP_LUT_HANDLE hLut, U8BIT* pucRed, U8BIT* pucGreen, U8BIT* pucBlue);
/** Gets 8-bit LUT data.
* This function fills up supplied arrays with the current LUT data. It is useful for example after calling lvip_AddGammaToLut() or
* lvip_AddWbToLut() to get the values of current LUT.
* @ingroup FunctionsLut
* @param hLut Handle to LUT
* @param pucRed pointer to an array of @ref LVIP_LUT_8BIT_SIZE size, which will be filled with the Red LUT values
* @param pucGreen pointer to an array of LVIP_LUT_8BIT_SIZE size, which will be filled with the Green LUT values
* @param pucBlue pointer to an array of LVIP_LUT_8BIT_SIZE size, will be filled with the LUT values
* @return \b TRUE in case of success, otherwise \b FALSE - use lvip_GetLastStatus() for details
*/
LVIP_DLLENTRY BOOL WINAPI lvip_Get8BitLut (LVIP_LUT_HANDLE hLut, U8BIT* pucRed, U8BIT* pucGreen, U8BIT* pucBlue);
/** Sets up 10-bit LUT data.
* Sets the LUT from 3 arrays of @ref LVIP_LUT_10BIT_SIZE U16BIT values with 10-bit values.
* For processing the monochrome images only the green is used.\n
* @ingroup FunctionsLut
* @param hLut Handle to LUT
* @param pwRed pointer to an array of @ref LVIP_LUT_10BIT_SIZE U16BIT red LUT values
* @param pwGreen pointer to an array of LVIP_LUT_10BIT_SIZE U16BIT green LUT values
* @param pwBlue pointer to an array of LVIP_LUT_10BIT_SIZE U16BIT blue LUT values
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -