⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 lvimgproc.h

📁 相机传输图像程序源代码 拜耳模式(RAW格式文件)与RGB图像数据互相转换函数库
💻 H
📖 第 1 页 / 共 5 页
字号:
 * @ingroup Functions 
 * @param pSrcImgInfo Source image info
 * @param pDstImgInfo Destination image info; can be NULL - then in-place reversion will be done (but in this case a temporary buffer for
 *                    line is needed)
 * @param pLineBuffer Pointer to temporary line buffer. Can be NULL.
 * @param dwFlags Flags - OR-ed combination of @ref ImageFlags
 * @return \b TRUE in case of success, otherwise \b FALSE - use lvip_GetLastStatus() for details
 */
LVIP_DLLENTRY BOOL WINAPI lvip_ReverseLinesFast(lvip_ImgInfo* pSrcImgInfo, lvip_ImgInfo* pDstImgInfo, 
                                                void* pLineBuffer, U32BIT dwFlags);


/** Extracts from the source bitmap a rectangle as destination bitmap.
 * If the rectangle goes outside of the source image, the intersection rectangle is taken,
 * that means the result width and/or height can be smaller than required.\n
 * If the intersection is zero, the function returns FALSE and the LastStatus returns
 * @ref LVIP_STATUS_DST_RECT_OUTSIDE_SRC.
 * - Supported input pixel formats: 8-bit mono, 15-bit RGB, 16-bit RGB, 24-bit RGB, 32-bit RGB.
 * - Supported output pixel formats: equal to the input pixel format.
 * - Can be done in-place: No. 
 * 
 * @ingroup Functions 
 * @param pSrcImgInfo Source image info
 * @param pDstImgInfo Destination image info
 * @param iDstXOffset Left offset of the rectangle
 * @param iDstYOffset Upper offset of the rectangle
 * @param dwDstWidth Width of area which has to be copied
 * @param dwDstHeight Height of area which has to be copied
 * @param dwFlags Flags - OR-ed combination of @ref ImageFlags
 * @return \b TRUE in case of success, otherwise \b FALSE - use lvip_GetLastStatus() for details
 */
LVIP_DLLENTRY BOOL WINAPI lvip_CopyArea(lvip_ImgInfo* pSrcImgInfo, lvip_ImgInfo* pDstImgInfo,
                                        int iDstXOffset, int iDstYOffset, 
                                        U32BIT dwDstWidth, U32BIT dwDstHeight, U32BIT dwFlags);

/** Saves the image to the TIFF file. 
 * In contrast to the BMP format, it enables to store also 9- to 16-bit mono formats.\n
 * The flag LVIP_IMG_TIFF_CONVERT_TO_16BIT can be used to force the conversion to 16bit format, which is
 * supported by wider range of applications.
 * -  Supported pixel formats: 8-bit to 16-bit mono, 15-bit RGB, 16-bit RGB, 24-bit RGB, 32-bit RGB.
 * 
 * @ingroup FunctionsSaveLoad
 * @param pszFileName File name
 * @param pImgInfo Image info of an image to be saved
 * @param dwFlags Flags - OR-ed combination of @ref ImageFlags
 * @return \b TRUE if image has been saved, otherwise \b FALSE - see lvip_GetLastStatus() for details
 */
LVIP_DLLENTRY BOOL WINAPI lvip_SaveToTiff(const char* pszFileName, lvip_ImgInfo* pImgInfo, U32BIT dwFlags);

/** Loads the image from TIFF file.
 * Is preferred to load the image from TIFF file which had been previously saved by lvip_SaveToTiff() function -
 * this library supports only a base TIFF format and there it is not assured that the TIFF image created by another
 * application could be loaded without error.\n
 * @ingroup FunctionsSaveLoad
 * @param pszFileName File name
 * @param pImgInfo Image info for the loaded image.
 * @param dwFlags Flags - OR-ed combination of @ref ImageFlags
 * @return \b TRUE in case of success, otherwise \b FALSE - use lvip_GetLastStatus() for details
 * @note The pData are always reallocated.
 */
