zoukankan      html  css  js  c++  java
  • halcon标定后畸变校正与测量

    这是一个很久以前的微博网友写的,现在的halcon运行有问题,因为已经没有parameters_image_to_world_plane_centered这个函数了,知道现在版本替换它的函数的朋友麻烦告知一下,万分感谢

    本文出处:http://blog.sina.com.cn/s/blog_442bfe0e0100yjce.html#commonComment

    1.get_image_size(Image : : : WidthHeight)

    返回图像的尺寸。

    2.parameters_image_to_world_plane_centered (CamParam, Pose, CenterRow, CenterCol, WidthMappedImage, HeightMappedImage, ScaleForCenteredImage, PoseForCenteredImage)

    Halcon内部程序,输出为图像的比率和姿态。

    3.gen_image_to_world_plane_map( : Map : CameraParamWorldPoseWidthInHeightInWidthMappedHeightMappedScaleMapType : )

    产生一个投影映射,该映射描述图像平面与Z=O的世界平面之间的关系,输出为图像MAP,是一个多通道的图像

    包含了映射数据。

    4.map_image(ImageMap : ImageMapped : : ) 

    利用映射变换校正图像,输出为矫正后的图像。

    5.image_to_world_plane(Image : ImageWorld : CameraParamWorldPoseWidthHeightScaleInterpolation : ) 

    把校正后的图像转换到Z=0的世界平面。

    6.image_points_to_world_plane( : : CameraParamWorldPoseRowsColsScale : XY)  

    把图像上的点转换到Z=0的世界平面,输出为点坐标。

    * This program provides procedures for the determination of the
    * parameters Pose and Scale of the operators image_to_world_plane
    * and gen_image_to_world_plane_map.
    *
    * Read the image
    ImgPath := '3d_machine_vision/calib/'
    read_image (Image, ImgPath+'caliper_01')
    * Set the camera parameters for the image
    CamParam := [0.0160728,-631.843,7.40077e-006,7.4e-006,326.369,246.785,652,494]
    Pose := [-41.2272,26.763,398.682,359.655,359.202,322.648,0]
    * Reopen the window appropriately
    get_image_size (Image, WidthOriginalImage, HeightOriginalImage)
    dev_open_window_fit_image (Image, 0, 0, WidthOriginalImage, HeightOriginalImage, WindowHandle)
    set_display_font (WindowHandle, 14, 'mono', 'true', 'false')
    dev_set_color ('red')
    WidthMappedImage := 652
    HeightMappedImage := 494
    * Transform the image such that a given point appears in the
    * center of the rectified image and the the scale of the rectified image
    * is similar to the scale of the original image (in the surroundings
    * of the given point)
    * Define the point that will appear in the center of the rectified image
    dev_display (Image)
    disp_message (WindowHandle, 'Define the center of the mapped image', 'window', 12, 12, 'white', 'false')
    get_mbutton (WindowHandle, CenterRow, CenterCol, Button)
    * Determine scale and pose such that the given point appears
    * in the center of the rectified image and that the
    * scale of the two images is similar (in the surroundings
    * of the given point).
    parameters_image_to_world_plane_centered (CamParam, Pose, CenterRow, CenterCol, WidthMappedImage, HeightMappedImage, ScaleForCenteredImage, PoseForCenteredImage)
    * Rectify the image
    gen_image_to_world_plane_map (Map, CamParam, PoseForCenteredImage, WidthOriginalImage, HeightOriginalImage, WidthMappedImage, HeightMappedImage, ScaleForCenteredImage, 'bilinear')
    map_image (Image, Map, ImageMapped)
    dev_open_window_fit_image (ImageMapped, 0, 0, WidthMappedImage, HeightMappedImage, WindowHandleMapped)
    set_display_font (WindowHandleMapped, 14, 'mono', 'true', 'false')
    dev_set_color ('red')
    dev_display (ImageMapped)
    * In case, only one image has to be mapped, the operator
    * image_to_world_plane can be used instead of the operators
    * gen_image_to_world_plane_map together with map_image.
    image_to_world_plane (Image, ImageMapped, CamParam, PoseForCenteredImage, WidthMappedImage, HeightMappedImage, ScaleForCenteredImage, 'bilinear')
    * Display the center point
    image_points_to_world_plane (CamParam, PoseForCenteredImage, CenterRow, CenterCol, ScaleForCenteredImage, CenterX, CenterY)
    disp_cross (WindowHandleMapped, CenterY, CenterX, 6, rad(45))
    disp_message (WindowHandleMapped, 'The selected point appears in the center', 'window', 12, 12, 'white', 'false')
    disp_message (WindowHandleMapped, 'of the rectified image', 'window', 36, 12, 'white', 'false')
    disp_continue_message (WindowHandleMapped, 'black', 'true')
    stop ()
    *
    * Now determine scale and pose such that the entire image
    * fits into the rectified image.
    parameters_image_to_world_plane_entire (Image, CamParam, Pose, WidthMappedImage, HeightMappedImage, ScaleForEntireImage, PoseForEntireImage)
    * Rectify the image
    image_to_world_plane (Image, ImageMapped, CamParam, PoseForEntireImage, WidthMappedImage, HeightMappedImage, ScaleForEntireImage, 'bilinear')
    dev_clear_window ()
    dev_display (ImageMapped)
    disp_message (WindowHandleMapped, 'The entire image is visible in the rectified image', 'window', -1, -1, 'white', 'false') 

  • 相关阅读:
    HTML-参考手册: HTTP 状态消息
    HTML-参考手册: HTML 语言代码
    HTML-参考手册: URL 编码
    HTML-参考手册: HTML 符号实体
    HTML-参考手册: HTML ISO-8859-1
    HTML-参考手册: HTML ASCII
    HTML-参考手册: HTML 字符集
    HTML-参考手册: 颜色混搭
    HTML-参考手册: HTML 拾色器
    HTML-参考手册: HTML 颜色名
  • 原文地址:https://www.cnblogs.com/eve612/p/13860742.html
Copyright © 2011-2022 走看看