halcon中Image的像素类型

在学习halcon算子sub_image(ImageMinuend, ImageSubtrahend : ImageSub : Mult, Add : )时,在样例中遇到了一个操作

* This example demonstrates how to subtract two images
* using the operator 'sub_image'.
* 
* 
dev_close_window ()
dev_update_off ()
* 
* Read two images and convert them
read_image (Scene00, 'autobahn/scene_00')
read_image (Scene01, 'autobahn/scene_01')
convert_image_type (Scene00, ImageConverted1, 'int2')
convert_image_type (Scene01, ImageConverted2, 'int2')
* 
* Display the input images for the subtraction
dev_open_window_fit_image (ImageConverted1, 0, 0, -1, -1, WindowHandle)
set_display_font (WindowHandle, 16, 'mono', 'true', 'false')
dev_display (ImageConverted1)
disp_message (WindowHandle, 'Image 1', 'window', 12, 12, 'black', 'true')
disp_continue_message (WindowHandle, 'black', 'true')
stop ()
dev_display (ImageConverted2)
disp_message (WindowHandle, 'Image 2', 'window', 12, 12, 'black', 'true')
disp_continue_message (WindowHandle, 'black', 'true')
stop ()
* 
* Subtract the input images and display the resulting image
sub_image (ImageConverted1, ImageConverted2, ImageSub, 1, 50)
dev_display (ImageSub)

将图片的类型转换为‘int2’

convert_image_type (Scene00, ImageConverted1, 'int2')
convert_image_type (Scene01, ImageConverted2, 'int2')

产生了疑惑:为什么在图像相减前要转换成这种类型?int2是什么?

在网上找了一圈,只有这个文档里的介绍比较详细

14年大恒图像培训3 halcon structure and programming

知道了int2是一种像素类型

halcon中Image的像素类型_第1张图片

halcon中Image的像素类型_第2张图片

以及各种类型的大小

halcon中Image的像素类型_第3张图片



至于为什么要在sub_image前进行转换还没弄清。。。

比较了一下转换和不转换做sub_image的差别:

1、将转换后的图像进行相减操作

sub_image (ImageConverted1, ImageConverted2, ImageSub, 1, 50)
dev_display (ImageSub)
halcon中Image的像素类型_第4张图片

2、将转换前的图像进行相减操作

sub_image(Scene00,Scene01,Imagesub,1,50)
dev_display(Imagesub)

halcon中Image的像素类型_第5张图片

感觉看不出具体的差别???

你可能感兴趣的:(halcon中Image的像素类型)