Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv
Commits
ccadad42
Commit
ccadad42
authored
Apr 22, 2016
by
Pavel Rojtberg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fisheye: allow using transposed image and object point arrays
parent
8d4cebe0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
11 deletions
+15
-11
fisheye.cpp
modules/calib3d/src/fisheye.cpp
+15
-11
No files found.
modules/calib3d/src/fisheye.cpp
View file @
ccadad42
...
...
@@ -1304,12 +1304,12 @@ cv::Mat cv::internal::NormalizePixels(const Mat& imagePoints, const IntrinsicPar
CV_Assert
(
!
imagePoints
.
empty
()
&&
imagePoints
.
type
()
==
CV_64FC2
);
Mat
distorted
((
int
)
imagePoints
.
total
(),
1
,
CV_64FC2
),
undistorted
;
const
Vec2d
*
ptr
=
imagePoints
.
ptr
<
Vec2d
>
(
0
);
Vec2d
*
ptr_d
=
distorted
.
ptr
<
Vec2d
>
(
0
);
const
Vec2d
*
ptr
=
imagePoints
.
ptr
<
Vec2d
>
();
Vec2d
*
ptr_d
=
distorted
.
ptr
<
Vec2d
>
();
for
(
size_t
i
=
0
;
i
<
imagePoints
.
total
();
++
i
)
{
ptr_d
[
i
]
=
(
ptr
[
i
]
-
param
.
c
).
mul
(
Vec2d
(
1.0
/
param
.
f
[
0
],
1.0
/
param
.
f
[
1
]));
ptr_d
[
i
][
0
]
=
ptr_d
[
i
][
0
]
-
param
.
alpha
*
ptr_d
[
i
][
1
];
ptr_d
[
i
][
0
]
-=
param
.
alpha
*
ptr_d
[
i
][
1
];
}
cv
::
fisheye
::
undistortPoints
(
distorted
,
undistorted
,
Matx33d
::
eye
(),
param
.
k
);
return
undistorted
;
...
...
@@ -1317,12 +1317,11 @@ cv::Mat cv::internal::NormalizePixels(const Mat& imagePoints, const IntrinsicPar
void
cv
::
internal
::
InitExtrinsics
(
const
Mat
&
_imagePoints
,
const
Mat
&
_objectPoints
,
const
IntrinsicParams
&
param
,
Mat
&
omckk
,
Mat
&
Tckk
)
{
CV_Assert
(
!
_objectPoints
.
empty
()
&&
_objectPoints
.
type
()
==
CV_64FC3
);
CV_Assert
(
!
_imagePoints
.
empty
()
&&
_imagePoints
.
type
()
==
CV_64FC2
);
Mat
imagePointsNormalized
=
NormalizePixels
(
_imagePoints
.
t
()
,
param
).
reshape
(
1
).
t
();
Mat
objectPoints
=
Mat
(
_objectPoints
.
t
())
.
reshape
(
1
).
t
();
Mat
imagePointsNormalized
=
NormalizePixels
(
_imagePoints
,
param
).
reshape
(
1
).
t
();
Mat
objectPoints
=
_objectPoints
.
reshape
(
1
).
t
();
Mat
objectPointsMean
,
covObjectPoints
;
Mat
Rckk
;
int
Np
=
imagePointsNormalized
.
cols
;
...
...
@@ -1375,9 +1374,12 @@ void cv::internal::CalibrateExtrinsics(InputArrayOfArrays objectPoints, InputArr
objectPoints
.
getMat
(
image_idx
).
convertTo
(
object
,
CV_64FC3
);
imagePoints
.
getMat
(
image_idx
).
convertTo
(
image
,
CV_64FC2
);
InitExtrinsics
(
image
,
object
,
param
,
omckk
,
Tckk
);
bool
imT
=
image
.
rows
<
image
.
cols
;
bool
obT
=
object
.
rows
<
object
.
cols
;
InitExtrinsics
(
imT
?
image
.
t
()
:
image
,
obT
?
object
.
t
()
:
object
,
param
,
omckk
,
Tckk
);
ComputeExtrinsicRefine
(
image
,
object
,
omckk
,
Tckk
,
JJ_kk
,
maxIter
,
param
,
thresh_cond
);
ComputeExtrinsicRefine
(
!
imT
?
image
.
t
()
:
image
,
!
obT
?
object
.
t
()
:
object
,
omckk
,
Tckk
,
JJ_kk
,
maxIter
,
param
,
thresh_cond
);
if
(
check_cond
)
{
SVD
svd
(
JJ_kk
,
SVD
::
NO_UV
);
...
...
@@ -1388,7 +1390,6 @@ void cv::internal::CalibrateExtrinsics(InputArrayOfArrays objectPoints, InputArr
}
}
void
cv
::
internal
::
ComputeJacobians
(
InputArrayOfArrays
objectPoints
,
InputArrayOfArrays
imagePoints
,
const
IntrinsicParams
&
param
,
InputArray
omc
,
InputArray
Tc
,
const
int
&
check_cond
,
const
double
&
thresh_cond
,
Mat
&
JJ2
,
Mat
&
ex3
)
...
...
@@ -1410,12 +1411,13 @@ void cv::internal::ComputeJacobians(InputArrayOfArrays objectPoints, InputArrayO
objectPoints
.
getMat
(
image_idx
).
convertTo
(
object
,
CV_64FC3
);
imagePoints
.
getMat
(
image_idx
).
convertTo
(
image
,
CV_64FC2
);
bool
imT
=
image
.
rows
<
image
.
cols
;
Mat
om
(
omc
.
getMat
().
col
(
image_idx
)),
T
(
Tc
.
getMat
().
col
(
image_idx
));
std
::
vector
<
Point2d
>
x
;
Mat
jacobians
;
projectPoints
(
object
,
x
,
om
,
T
,
param
,
jacobians
);
Mat
exkk
=
image
.
t
(
)
-
Mat
(
x
);
Mat
exkk
=
(
imT
?
image
.
t
()
:
image
)
-
Mat
(
x
);
Mat
A
(
jacobians
.
rows
,
9
,
CV_64FC1
);
jacobians
.
colRange
(
0
,
4
).
copyTo
(
A
.
colRange
(
0
,
4
));
...
...
@@ -1469,11 +1471,13 @@ void cv::internal::EstimateUncertainties(InputArrayOfArrays objectPoints, InputA
objectPoints
.
getMat
(
image_idx
).
convertTo
(
object
,
CV_64FC3
);
imagePoints
.
getMat
(
image_idx
).
convertTo
(
image
,
CV_64FC2
);
bool
imT
=
image
.
rows
<
image
.
cols
;
Mat
om
(
omc
.
getMat
().
col
(
image_idx
)),
T
(
Tc
.
getMat
().
col
(
image_idx
));
std
::
vector
<
Point2d
>
x
;
projectPoints
(
object
,
x
,
om
,
T
,
params
,
noArray
());
Mat
ex_
=
image
.
t
(
)
-
Mat
(
x
);
Mat
ex_
=
(
imT
?
image
.
t
()
:
image
)
-
Mat
(
x
);
ex_
.
copyTo
(
ex
.
rowRange
(
ex_
.
rows
*
image_idx
,
ex_
.
rows
*
(
image_idx
+
1
)));
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment