40、gen_projective_mosaic.hdev:图像拼接,使用proj_match_points_ransac和gen_projective_mosaic。
* This example program shows how veral images of a PCB can be combined into a large mosaic image of the PCB. The program shows how to u proj_match_points_ransac and gen_projective_mosaic to achieve this. Plea note that the PCB has some degradations on its surface, which look like folds and may easily be mistaken as the ams between the images in the mosaic image. To show that this is not the ca, the program also displays the true ams of the mosaic image.
*此示例程序显示了PCB的几个图像如何组合成PCB的大型镶嵌图像。 该程序显示如何使*用proj_match_points_ransac和gen_projective_mosaic来实现这一点。 请注意,印刷电路板*的表面有一些退化,看起来像褶皱,很容易被误认为马赛克图像中的图像之间的接缝。 为*了表明情况并非如此,程序还显示了马赛克图像的真实接缝。
dev_update_off ()
*关闭更新
dev_clo_window ()
*关闭窗口
dev_open_window (0, 0, 640, 480, 'white', WindowHandle)
*创建窗口
dev_t_color ('green')
*设置显示颜色为绿色
t_display_font (WindowHandle, 14, 'mono', 'true', 'fal')
*设置窗口内字体几大小
* Read in the images and show them one-by-one. Plea not the fold-like degradations running across the PCB.
*读图像并逐一显示。 请不要在意PCB板上的褶皱状退化。
gen_empty_obj (Images)
创建一个空的目标元组。
for J := 1 to 6 by 1
read_image (Image, 'mosaic/pcb_'+J$'02')
*依次读取图像
concat_obj (Images, Image, Images)
*把两个图像数组合并在一起
dev_display (Image)
*显示图像
disp_message (WindowHandle, 'Image '+J$'d', 'image', -1, -1, 'black', 'true')
*显示读取图像的进度婚内财产协议书
明显陵
wait_conds (1)
*等待1秒
endfor
disp_continue_message (WindowHandle, 'black', 'true')
*显示继续提示消息
stop ()
* To show the point matches that are ud to compute the projective transformation between the images, we will show all images in a large tiled image with some space between the images so that the extents of the images are easily visible.
*为了显示用于计算图像之间的投影变换的点匹配,我们在大平铺图像的所有图像与图像之绿是多音字吗
*间留了一些空间,这样更容易看清楚没个图像的范围。
未来的食物
dev_t_window_extents (-1, -1, 640/4, 2980/4)
*改变一个图形窗口的位置和大小
tile_images_offt (Images, TiledImage, [0,500,1000,1500,2000,2500], [0,0,0,0,0,0], [-1,-1,-1,-1,-1,-1], [-1,-1,-1,-1,-1,-1], [-1,-1,-1,-1,-1,-1], [-1,-1,-1,-1,-1,-1], 640, 2980)
*简单拼图
dev_clear_window ()
*清除活动图像窗口
dev_display (TiledImage)
*显示图像
disp_message (WindowHandle, 'All 6 images', 'window', 12, 12, 'black', 'true')
*显示读取全部图像的消息
disp_message (WindowHandle, 'Click \'Run\'\nto continue', 'window', 2980/4-50, 12, 'black', 'true')
*显示点击继续运行
stop ()
* Now we compute point matches between the five pairs of images and with this the projective *transformation between the image pairs. Note that the code below calls the point operator for *each image pair. Since the images form a strip, with a little book keeping we could make the *process a little more efficient by saving the points from the last iteration (ImageT in pair J will be *identical to ImageF in pair J+1). This is not done here becau such an optimization would be *quite cumbersome in the general ca where the images can lie in a general configuration that *cannot be reprented by a strip.
*现在我们计算五对图像之间的点匹配,并用这个图像对之间的投影变换。 请注意,以下
代*码将为每个图像对调用点运算符。 由于图像形成一个条带,稍微保留一点,我们可以通过*保存最后一次迭代的点(J对中的ImageT将与J + 1对中的ImageF相同)使得处理更有效*率。 这不是在这里完成的,因为这样的优化在一般情况下是非常麻烦的,即图像可能处于*一个不能用条表示的一般配置。
dev_clear_window ()
*清除活动图像窗口
大学生考试网dev_display (TiledImage)
*显示图像
disp_message (WindowHandle, 'Point matches', 'window', 12, 3, 'black', 'true')
*显示点匹配的消息
* We define the image pairs, i.e., which image should be mapped to which image.
*定义图像对,即,所述图像应该被映射到哪个图像。
From := [1,2,3,4,5]
To := [2,3,4,5,6]
Num := |From|
* We need a variable to accumulate the projective transformation matrices.
*定义一个变量来累积投影变换矩阵。
ProjMatrices := []
* Furthermore, since we want to create a rigid mosaic below we need to accumulate all the point *correspondences and the number of matches per image pair.
*此外,由于我们要在下面创建一个严格的马赛克,我们需要累积所有的点对应关系和每个
*图像对的匹配数量。
Rows1 := []
Cols1 := []
Rows2 := []
Cols2 := []
NumMatches := []征信信用查询
* Now we can determine the transformations between the five image pairs.
写信的格式
*现在我们可以确定五个图像对之间的转换。
for J := 0 to Num-1 by 1
F := From[J]
T := To[J]
如何做圆柱体 lect_obj (Images, ImageF, F)
lect_obj (Images, ImageT, T)
* Extract the points in both images.
*提取两个图像中的点。
points_foerstner (ImageF, 1, 2, 3, 200, 0.3, 'gauss', 'fal', RowJunctionsF, ColJunctionsF, CoRRJunctionsF, CoRCJunctionsF, CoCCJunctionsF, RowAreaF, ColAreaF, CoRRAreaF, CoRCAreaF, CoCCAreaF)
使用Förstner算子检测关注点
points_foerstner (ImageT, 1, 2, 3, 200, 0.3, 'gauss', 'fal', RowJunctionsT, ColJunctionsT, CoRRJunctionsT, CoRCJunctionsT, CoCCJunctionsT, RowAreaT, ColAreaT, CoRRAreaT, CoRCAreaT, CoCCAreaT)
使用Förstner算子检测关注点
* Determine the point matches and the transformation for the current image pair.