Halcon图像处理中的坐标系

本文参考博客:https://blog.csdn.net/qq_20161893/article/details/72917780,在此基础上按照自己的理解,进行了整理

一、Halcon图像处理的两个坐标系

                                    coordinate system                                                                                              standard image coordinate system
                              (0,0)  to (Width-1,Height-1)                                                                                         (-0.5,-0.5) to (Width+0.5, Height+0.5)

 二、各个算子使用的坐标系

1)affine_trans_pixel,affine_trans_contour_xld,affine_trans_region,affine_trans_image: 第一个坐标系,像素坐标系

eg1:affine_trans_pixel  

eg2:affine_trans_image

 

//绕着图像中心点旋转90度
area_center(Image,Area,Row,Column)//这是基于标准图像坐标系
vector_angle_to_rigid(Row,Column,0,Row,Column,rad(90),HomMat2D)
//以下两个运算交换下顺序也可以,因为矩阵乘法满足结合律
hom_mat2d_translate(HomMat2D, 0.5, 0.5, HomMat2DTmp)    //矩阵左乘
hom_mat2d_translate_local(HomMat2DTmp, -0.5, -0.5, HomMat2DAdapted)   //矩阵右乘,基于本地坐标系
affine_trans_image(Image, ImageAffinTrans, HomMat2DAdapted, 'constant', 'false') //这是基于像素坐标系

//绕着图像中心点旋转90度(另一种实现方式)
get_image_size(Image,Width,Height)
Row := Height/2 
Column := Width/2
vector_angle_to_rigid(Row,Column,0,Row,Column,rad(90),HomMat2D)
affine_trans_image(Image, ImageAffinTrans, HomMat2DAdapted, 'constant', 'false')
    
//绕着图像中心点旋转90度(第三种实现方式)
area_center(Circle,Area, Row,Column)
vector_angle_to_rigid(Row+0.5,Column+0.5,0,Row+0.5,Column+0.5,rad(90),HomMat2D)
affine_trans_image(ImageResult,ImageAffinTrans2,HomMat2D,'constant', 'false')

 

 

 2)affine_trans_point_2d, area_center:第二个坐标系,标准图像坐标系

 

 

posted @ 2021-02-03 14:19  Jane_bai  阅读(4901)  评论(1编辑  收藏  举报