블로그 이미지
Leeway is... the freedom that someone has to take the action they want to or to change their plans.
maetel

Notice

Recent Post

Recent Comment

Recent Trackback

Archive

calendar

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 31
  • total
  • today
  • yesterday

Category

2010. 9. 24. 23:16 Computer Vision
Janne Heikkila, Olli Silven, "A Four-step Camera Calibration Procedure with Implicit Image Correction," cvpr, pp.1106, 1997 IEEE Computer Society Conference on Computer Vision and Pattern Recognition (CVPR'97), 1997


Matlab toolbox: http://www.ee.oulu.fi/~jth/calibr/

JanneHeikkilä - Machine Vision Group, Computer Science and Engineering Laboratory, University of Oulu
Olli Silven - Information Processing Laboratory, University of Oulu

cf.
http://www.vision.caltech.edu/bouguetj/calib_doc/htmls/parameters.html


1. Introduction

4-step
1) DLT (direct linear transformation) for initial parameter values [Tsai 1987, Abdel-Aziz 1971, Melen 1994]
2) Nonlinear parameter estimation for final parameter values [Slama 1980]
3) Correcting errors sourced from feature extraction
4) image correction: new implicit model to interpolate the correct image points


2. Explicit camera calibration

The pinhole camera model is based on the principle of collinearity, where each point in the object space is projected by a straight line through the projection center into the image plane.

http://en.wikipedia.org/wiki/Euler_angle











posted by maetel
J. Weng, P. Cohen, and M. Herniou. "Camera calibration with distortion models and accuracy evaluation." In IEEE Transactions on Pattern Analysis and Machine Intelligence (PAMI), 14(10): 965-980, 1992.


posted by maetel
The DLR Camera Calibration Toolbox
http://www.dlr.de/rm/desktopdefault.aspx/tabid-3925/


Institute of Robotics and Mechatronics, German Aerospace Center (DLR)



> 특징
스테레오 (두 대 이상의 카메라)
자동 캘리브레이션(카메라 렌즈 왜곡, 내부/외부 파라미터)
Hand-Eye Calibration
수동 조작 가능


[1] K. H. Strobl and G. Hirzinger. "Optimal Hand-Eye Calibration." In Proceedings of the IEEE/RSJ International Conference on Intelligent Robots and Systems (IROS 2006), Beijing, China, pp. 4647-4653, October 2006.

[2] J. Weng, P. Cohen, and M. Herniou. "Camera calibration with distortion models and accuracy evaluation." In IEEE Transactions on Pattern Analysis and Machine Intelligence (PAMI), 14(10): 965-980, 1992.

[3] K. H. Strobl and G. Hirzinger. "More Accurate Camera and Hand-Eye Calibrations with Unknown Grid Pattern Dimensions." In Proceedings of the IEEE International Conference on Robotics and Automation (ICRA 2008), Pasadena, California, USA, May 2008, in press.


posted by maetel
2010. 6. 22. 17:31 Computer Vision
Luis Alvarez, Luis Gómez and J. Rafael Sendra
An Algebraic Approach to Lens Distortion by Line Rectification
Journal of Mathematical Imaging and Vision, vol. 35, nº 1, pp. 36 - 50, September 2009.



posted by maetel
2010. 6. 22. 16:23 Computer Vision
posted by maetel
2010. 6. 2. 20:57 Computer Vision
D.C. Brown, Close-Range Camera Calibration, Photogrammetric Engineering, pages 855-866, Vol. 37, No. 8, 1971.









posted by maetel
2010. 5. 26. 22:59 Computer Vision
2010/02/10 - [Visual Information Processing Lab] - Seong-Woo Park & Yongduek Seo & Ki-Sang Hong
2010/05/18 - [Visual Information Processing Lab] - virtual studio 구현: camera calibration test



1. 내부 파라미터 계산

cvCalibrateCamera2() 함수를 이용하여 카메라 내부/외부 파라미터와 렌즈 왜곡 변수를 얻는다.


frame # 191  ---------------------------
# of found lines = 8 vertical, 6 horizontal
vertical lines:
horizontal lines:
p.size = 48
CRimage.size = 48
# of corresponding pairs = 15 = 15

camera matrix
fx=286.148 0 cx=207.625
0 fy=228.985 cy=98.8437
0 0 1

