Created
February 11, 2018 17:37
-
-
Save MareArts/6b35ba6b3ed93913e90dd7a603f360fd to your computer and use it in GitHub Desktop.
camera pattern position
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| http://study.marearts.com/2013/10/opencv-246-calibration-example-source.html | |
| clc; | |
| close all; | |
| %clear all; | |
| %ImgPT=load('imagept.txt'); | |
| %ObjPT=load('objectpt.txt'); | |
| k=load('intrinsic.txt');R=load('rotation.txt');T=load('translation.txt');%S=load('ptSize.txt'); | |
| %intrinsic and extrinsic matrix | |
| R = reshape(R,3,length(R)/3); | |
| T = reshape(T,3,length(T)/3); | |
| boardXYZ=[0 0 0 1; 175 0 0 1; 175 200 0 1; 0 200 0 1; 0 0 0 1]'; | |
| figure(1); | |
| hold on; xlabel('x'); ylabel('y'); zlabel('z'); grid on; axis equal; | |
| cmap = hsv( length(R) ); | |
| for i=1:length(R) | |
| Convert3D_2{i} = ( [rodrigues(R(:,i)) T(:,i)] * boardXYZ )'; | |
| plot3( Convert3D_2{i}(1:5,1), Convert3D_2{i}(1:5,2), Convert3D_2{i}(1:5,3),'-', 'color', cmap(i,:) ); | |
| text( Convert3D_2{i}(1,1), Convert3D_2{i}(1,2),Convert3D_2{i}(1,3),num2str(i),'color', cmap(i,:) ); | |
| end | |
| %camera draw | |
| camView(5,eye(3), zeros(3,1),[1 0 0],'o'); | |
| %draw axis | |
| drawAxis(5); | |
| figure(2) | |
| hold on; xlabel('x'); ylabel('y'); zlabel('z'); grid on; axis equal; | |
| plot3( boardXYZ(1,:), boardXYZ(2,:), boardXYZ(3,:),'-', 'color', cmap(i,:) ); | |
| for i=1:length(R) | |
| camView(10, rodrigues(R(:,i))', -T(:,i), cmap(i,:),num2str(i)); | |
| end |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
http://study.marearts.com/2013/10/opencv-246-calibration-example-source.html