summaryrefslogtreecommitdiff
path: root/macros/undistortPoints.sci
diff options
context:
space:
mode:
authorshamikam2017-01-16 02:56:17 +0530
committershamikam2017-01-16 02:56:17 +0530
commita6df67e8bcd5159cde27556f4f6a315f8dc2215f (patch)
treee806e966b06a53388fb300d89534354b222c2cad /macros/undistortPoints.sci
downloadFOSSEE_Image_Processing_Toolbox-a6df67e8bcd5159cde27556f4f6a315f8dc2215f.tar.gz
FOSSEE_Image_Processing_Toolbox-a6df67e8bcd5159cde27556f4f6a315f8dc2215f.tar.bz2
FOSSEE_Image_Processing_Toolbox-a6df67e8bcd5159cde27556f4f6a315f8dc2215f.zip
First CommitHEADmaster
Diffstat (limited to 'macros/undistortPoints.sci')
-rw-r--r--macros/undistortPoints.sci37
1 files changed, 37 insertions, 0 deletions
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