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

📄 lvimgproc.h

📁 相机传输图像程序源代码 拜耳模式(RAW格式文件)与RGB图像数据互相转换函数库
💻 H
📖 第 1 页 / 共 5 页
字号:
 * @return \b TRUE in case of success, otherwise \b FALSE - use lvip_GetLastStatus() for details
 */
LVIP_DLLENTRY BOOL WINAPI lvip_Set10BitLut (LVIP_LUT_HANDLE hLut, U16BIT* pwRed, U16BIT* pwGreen, U16BIT* pwBlue);

/** Gets 10-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 pwRed pointer to an array of @ref LVIP_LUT_10BIT_SIZE U16BIT values, will be filled with red
 * @param pwGreen pointer to an array of LVIP_LUT_10BIT_SIZE U16BIT, will be filled with green
 * @param pwBlue pointer to an array of LVIP_LUT_10BIT_SIZE U16BIT, will be filled with blue
 * @return \b TRUE in case of success, otherwise \b FALSE - use lvip_GetLastStatus() for details
 */
LVIP_DLLENTRY BOOL WINAPI lvip_Get10BitLut (LVIP_LUT_HANDLE hLut, U16BIT* pwRed, U16BIT* pwGreen, U16BIT* pwBlue);

/** Sets up 12-bit LUT data.
 * Sets the LUT from 3 arrays of @ref LVIP_LUT_12BIT_SIZE U16BIT values with 12-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_12BIT_SIZE U16BIT red LUT values
 * @param pwGreen pointer to an array of LVIP_LUT_12BIT_SIZE U16BIT green LUT values
 * @param pwBlue pointer to an array of LVIP_LUT_12BIT_SIZE U16BIT blue LUT values
 * @return \b TRUE in case of success, otherwise \b FALSE - use lvip_GetLastStatus() for details
 */
LVIP_DLLENTRY BOOL WINAPI lvip_Set12BitLut (LVIP_LUT_HANDLE hLut, U16BIT* pwRed, U16BIT* pwGreen, U16BIT* pwBlue);

/** Gets 12-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 pwRed pointer to an array of @ref LVIP_LUT_12BIT_SIZE U16BIT values, will be filled with red
 * @param pwGreen pointer to an array of LVIP_LUT_12BIT_SIZE U16BIT, will be filled with green
 * @param pwBlue pointer to an array of LVIP_LUT_12BIT_SIZE U16BIT, will be filled with blue
 * @return \b TRUE in case of success, otherwise \b FALSE - use lvip_GetLastStatus() for details
 */
LVIP_DLLENTRY BOOL WINAPI lvip_Get12BitLut (LVIP_LUT_HANDLE hLut, U16BIT* pwRed, U16BIT* pwGreen, U16BIT* pwBlue);

// dwGamma is multiplies by 1000
/** Adds gamma to LUT.
 * Recalculates each value in the LUT table by applying the Gamma curve.
 * dwGamma is supplied multiplied by 1000, i.e. for gamma = 1.0 the passed value will be 1000.
 * There is a possibility to do image lighter/darker using different gamma value. This gamma will be added to LUT
 * and when the image is being transformed using any of function, add this LUT to this function as the last parameter.
 * @ingroup FunctionsLut 
 * @note There is a need to have LUT - see lvip_AllocateLut() and its company.
 * @param dwGamma Minimal gamma value is 10 - it means that there is a need to enter gamma multiplies by 1000
 * @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_AddGammaToLut (U32BIT dwGamma, LVIP_LUT_HANDLE hLut);

/** Adds white balance to LUT.
 * Recalculates each value in the LUT table by applying the white balance factors.
 * The factors are supplied multiplied by 1000, i.e. for the factor = 1.0 the passed value will be 1000. See
 * lvip_CalcWbFactors() for obtaining the WB factors from an image.\n
 * @ingroup FunctionsLut
 * @param dwFactorRed Red factor of white balance, multiplied by 1000
 * @param dwFactorGreen Green factor of white balance, multiplied by 1000
 * @param dwFactorBlue Blue factor of white balance, multiplied by 1000
 * @param hLut Handle to the LUT
 * @return \b TRUE in case of success, otherwise \b FALSE - use lvip_GetLastStatus() for details
 */
LVIP_DLLENTRY BOOL WINAPI lvip_AddWbToLut (U32BIT dwFactorRed, U32BIT dwFactorGreen, U32BIT dwFactorBlue, 
                                           LVIP_LUT_HANDLE hLut);

