I have a image that is taken with uneven lighting.. there is a Light obove and one below the camera, so as a result, the image is properly lit in the center (top to bottom) but quite dark left and right.
Is there a way to apply a brightening filter with a gradient? so the more it nears the outer edge, the brighter it gets?
Solved with the answer from Mannari this way:
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)
Yes, of course.
You can find an example in the demo multi_image.dev.
Here the demo code:
I think it's better if you grab a reference photo (for example with a white paper) instead of creating a gradient image.