java - Can't remove distortion -


i'm making program calibrate camera , remove distortion chessboard using opencv in java. i've been reading "learning opencv" , code quite similar program run without errors results wrong. i'm looking intrinsic matrix , distortion coefficients.

could me? i'm desperate!! briefly,i set size of cheesboard (4 points width , 5 height).

i capture image, , create 4 matrix image_points, object_points, image size (as inputs) camera_matrix , distortion_coefficients (as outputs). apply smooth filter (gaussian one) noise effects and:

cvfindchessboardcorners(image, board_sz, corners, corner_count, cv_calib_cb_fast_check);

        cvcvtcolor(image, gray_image, cv_bgr2gray);         cvfindcornersubpix(                         // subpixel accuracy on corners                 gray_image,                 corners,                 corner_count[0],                 cvsize(11,11),                 cvsize(-1, -1),                 cvtermcriteria(cv_termcrit_eps + cv_termcrit_iter, 30,                         0.1));           cvdrawchessboardcorners(image, board_sz, corners,                 corner_count[0], found);  // calibrate camera! cvcalibratecamera2(object_points2, image_points2, point_counts2,         cvgetsize(image), intrinsic_matrix, distortion_coeffs, null,         null, cv_calib_rational_model //0 // cv_calib_fix_aspect_ratio );   iplimage mapx = cvcreateimage(cvgetsize(image), ipl_depth_32f, 1); iplimage mapy = cvcreateimage(cvgetsize(image), ipl_depth_32f, 1);  cvinitundistortmap(intrinsic, distortion, mapx, mapy);  while (image != null) {                 imga = imageio.read(u);                 image = iplimage.createfrom(imga);      iplimage t = cvcloneimage(image);     rawframe.showimage(image); // show raw image     cvremap(t, image, mapx, mapy, cv_inter_linear             | cv_warp_fill_outliers, cvscalarall(0));     cvreleaseimage(t);                 undistortframe.showimage(image); // show corrected image        } 

the parameters have obtain, should close @ these ones:
* intrinsic matrix:

fx 800.161011; fy = 800.174866; cx = 648.423279; cy = 483.997681; 
  • distortion coefficients:

    k1 -4.25992794e-002; k2 = -1.11125395e-001; k3 = 8.78498256e-002; k4 = 3.94474864e-002; k5 = -1.00275539e-001; k6 = 8.33327100e-002; p1 = 6.98052521e-004; p2= 4.69301594e-004;

i'm desperate! thank much! :)


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -