aa12356jm / procamcalib

Automatically exported from code.google.com/p/procamcalib
0 stars 0 forks source link

Ill-conditioned optimization routine #2

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
While trying to calibrate my projector, I follow exactly the steps in the PDF, 
but it always fails with 
the following error-message when clicking on 'calibrate the projector':

Warning: View #1 ill-conditioned. This image is now set inactive. (note: to 
disactivate this option, 
set check_cond=0)
5...Intrinsic parameters at frame 1 do not exist
List of images left desactivated: 1

What's the problem there?

Original issue reported on code.google.com by imik...@gmail.com on 11 May 2009 at 1:08

GoogleCodeExporter commented 8 years ago
Trying to fix it. You can perhaps send us some of your images so that we can 
test on?

Original comment by david.f...@gmail.com on 13 May 2009 at 8:44

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
There appear to be a problem with the Bouguet toolbox deling with image 
formats. here it did not work with 
capital extension names like .JPG we had to rename the images so they had lower 
case names .jpg instead. You 
can try to run the camera calibration toolbox alone to make sure it is working, 
the just save the results and load 
the calibration into the cam-proj gui.  Hope it helps.  
Best Regards 
Gabriel Falcao Rozenwald

Original comment by gabriel....@gmail.com on 14 May 2009 at 9:19

GoogleCodeExporter commented 8 years ago
Hello,

I am having the same problem when trying to calibrate my projector. Gabriel, 
your
suggestion to try lowercase names has not worked for me. I have also already 
used the
Bouguet toolbox to calibrate my camera using different images, before loading 
your
calibration toolbox. Looking forward to your suggestions, if any.

Thanks.

Original comment by bijan.sh...@gmail.com on 14 May 2009 at 3:24

GoogleCodeExporter commented 8 years ago
hi, 
the ill conditioned problem will occur if the points provided lie in a plane 
from the projector point of view. We 
received some pictures of setup where the projector appear stationary while a 
camera is moved taking the 
picture... This is not the goal of this toolbox. It is designed to calibrate a 
system composed by a camera and a 
projector, hence the camera cannot have relative movements with the projector. 
Thus there are two options:
1 Move a flat screen in front of the system (carefull to not move the camera 
when pressing the snap button).
2 Move the rigid system composed of camera and projector in front of a flat 
screen/wall (camera and 
projcetor should be moved together rigidly).
 I am not sure if it is an issue in my matlab version (it is a mac version), but i had to change the following file 
in order to get to load my the images I received. It is related to the 
conversion from integer to double of the 
image
file: ima_read_calib.m (from bouguet's toolbox)            
line 69  Ii = double(imread(ima_name))+1;

The file name issue is just for loading the files. The ill-conditioned problem 
is most probably a setup issue...

Best Regards
Gabriel Falcao Rozenwald

Original comment by gabriel....@gmail.com on 15 May 2009 at 10:00

GoogleCodeExporter commented 8 years ago
Hi,
I tried exactly this setup. Camera + Projector fixed, and a moving projection 
wall. Still got the ill-conditioned 
error. I already sent my pictures to David.
best regards,
daniel

Original comment by imik...@gmail.com on 18 May 2009 at 7:26

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
Hi, I believe I found the reason for the problem. What is happening here with 
the
images I received is an error in the corner extraction for the PROJECTED 
Pattern.
Please verify the extracted corners figure (after clicking). If you can confirm 
that,
for you, the corners are incorrectly extracted I can fix it by changing the 
call to
the corner extraction routine. (they are slightly different for the printed and 
for
projected pattern).
Thank you for your interest in this toolbox.

Best Regards
Gabriel Falcao Rozenwald

Original comment by gabriel....@gmail.com on 20 May 2009 at 8:49

GoogleCodeExporter commented 8 years ago
Bijan,

I received your images, and after corecting some issues with the corner 
extraction
(maybe it was only here) I got the same error. After looking carefully at the 3D
points extracted from your images I could notice a important amount of noise. I
attached some figures from matlab to illustrate this. The points in the with 
the same
color should form a line in space, they are the projection rays of the projector

I have three suggestions for you.
1 Increase the base-line (distance from camera to projector). It should be 
compatible
with the depth you are working with. I notice you have a quite large working 
distance
>3 meters. This associated with a low resolution camera can produce errors that 
may
prevent the solution to be found.
2 Reduce the working depth, by focusing the projector at a closer range to the
camera, this should decrease the errors as well.
3 A higher resolution camera would not do any bad to the system :) It can help 
better
detect the 3D points.

