设置首页收藏本站
开启左侧

解决矫正过的图片中的特征对视差图的影响

[复制链接]
shunzi11 发表于 2020-3-19 21:50:32 | 显示全部楼层 |阅读模式
我怎么才能解决矫正过的图片中的特征对视差图的影响
比如下图中包装袋上的图案被反应进了视差图中。
程序是
  1. ##############################################################################
  2. # File generated by HDevelop for text file Version 18.11.1.0
  3. # Non-ASCII strings in this file are encoded in local-8-bit encoding (cp936).
  4. #
  5. # Please note that non-ASCII characters in string constants are exported
  6. # as octal codes in order to guarantee that the strings are correctly
  7. # created on all systems, independent on any compiler settings.
  8. #
  9. ##############################################################################
  10. # File generated by HDevelop for text file Version 18.11.1.0
  11. # Non-ASCII strings in this file are encoded in local-8-bit encoding (cp936).
  12. #
  13. # Please note that non-ASCII characters in string constants are exported
  14. # as octal codes in order to guarantee that the strings are correctly
  15. # created on all systems, independent on any compiler settings.
  16. #
  17. # Source files with different encoding should not be mixed in one project.
  18. ##############################################################################
  19. # Procedures
  20. # Chapter: Develop
  21. # Short Description: Switch dev_update_pc, dev_update_var and dev_update_window to 'off'.
  22.   dev_update_off ()
  23.   * This procedure sets different update settings to 'off'.
  24.   * This is useful to get the best performance and reduce overhead.
  25.   *
  26.   dev_update_pc ('off')
  27.   dev_update_var ('off')
  28.   dev_update_window ('off')
  29.   return ()

  30. # Main procedure
  31.   * Example program to demonstrate the operator binocular_disparity
  32.   *
  33.   * A pair of epipolar images (which are already rectified and have parallel,
  34.   * horizontal epipolar lines) will be processed.
  35.   * --------------------------------------------------------
  36. #*for image_index:= 1 to 3 by 1
  37.    
  38.   dev_update_off ()
  39.   dev_close_window ()
  40.        Width :=640
  41.   Height := 512
  42.   dev_open_window (0, 0, Width / 2, Height / 2, 'black', WindowHandle1)
  43.   dev_open_window (0, Width / 2 + 12, Width / 2, Height / 2, 'black', WindowHandle2)
  44.   dev_open_window (Height / 2 + 62, 0, Width / 2, Height / 2, 'black', WindowHandle3)
  45.   * The images to be read:
  46.   Path := 'stereo/epipolar/'
  47.   *
  48.   * read_image (LImage, Path + 'baseball_l')
  49.   * read_image (LImage, 'D:/stereo_data/stereo_data/data2/colorleft1.png')
  50.   read_image (LImage, '路径')
  51.   dev_set_window (WindowHandle1)
  52.   dev_display (LImage)
  53.   * read_image (RImage, Path + 'baseball_r')
  54.   * read_image (RImage, 'D:/stereo_data/stereo_data/data2/colorright1.png')
  55.   read_image (RImage, '路径')
  56.   *read_image (GImage, '路径')
  57.   dev_set_window (WindowHandle2)
  58.   dev_display (RImage)
  59.   count_seconds (Start)
  60.   z := 3
  61.   
  62.   DefaultParameters := ['fast','fast_accurate','accurate','very_accurate']
  63.    *binocular_disparity (LImage, RImage, DisparityNCC, Score, 'ncc', 5,5, 0, 64, 164, 2, -0.5, 'none', 'interpolation')
  64.   SurfaceSmoothing := [0,10,20,30,40,50,0,0,0,0,0,30]
  65.   EdgeSmoothing := [0,0,0,0,0,0,10,20,30,40,50,20]
  66.   
  67.   final_sum_dis := 1000
  68.   final_bad_1 := 1000
  69.   final_bad_2 := 1000
  70.   for I1 := 10 to |SurfaceSmoothing| - 1 by 1
  71.    *for I2 := 3 to 21 by 2
  72.        for I := -170 to -125 by 1
  73.       binocular_disparity_ms (LImage, RImage, DisparityNCC, Score, I, I+140, SurfaceSmoothing[I1], EdgeSmoothing[I1],  'similarity_measure','census_sparse')
  74.          
  75.        *binocular_disparity (LImage, RImage, DisparityNCC, Score, 'ncc',  I2, I2,30,I ,I+100, 2, 0.8, 'left_right_check','interpolation')
  76.    *get_domain (DisparityNCC, RegionInpainting)
  77.      *complement (RegionInpainting, RegionInpainting)
  78.      *full_domain (DisparityNCC, DisparityNCC)
  79.      
  80.     * harmonic_interpolation (DisparityNCC, RegionInpainting, DisparityNCC, 0.001)
  81.        count_seconds (Stop)
  82.           Duration := (Stop - Start) * 1000
  83.   *     write_image (DisparityNCC, 'png', 0, 'D:/stereo_data/stereo_data/ncc_result/cones_1.png')
  84.    
  85.    
  86.       DisparityNCC := DisparityNCC
  87.       dev_set_window (WindowHandle3)
  88.       dev_display (DisparityNCC)
  89.       disp_message (WindowHandle3,I1 , 'window', 12, 12, 'black', 'true')
  90.       disp_message (WindowHandle3,I, 'window', 24, 24, 'black', 'true')
  91.       *dev_display (Score)
  92.   endfor
  93.   endfor
  94.   * write_image (DisparityNCC, 'png', 0, 'D:/stereo_data/stereo_data/ncc_result/cones.png')
复制代码

视差图

视差图

左

右

老师给的视查

老师给的视查
奖励计划已经开启,本站鼓励作者发布最擅长的技术内容和资源,流量变现就在现在,[点我]加入吧~~~Go
Criss 发表于 2020-3-23 08:50:43 | 显示全部楼层
双目视觉中做视差,两相机偏差不能太大,而且角度也不能太大,同时标定和二维标定的一致,标定板用7×7的即可,两相机重合区域要达到70%左右,标定时候要两个相机同时记录同一个标定板的位置和姿态,大概做30张附近就差不多了,这样出来的视差就比较合适准确了!

要提醒的就是,标定环节是最重要的,因为稍微不慎就会导致结果偏差很大,而且可能出现各种噪点!
奖励计划已经开启,本站鼓励作者发布最擅长的技术内容和资源,流量变现就在现在,[点我]加入吧~~~Go
Naruto_向 发表于 2020-6-2 14:25:20 | 显示全部楼层
双视觉做视差,学习到了
奖励计划已经开启,本站鼓励作者发布最擅长的技术内容和资源,流量变现就在现在,[点我]加入吧~~~Go
您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表