Pdi Trabajo 1 Final

download Pdi Trabajo 1 Final

of 7

Transcript of Pdi Trabajo 1 Final

  • 8/13/2019 Pdi Trabajo 1 Final

    1/7

    >> calib_gui

    . calib_data.mat prueIzq08.jpg

    .. pathdef.m prueIzq09.jpg

    Calib_Results.m prueIzq01.jpg prueIzq10.jpg

    Calib_Results.mat prueIzq02.jpg prueIzq11.jpg

    Debug prueIzq03.jpg prueIzq12.jpg

    Lab PDI 2.vcxproj prueIzq04.jpg prueIzq13.jpg

    Lab PDI 2.vcxproj.filters prueIzq05.jpg prueIzq14.jpg

    Lab PDI 2.vcxproj.user prueIzq06.jpg prueIzq15.jpg

    analisis de error.fig prueIzq07.jpg

    Basename camera calibration images (without number nor suffix): prueIzqImage format: ([]='r'='ras', 'b'='bmp', 't'='tif', 'p'='pgm', 'j'='jpg', 'm'='ppm') j

    Loading image 1...2...3...4...5...6...7...8...9...10...11...12...13...14...15...done

    Extraction of the grid corners on the imagesNumber(s) of image(s) to process ([] = all images) =Window size for corner finder (wintx and winty):wintx ([] = 5) = 5winty ([] = 5) = 5Window size = 11x11Do you want to use the automatic square counting mechanism (0=[]=default) or do you always want to enter the number of squares manually (1,other)? 1

    Processing image 1...

    Using (wintx,winty)=(5,5) - Window size = 11x11 (Note: To reset the windowsize, run script clearwin)Click on the four extreme corners of the rectangular complete pattern (the firstclicked corner is the origin)...Number of squares along the X direction ([]=10) = 6Number of squares along the Y direction ([]=10) = 6Size dX of each square along the X direction ([]=100mm) = 30Size dY of each square along the Y direction ([]=100mm) = 30If the guessed grid corners (red crosses on the image) are not close to the actual corners,it is necessary to enter an initial guess for the radial distortion factor kc (useful for subpixel detection)Need of an initial guess for distortion? ([]=no, other=yes)

    Corner extraction...

    Processing image 2...Using (wintx,winty)=(5,5) - Window size = 11x11 (Note: To reset the windowsize, run script clearwin)Click on the four extreme corners of the rectangular complete pattern (the firstclicked corner is the origin)...Number of squares along the X direction ([]=6) =Number of squares along the Y direction ([]=6) =Size of each square along the X direction: dX=30mm

  • 8/13/2019 Pdi Trabajo 1 Final

    2/7

    Size of each square along the Y direction: dY=30mm (Note: To reset the size ofthe squares, clear the variables dX and dY)If the guessed grid corners (red crosses on the image) are not close to the actual corners,it is necessary to enter an initial guess for the radial distortion factor kc (useful for subpixel detection)Need of an initial guess for distortion? ([]=no, other=yes)Corner extraction...

    Processing image 3...Using (wintx,winty)=(5,5) - Window size = 11x11 (Note: To reset the windowsize, run script clearwin)Click on the four extreme corners of the rectangular complete pattern (the firstclicked corner is the origin)...Number of squares along the X direction ([]=6) =Number of squares along the Y direction ([]=6) =Size of each square along the X direction: dX=30mmSize of each square along the Y direction: dY=30mm (Note: To reset the size ofthe squares, clear the variables dX and dY)If the guessed grid corners (red crosses on the image) are not close to the actual corners,it is necessary to enter an initial guess for the radial distortion factor kc (useful for subpixel detection)Need of an initial guess for distortion? ([]=no, other=yes)

    Corner extraction...

    Processing image 4...Using (wintx,winty)=(5,5) - Window size = 11x11 (Note: To reset the windowsize, run script clearwin)Click on the four extreme corners of the rectangular complete pattern (the firstclicked corner is the origin)...Number of squares along the X direction ([]=6) =Number of squares along the Y direction ([]=6) =Size of each square along the X direction: dX=30mmSize of each square along the Y direction: dY=30mm (Note: To reset the size ofthe squares, clear the variables dX and dY)If the guessed grid corners (red crosses on the image) are not close to the actu

    al corners,it is necessary to enter an initial guess for the radial distortion factor kc (useful for subpixel detection)Need of an initial guess for distortion? ([]=no, other=yes)Corner extraction...

    Processing image 5...Using (wintx,winty)=(5,5) - Window size = 11x11 (Note: To reset the windowsize, run script clearwin)Click on the four extreme corners of the rectangular complete pattern (the firstclicked corner is the origin)...Number of squares along the X direction ([]=6) =Number of squares along the Y direction ([]=6) =

    Size of each square along the X direction: dX=30mmSize of each square along the Y direction: dY=30mm (Note: To reset the size ofthe squares, clear the variables dX and dY)If the guessed grid corners (red crosses on the image) are not close to the actual corners,it is necessary to enter an initial guess for the radial distortion factor kc (useful for subpixel detection)Need of an initial guess for distortion? ([]=no, other=yes)Corner extraction...

  • 8/13/2019 Pdi Trabajo 1 Final

    3/7

    Processing image 6...Using (wintx,winty)=(5,5) - Window size = 11x11 (Note: To reset the windowsize, run script clearwin)Click on the four extreme corners of the rectangular complete pattern (the firstclicked corner is the origin)...Number of squares along the X direction ([]=6) =Number of squares along the Y direction ([]=6) =Size of each square along the X direction: dX=30mmSize of each square along the Y direction: dY=30mm (Note: To reset the size ofthe squares, clear the variables dX and dY)If the guessed grid corners (red crosses on the image) are not close to the actual corners,it is necessary to enter an initial guess for the radial distortion factor kc (useful for subpixel detection)Need of an initial guess for distortion? ([]=no, other=yes)Corner extraction...

    Processing image 7...Using (wintx,winty)=(5,5) - Window size = 11x11 (Note: To reset the windowsize, run script clearwin)Click on the four extreme corners of the rectangular complete pattern (the firstclicked corner is the origin)...Number of squares along the X direction ([]=6) =Number of squares along the Y direction ([]=6) =

    Size of each square along the X direction: dX=30mmSize of each square along the Y direction: dY=30mm (Note: To reset the size ofthe squares, clear the variables dX and dY)If the guessed grid corners (red crosses on the image) are not close to the actual corners,it is necessary to enter an initial guess for the radial distortion factor kc (useful for subpixel detection)Need of an initial guess for distortion? ([]=no, other=yes)Corner extraction...

    Processing image 8...Using (wintx,winty)=(5,5) - Window size = 11x11 (Note: To reset the windowsize, run script clearwin)

    Click on the four extreme corners of the rectangular complete pattern (the firstclicked corner is the origin)...Number of squares along the X direction ([]=6) =Number of squares along the Y direction ([]=6) =Size of each square along the X direction: dX=30mmSize of each square along the Y direction: dY=30mm (Note: To reset the size ofthe squares, clear the variables dX and dY)If the guessed grid corners (red crosses on the image) are not close to the actual corners,it is necessary to enter an initial guess for the radial distortion factor kc (useful for subpixel detection)Need of an initial guess for distortion? ([]=no, other=yes)Corner extraction...

    Processing image 9...Using (wintx,winty)=(5,5) - Window size = 11x11 (Note: To reset the windowsize, run script clearwin)Click on the four extreme corners of the rectangular complete pattern (the firstclicked corner is the origin)...Number of squares along the X direction ([]=6) =Number of squares along the Y direction ([]=6) =Size of each square along the X direction: dX=30mmSize of each square along the Y direction: dY=30mm (Note: To reset the size of

  • 8/13/2019 Pdi Trabajo 1 Final

    4/7

    the squares, clear the variables dX and dY)If the guessed grid corners (red crosses on the image) are not close to the actual corners,it is necessary to enter an initial guess for the radial distortion factor kc (useful for subpixel detection)Need of an initial guess for distortion? ([]=no, other=yes)Corner extraction...

    Processing image 10...Using (wintx,winty)=(5,5) - Window size = 11x11 (Note: To reset the windowsize, run script clearwin)Click on the four extreme corners of the rectangular complete pattern (the firstclicked corner is the origin)...Number of squares along the X direction ([]=6) =Number of squares along the Y direction ([]=6) =Size of each square along the X direction: dX=30mmSize of each square along the Y direction: dY=30mm (Note: To reset the size ofthe squares, clear the variables dX and dY)If the guessed grid corners (red crosses on the image) are not close to the actual corners,it is necessary to enter an initial guess for the radial distortion factor kc (useful for subpixel detection)Need of an initial guess for distortion? ([]=no, other=yes)Corner extraction...

    Processing image 11...Using (wintx,winty)=(5,5) - Window size = 11x11 (Note: To reset the windowsize, run script clearwin)Click on the four extreme corners of the rectangular complete pattern (the firstclicked corner is the origin)...Number of squares along the X direction ([]=6) =Number of squares along the Y direction ([]=6) =Size of each square along the X direction: dX=30mmSize of each square along the Y direction: dY=30mm (Note: To reset the size ofthe squares, clear the variables dX and dY)If the guessed grid corners (red crosses on the image) are not close to the actual corners,

    it is necessary to enter an initial guess for the radial distortion factor kc (useful for subpixel detection)Need of an initial guess for distortion? ([]=no, other=yes)Corner extraction...

    Processing image 12...Using (wintx,winty)=(5,5) - Window size = 11x11 (Note: To reset the windowsize, run script clearwin)Click on the four extreme corners of the rectangular complete pattern (the firstclicked corner is the origin)...Number of squares along the X direction ([]=6) =Number of squares along the Y direction ([]=6) =Size of each square along the X direction: dX=30mm

    Size of each square along the Y direction: dY=30mm (Note: To reset the size ofthe squares, clear the variables dX and dY)If the guessed grid corners (red crosses on the image) are not close to the actual corners,it is necessary to enter an initial guess for the radial distortion factor kc (useful for subpixel detection)Need of an initial guess for distortion? ([]=no, other=yes)Corner extraction...

    Processing image 13...

  • 8/13/2019 Pdi Trabajo 1 Final

    5/7

    Using (wintx,winty)=(5,5) - Window size = 11x11 (Note: To reset the windowsize, run script clearwin)Click on the four extreme corners of the rectangular complete pattern (the firstclicked corner is the origin)...Number of squares along the X direction ([]=6) =Number of squares along the Y direction ([]=6) =Size of each square along the X direction: dX=30mmSize of each square along the Y direction: dY=30mm (Note: To reset the size ofthe squares, clear the variables dX and dY)If the guessed grid corners (red crosses on the image) are not close to the actual corners,it is necessary to enter an initial guess for the radial distortion factor kc (useful for subpixel detection)Need of an initial guess for distortion? ([]=no, other=yes)Corner extraction...

    Processing image 14...Using (wintx,winty)=(5,5) - Window size = 11x11 (Note: To reset the windowsize, run script clearwin)Click on the four extreme corners of the rectangular complete pattern (the firstclicked corner is the origin)...Number of squares along the X direction ([]=6) =Number of squares along the Y direction ([]=6) =Size of each square along the X direction: dX=30mm

    Size of each square along the Y direction: dY=30mm (Note: To reset the size ofthe squares, clear the variables dX and dY)If the guessed grid corners (red crosses on the image) are not close to the actual corners,it is necessary to enter an initial guess for the radial distortion factor kc (useful for subpixel detection)Need of an initial guess for distortion? ([]=no, other=yes)Corner extraction...

    Processing image 15...Using (wintx,winty)=(5,5) - Window size = 11x11 (Note: To reset the windowsize, run script clearwin)Click on the four extreme corners of the rectangular complete pattern (the first

    clicked corner is the origin)...Number of squares along the X direction ([]=6) =Number of squares along the Y direction ([]=6) =Size of each square along the X direction: dX=30mmSize of each square along the Y direction: dY=30mm (Note: To reset the size ofthe squares, clear the variables dX and dY)If the guessed grid corners (red crosses on the image) are not close to the actual corners,it is necessary to enter an initial guess for the radial distortion factor kc (useful for subpixel detection)Need of an initial guess for distortion? ([]=no, other=yes)Corner extraction...done

    Aspect ratio optimized (est_aspect_ratio = 1) -> both components of fc are estimated (DEFAULT).Principal point optimized (center_optim=1) - (DEFAULT). To reject principal point, set center_optim=0Skew not optimized (est_alpha=0) - (DEFAULT)Distortion not fully estimated (defined by the variable est_dist): Sixth order distortion not estimated (est_dist(5)=0) - (DEFAULT) .Initialization of the principal point at the center of the image.Initialization of the intrinsic parameters using the vanishing points of planar

  • 8/13/2019 Pdi Trabajo 1 Final

    6/7

    patterns.

    Initialization of the intrinsic parameters - Number of images: 15

    Calibration parameters after initialization:

    Focal Length: fc = [ 867.42138 867.42138 ]Principal point: cc = [ 319.50000 239.50000 ]Skew: alpha_c = [ 0.00000 ] => angle of pixel = 90.00000 degreesDistortion: kc = [ 0.00000 0.00000 0.00000 0.00000 0.00000 ]

    Main calibration optimization procedure - Number of images: 15Gradient descent iterations: 1...2...3...4...5...6...7...8...9...10...11...12...13...14...15...16...17...18...19...20...21...22...23...24...25...26...27...28...29...30...doneEstimation of uncertainties...done

    Calibration results after optimization (with uncertainties):

    Focal Length: fc = [ 839.96642 844.68057 ] [ 54.83211 54.30124 ]Principal point: cc = [ 324.96897 249.43750 ] [ 8.87082 19.82881 ]Skew: alpha_c = [ 0.00000 ] [ 0.00000 ] => angle of pixel axes =

    90.00000 0.00000 degreesDistortion: kc = [ -0.27155 0.32360 -0.01092 0.00152 0.00000 ] [ 0.06217 0.40299 0.00450 0.00163 0.00000 ]Pixel error: err = [ 0.55694 0.45067 ]

    Note: The numerical errors are approximately three times the standard deviations(for reference).

    WARNING: File Calib_Results.mat already existsCopying the current Calib_Results.mat file to Calib_Results_old0.matCopying the current Calib_Results.m file to Calib_Results_old0.m

    Saving calibration results under Calib_Results.matGenerating the matlab script file Calib_Results.m containing the intrinsic and extrinsic parameters...done>> Calib_Results>> K=[fc(1,1) 0 cc(1,1);0 fc(2,1) cc(2,1);0 0 1];>> R1=rod2tr(omc_1);>>>> R1=tr2rot(R1);>> t1=Tc_1;>> P=K*[R1 t1];>> M1=[0 0 0 1];M2=[0 120 0 1];M3=[120 120 0 1];M4=[120 0 0 1];M5=[0 0 120 1];M6=[0 120 120 1];M7=[120 120 120 1];M8=[120 0 120 1];

    >> m1=P*M1';m2=P*M2';m3=P*M3';m4=P*M4';m5=P*M5';m6=P*M6';m7=P*M7';m8=P*M8';>> m1=m1/m1(3,1);m2=m2/m2(3,1);m3=m3/m3(3,1);m4=m4/m4(3,1);m5=m5/m5(3,1);m6=m6/m6(3,1);m7=m7/m7(3,1);m8=m8/m8(3,1);>> I=imread('prueIzq01.jpg');>> imshow(I)>> hold on>> I=imread('prueIzq01.jpg');>> imshow(I)>> hold onBye. To run again, type calib_gui.

  • 8/13/2019 Pdi Trabajo 1 Final

    7/7

    >> I=imread('prueIzq01.jpg');>> imshow(I)>> hold on>> plot(m1(1,1),m1(2,1),'cs')>> plot(m2(1,1),m2(2,1),'cs')>> plot(m3(1,1),m3(2,1),'cs')>> plot(m4(1,1),m4(2,1),'cs')>> plot(m5(1,1),m5(2,1),'cs')>> plot(m6(1,1),m6(2,1),'cs')>> plot(m7(1,1),m7(2,1),'cs')>> plot(m8(1,1),m8(2,1),'cs')>> line([m1(1,1) m2(1,1) m3(1,1) m4(1,1)],[m1(2,1) m2(2,1) m3(2,1) m4(2,1)])>> line([m1(1,1) m2(1,1) m3(1,1) m4(1,1)],[m1(2,1) m2(2,1) m3(2,1) m4(2,1)],[m1(1,1) m2(1,1) m3(1,1) m4(1,1))??? line([m1(1,1) m2(1,1) m3(1,1) m4(1,1)],[m1(2,1) m2(2,1) m3(2,1) m4(2,1)],[m1(1,1) m2(1,1) m3(1,1) m4(1,1))

    |Error: Unbalanced or unexpected parenthesis or bracket.>> line([m1(1,1) m2(1,1) m3(1,1) m4(1,1) m1(1,1)],[m1(2,1) m2(2,1) m3(2,1) m4(2,1) m2(2,1)])>> line([m5(1,1) m6(1,1) m7(1,1) m7(1,1) m5(1,1)],[m5(2,1) m6(2,1) m7(2,1) m8(2,1) m5(2,1)])

    >> line([m5(1,1) m6(1,1) m7(1,1) m8(1,1) m5(1,1)],[m5(2,1) m6(2,1) m7(2,1) m8(2,1) m5(2,1)])>> I=imread('prueIzq01.jpg');>> imshow(I)>> hold on>> plot(m1(1,1),m1(2,1),'cs')>> plot(m2(1,1),m2(2,1),'cs')>> plot(m3(1,1),m3(2,1),'cs')>> plot(m4(1,1),m4(2,1),'cs')>> plot(m5(1,1),m5(2,1),'cs')>> plot(m6(1,1),m6(2,1),'cs')>> plot(m7(1,1),m7(2,1),'cs')>> plot(m8(1,1),m8(2,1),'cs')

    >> line([m1(1,1) m2(1,1) m3(1,1) m4(1,1) m1(1,1)],[m1(2,1) m2(2,1) m3(2,1) m4(2,1) m2(2,1)])>> line([m5(1,1) m6(1,1) m7(1,1) m8(1,1) m5(1,1)],[m5(2,1) m6(2,1) m7(2,1) m8(2,1) m5(2,1)])>> line([m1(1,1) m5(1,1)],[m1(2,1) m5(2,1)])>> line([m2(1,1) m6(1,1)],[m2(2,1) m6(2,1)])>> line([m3(1,1) m7(1,1)],[m3(2,1) m7(2,1)])>> line([m4(1,1) m8(1,1)],[m4(2,1) m8(2,1)])