weixin_44726512 2019-04-10 14:23 采纳率: 0%
浏览 1733

halcon的仿射旋转变换问题

dev_clear_window ()
dev_open_window (0, 0, 512, 512, 'black', WindowHandle)
read_image (Image10000059950514645933354065, 'C:/Users/lenovo/Desktop/字符图片/图片/100000599505_14645933354065.jpg')
gen_rectangle1 (ROI_0, 104.445, 11.06, 299.045, 368.74)
reduce_domain (Image10000059950514645933354065, ROI_0, ImageReduced)

text_line_orientation (ROI_0, ImageReduced, 25, -0.523599, 0.523599, OrientationAngle)
hom_mat2d_identity (HomMat2DIdentity)
hom_mat2d_rotate (HomMat2DIdentity, -OrientationAngle, 0, 0, HomMat2DRotate)
affine_trans_image (ImageReduced, ImageAffineTrans, HomMat2DRotate, 'constant', 'false')
![图片说明](https://img-ask.csdn.net/upload/201904/10/1554877038_700110.jpg)

然后旋转正了,边上的字就不见了,这是什么问题,我是初学者

  • 写回答

1条回答 默认 最新

  • CZ_rogers 2021-08-11 20:46
    关注

    Attention
    The region of the input image is ignored.

    affine_trans_image does not use the HALCON standard coordinate system (with the origin in the center of the first pixel), but instead uses the same coordinate system as in affine_trans_pixel, i.e., the origin lies in the upper left corner of the first pixel. Therefore, applying affine_trans_image corresponds to a chain of transformations (see affine_trans_pixel), which is applied to each point of the image (input and output pixels as homogeneous vectors). As an effect, you might get unexpected results when creating affine transformations based on coordinates that are derived from the image, e.g., by operators like area_center_gray. For example, if you use this operator to calculate the center of gravity of a rotationally symmetric image and then rotate the image around this point using hom_mat2d_rotate, the resulting image will not lie on the original one. In such a case, you can compensate this effect by applying the following translations to HomMat2D before using it in affine_trans_image:

    hom_mat2d_translate(HomMat2D, 0.5, 0.5, HomMat2DTmp)
    hom_mat2d_translate_local(HomMat2DTmp, -0.5, -0.5, HomMat2DAdapted)
    affine_trans_image(Image, ImageAffineTrans, HomMat2DAdapted,
    'constant', 'false')
    For an explanation of the different 2D coordinate systems used in HALCON, see the introduction of chapter Transformations / 2D Transformations.

    帮助里有写,halcon会直接把图像截断的,如果用的是整个图像region的话

    评论

报告相同问题?

悬赏问题

  • ¥15 安卓adb backup备份应用数据失败
  • ¥15 eclipse运行项目时遇到的问题
  • ¥15 关于#c##的问题:最近需要用CAT工具Trados进行一些开发
  • ¥15 南大pa1 小游戏没有界面,并且报了如下错误,尝试过换显卡驱动,但是好像不行
  • ¥15 没有证书,nginx怎么反向代理到只能接受https的公网网站
  • ¥50 成都蓉城足球俱乐部小程序抢票
  • ¥15 yolov7训练自己的数据集
  • ¥15 esp8266与51单片机连接问题(标签-单片机|关键词-串口)(相关搜索:51单片机|单片机|测试代码)
  • ¥15 电力市场出清matlab yalmip kkt 双层优化问题
  • ¥30 ros小车路径规划实现不了,如何解决?(操作系统-ubuntu)