lens distortion
k1 = 0.0728017
k2 = -0.0447815
p1 = -0.0104295
p2 = 0.00914935

rotation vector
-0.117104  -0.109022  -0.0709096

translation vector
-208.234  -160.983  163.298



이 결과를 가지고 cvProjectPoints2()를 써서 패턴의 점에 대응되는 이미지 상의 점을 찾은 결과는 아래와 같다.




1-1.

카메라 내부 파라미터와 외부 파라미터를 모두 계산하는 cvCalibrateCamera2() 함수 대신 내부 파라미터만 계산하는
cvInitIntrinsicParams2D() 함수를 써 본다.



2. lens distortion(kappa1, kappa2)을 가지고 rectification

패턴 인식이 성공적인 경우 당연히 카메라 캘리브레이션 결과가 정확해지며, 이로부터 가상의 물체를 합성하기 위해 필요한 object 또는 graphic coordinate을 실시간으로 계산할 수 있다. 현재 우리 프로그램에서 패턴 인식이 실패하는 원인은 직선 검출의 오차인데, 이 오차의 원인으로는 여러가지가 있지만 가장 큰 것은 렌즈 왜곡이다. (현재 렌즈 왜곡을 고려하지 않고 있다.) 그래서 실제로는 하나의 직선에 대해 여러 개 (2-3개)의 직선을 검출하며 (NMS 알고리즘만으로는 이 오차를 줄이는 데 한계를 보이고 있어), 이로부터 계산된 교차점들의 위치 좌표 오차는 cross ratio 계산에 결정적인 오차로 작용한다. 현재 방식의 패턴 생성과 패턴 인식은 cross ratios 값에 절대적으로 의존하고 있기 때문에 이 문제를 반드시 해결해야 한다. 그러므로 렌즈 왜곡을 고려하여 입력 이미지를 펴서 (rectification) 기존의 패턴 인식 알고리즘을 적용하자.

ref.
Learning OpenCV: Chapter 6: Image Trasnforms
opencv v2.1 documentation — Geometric Image Transformations


1) Undistortion

Learning OpenCV: 396p
"OpenCV provides us with a ready-to-use undistortion algorithm that takes a raw image and the distortion coefficients from cvCalibrateCamera2() and produces a corrected image (see Figure 11-12). We can access this algorithm either through the function cvUndistort2(), which does everything we need in one shot, or through the pair of routines cvInitUndistortMap() and cvRemap(), which allow us to handle things a little more efficiently for video or other situations where we have many images from the same camera. ( * We should take a moment to clearly make a distinction here between undistortion, which mathematically removes lens distortion, and rectifi cation, which mathematically aligns the images with respect to each other. )

입력 영상 (렌즈 왜곡)

출력 영상 (왜곡 제거)






 

# of corresponding pairs = 30 = 30

camera matrix
fx=94.6664 0 cx=206.772
0 fy=78.3349 cy=158.782
0 0 1

lens distortion
k1 = 0.0130734
k2 = -0.000955421
p1 = 0.00287948
p2 = 0.00158042









            if ( ( k1 > 0.3 && k1 < 0.6 ) && ( cx > 150.0 && cx < 170.0 ) && ( cy > 110 && cy < 130 ) )


# of corresponding pairs = 42 = 42

camera matrix
fx=475.98 0 cx=162.47
0 fy=384.935 cy=121.552
0 0 1

lens distortion
k1 = 0.400136
k2 = -0.956089
p1 = 0.00367761
p2 = 0.00547217







2) Recitifaction




cvInitUndistortRectifyMap



3. line detection




4. 패턴 인식 (대응점 찾기)




5. 외부 파라미터 계산 (4의 결과 & lens distortion = 0 입력)
cvFindExtrinsicCameraParams2()



6. reprojection
2에서 얻은 rectificated image에 할 것




posted by maetel
2010. 2. 23. 00:47 Computer Vision
1> pattern identification 패턴 인식

rough preview
1) 무늬의 deep/light 색의 경계점들 찾기 edge detection
2) 찾은 점들을 직선으로 연결
3) 검출된 가로선과 세로선의 cross ratio와 실제 무늬의 cross ratio를 비교하여, 몇 번째 선인지 인식

detailed preview
1. initial identification process 초기 인식 과정 (특징점 인식)

1) chroma keying:  RGB -> YUV 변환