You could try any combination of the above.
In the meanwhile I will try to find some time to update the code in order to 
fix the
corner extraction issue.
Best Regards
Gabriel F. Rozenwald

Original comment by gabriel....@gmail.com on 20 May 2009 at 2:00

Attachments:

GoogleCodeExporter commented 8 years ago
Gabriel,

I ended up using a full sized projected pattern (not the smaller and offset one 
that
I emailed you), and was able to avoid the ill-conditioned error and get the
calibration numbers. I also ended up using a higher resolution camera. Thanks 
for the
help, things seem to work now. :) I have two things to add though:

1. Even with the new set-up, I had to suppress 3 of 7 images, because the corner
finding algorithm seemed to do a poor job in finding the corners on one part of 
the
projected chessboard. I am not sure if you encountered this with anyone other 
images
or if this is related to the way I am taking images.

2. In Ray-plane intersection, when the toolbox asks for the projected image 
used, it
asks for the size dX and dY of each square. Is this just the size in pixels?

Many Thanks,
Bijan

Original comment by bijan.sh...@gmail.com on 20 May 2009 at 8:12

GoogleCodeExporter commented 8 years ago
Hi,
 The corner finding for the projected pattern has an issue that is related to the
attempt to use the distortion values of the camera with a bad initial guess... I
already corrected it here, have update the toolbox with the file...
 You can just ignore the size of Dx and Dy (enter any value, or leave the default),
it is there because we did not want to modify the scripts in the Bouguet 
toolbox. It
is not used inside since we only keep the pixel coordinates of the corners. The 
size
is for the calibration of the camera only.
 Nice to hear that it worked :)

Original comment by gabriel....@gmail.com on 20 May 2009 at 8:22

GoogleCodeExporter commented 8 years ago
Gabriel,

One more thing. This is what MATLAB has to say after I run calibration. Notice 
that I
have 4 active images. I hit calibration, and it looks like it sets 
active_images = 1,
which would mean only the first image was used?

----------------------------------------------------------------

Number(s) of image(s) to suppress ([] = no image) = [3 4 7]

There is now a total of 4 active images for calibration:
1, 2, 5 and 6.

You may now run 'Calibration' to recalibrate based on this new set of images.

active_images =

     1

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=0
Skew 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 focal length to a FOV of 35 degrees.
Initialization of the image distortion to zero.

Main calibration optimization procedure - Number of images: 1
Gradient 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...done
Estimation of uncertainties...done

Calibration results after optimization (with uncertainties):

Focal Length:          fc = [ 1692.41000   1700.70576 ] ± [ 119.30391   
125.62592 ]
Principal point:       cc = [ 462.02045   567.94935 ] ± [ 97.37049   125.55369 
]
Skew:             alpha_c = [ 0.00000 ] ± [ 0.00000  ]   => angle of pixel 
axes =
90.00000 ± 0.00000 degrees
Distortion:            kc = [ 0.00995   0.07674   0.02001   0.01146  0.00000 ] 
± [
0.38723   1.85585   0.03955   0.01834  0.00000 ]
Pixel error:          err = [ 3.93856   4.02973 ]

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

Recommendation: Some distortion coefficients are found equal to zero (within 
their
uncertainties).
                To reject them from the optimization set est_dist=[0;0;1;1;0] and run
Calibration

----------------------------------------------------------------

Original comment by bijan.sh...@gmail.com on 20 May 2009 at 8:48

GoogleCodeExporter commented 8 years ago
It in fact uses only one Image, but this image contains all the points from all 
the
images, This is because the calibration routines usually work with a planar 
pattern,
but Bouguet toolbox can work with one image of a 3D object, and that is what we 
use
in the toolbox, You can have a look at the variables X_1 or X_kk and you see 
their
size is the #images*#(corners in projected pattern). These are the 3D points 
that are
calibrated with the projected pattern. This is exactly the variable I checked 
to make
the images I posted previously.

In fact the calibration cannot work with only one image of a planar pattern. We 
use a
feature of the Toolbox designed by Bouguet. 
All the active images are used in the calibration, adding more images with good
quality, can improve your errors. I would say more than 10 images is a good 
number.

Best Regards...

Original comment by gabriel....@gmail.com on 20 May 2009 at 9:41

GoogleCodeExporter commented 8 years ago
I see, thanks for the clarification.

Cheers

Original comment by bijan.sh...@gmail.com on 21 May 2009 at 3:38

