【问题标题】:Halcon - Gradient brightnessHalcon - 渐变亮度
【发布时间】:2021-01-13 20:38:58
【问题描述】:

我的图像是在光线不均匀的情况下拍摄的。相机上方有一个光,相机下方有一个,因此,图像的中心(从上到下)照明正常,但左右两侧很暗.

有没有办法应用渐变的增亮滤镜?所以它越靠近外边缘,它就越亮?

以这种方式解决了 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)

【问题讨论】:

    标签: gradient brightness halcon


    【解决方案1】:

    是的,当然。

    您可以在演示 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')
    

    我认为最好是获取参考照片(例如使用白纸)而不是创建渐变图像。

    【讨论】:

    • 非常感谢! è proprio quello che cercavo!
    • 嗯,它看起来只适用于灰度图像...我确实有一个彩色图像..我生成了我需要的渐变,并希望相应地使我的彩色图像变亮...
    • 您可以使用 decompose3 将 RGB 图像分离为三个通道(灰色图像):红色、绿色和蓝色。在您可以使用 mult_image 处理每个灰度图像之后,最后您使用 compose3 将三个处理后的通道合并到一个 RGB 图像中。
    • 谢谢!它起作用了..必须在 HSL 中做到这一点才能获得更好的结果。增加亮度和饱和度。我用我的工作代码更新了主帖。
    猜你喜欢
    • 1970-01-01
    • 2020-08-29
    • 1970-01-01
    • 2022-01-15
    • 2018-04-17
    • 2011-01-28
    • 1970-01-01
    • 2019-11-30
    相关资源
    最近更新 更多