2) gradient filtering: first-order derivative Gaussian filter (length = 7)
 -1) 세로축에 대해 영상 축소 (1/4)하여 필터링
 -2) Gx, Gy 절대값 비교하여 vertical / horizontal direction 판별
 -3) 가로축에 대해

3) line fitting: lens distortion coefficient을 고려하여 이차곡선으로 피팅

4) identification
 -1) 영상에서 찾아진 선들이 실제 무늬에서 몇 번째 선인지 인식
 -2) feature points는 직선 식에 의해 피팅된 선들의 교점으로 정확하게 구할 수 있음

2. feature point tracking 실제 동작 과정 (특징점 위치 추적)
: feature points corresponding 검출된 특징점을 무늬의 교점과 매칭

  1) intersection filter H (교점 필터)로 local maximum & minimum를 가지는 교점 검출

  2) 검출된 교점의 부호를 판별하여 두 부류로 나눔

  3) 이전 프레임에서의 교점의 위치를 기준으로 현재 프레임에서 검출된 교점에 대해 가장 가까운 이전 점을 찾음

  * 다음 프레임에서 새로 나타난 특징점에 대해서도 이전 프레임에서의 카메라 변수를 이용해 실제 패턴 상의 교점을 영상으로 투영시켜 기준점으로 삼을 수 있음




2> real-time camera parameter extraction 실시간 카메라 변수 추출: Tsai's algorithm

1. determining image center 영상 중심 구하기: zooming
: using the center of expansion as a constant image-center

1) (lens distortion을 구하기 위한 초기화 과정에서) 정지된 카메라의 maximum zoom-out과 maximum zoom-in 상태에서 찾아서 인식한 특징점들을 저장

2) 두 개의 프레임에서 같은 점으로 나타난 특징점들을 연결한 line segments의 common intersection 교점을 계산

* 실제로 zooming은 여러 개의 lens들의 조합으로 작동하기 때문에 카메라의 zoom에 따라서 image center가 변하게 되지만, 이에 대한 표준 편차가 작으므로 무시하기로 함

2. lens distortion coefficient 계산
zooming이 없다면 고정된 값이 되므로 이하와 같이 매번 계산해 줄 필요가 없어짐

(1) f-k1 look-up table을 참조하는 방법
: zooming하는 과정에서 초점 거리 f와 렌즈 왜곡 변수 k1이 계속 변하게 되므로, 이에 대한 참조표를 미리 만들어 두고 나서 실제 동작 과정에서 참조
* 특징점들이 모두 하나의 평면에 존재하는 경우에는 초점거리 f와 카메라의 z 방향으로의 이동 Tz가 서로 coupled되기 때문에 카메라 변수가 제대로 계산되기 어렵다는 점을 고려하여 평면 상의 특징점들에 대해서 Tz/f를 인덱스로 사용하는 편법을 쓴다면, 카메라가 z 방향으로는 이동하지 않고 고정되어 있어야 한다는 (T1z = 0)조건이 붙게 됨

(2) collinearity를 이용하는 방법
: searching for k1 which maximally preserves collinearity 인식된 교점들에 대해 원래 하나의 직선에 속하는 점들이 왜곡 보상 되었을 때 가장 직선이 되게 하는 왜곡변수를 구함

  1) 영상에서 같은 가로선에 속하는 교점들 (Xf, Yf) 가운데 세 개를 고름

  2) 식7로부터 왜곡된 영상면 좌표 (Xd, Yd)를 구함
 
  3) 식5로부터 왜곡 보상된 영상면 좌표 (Xu, Yu)를 구함

  4) 식21과 같은 에러 함수 E(k1)를 정의

  5) 영상에 나타난 N개의 가로선들에 대해서 E(k1) 값을 최소화하는 k1을 구함 (식 23) -> 비선형 최적화이나 iteration은 한 번
 
3. Tsai's algorithm
렌즈 왜곡 변수를 알면 카메라 캘리브레이션은 선형적 방법으로 구할 수 있게 됨




3> filtering
잡음으로 인해 검출된 교점에 오차가 생기므로 카메라변수가 틀려지게 됨
(->카메라가 정지해 있어도 카메라변수에 변화가 생겨 결과적으로 그래픽으로 생성된 가상의 무대에 떨림이 나타나게 됨)

averaging filter 평균 필터 (전자공학회논문지 제36권 S편 제7호 식19)









