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
f5152500
Commit
f5152500
authored
Mar 29, 2012
by
Marina Kolpakova
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed #1373
parent
d46f44b4
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
88 additions
and
6 deletions
+88
-6
contours.cpp
modules/imgproc/src/contours.cpp
+11
-6
test_imgwarp.cpp
modules/imgproc/test/test_imgwarp.cpp
+77
-0
No files found.
modules/imgproc/src/contours.cpp
View file @
f5152500
...
...
@@ -1984,17 +1984,22 @@ void cv::fitLine( InputArray _points, OutputArray _line, int distType,
double
param
,
double
reps
,
double
aeps
)
{
Mat
points
=
_points
.
getMat
();
bool
is3d
=
points
.
checkVector
(
3
)
>=
0
,
is2d
=
is3d
?
false
:
points
.
checkVector
(
2
)
>=
0
;
CV_Assert
((
is2d
||
is3d
)
&&
(
points
.
depth
()
==
CV_32F
||
points
.
depth
()
==
CV_32S
));
CvMat
_cpoints
=
points
;
bool
is3d
=
points
.
checkVector
(
3
)
>=
0
;
bool
is2d
=
points
.
checkVector
(
2
)
>=
0
;
CV_Assert
(
(
is2d
||
is3d
)
&&
(
points
.
depth
()
==
CV_32F
||
points
.
depth
()
==
CV_32S
)
);
CvMat
_cpoints
=
points
.
reshape
(
2
+
is3d
);
float
line
[
6
];
cvFitLine
(
&
_cpoints
,
distType
,
param
,
reps
,
aeps
,
&
line
[
0
]);
_line
.
create
(
is2d
?
4
:
6
,
1
,
CV_32F
,
-
1
,
true
);
int
out_size
=
(
is2d
)
?
(
(
is3d
)
?
(
points
.
channels
()
*
points
.
rows
*
2
)
:
4
)
:
6
;
_line
.
create
(
out_size
,
1
,
CV_32F
,
-
1
,
true
);
Mat
l
=
_line
.
getMat
();
CV_Assert
(
l
.
isContinuous
()
);
memcpy
(
l
.
data
,
line
,
(
is2d
?
4
:
6
)
*
sizeof
(
line
[
0
])
);
memcpy
(
l
.
data
,
line
,
out_size
*
sizeof
(
line
[
0
])
);
}
...
...
modules/imgproc/test/test_imgwarp.cpp
View file @
f5152500
...
...
@@ -1385,6 +1385,83 @@ TEST(Imgproc_cvWarpAffine, regression)
cvWarpAffine
(
src
,
dst
,
&
M
);
}
TEST
(
Imgproc_fitLine_vector_3d
,
regression
)
{
std
::
vector
<
Point3f
>
points_vector
;
Point3f
p21
(
4
,
4
,
4
);
Point3f
p22
(
8
,
8
,
8
);
points_vector
.
push_back
(
p21
);
points_vector
.
push_back
(
p22
);
std
::
vector
<
float
>
line
;
cv
::
fitLine
(
points_vector
,
line
,
CV_DIST_L2
,
0
,
0
,
0
);
ASSERT_EQ
(
line
.
size
(),
(
size_t
)
6
);
}
TEST
(
Imgproc_fitLine_vector_2d
,
regression
)
{
std
::
vector
<
Point2f
>
points_vector
;
Point2f
p21
(
4
,
4
);
Point2f
p22
(
8
,
8
);
Point2f
p23
(
16
,
16
);
points_vector
.
push_back
(
p21
);
points_vector
.
push_back
(
p22
);
points_vector
.
push_back
(
p23
);
std
::
vector
<
float
>
line
;
cv
::
fitLine
(
points_vector
,
line
,
CV_DIST_L2
,
0
,
0
,
0
);
ASSERT_EQ
(
line
.
size
(),
(
size_t
)
4
);
}
TEST
(
Imgproc_fitLine_Mat_2dC2
,
regression
)
{
cv
::
Mat
mat1
(
3
,
1
,
CV_32SC2
);
std
::
vector
<
float
>
line1
;
cv
::
fitLine
(
mat1
,
line1
,
CV_DIST_L2
,
0
,
0
,
0
);
ASSERT_EQ
(
line1
.
size
(),
(
size_t
)
4
);
}
TEST
(
Imgproc_fitLine_Mat_2dC1
,
regression
)
{
cv
::
Matx
<
int
,
3
,
2
>
mat2
;
std
::
vector
<
float
>
line2
;
cv
::
fitLine
(
mat2
,
line2
,
CV_DIST_L2
,
0
,
0
,
0
);
ASSERT_EQ
(
line2
.
size
(),
(
size_t
)
4
);
}
TEST
(
Imgproc_fitLine_Mat_3dC3
,
regression
)
{
cv
::
Mat
mat1
(
2
,
1
,
CV_32SC3
);
std
::
vector
<
float
>
line1
;
cv
::
fitLine
(
mat1
,
line1
,
CV_DIST_L2
,
0
,
0
,
0
);
ASSERT_EQ
(
line1
.
size
(),
(
size_t
)
6
);
}
TEST
(
Imgproc_fitLine_Mat_3dC1
,
regression
)
{
cv
::
Mat
mat2
(
2
,
3
,
CV_32SC1
);
std
::
vector
<
float
>
line2
;
cv
::
fitLine
(
mat2
,
line2
,
CV_DIST_L2
,
0
,
0
,
0
);
ASSERT_EQ
(
line2
.
size
(),
(
size_t
)
6
);
}
//////////////////////////////////////////////////////////////////////////
TEST
(
Imgproc_Resize
,
accuracy
)
{
CV_ResizeTest
test
;
test
.
safe_run
();
}
...
...
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