我有一张照片,是用不均匀的光线拍摄的。有一个Light obove和一个在相机下面,所以结果是,图像在中心(从上到下)被适当地照亮,但左右都很暗。
有没有办法使用渐变的增白滤镜?所以它越靠近外缘,它就越亮?
用Mannari的答案这样解决:
decompose3 (OriginalImage, ImageR, ImageG, ImageB)
trans_from_rgb(ImageR, ImageG, ImageB, ImageH, ImageL, ImageS, 'hls')
ImageWhite:=ImageL
gen_rectangle1(Rectangle,0,0,ImageHeight-1,ImageWidth-1)
* paint a white rectangle
paint_region(Rectangle,ImageWhite,ImageWhite,255.0,'fill')
tuple_real(BrightenWidth,BrightenWidth)
gen_image_gray_ramp (ImageGrayRampL, 0, -(255/BrightenWidth), 128, 1, BrightenWidth/2, ImageWidth, ImageHeight)
gen_image_gray_ramp (ImageGrayRampR, 0, (255/BrightenWidth), 128, 1, ImageWidth-(BrightenWidth/2), ImageWidth, ImageHeight)
add_image (ImageGrayRampL,ImageGrayRampR,ImageGrayRampRaw,1,0)
mult_image (ImageL, ImageGrayRampRaw, ImageComp, 0.003, 0)
add_image (ImageL, ImageComp, BrightenedImageL, 1, 0)
add_image (ImageS, ImageComp, BrightenedImageS, 1, 0)
trans_to_rgb(ImageH,BrightenedImageL,BrightenedImageS,ImageR,ImageG,ImageB,'hls')
compose3(ImageR,ImageG,ImageB,CompensatedImage)发布于 2020-09-28 19:11:20
是的,当然。
您可以在演示multi_image.dev中找到一个示例。
演示代码如下:
* This example demonstrates how to multiply two images using
* the operator 'mult_image'.
*
*
dev_close_window ()
dev_update_off ()
*
* Read an input image and generate a second input image
* by creating a gray value ramp
read_image (Scene00, 'autobahn/scene_00')
gen_image_gray_ramp (ImageGrayRamp, 0.5, 0.5, 128, 256, 256, 512, 512)
*
* Display the input images for the multiplication
dev_open_window_fit_image (Scene00, 0, 0, -1, -1, WindowHandle)
set_display_font (WindowHandle, 16, 'mono', 'true', 'false')
dev_display (Scene00)
disp_message (WindowHandle, 'Multiply the image with a gray value ramp', 'window', 12, 12, 'black', 'true')
disp_continue_message (WindowHandle, 'black', 'true')
stop ()
dev_display (ImageGrayRamp)
disp_message (WindowHandle, 'Created gray value ramp', 'window', 12, 12, 'black', 'true')
disp_continue_message (WindowHandle, 'black', 'true')
stop ()
*
* Multiply the images with factor 0.005 for the gray value
* adaption and display the resulting image
mult_image (Scene00, ImageGrayRamp, ImageResult, 0.005, 0)
dev_display (ImageResult)
disp_message (WindowHandle, 'Resulting image of the product', 'window', 12, 12, 'black', 'true')我认为如果你抓取一张参考照片(例如用白纸),而不是创建一个渐变图像,效果会更好。
https://stackoverflow.com/questions/64099202
复制相似问题