posted by maetel
2010. 2. 10. 15:47 Computer Vision
Seong-Woo Park, Yongduek Seo, Ki-Sang Hong: Real-Time Camera Calibration for Virtual Studio. Real-Time Imaging 6(6): 433-448 (2000)
doi:10.1006/rtim.1999.0199

Seong-Woo Park, Yongduek Seo and Ki-Sang Hong1

Dept. of E.E. POSTECH, San 31, Hyojadong, Namku, Pohang, Kyungbuk, 790-784, Korea


Abstract

In this paper, we present an overall algorithm for real-time camera parameter extraction, which is one of the key elements in implementing virtual studio, and we also present a new method for calculating the lens distortion parameter in real time. In a virtual studio, the motion of a virtual camera generating a graphic studio must follow the motion of the real camera in order to generate a realistic video product. This requires the calculation of camera parameters in real-time by analyzing the positions of feature points in the input video. Towards this goal, we first design a special calibration pattern utilizing the concept of cross-ratio, which makes it easy to extract and identify feature points, so that we can calculate the camera parameters from the visible portion of the pattern in real-time. It is important to consider the lens distortion when zoom lenses are used because it causes nonnegligible errors in the computation of the camera parameters. However, the Tsai algorithm, adopted for camera calibration, calculates the lens distortion through nonlinear optimization in triple parameter space, which is inappropriate for our real-time system. Thus, we propose a new linear method by calculating the lens distortion parameter independently, which can be computed fast enough for our real-time application. We implement the whole algorithm using a Pentium PC and Matrox Genesis boards with five processing nodes in order to obtain the processing rate of 30 frames per second, which is the minimum requirement for TV broadcasting. Experimental results show this system can be used practically for realizing a virtual studio.


전자공학회논문지 제36권 S편 제7호, 1999. 7 
가상스튜디오 구현을 위한 실시간 카메라 추적 ( Real-Time Camera Tracking for Virtual Studio )   
박성우 · 서용덕 · 홍기상 저 pp. 90~103 (14 pages)
http://uci.or.kr/G300-j12265837.v36n07p90

서지링크     한국과학기술정보연구원
가상스튜디오의 구현을 위해서 카메라의 움직임을 실시간으로 알아내는 것이 필수적이다. 기존의 가상스튜디어 구현에 사용되는 기계적인 방법을 이용한 카메라의 움직임 추적하는 방법에서 나타나는 단점들을 해결하기 위해 본 논문에서는 카메라로부터 얻어진 영상을 이용해 컴퓨터비전 기술을 응용하여 실시간으로 카메라변수들을 알아내기 위한 전체적인 알고리듬을 제안하고 실제 구현을 위한 시스템의 구성 방법에 대해 다룬다. 본 연구에서는 실시간 카메라변수 추출을 위해 영상에서 특징점을 자동으로 추출하고 인식하기 위한 방법과, 카메라 캘리브레이션 과정에서 렌즈의 왜곡특성 계산에 따른 계산량 문제를 해결하기 위한 방법을 제안한다.



Practical ways to calculate camera lens distortion for real-time camera calibration
Pattern Recognition, Volume 34, Issue 6, June 2001, Pages 1199-1206
Seong-Woo Park, Ki-Sang Hong




generating virtual studio




Matrox Genesis boards
http://www.matrox.com/imaging/en/support/legacy/

http://en.wikipedia.org/wiki/Virtual_studio
http://en.wikipedia.org/wiki/Chroma_key

camera tracking system : electromechanical / optical
pattern recognition
2D-3D pattern matches
planar pattern


feature extraction -> image-model matching & identification -> camera calibration
: to design the pattern by applying the concept of cross-ratio and to identify the pattern automatically


영상에서 찾아진 특징점을 자동으로 인식하기 위해서는 공간 상의 점들과 영상에 나타난 그것들의 대응점에 대해서 같은 값을 갖는 성질이 필요한데 이것을 기하적 불변량 (Geometric Invariant)이라고 한다. 본 연구에서는 여러 불변량 가운데 cross-ratio를 이용하여 패턴을 제작하고, 영상에서 불변량의 성질을 이용하여 패턴을 자동으로 찾고 인식할 수 있게 하는 방법을 제안한다.


Tsai's algorithm
R. Y. Tsai, A Versatile Camera Calibration Technique for High Accuracy 3-D Maching Vision Metrology Using Off-the-shelf TV Cameras and Lenses. IEEE Journal of Robotics & Automation 3 (1987), pp. 323–344.