/** Adds offset and gain to LUT.
 * @ingroup FunctionsLut
 * Recalculates each value in the LUT table by adding the offset and multiplying by gain.
 * The offset is in range -1000 to +1000, where 0 means no change and 1000
 * the maximum pixel value - adding 1000 will make the image fully white, 
 * adding -1000 will make it fully black.
 * The offset is corresponding to Brightness - 1000, see lvip_AddBrightnessAndContrastToLut().
 * \n
 * The gain is the gain factor multiplied by 1000, i.e. 1000 means 1.0 = no change. 
 * Can be also negative - 1000 makes inversion. It is equivalent to contrast.
 *
 * @param iOffset The Offset to be added expressed in 1/1000 of the maximum pixel value. See the explanation above. 
 * @param iGain The Gain factor multiplied by 1000.
 * @param hLut Handle to the LUT
 * @return \b TRUE in case of success, otherwise \b FALSE - use lvip_GetLastStatus() for details.
 */
LVIP_DLLENTRY BOOL WINAPI lvip_AddOffsetAndGainToLut(S32BIT iOffset, S32BIT iGain, LVIP_LUT_HANDLE hLut);

/** Adds brightness and contrast to LUT.
 * @ingroup FunctionsLut
 * Recalculates each value in the LUT table by adding the brightness and multiplying by contrast.
 * This function is similar to the lvip_AddOffsetAndGainToLut() function, with the following 2 differences:
 * - The Brightness middle value is 1000, meaning no change. The Brightness 0 means black image and 2000 means 
 * fully white image, because subtracting or adding the 1000 means subtracting or adding the maximum pixel value.
 * - The Brightness factor is internally corrected in dependence on contrast.
 * The Contrast is equivalent to Gain in the lvip_AddOffsetAndGainToLut() function. It is a factor multiplied 
 * by 1000, i.e. 1000 means 1.0 = no change. Can be also negative - 1000 makes inversion.
 *
 * @param iBrightness The Brightness to be added expressed in 1/1000 of the maximum pixel value. See the explanation above. 
 * @param iContrast The Contrast factor multiplied by 1000.
 * @param hLut Handle to the LUT.
 * @return \b TRUE in case of success, otherwise \b FALSE - use lvip_GetLastStatus() for details.
 */
LVIP_DLLENTRY BOOL WINAPI lvip_AddBrightnessAndContrastToLut(S32BIT iBrightness, S32BIT iContrast, LVIP_LUT_HANDLE hLut);


/** Apply LUT to source image and save it in the destination image.
 * Applies the LUT to the image. Note that the LUT can be applied in other functions as well, which is faster than
 * this separate processing.\n
 * \n
 * Supported input pixel formats: 8-bit mono, 10-bit mono, 12-bit mono, 24-bit RGB, 32-bit RGB.\n
 * Supported output pixel formats: equal to the input pixel format.\n
 * Can be done in-place: Yes.\n
 * @ingroup FunctionsLut
 * @param pSrcImgInfo Source image info
 * @param pDstImgInfo Destination image info
 * @param hLut Handle to the LUT, which has to be applied
 * @param dwFlags Flags
 * @return \b TRUE in case of success, otherwise \b FALSE - use lvip_GetLastStatus() for details
 */
LVIP_DLLENTRY BOOL WINAPI lvip_ApplyLut (lvip_ImgInfo* pSrcImgInfo, lvip_ImgInfo* pDstImgInfo,
                                         LVIP_LUT_HANDLE hLut, U32BIT dwFlags);

/** Calculates white balance factors. The image is expected to be obtained from camera
 * pointed at a neutral grey area.
 * The factor is a gain applied to each pixel component. The gain = 1.0 means no change. In order
 * to avoid using float numbers, the factors are multiplied by 1000 and stored in U32BIT.
 * If the image pixel format is MONO, the image is expected to be Bayer
 * Array encoded (be sure you have the @ref LVIP_IMG_ATTR_BAYER_RED_ON_ODD_LINES and
 * @ref LVIP_IMG_ATTR_BAYER_RED_ON_ODD_COLS properly set in the @ref lvip_ImgInfo).
 * The factors are normalized, so that all are >= 1.0. This assures the areas with saturated colors
 * remain white. \n
 * The obtained factors could be used in the lvip_AddWbToLut() function.
 *
 * @ingroup FunctionsLut 
 * @param pSrcImgInfo Source image info from which the white balance has to be calculated
 * @param pdwFactorRed pointer to U32BIT variable to which will be saved the Red factor, multiplied by 1000
 * @param pdwFactorGreen pointer to U32BIT variable to which will be saved the Green factor, multiplied by 1000
 * @param pdwFactorBlue pointer to U32BIT variable to which will be saved the Blue factor, multiplied by 1000
 * @param dwFlags Flags
 * @return \b TRUE in case of success, otherwise \b FALSE - use lvip_GetLastStatus() for details
 */
LVIP_DLLENTRY BOOL WINAPI lvip_CalcWbFactors (lvip_ImgInfo* pSrcImgInfo, U32BIT* pdwFactorRed, 
                                              U32BIT* pdwFactorGreen, U32BIT* pdwFactorBlue, U32BIT dwFlags);

