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
cfd5caf2
Commit
cfd5caf2
authored
Nov 03, 2015
by
Viet Dinh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
deal with type casting issues
parent
f461d0cb
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
8 deletions
+8
-8
mathfuncs.cpp
modules/core/src/mathfuncs.cpp
+7
-7
test_math.cpp
modules/core/test/test_math.cpp
+1
-1
No files found.
modules/core/src/mathfuncs.cpp
View file @
cfd5caf2
...
@@ -2544,15 +2544,15 @@ double cv::solvePoly( InputArray _coeffs0, OutputArray _roots0, int maxIters )
...
@@ -2544,15 +2544,15 @@ double cv::solvePoly( InputArray _coeffs0, OutputArray _roots0, int maxIters )
}
}
if
(
num_same_root
%
2
!=
0
){
if
(
num_same_root
%
2
!=
0
){
Mat
cube_coefs
(
4
,
1
,
CV_
32
FC1
);
Mat
cube_coefs
(
4
,
1
,
CV_
64
FC1
);
Mat
cube_roots
(
3
,
1
,
CV_
32
FC2
);
Mat
cube_roots
(
3
,
1
,
CV_
64
FC2
);
cube_coefs
.
at
<
float
>
(
3
)
=
-
(
std
::
pow
(
old_num_re
,
3
));
cube_coefs
.
at
<
double
>
(
3
)
=
-
(
std
::
pow
(
old_num_re
,
3
));
cube_coefs
.
at
<
float
>
(
2
)
=
-
(
15
*
std
::
pow
(
old_num_re
,
2
)
+
27
*
std
::
pow
(
old_num_im
,
2
));
cube_coefs
.
at
<
double
>
(
2
)
=
-
(
15
*
std
::
pow
(
old_num_re
,
2
)
+
27
*
std
::
pow
(
old_num_im
,
2
));
cube_coefs
.
at
<
float
>
(
1
)
=
-
48
*
old_num_re
;
cube_coefs
.
at
<
double
>
(
1
)
=
-
48
*
old_num_re
;
cube_coefs
.
at
<
float
>
(
0
)
=
64
;
cube_coefs
.
at
<
double
>
(
0
)
=
64
;
cv
::
solveCubic
(
cube_coefs
,
cube_roots
);
cv
::
solveCubic
(
cube_coefs
,
cube_roots
);
num
.
re
=
cv
::
cubeRoot
(
cube_roots
.
at
<
float
>
(
0
));
num
.
re
=
cv
::
cubeRoot
(
cube_roots
.
at
<
double
>
(
0
));
num
.
im
=
std
::
sqrt
(
std
::
pow
(
num
.
re
,
2
)
/
3
-
old_num_re
/
(
3
*
num
.
re
));
num
.
im
=
std
::
sqrt
(
std
::
pow
(
num
.
re
,
2
)
/
3
-
old_num_re
/
(
3
*
num
.
re
));
}
}
}
}
...
...
modules/core/test/test_math.cpp
View file @
cfd5caf2
...
@@ -2351,7 +2351,7 @@ void Core_SolvePolyTest::run( int )
...
@@ -2351,7 +2351,7 @@ void Core_SolvePolyTest::run( int )
template
<
typename
T
>
template
<
typename
T
>
static
void
checkRoot
(
Mat
&
r
,
T
re
,
T
im
)
static
void
checkRoot
(
Mat
&
r
,
T
re
,
T
im
)
{
{
for
(
size_t
i
=
0
;
i
<
r
.
total
()
;
i
++
)
for
(
int
i
=
0
;
i
<
r
.
cols
*
r
.
rows
;
i
++
)
{
{
Vec
<
T
,
2
>
v
=
*
(
Vec
<
T
,
2
>*
)
r
.
ptr
(
i
);
Vec
<
T
,
2
>
v
=
*
(
Vec
<
T
,
2
>*
)
r
.
ptr
(
i
);
if
(
fabs
(
re
-
v
[
0
])
<
1e-6
&&
fabs
(
im
-
v
[
1
])
<
1e-6
)
if
(
fabs
(
re
-
v
[
0
])
<
1e-6
&&
fabs
(
im
-
v
[
1
])
<
1e-6
)
...
...
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