yesir
初学者
初学者
  • 最后登录2017-12-08
  • 发帖数12
  • 金币72枚
  • 贡献勋章0枚
阅读:93回复:1

error in projection:s_x=0 or s_y=0 or z=0 错误8406

楼主#
更多 发布于:2017-12-06 20:42
在做双目视觉标定的时候,运行到binocular_calibration(X,Y,Z,RowsL,ColsL,RowsR,ColsR,StartCamParL,StartCamParR,StartPosesL,StartPosesR,'all', CamParamL, CamParamR, NFinalPoseL, NFinalPoseR, cLPcR, Errors)这句会报错error in projection:s_x=0
or s_y=0 or z=0

图片:error.png


不知道是什么原因啊,希望大佬能解答。
附代码:

Index := 1
read_image(ImageL,'C:/Users/Administrator/Desktop/halcon/binocal/binonew/L/'+'L_'+Index$'02d')
read_image(ImageR,'C:/Users/Administrator/Desktop/halcon/binocal/binonew/R/'+'R_'+Index$'02d')
* Reopen the windows with an appropriate size
dev_close_window ()
dev_update_off ()
get_image_size (ImageL, WidthL, HeightL)
dev_open_window (0, 0, WidthL, HeightL, 'black', WindowHandle1)
dev_set_draw ('margin')
dev_set_color ('green')
set_display_font (WindowHandle1, 14, 'mono', 'true', 'false')
get_image_size (ImageR, WidthR, HeightR)
dev_open_window (0, WidthL + 12, WidthL, HeightL, 'black', WindowHandle2)
dev_set_draw ('margin')
dev_set_color ('green')
* Read the model calibration points.
CaltabFile :='caltab_30mm.descr'
caltab_points (CaltabFile, X, Y, Z)
* Set the initial values for the internal camera parameters
StartCamParL:=[0.012,0,0.002592,0.001944,WidthL / 2.0,HeightL / 2.0,WidthL,HeightL]
StartCamParR := StartCamParL
* Parameter settings for find_caltab and find_marks_and_pose
SizeGauss := 3
MarkThresh := 48
MinDiamMarks := 5
StartThresh := 128
DeltaThresh := 10
MinThresh := 18
Alpha := 0.8
MinContLength := 15
MaxDiamMarks := 150
* Create the tuples in which the image coordinates of the
* calibration marks and the initial poses will be accumulated
RowsL := []
ColsL := []
StartPosesL := []
RowsR := []
ColsR := []
StartPosesR := []
* Start the loop over the calibration images
for Index := 1 to 18 by 1
    * Read the calibration images
    read_image(ImageL,'C:/Users/Administrator/Desktop/halcon/binocal/binonew/L/'+'L_'+Index$'02d')
    read_image(ImageR,'C:/Users/Administrator/Desktop/halcon/binocal/binonew/R/'+'R_'+Index$'02d')
    * Search for the calibration plate
    find_caltab (ImageL, CaltabL, CaltabFile, SizeGauss, MarkThresh, MinDiamMarks)
    find_caltab (ImageR, CaltabR, CaltabFile, SizeGauss, MarkThresh, MinDiamMarks)
   * Display calibration plate regions
    dev_set_window (WindowHandle1)
    dev_display (ImageL)
    dev_display (CaltabL)
    dev_set_window (WindowHandle2)
    dev_display (ImageR)
    dev_display (CaltabR)
   * Extraction of marks and pose as well as visualization of the
   * results for the second image.
    find_marks_and_pose (ImageL, CaltabL, CaltabFile, StartCamParL, StartThresh, DeltaThresh, MinThresh, Alpha, MinContLength, MaxDiamMarks, RCoordL, CCoordL, StartPoseL)
    disp_caltab (WindowHandle1, CaltabFile, StartCamParL, StartPoseL, 1)
   * Extraction of marks and pose as well as visualization of the
   * results for the second image.
    find_marks_and_pose (ImageR, CaltabR, CaltabFile, StartCamParR, StartThresh, DeltaThresh, MinThresh, Alpha, MinContLength, MaxDiamMarks, RCoordR, CCoordR, StartPoseR)
    disp_caltab (WindowHandle2, CaltabFile, StartCamParR, StartPoseR, 1)
   * Accumulate the image coordinates of the calibration marks
   * as well as the estimated initial poses for all stereo pairs,
   * where the poses has been estimated consistently.
    RowsL := [RowsL,RCoordL]
    ColsL := [ColsL,CCoordL]
    StartPosesL := [StartPosesL,StartPoseL]
    RowsR := [RowsR,RCoordR]
    ColsR := [ColsR,CCoordR]
    StartPosesR := [StartPosesR,StartPoseR]
endfor
* Perform the actual calibration
binocular_calibration (X, Y, Z, RowsL, ColsL, RowsR, ColsR, StartCamParL, StartCamParR, StartPosesL, StartPosesR, 'all', CamParamL, CamParamR, NFinalPoseL, NFinalPoseR, cLPcR, Errors)

* Generate the rectification maps
gen_binocular_rectification_map (MapL, MapR, CamParamL, CamParamR, cLPcR, 1, 'geometric', 'bilinear', RectCamParL, RectCamParR, CamPoseRectL, CamPoseRectR, RectLPosRectR)
* Read in a stereo image pair, acquired with the stereo camera system,
* which has been calibrated, just now.
stop()
read_image(ImageL,'C:/Users/Administrator/Desktop/halcon/binocal/binonew/L/'+'L_'+Index$'02d')
read_image(ImageR,'C:/Users/Administrator/Desktop/halcon/binocal/binonew/R/'+'R_'+Index$'02d')
* Rectify the stereo images and display them
map_image (ImageL, MapL, ImageRectifiedL)
map_image (ImageR, MapR, ImageRectifiedR)
* Check the epipolar constraint on the rectified images,
* (the differences of the features' row coordinates should be small)
* and visualize the result (including some corresponding epipolar lines)
yesir
初学者
初学者
  • 最后登录2017-12-08
  • 发帖数12
  • 金币72枚
  • 贡献勋章0枚
沙发#
发布于:2017-12-08 14:11
已解决 是初始参数设置错误
(f,κ,Sx,Sy,Cx,Cy)
f为焦距,Sx,Sy是缩放比例因子,说明书中有像素那一栏水平和垂直两个参数
游客

返回顶部