GoogleCodeExporter commented 8 years ago
Hi Bijan,

I still got the problem. I'm using a Canon EOS 450D with enoug resolution and a 
projector with a resolution of 
1024x768. So bouth should be enough. Have you changed something else of you 
setup?
Could you email me your images so I could see how your pictures are like? 
imikbox-at-gmail-dot-com

thx

Original comment by imik...@gmail.com on 22 May 2009 at 8:36

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
Hi Gabriel,

I recently find out about your toolbox. While testing it, I got the same ill-
conditioned error. I believe the error is because I am not using a full sized 
projected pattern. I will try using this pattern as soon as possible. 
Meanwhile, my 
questions are:

1. Is (in fact) necesary the full sized projected pattern for the ray plane 
intersection process?

2. When capturing the images for ray plane intersection process, are the 2 
patterns 
(printed and projected) necessarily be on the camera's FOV?

Thanks in advance, I'll keep in touch.
Best regards.

Original comment by mangy.ga...@gmail.com on 5 Jun 2009 at 9:25

GoogleCodeExporter commented 8 years ago
Hi,
I have recently discussed with the other people wit the same problem and found 
that
the error was related to the set-up. There some things that should be followed 
in
order to successfully calibrate the system. 
1. The camera should have any auto-focus feature disabled.
2. The projector should not be zoomed or re-focused during the measurements. 
(fix at
the beginning and do not change it). The same applies to the camera.
3. The System camera-projector should be fixed. Meaning that there is no 
movement
between camera and projector during snap-shots. This allow for a moving planar
surface, or a moving system, rigdly attached.
4. Both projected and printed pattern should be visible (by cam) and in the 
focus
range of the camera and projector.
5. The projected pattern should be grabbed as a screen shot with the same 
resolution
as the projector. 

The projected pattern does not necessarily need to be full size. However it is
recommend as, some distortion parameters could not be correctly estimated.

Let me know if you still have this problem.
Please also check the corner extraction of your projected pattern. I have seen 
here
some "wild behavior". But i have not received any confirmation from other 
users. I
have a fix for it that solved the problem here.
I hope it helps.

Best Regards,
Gabriel Falcao Rozenwald

Original comment by gabriel....@gmail.com on 5 Jun 2009 at 9:42

GoogleCodeExporter commented 8 years ago
Hi Gabriel,

I have achieved the first four points on your list, and the corner extraction 
algorithm appears to be working correctly (none of the corners are 
miss-detected).

My only doubt is with point 5. You said: "The projected pattern should be 
grabbed as 
a screen shot with the same resolutionas the projector" I don't fully 
understand 
this. I am using a projector with 800x600pixels resolution, but I project a 
300x300 
pixels chess-pattern (not full sized projected pattern). The corner extraction 
for 
the projected pattern captures works fine and then, when the toolbox ask for 
the 
pattern image I input the 300x300 image. Also, the corner extraction is correct.

Am I missing something?

Thanks for the replies.

Original comment by mangy.ga...@gmail.com on 5 Jun 2009 at 10:11

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
Hi,

If you are using a 800x600 projector, the image should be 800x600. It should 
match
exactly what the projector is receiving in the time of the pictures. The way it 
is
done is to configure the computer's display to the same resolution (800x600) 
and get
a screenshot of the projected pattern on the screen. This way you end up with a 
image
of your projected pattern that is 800x600 even though your pattern is smaller 
(may be
in a corner of the screen). 

Hope it is clear now...
Best Regards
Gabriel Falcao Rozenwald

Original comment by gabriel....@gmail.com on 6 Jun 2009 at 1:31

GoogleCodeExporter commented 8 years ago
Hi Gabriel,

I have read the whole discussion of you and bijan. i got the same problem but 
with 
some elaboration. this is what I got.
Warning: Matrix is close to singular or badly scaled.
         Results may be inaccurate. RCOND = 1.392560e-018.
> In compute_homography at 142
  In compute_extrinsic_init at 101
  In comp_ext_calib at 22
  In go_calib_optim_iter at 293
  In go_calib_optim at 59
  In calibrate_projector at 45
Warning: Matrix is close to singular or badly scaled.
         Results may be inaccurate. RCOND = 7.305107e-023.
> In compute_homography at 142
  In compute_extrinsic_init at 101
  In comp_ext_calib at 22
  In go_calib_optim_iter at 293
  In go_calib_optim at 59
  In calibrate_projector at 45
Warning: Matrix is close to singular or badly scaled.
         Results may be inaccurate. RCOND = 2.172914e-022.