/** Deinterlacing.
 * Deinterlaces by averaging the neighbour lines.
 * Deinterlace function reduces the artefacts resulting from capturing a moving object by an interlaced camera.
 * - 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: Yes. 
 * 
 * @ingroup Functions 
 * @param pSrcImgInfo Source image info
 * @param pDstImgInfo Destination image info
 * @param dwFlags Flags
 * @return \b TRUE in case of success, otherwise \b FALSE - use lvip_GetLastStatus() for details
 */
LVIP_DLLENTRY BOOL WINAPI lvip_Deinterlace(lvip_ImgInfo* pSrcImgInfo, lvip_ImgInfo* pDstImgInfo, U32BIT dwFlags);

/** Rotates the image by 90 degrees clockwise or counterclockwise.
 *
 * - 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.
 * 
 * @note the LUT in this function is not yet implemented.
 * @ingroup FunctionsRotate
 * @note For 180 degrees rotation use the lvip_Mirror() function and set mirroring along both axes.
 * @param pSrcImgInfo Source image info
 * @param pDstImgInfo Destination image info
 * @param bClockWise \b TRUE if the image has to be rotated clockwise, \b FALSE if the image
 *                   has to be rotated by counterclockwise
 * @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_Rotate90(lvip_ImgInfo* pSrcImgInfo, lvip_ImgInfo* pDstImgInfo, 
                                        BOOL bClockWise, U32BIT dwFlags, LVIP_LUT_HANDLE hLut);

/** Mirrors the image along the horizontal axis (TopBottomMirror) or vertical axis (LeftRightMirror).
 * @ingroup FunctionsRotate
 * - 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: Yes.
 * 
 * @param pSrcImgInfo Source image info
 * @param pDstImgInfo Destination image info.
 * @param bTopBottomMirror \b TRUE for top-bottom mirror, \b FALSE if not
 * @param bLeftRightMirror \b TRUE for left-right mirror, \b FALSE if not
 * @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_Mirror(lvip_ImgInfo* pSrcImgInfo, lvip_ImgInfo* pDstImgInfo, 
                                      BOOL bTopBottomMirror, BOOL bLeftRightMirror, U32BIT dwFlags, 
                                      LVIP_LUT_HANDLE hLut);

/** It does the rotation and mirroring in the same step.
 * If the dwFlags contain LVIP_IMG_REALLOCATE_DST and the pDstImgInfo contains different image
 * width or height or the pData is NULL, the pData is reallocated and the image parameters
 * are adjusted. The dwFlags in such case can contain also LVIP_IMG_ flags for new image descriptor
 * creation.
 * - 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 FunctionsRotate
 * @param pSrcImgInfo Source image info
 * @param pDstImgInfo Destination image info
 * @param bClockWise \b TRUE if image has to be rotated by 90 degrees clockwise, otherwise (counterclockwise) \b FALSE
 * @param bTopBottomMirror \b TRUE if top-bottom mirror has to be used, otherwise \b FALSE
 * @param bLeftRightMirror \b TRUE if left-right mirror has to be used, otherwise \b FALSE
 * @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_Rotate90AndMirror(lvip_ImgInfo* pSrcImgInfo, lvip_ImgInfo* pDstImgInfo, 
                                      BOOL bClockWise, BOOL bTopBottomMirror, BOOL bLeftRightMirror,
                                      U32BIT dwFlags, LVIP_LUT_HANDLE hLut);

/** Reversed lines for switching between the top-down and bottom-up formats.
 * Performs the same action as TopBottom mirror, but updates also the @ref lvip_ImgInfo with a flag
 * indicating the orientation (this has a meaning when switching between top-down and bottom-up formats).
 * @ingroup Functions 
 * - 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: Yes. 
 * 
 * @param pSrcImgInfo Source image info
 * @param pDstImgInfo Destination image info
 * @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_ReverseLines(lvip_ImgInfo* pSrcImgInfo, lvip_ImgInfo* pDstImgInfo, U32BIT dwFlags);

/** Fastly reverses lines (copying whole lines).
 * The pDstImgInfo can be NULL (in-place reversion). In such case a temporary buffer for a line is needed.\n
 * The buffer can be supplied in pLineBuffer (must have sufficient size to hold the whole line in its 
 * pixel format, that means >= ImgInfo.dwLineIncrement).\n
 * If the pLineBuffer is NULL, the buffer is temporarily allocated and deallocated, 
 * which might require additional CPU time, so for the repeated call of this function it is
 * better to allocate the buffer outside the function and pass it as pLineBuffer parameter.
 * - 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: Yes.
 *  

⌨️ 快捷键说明

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