zoukankan      html  css  js  c++  java
  • 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:第二个坐标系,标准图像坐标系

     

    专注工业视觉检测,提供系统集成解决方案
  • 相关阅读:
    P1182 数列分段Section II
    P1119 灾后重建
    P1133 教主的花园
    P1077 摆花
    P2002 消息扩散
    P2341 [HAOI2006]受欢迎的牛(tarjan+缩点)
    luoguP1726 上白泽慧音
    P1053 篝火晚会
    P2296 寻找道路
    P1156 垃圾陷阱
  • 原文地址:https://www.cnblogs.com/baiyy-daheng/p/14366793.html
Copyright © 2011-2022 走看看