> In compute_homography at 142
  In compute_extrinsic_init at 101
  In comp_ext_calib at 22
  In go_calib_optim_iter at 293
  In go_calib_optim at 59
  In calibrate_projector at 45

Warning: View #1 ill-conditioned. This image is now set inactive.

Could you please guide me a little about this problem.
Regards
Anwar

Original comment by hafeez...@gmail.com on 12 Aug 2009 at 12:08

GoogleCodeExporter commented 8 years ago
Hi, first of all: thanks for the toolbox. it's a really great tool! 

I'm having the same "ill-conditioned" issue. I read all the comments here but I 
don't
get what could be wrong. I'm using a 1024x768 projector, a 640x480 webcam and
projecting a fullsize 1024x768 pattern. I have the system fixed, not moving 
anything
but the patterns in the calibration process. 
This is the matlab console when the error appears:

There is now a total of 19 active images for calibration:
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18 and 19.

You may now run 'Calibration' to recalibrate based on this new set of images.
active_images =
     1

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=0
Skew 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) .

Warning: View #1 ill-conditioned. This image is now set inactive.
Error: There is no active image. Run Add/Suppress images to add images

I attach a zip with the calibration process files (*.mat, *.jpg) Let me know if 
you
need anything else for debugging.
Any clue about what should I do get the calibration working..?

Thank you.
Regards,
Christian

Original comment by chpars...@gmail.com on 15 Aug 2009 at 7:51

Attachments:

GoogleCodeExporter commented 8 years ago
Well, another problem is that when I finish the Ray Plane Intersection it says 
that
there is only up to 1 image to use (I read your comment about this), but I have 
19
and the Add/Supress Images command doesn't work. How could I control the images 
to be
used to run the calibration?
I attach another zip with another try I have just made that also gave me the
ill-conditioned error.
Thank you.

Original comment by chpars...@gmail.com on 15 Aug 2009 at 8:27

Attachments:

GoogleCodeExporter commented 8 years ago
Hi, just wanted to say that I could make the calibration run with a 720x480 
firewire
dv camera. I think I was using a really bad camera. 
If there is still anyone out there, I'm now trying to use the data given by the
Cam_Proj_calib.mat file 
I get this:

>> R_proj
R_proj =
    0.9486   -0.2351    0.2121
    0.0579    0.7873    0.6139
   -0.3112   -0.5700    0.7604
>> T_proj
T_proj =
-486.4364074452047
-1050.799602157130      
-887.4365191024527

Is [R_proj,T_proj] the tranformation of the projector related to the camera 
(which is
in the center of the world)?
Or should I get this data from other variables in the .mat file?

Thanks..

Original comment by chpars...@gmail.com on 5 Sep 2009 at 6:50

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
hi,
I already read all text...and I have the problems "Warning: ill-conditioned" and
"..add/supress image"....
In the true, I already calibrated with the toolbox, but now, do all the steps 
but
have the problems that you have too.
.....I attach the two equals instance....but one it good and other wrong.
....In this case, I already have the image points and world points....
......thanks.

Original comment by isaac.ba...@gmail.com on 5 Sep 2009 at 8:59

Attachments:

GoogleCodeExporter commented 8 years ago
I have some error which is similar with the Comment 23 by hafeezCSE, Aug 11, 
2009 

Gabriel, could you please give us some suggestions?
Is this error original from the same reason you have mentioned above?

ps: i move the camera and make the patter fixed on the floor. 

Original comment by cho...@gmail.com on 27 Sep 2009 at 4:19

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
Hi Guys,
I'm suspecting the problem is due to MatLAB version. I'm using MatLAB version
7.6.0.324 (R2008a). How about others who got the results correctly?

Please Reply.

Best Regards,
Paheerathan

Original comment by ratha...@gmail.com on 18 Apr 2010 at 7:10

GoogleCodeExporter commented 8 years ago
i think that error is in the distance between the camera and projector
decreasing tis distance will -en-shaa alaah- solve the problem

Original comment by newsoft....@gmail.com on 4 Jul 2010 at 9:55

GoogleCodeExporter commented 8 years ago
hi, everyone
i trying many time to do the project calibration.but i always met this kind of 
problem.

You may now run 'Calibration' to recalibrate based on this new set of images.
active_images =
     1

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=0
Skew 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) .

Warning: View #1 ill-conditioned. This image is now set inactive.
Error: There is no active image. Run Add/Suppress images to add images