LVIP_DLLENTRY BOOL WINAPI lvip_LoadFromTiff(const char* pszFileName, lvip_ImgInfo* pImgInfo, U32BIT dwFlags);

/** Saves the image to a BMP file if the pixel format is compatible with BMP.
 * \a Compatible \a with \a BMP means that @ref PixelFormats "pixel format" is one of 8-bit mono, 24- or 32-bit RGB.
 * - Supported pixel formats: 8-bit mono, 15-bit RGB, 16-bit RGB, 24-bit RGB, 32-bit RGB.
 * 
 * @ingroup FunctionsSaveLoad
 * @param pszFileName File name
 * @param pImgInfo Image info of an image to be saved
 * @param dwFlags Flags - OR-ed combination of @ref ImageFlags
 * @return \b TRUE in case of success, otherwise \b FALSE - use lvip_GetLastStatus() for details
 */
LVIP_DLLENTRY BOOL WINAPI lvip_SaveToBmp  (const char* pszFileName, lvip_ImgInfo* pImgInfo, U32BIT dwFlags);

/** Loads image from BMP file.
 * Formats with less 8 bits per pixel are not supported. The color palette by
 * 8-bit pixel format is expected to be greyscale.
 * @ingroup FunctionsSaveLoad
 * @param pszFileName File name
 * @param pImgInfo Image info for the loaded image
 * @param dwFlags Flags - OR-ed combination of @ref ImageFlags
 * @return \b TRUE in case of success, otherwise \b FALSE - use lvip_GetLastStatus() for details
 */
LVIP_DLLENTRY BOOL WINAPI lvip_LoadFromBmp(const char* pszFileName, lvip_ImgInfo* pImgInfo, U32BIT dwFlags);

/** Converts the image from one pixel format to another one.
 * @ingroup Functions
 * - Supported input pixel formats: 8-bit to 16-bit mono, 15-bit RGB, 16-bit RGB, 24-bit RGB, 32-bit RGB.
 * - Supported output pixel formats: 8-bit mono, 24-bit RGB, 32-bit RGB.
 * - Can be done in-place: No.
 * 
 * @param pSrcImgInfo Source Image Info
 * @param pDstImgInfo Destination Image Info
 * @param dwDstPixelFormat Destination @ref PixelFormats "pixel format"
 * @param dwFlags Flags - OR-ed combination of @ref ImageFlags
 * @return \b TRUE in case of success, otherwise \b FALSE - use lvip_GetLastStatus() for details
 */
LVIP_DLLENTRY BOOL WINAPI lvip_ConvertToPixelFormat(lvip_ImgInfo* pSrcImgInfo, lvip_ImgInfo* pDstImgInfo, 
                                                    U32BIT dwDstPixelFormat, U32BIT dwFlags);


/** RGB color correction.
 * A color correction 3x3 matrix is applied to RGB components of each pixel.
 * -  Supported input pixel formats: 24-bit RGB, 32-bit RGB.
 * -  Supported output pixel formats: equal to the input pixel format.
 * -  Can be done in-place: Yes.
 * 
 * @ingroup Functions
 * @param pSrcImgInfo Image which needs to correct colors
 * @param pDstImgInfo Where to save image with correct colors
 * @param piMatrix 3x3 matrix used to correct colors. It could be filled up using lvip_SetSaturationMatrix()
 * @param dwFlags Flags - OR-ed combination of @ref ImageFlags
 * @param hLut Handle to LUT (could be NULL)
 * @return \b TRUE in case of success, otherwise \b FALSE - use lvip_GetLastStatus() for details
 * @note the LUT in this function is not yet implemented.
 */
LVIP_DLLENTRY BOOL WINAPI lvip_ApplyRgbColorCorrection (lvip_ImgInfo* pSrcImgInfo, lvip_ImgInfo* pDstImgInfo,
                                                        S32BIT* piMatrix, U32BIT dwFlags, LVIP_LUT_HANDLE hLut);
