From a6df67e8bcd5159cde27556f4f6a315f8dc2215f Mon Sep 17 00:00:00 2001 From: shamikam Date: Mon, 16 Jan 2017 02:56:17 +0530 Subject: First Commit --- macros/undistortPoints.sci | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 macros/undistortPoints.sci (limited to 'macros/undistortPoints.sci') diff --git a/macros/undistortPoints.sci b/macros/undistortPoints.sci new file mode 100644 index 0000000..39b13d5 --- /dev/null +++ b/macros/undistortPoints.sci @@ -0,0 +1,37 @@ +function [idealPoints] = undistortPoints(observedPoints, camMat, disCoefMat, rectMat, newCamMat) +// Returns the ideal point coordinates from the observed point coordinates +// +// Calling Sequence +// [idealPoints] = undistortPoints(observedPoints, camMat, disCoefMat, rectMat, newCamMat) +// +// Parameters +// observedPoints: 1xN or Nx1 2-channel (CV_32FC2 or CV_64FC2). +// camMat: \vecthreethree{f_x}{0}{c_x}{0}{f_y}{c_y}{0}{0}{1} +// disCoefMat: Input vector of distortion coefficients (k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6]]) of 4, 5, or 8 elements. If the vector is NULL/empty, the zero distortion coefficients are assumed. +// rectMat: Rectification transformation in the object space (3x3 matrix). If the matrix is empty, the identity transformation is used. +//newCamMat: New camera matrix (3x3) or new projection matrix (3x4. If the matrix is empty, the identity new camera matrix is used. +// idealPoints: ideal point coordinates matrix. If matrix newCamMat is identity or omitted, idealPoints will contain normalized point coordinates. +// +// Description +// Returns the ideal points coordinates from the observed point coordinates after undistortion and reverse perpective transformation. +// +// Examples +// [observedPoints] = [1 2 3 4; 4 3 2 1] +// [camMat] = [450 0 231; 0 876.3 87.1; 0 0 1] +// [disCoefMat] = [3 2 0 9] +// [rectMat] = [1 0 0; 0 1 0; 0 0 1] +// [newCamMat] = [] +// [idealPoints] = undistortPoints(observedPoints, camMat, disCoefMat, rectMat, newCamMat) +// +// Authors +// Deepshikha + + output = opencv_undistortPoints(srcMat, camMat, disCoefMat, rectMat, newCamMat) + + channels = size(output) + + for i = 1:channels // for i channel image + idealPoints(:,:,i) = output(i) + end + +endfunction -- cgit