建立函数,如图:
代码如下:
get_region_points (Image, Rows, Columns)
decompose3 (Image, ImageR, ImageG, ImageB)
get_grayval (ImageR, Rows, Columns, GrayvalR)
get_grayval (ImageG, Rows, Columns, GrayvalG)
get_grayval (ImageB, Rows, Columns, GrayvalB)
ScaleR := TargetR/mean(GrayvalR)
ScaleG := TargetG/mean(GrayvalG)
ScaleB := TargetB/mean(GrayvalB)
scale_image (ImageR, ImageScaledR, ScaleR, 0)
scale_image (ImageG, ImageScaledG, ScaleG, 0)
scale_image (ImageB, ImageScaledB, ScaleB, 0)
compose3 (ImageScaledR, ImageScaledG, ImageScaledB, ImageBalance)
return ()
调用函数:lib_white_balance (TabImage, TabImage1, 100, 100, 100)
TabImage:输入图片;TabImage1:输出图片;后面三个100:分别是TargetR、TargetG,TargetB对应值(值越大图片越亮,值越小图片越暗)