测试效果
输入一张偏暗和偏亮的图片
通过HDR合成
另外一个例子
合成的图像
另一个例子
另一个案例
测试代码
* This example shows how high dynamic range images
* can be created from multiple input images (acquired
* with different exposure times) by manipulating the
* image gradient.
*
dev_update_off ()
ImageNames := 'hdr/' + ['bore_hole','halogen','engraved_surface','namibia']
dev_close_window ()
dev_open_window (0, 0, 640, 480, 'black', WindowHandle)
set_display_font (WindowHandle, 14, 'mono', 'true', 'false')
*
for Index := 0 to |ImageNames| - 1 by 1
read_image (ImageDark, ImageNames[Index] + '_dark')
read_image (ImageBright, ImageNames[Index] + '_bright')
dev_clear_window ()
dev_resize_window_fit_image (ImageDark, 0, 0, -1, -1)
dev_display (ImageDark)
disp_message (WindowHandle, 'Dark input image', 'window', 12, 12, 'black', 'true')
disp_continue_message (WindowHandle, 'black', 'true')
stop ()
dev_display (ImageBright)
disp_message (WindowHandle, 'Bright input image', 'window', 12, 12, 'black', 'true')
disp_continue_message (WindowHandle, 'black', 'true')
stop ()
count_channels (ImageDark, Channels)
if (Channels == 1)
create_hdr_image (ImageDark, ImageBright, HDRImage)
elseif (Channels == 3)
decompose3 (ImageDark, Red1, Green1, Blue1)
decompose3 (ImageBright, Red2, Green2, Blue2)
create_hdr_image (Red1, Red2, HDRRed)
create_hdr_image (Green1, Green2, HDRGreen)
create_hdr_image (Blue1, Blue2, HDRBlue)
compose3 (HDRRed, HDRGreen, HDRBlue, HDRImage)
endif
dev_display (HDRImage)
disp_message (WindowHandle, 'HDR image', 'window', 12, 12, 'black', 'true')
if (Index < |ImageNames| - 1)
disp_continue_message (WindowHandle, 'black', 'true')
stop ()
endif
* For further processing convert to a 2 byte image
* (not used in this example)
min_max_gray (HDRImage, HDRImage, 0, Min, Max, Range)
scale_image_range (HDRImage, ImageScaled, [Min,0], [Max,65535])
convert_image_type (ImageScaled, ImageConverted, 'uint2')
endfor