关键算子:

           orientation_region

           vector_angle_to_rigid

           affine_trans_region

 

测试图片:

halcon图像变形-ROI区域旋转

halcon代码:

 
  1. *此例子将图中没有偏移的形状参照旋转的形状进行旋转

  2. read_image (Image, 'D:/Halcon-WorkSpaces/Test/Image/test14.png')

  3. rgb1_to_gray (Image, GrayImage)

  4. *获取旋转的矩形

  5. threshold (GrayImage, Regions, 0, 0)

  6. *计算区域斜率

  7. orientation_region (Regions, Phi)

  8.  
  9. *获取没有旋转的矩形

  10. threshold (GrayImage, Regions1, 100, 140)

  11. area_center (Regions1, Area, Row, Column)

  12. *创建变换模型

  13. vector_angle_to_rigid (Row, Column, 0, Row, Column, Phi, HomMat2D)

  14. *区域变换

  15. affine_trans_region (Regions1, RegionAffineTrans, HomMat2D, 'nearest_neighbor')

  16. dev_clear_window ()

  17. dev_display (RegionAffineTrans)

  18. dev_display (Regions)

效果:

halcon图像变形-ROI区域旋转

 

相关文章:

  • 2022-02-13
  • 2022-12-23
  • 2021-05-20
  • 2021-11-23
  • 2022-01-09
  • 2022-01-06
  • 2021-09-05
  • 2021-06-10
猜你喜欢
  • 2021-08-22
  • 2021-11-21
  • 2021-08-28
  • 2022-12-23
  • 2021-09-09
  • 2022-01-07
  • 2021-07-30
相关资源
相似解决方案