direct image mosaic method
Sawhney, H. S. and Kumar, R. 1999. True Multi-Image Alignment and Its Application to Mosaicing and Lens Distortion Correction. IEEE Trans. Pattern Anal. Mach. Intell. 21, 3 (Mar. 1999), 235-243. DOI= http://dx.doi.org/10.1109/34.754589

Lens distortion
Richard Szeliski, Computer Vision: Algorithms and Applications: 2.1.6 Lens distortions & 6.3.5 Radial distortion

radial alignment constraint
"If we presume that the lens has only radial distortion, the direction of a distorted point is the same as the direction of an undistorted point."

cross-ratio  http://en.wikipedia.org/wiki/Cross_ratio
: planar projective geometric invariance
 - "pencil of lines"
http://mathworld.wolfram.com/CrossRatio.html
http://homepages.inf.ed.ac.uk/rbf/CVonline/LOCAL_COPIES/MOHR_TRIGGS/node25.html
http://www.cut-the-knot.org/pythagoras/Cross-Ratio.shtml
http://web.science.mq.edu.au/~chris/geometry/


pattern identification

 카메라의 움직임을 알아내기 위해서는 공간상에 인식이 가능한 물체가 있어야 한다. 즉, 어느 위치에서 보더라도 영상에 나타난 특징점을 찾을 수 있고, 공간상의 어느 점에 대응되는 점인지를 알 수 있어야 한다.

패턴이 인식 가능하기 위해서는 카메라가 어느 위치, 어느 자세로 보던지 항상 같은 값을 갖는 기하적 불변량 (Geometric Invariant)이 필요하다.

Coelho, C., Heller, A., Mundy, J. L., Forsyth, D. A., and Zisserman, A.1992. An experimental evaluation of projective invariants. In Geometric invariance in Computer Vision, J. L. Mundy and A. Zisserman, Eds. Mit Press Series Of Artificial Intelligence Series. MIT Press, Cambridge, MA, 87-104.


> initial identification process
extracting the pattern in an image: chromakeying -> gradient filtering: a first-order derivative of Gaussian (DoG) -> line fitting: deriving a distorted line (that is actually a curve) equation -> feature point tracking (using intersection filter)


R1x = 0



http://en.wikipedia.org/wiki/Difference_of_Gaussians



real-time camera parameter extraction

이상적인 렌즈의 optical axis가 영상면에 수직이고 변하지 않는다고 할 때, 영상 중심은 카메라의 줌 동작 동안 고정된 값으로 계산된다. (그러나 실제 렌즈의 불완전한 특성 때문에 카메라의 줌 동작 동안 영상 중심 역시 변하게 되는데, 이 변화량은 적용 범위 이내에서 2픽셀 이하이다. 따라서 본 연구에서는 이러한 변화를 무시하고 이상적인 렌즈를 가정하여 줌동작에 의한 영상 중심을 구하게 된다.)

For zoom lenses, the image centers vary as the camera zooms because the zooming operation is executed by a composite combination of several lenses. However, when we examined the location of the image centers, its standard deviation was about 2 pixels; thus we ignored the effect of the image center change.


calculating lens distortion coefficient

Zoom lenses are zoomed by a complicated combination of several lenses so that the effective focal length and distortion coefficient vary during zooming operations.

When using the coplanar pattern with small depth variation, it turns out that focal length and z-translation cannot be separated exactly and reliably even with small noise.

카메라 변수 추출에 있어서 공간상의 특징점들이 모두 하나의 평면상에 존재할 때는 초점거리와 z 방향으로의 이동이 상호 연관 (coupling)되어 계산값의 안정성이 결여되기 쉽다.


collinearity

Collinearity represents a property when the line in the world coordinate is also shown as a line in the image. This property is not preserved when the lens has a distortion.


Once the lens distortion is calculated, we can execute camera calibration using linear methods.


filtering

가상 스튜디오 구현에 있어서는 시간 지연이 항상 같은 값을 가지게 하는 것이 필수적이므로, 실제 적용에서는 예측 (prediction)이 들어가는 필터링 방법(예를 들면, Kalman filter)은 사용할 수가 없었다.

averaging filter 평균 필터








Orad  http://www.orad.co.il

Evans & Sutherland http://www.es.com









posted by maetel