and i also read your guys comment and follow your guys suggestion to do it 
again and again.but i still met this problem. everyone here who already done 
all the way and get the final results can you send me the results or images let 
me try your images see that i can get the calibration results or 
not.urgent.thanks.Allen

please let me know what is the
Size dX of each square along the X direction
Size dY of each square along the Y direction

and
Number of squares along the X direction
Number of squares along the Y direction

my email address is show-allen@hotmail.com
thanks

Original comment by allen-c...@hotmail.com on 17 Jan 2011 at 5:54

GoogleCodeExporter commented 8 years ago
Hi everyone!

Firstly, thanks for the great toolbox, it works very well!!

My question is, how do I get the intrinsic and extrinsic parameters of the 
projector after calibration (it displays the intrinsic but not the extrinsic). 
Also, do you have a function somewhere, that would map the pixels of the the 
projector to that in the image or vice-versa? 

Any help would be appreciated.
Kind regards,
Arjun

Original comment by arjunj...@gmail.com on 6 Jul 2011 at 2:32

GoogleCodeExporter commented 8 years ago
Hi Gabrial,
Can you please point me to the theoretical justification for why camera & 
projector must be kept fixed with respect to each other for all view? 

Original comment by pranav8i...@gmail.com on 24 May 2012 at 12:21

GoogleCodeExporter commented 8 years ago
I am using MATLAB camera calibration toolbox for following attached images..

I am getting ok results after initialization, but wrong results after 
optimization. So,why this happens..? dX=dY=25mm..

Calibration parameters after initialization:

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

Calibration results after optimization (with uncertainties):

Focal Length:          fc = [ 3071.17426   3075.94765 ] ± [ 50.33856   
52.98710 ]
Principal point:       cc = [ 252.49068   354.48202 ] ± [ 47.87438   53.97649 ]
Skew:             alpha_c = [ 0.00000 ] ± [ 0.00000  ]   => angle of pixel 
axes = 90.00000 ± 0.00000 degrees
Distortion:            kc = [ 0.04612   0.55538   0.01833   -0.00178  0.00000 ] 
± [ 0.18303   7.39707   0.00870   0.00648  0.00000 ]
Pixel error:          err = [ 0.11596   0.20525 ]

Original comment by lalit.ge...@gmail.com on 9 Nov 2012 at 6:06

Attachments:

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
Hi,

The Calibration parameters error are too big, anyone know what's the reason 
please, Cheers!

Calibration results after optimization (with uncertainties):

Focal Length:          fc = [ 449.53415   449.16432 ] ± [ 386.18065   
406.51920 ]
Principal point:       cc = [ 511.50000   639.50000 ] ± [ 0.00000   0.00000 ]
Skew:             alpha_c = [ 0.00000 ] ± [ 0.00000  ]   => angle of pixel 
axes = 90.00000 ± 0.00000 degrees
Distortion:            kc = [ -0.05121   0.01353   -0.00446   -0.01003  0.00000 
] ± [ 0.10877   0.06406   0.01308   0.03580  0.00000 ]
Pixel error:          err = [ 5.39802   3.62466 ]

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

Original comment by jiaweizz...@gmail.com on 14 Jan 2014 at 4:03

GoogleCodeExporter commented 8 years ago
rewhat does this message mean?

Warning: Matrix is close to singular or badly scaled. Results may be 
inaccurate. RCOND =  1.193554e-20. 
> In compute_homography at 142
  In compute_extrinsic_init at 101
  In go_calib_optim_iter at 472
  In go_calib_optim at 56
  In test at 37 

Original comment by jiaweizz...@gmail.com on 14 Jan 2014 at 4:54

GoogleCodeExporter commented 8 years ago
Hi,
I've been using this toolbox for a long time know and didn't have any problems 
until recently. I am calibrating with theoritical points without using the 
corner detection. This is like ideal conditions since I can control all the 
parameters and I have the problem. I don't think it has anything to do with 
experimental procedures. I feel it is a software problem but I don't know which 
one exactly.
Sophie

Original comment by anne.sop...@gmail.com on 27 Oct 2014 at 7:42

GoogleCodeExporter commented 8 years ago
Hi Gabrial,

I have a new beginer's problem that after the program extract the four extreme 
corners of the projected pattern it asks for the Projected image name. I think 
I already put it in the file of this toolbox but it still shows that this image 
is not exit. Can you tell me how to deal with it?

Thanks a lot
Frank 

Original comment by liudiyi8...@gmail.com on 17 Dec 2014 at 11:59