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
d16cf68a
Commit
d16cf68a
authored
Dec 27, 2019
by
Alexander Alekhin
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #16242 from catree:add_Rodrigues_input_shape_check
parents
ccb72538
badd0d1f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
6 deletions
+12
-6
calibration.cpp
modules/calib3d/src/calibration.cpp
+12
-6
No files found.
modules/calib3d/src/calibration.cpp
View file @
d16cf68a
...
@@ -250,8 +250,6 @@ CV_IMPL void cvComposeRT( const CvMat* _rvec1, const CvMat* _tvec1,
...
@@ -250,8 +250,6 @@ CV_IMPL void cvComposeRT( const CvMat* _rvec1, const CvMat* _tvec1,
CV_IMPL
int
cvRodrigues2
(
const
CvMat
*
src
,
CvMat
*
dst
,
CvMat
*
jacobian
)
CV_IMPL
int
cvRodrigues2
(
const
CvMat
*
src
,
CvMat
*
dst
,
CvMat
*
jacobian
)
{
{
int
depth
,
elem_size
;
int
i
,
k
;
double
J
[
27
]
=
{
0
};
double
J
[
27
]
=
{
0
};
CvMat
matJ
=
cvMat
(
3
,
9
,
CV_64F
,
J
);
CvMat
matJ
=
cvMat
(
3
,
9
,
CV_64F
,
J
);
...
@@ -262,8 +260,8 @@ CV_IMPL int cvRodrigues2( const CvMat* src, CvMat* dst, CvMat* jacobian )
...
@@ -262,8 +260,8 @@ CV_IMPL int cvRodrigues2( const CvMat* src, CvMat* dst, CvMat* jacobian )
CV_Error
(
!
dst
?
CV_StsNullPtr
:
CV_StsBadArg
,
CV_Error
(
!
dst
?
CV_StsNullPtr
:
CV_StsBadArg
,
"The first output argument is not a valid matrix"
);
"The first output argument is not a valid matrix"
);
depth
=
CV_MAT_DEPTH
(
src
->
type
);
int
depth
=
CV_MAT_DEPTH
(
src
->
type
);
elem_size
=
CV_ELEM_SIZE
(
depth
);
int
elem_size
=
CV_ELEM_SIZE
(
depth
);
if
(
depth
!=
CV_32F
&&
depth
!=
CV_64F
)
if
(
depth
!=
CV_32F
&&
depth
!=
CV_64F
)
CV_Error
(
CV_StsUnsupportedFormat
,
"The matrices must have 32f or 64f data type"
);
CV_Error
(
CV_StsUnsupportedFormat
,
"The matrices must have 32f or 64f data type"
);
...
@@ -349,12 +347,12 @@ CV_IMPL int cvRodrigues2( const CvMat* src, CvMat* dst, CvMat* jacobian )
...
@@ -349,12 +347,12 @@ CV_IMPL int cvRodrigues2( const CvMat* src, CvMat* dst, CvMat* jacobian )
double
d_r_x_
[]
=
{
0
,
0
,
0
,
0
,
0
,
-
1
,
0
,
1
,
0
,
double
d_r_x_
[]
=
{
0
,
0
,
0
,
0
,
0
,
-
1
,
0
,
1
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
-
1
,
0
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
-
1
,
0
,
0
,
0
,
-
1
,
0
,
1
,
0
,
0
,
0
,
0
,
0
};
0
,
-
1
,
0
,
1
,
0
,
0
,
0
,
0
,
0
};
for
(
i
=
0
;
i
<
3
;
i
++
)
for
(
i
nt
i
=
0
;
i
<
3
;
i
++
)
{
{
double
ri
=
i
==
0
?
r
.
x
:
i
==
1
?
r
.
y
:
r
.
z
;
double
ri
=
i
==
0
?
r
.
x
:
i
==
1
?
r
.
y
:
r
.
z
;
double
a0
=
-
s
*
ri
,
a1
=
(
s
-
2
*
c1
*
itheta
)
*
ri
,
a2
=
c1
*
itheta
;
double
a0
=
-
s
*
ri
,
a1
=
(
s
-
2
*
c1
*
itheta
)
*
ri
,
a2
=
c1
*
itheta
;
double
a3
=
(
c
-
s
*
itheta
)
*
ri
,
a4
=
s
*
itheta
;
double
a3
=
(
c
-
s
*
itheta
)
*
ri
,
a4
=
s
*
itheta
;
for
(
k
=
0
;
k
<
9
;
k
++
)
for
(
int
k
=
0
;
k
<
9
;
k
++
)
J
[
i
*
9
+
k
]
=
a0
*
I
[
k
]
+
a1
*
rrt
.
val
[
k
]
+
a2
*
drrt
[
i
*
9
+
k
]
+
J
[
i
*
9
+
k
]
=
a0
*
I
[
k
]
+
a1
*
rrt
.
val
[
k
]
+
a2
*
drrt
[
i
*
9
+
k
]
+
a3
*
r_x
.
val
[
k
]
+
a4
*
d_r_x_
[
i
*
9
+
k
];
a3
*
r_x
.
val
[
k
]
+
a4
*
d_r_x_
[
i
*
9
+
k
];
}
}
...
@@ -490,6 +488,10 @@ CV_IMPL int cvRodrigues2( const CvMat* src, CvMat* dst, CvMat* jacobian )
...
@@ -490,6 +488,10 @@ CV_IMPL int cvRodrigues2( const CvMat* src, CvMat* dst, CvMat* jacobian )
dst
->
data
.
db
[
step
*
2
]
=
r
.
z
;
dst
->
data
.
db
[
step
*
2
]
=
r
.
z
;
}
}
}
}
else
{
CV_Error
(
CV_StsBadSize
,
"Input matrix must be 1x3 or 3x1 for a rotation vector, or 3x3 for a rotation matrix"
);
}
if
(
jacobian
)
if
(
jacobian
)
{
{
...
@@ -3219,6 +3221,10 @@ void cv::Rodrigues(InputArray _src, OutputArray _dst, OutputArray _jacobian)
...
@@ -3219,6 +3221,10 @@ void cv::Rodrigues(InputArray _src, OutputArray _dst, OutputArray _jacobian)
CV_INSTRUMENT_REGION
();
CV_INSTRUMENT_REGION
();
Mat
src
=
_src
.
getMat
();
Mat
src
=
_src
.
getMat
();
CV_Check
(
src
.
rows
,
(
src
.
rows
==
1
&&
src
.
cols
==
3
)
||
(
src
.
rows
==
3
&&
src
.
cols
==
1
)
||
(
src
.
rows
==
1
&&
src
.
cols
==
1
&&
src
.
channels
()
==
3
)
||
(
src
.
rows
==
3
&&
src
.
cols
==
3
),
"Input matrix must be 1x3 or 3x1 for a rotation vector, or 3x3 for a rotation matrix"
);
bool
v2m
=
src
.
cols
==
1
||
src
.
rows
==
1
;
bool
v2m
=
src
.
cols
==
1
||
src
.
rows
==
1
;
_dst
.
create
(
3
,
v2m
?
3
:
1
,
src
.
depth
());
_dst
.
create
(
3
,
v2m
?
3
:
1
,
src
.
depth
());
Mat
dst
=
_dst
.
getMat
();
Mat
dst
=
_dst
.
getMat
();
...
...
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