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 乘性高斯噪声在深度学习网络中的应用
  • ¥15 运筹学排序问题中的在线排序
  • ¥15 关于docker部署flink集成hadoop的yarn,请教个问题 flink启动yarn-session.sh连不上hadoop,这个整了好几天一直不行,求帮忙看一下怎么解决
  • ¥30 求一段fortran代码用IVF编译运行的结果
  • ¥15 深度学习根据CNN网络模型,搭建BP模型并训练MNIST数据集
  • ¥15 C++ 头文件/宏冲突问题解决
  • ¥15 用comsol模拟大气湍流通过底部加热(温度不同)的腔体
  • ¥50 安卓adb backup备份子用户应用数据失败
  • ¥20 有人能用聚类分析帮我分析一下文本内容嘛
  • ¥30 python代码,帮调试,帮帮忙吧