/** Sets up the color saturation 3x3 matrix.
 * The saturation factor is in percents, eg. 100 = 1.0 = unchanged image.
 * The matrix can be used as parameter in the lvip_ApplyRgbColorCorrection() function.
 * @ingroup Functions 
 * @param dwSaturationFactor the saturation factor in percents
 * @param piMatrix 3x3 matrix of S32BIT values which will obtain the calculated factors
 * @param dwFlags Flags - OR-ed combination of @ref ImageFlags
 * @return \b TRUE in case of success, otherwise \b FALSE - use lvip_GetLastStatus() for details
 */
LVIP_DLLENTRY BOOL WINAPI lvip_SetSaturationMatrix (U32BIT dwSaturationFactor, S32BIT* piMatrix, U32BIT dwFlags);

/** Sets up sharpening matrix.
 * Fills the matrix with weighted values for 3x3 sharpening.\n
 * The factor is 0 for no-change matrix, +100 for maximum sharpening, -100 for blurring
 * @ingroup Functions 
 * @param iFactor Factor of sharpening
 * @param piMatrix 3x3 matrix of S32BIT values which will obtain the calculated values
 * @param dwFlags Flags - OR-ed combination of @ref ImageFlags
 * @return \b TRUE in case of success, otherwise \b FALSE - use lvip_GetLastStatus() for details
 */
LVIP_DLLENTRY BOOL WINAPI lvip_Set3x3MatrixSharpening (S32BIT iFactor, S32BIT* piMatrix, U32BIT dwFlags);

/** Does 3x3 convolution.
 * Applies the 3x3 matrix convolution operation. Typically, if the matrix is set for sharpening, sharpens the image.\n
 * @sa lvip_Set3x3MatrixSharpening() for creation of the sharpening matrix.
 * - Supported input pixel formats: 8-bit to 16-bit mono, 24-bit RGB, 32-bit RGB.
 * - Supported output pixel formats: equal to the input pixel format.
 * - Can be done in-place: No.
 * 
 * @ingroup Functions
 * @param pSrcImgInfo Source image
 * @param pDstImgInfo Destination image info
 * @param piMatrix Matrix for the convolution operation.
 * @param dwFlags Flags - OR-ed combination of @ref ImageFlags
 * @param hLut Handle to LUT
 * @return \b TRUE in case of success, otherwise \b FALSE - use lvip_GetLastStatus() for details
 * @note the LUT in this function is not yet implemented.
 */
LVIP_DLLENTRY BOOL WINAPI lvip_Apply3x3Convolution (lvip_ImgInfo* pSrcImgInfo, lvip_ImgInfo* pDstImgInfo,
                                                    S32BIT* piMatrix, U32BIT dwFlags, LVIP_LUT_HANDLE hLut);

/** Applies the shading correction.
 * The pBlackRefImgInfo and pWhiteRefImgInfo must be either NULL or must point to a
 * valid image of the same pixel format as the pSrcImgInfo.
 * - Supported input pixel formats: 8-bit to 16-bit mono, 24-bit RGB, 32-bit RGB.
 * - Supported output pixel formats: equal to the input pixel format.
 * - Can be done in-place: Yes. 
 * 
 * @ingroup Functions 
 * @param pSrcImgInfo Source image info
 * @param pDstImgInfo Destination image info
 * @param pBlackRefImgInfo Black reference image
 * @param pWhiteRefImgInfo White reference image
 * @param dwFlags Flags - OR-ed combination of @ref ImageFlags
 * @param hLut Handle to LUT
 * @return \b TRUE in case of success, otherwise \b FALSE - use lvip_GetLastStatus() for details
 */
LVIP_DLLENTRY BOOL WINAPI lvip_ApplyShadingCorrection (lvip_ImgInfo* pSrcImgInfo, lvip_ImgInfo* pDstImgInfo,
                                                       lvip_ImgInfo* pBlackRefImgInfo, lvip_ImgInfo* pWhiteRefImgInfo, 
                                                       U32BIT dwFlags, LVIP_LUT_HANDLE hLut);

