Camera calibration - opencv 2.3.1 android

1,678 views
Skip to first unread message

Rui Marques

unread,
Jan 26, 2012, 11:02:58 AM1/26/12
to android-opencv
I'm trying to do camera calibration and I know there are CPP and Java
sources out there but they all seem to be outdated.

For example this one is in Java but was removed from the trunk months
ago:

https://code.ros.org/trac/opencv/browser/trunk/opencv/android/apps/Calibration/src/com/opencv/calibration/Calibration.java?rev=5822

I can't find it on the 2.3.1 release and I am under the impression
that it won't work with 2.3.1.

I do know about "samples/cpp/calibration.cpp" in 2.3.1 but it would be
quite a shore for me to translate it to Java :x

There is also the CVCamera ( https://github.com/georgegoh/cvcamera )
project that does calibration, but again, its based on opencv 2.2.

Any help or my best bet is to wait for the next opencv release?
I read that it would be released February, is this accurate for
android too? =)

Kirill Kornyakov

unread,
Jan 27, 2012, 3:30:43 AM1/27/12
to android...@googlegroups.com
Why do you want to calibrate camera on a device itself? You can save a set of images to sdcard, then copy them to desktop and run C++ calibration sample. This is how we do it. It should be dome just once, so there is now point in having it on device. At least you want to force end users calibrate their cameras, but it doesn't look as a good idea...

Regards,
Kirill

Rui Marques

unread,
Jan 27, 2012, 4:51:44 AM1/27/12
to android-opencv
You have a point Kirill.. I was on this mindset because I'm just using
opencv java, but I can do as you say on the desktop with C++.
Thanks.

On 27 Jan, 08:30, Kirill Kornyakov <kirill.kornya...@itseez.com>
wrote:

Rui Marques

unread,
Jan 30, 2012, 11:42:53 AM1/30/12
to android-opencv
I have run the calibration but i got a very weird result in the last
image.
I have tried with release 2.3.1 and also with the trunk and the
results are similar.
I have no screenshots of the chessboards with the colored lines and
circles but they looked ok.

Any ideas of what is wrong?

./calibration -w 9 -h 6 -o ~/camera.yml -op -oe -pt chessboard -su
imagelist.xml

screenshot below:

http://i39.tinypic.com/hs1285.png

Rui Marques

unread,
Jan 30, 2012, 12:09:39 PM1/30/12
to android-opencv
Update:

I have tried again and now i think it is ok. The problem was probably
the paper with the printed chessboard that was not "very" straight.

Rafa Ortega

unread,
Jan 31, 2012, 9:37:04 AM1/31/12
to android...@googlegroups.com
Hi! I don't understand very well the parameters you are using when you execute calibration, i thought that -w and -h should be followed by the number of inner corners in your image, and I see in your picture there are 8 and 5 (not 9 and 6) maybe I am missunderstanding something... Can you tell me what?

thanks in advance1

2012/1/30 Rui Marques <rui...@gmail.com>

Rui Marques

unread,
Feb 1, 2012, 12:00:36 PM2/1/12
to android-opencv
It actually has 9x6 inner corners, maybe you are not counting them
correctly :P

On 31 Jan, 14:37, Rafa Ortega <rafaelmiguel.ort...@gmail.com> wrote:
> Hi! I don't understand very well the parameters you are using when you
> execute calibration, i thought that -w and -h should be followed by the
> number of inner corners in your image, and I see in your picture there are
> 8 and 5 (not 9 and 6) maybe I am missunderstanding something... Can you
> tell me what?
>
> thanks in advance1
>
> 2012/1/30 Rui Marques <rui....@gmail.com>

RafaO

unread,
Apr 19, 2012, 2:02:51 PM4/19/12
to android...@googlegroups.com
About the initial question here... I am still wondering if there is some stand alone app somewhere to calibrate the camera from the device, it would be helpfull for me.

Thanks!

dschaudel

unread,
Apr 19, 2012, 2:23:10 PM4/19/12
to android...@googlegroups.com
as Kirill already mentioned. Take some pictures of the calibration template (there iss a new one - asymetric circle pattern).
use the calibration c++ example: 

./calibration -h 11 -w 4 -o camera.yml -pt acircles -oe image_list1.xml

copy the .yml file to your phone and reuse the camera matrix and distortion coefficients ... keep it simple!

RafaO

unread,
Apr 19, 2012, 5:28:11 PM4/19/12
to android...@googlegroups.com
Thanks for your response. Anyway, I know about the usual way of calibrating in a computer but i want to find out if there is a way to do it completely in the device so any user with a pattern and a mobile can do it. I know it could be a little anoying for them but I need it.

Regards.

Rui Marques

unread,
Apr 20, 2012, 5:07:40 AM4/20/12
to android...@googlegroups.com
Then you should probably port the C++ calibration example from opencv.
You can either use a native NDK port or port it to java. And if you are successful some people will be happy if you share the code, i know i would =)
Reply all
Reply to author
Forward
0 new messages