/** Bayer Decoding: Show mosaic.
 * This function converts the Bayer encoded image to RGB format, without decoding the color information, only
 * showing in the color how the image is seen by the chip after the light goes through the color lenses. The
 * purpose of this function is only to help in Bayer decoding algorithms investigations.
 * -  Supported input pixel formats: 8-bit mono.
 * -  Supported output pixel formats: 24-bit RGB, 32-bit RGB.
 * -  Can be done in-place: No.
 * 
 * @ingroup FunctionsBayer 
 * @param pSrcImgInfo Bayer encoded image
 * @param pDstImgInfo Where to save displayable image
 * @param dwDstPixelFormat To which @ref PixelFormats "pixel format" convert bayer encoded image
 * @param dwFlags Flags - OR-ed combination of @ref ImageFlags
 * @return \b TRUE in case of success, otherwise \b FALSE - use lvip_GetLastStatus() for details
 */
LVIP_DLLENTRY BOOL WINAPI lvip_BdShowMosaic
                            (lvip_ImgInfo* pSrcImgInfo, lvip_ImgInfo* pDstImgInfo,
                             U32BIT dwDstPixelFormat, U32BIT dwFlags);

/** Bayer Decoding: Convert green to greyscale
 * Converts fast but roughly the Bayer encoded image to a greyscale
 * by using only the green pixels, which cover the half of all pixels. 
 * The other half is calculated by bilinear interpolation.
 * - Supported input pixel formats: 8-bit mono.
 * - Supported output pixel formats: 8-bit mono.
 * - Can be done in-place: No.
 * 
 * @ingroup FunctionsBayer 
 * @param pSrcImgInfo source image info
 * @param pDstImgInfo destination image info
 * @param dwDstPixelFormat destination @ref PixelFormats "pixel format"
 * @param dwFlags Flags - OR-ed combination of @ref ImageFlags
 * @return \b TRUE in case of success, otherwise \b FALSE - use lvip_GetLastStatus() for details
 */
LVIP_DLLENTRY BOOL WINAPI lvip_BdGreenToGreyscale
                            (lvip_ImgInfo* pSrcImgInfo, lvip_ImgInfo* pDstImgInfo,
                             U32BIT dwDstPixelFormat, U32BIT dwFlags);

/** Bayer Decoding: The Nearest Neigbour method
 * The fastest method for Bayer array decoding.
 * It uses the nearest pixel with the required lense color to get the
 * pixel value. Gives rough results.
 * - Supported input pixel formats: 8-bit mono.
 * - Supported output pixel formats: 8-bit mono, 24-bit RGB, 32-bit RGB.
 * - Can be done in-place: No.
 * 
 * @ingroup FunctionsBayer 
 * @param pSrcImgInfo Bayer encoded source image info
 * @param pDstImgInfo Destination image info
 * @param dwDstPixelFormat To which @ref PixelFormats "pixel format"
 * @param dwFlags Flags - OR-ed combination of @ref ImageFlags
 * @param hLut Handle to LUT
 * @return \b TRUE in case of success, otherwise \b FALSE - use lvip_GetLastStatus() for details
 */
LVIP_DLLENTRY BOOL WINAPI lvip_BdNearestNeighbour
                            (lvip_ImgInfo* pSrcImgInfo, lvip_ImgInfo* pDstImgInfo,
                             U32BIT dwDstPixelFormat, U32BIT dwFlags, LVIP_LUT_HANDLE hLut);

/** Bayer Decoding: The Bilinear Interpolation method
 * The most commonly used method for fast Bayer decoding.
 * For the color not directly available for the given pixel makes the
 * linear interpolation between the 2 or 4 neigbouring pixels to get it. 
 * Gives good results with a high speed.
 * - Supported input pixel formats: 8-bit mono.
 * - Supported output pixel formats: 8-bit mono, 24-bit RGB, 32-bit RGB.
 * - Can be done in-place: No.
 * 
 * @ingroup FunctionsBayer

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -