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
78402bf5
Commit
78402bf5
authored
Feb 14, 2013
by
Vadim Pisarevsky
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
made several minor fixes as pointed out by Andrey
parent
77d647b6
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
118 additions
and
103 deletions
+118
-103
matrix.cpp
modules/core/src/matrix.cpp
+5
-0
perf_houghLines.cpp
modules/imgproc/perf/perf_houghLines.cpp
+3
-4
cornersubpix.cpp
modules/imgproc/src/cornersubpix.cpp
+1
-1
distransform.cpp
modules/imgproc/src/distransform.cpp
+96
-89
hough.cpp
modules/imgproc/src/hough.cpp
+5
-4
samplers.cpp
modules/imgproc/src/samplers.cpp
+4
-2
segmentation.cpp
modules/imgproc/src/segmentation.cpp
+4
-3
No files found.
modules/core/src/matrix.cpp
View file @
78402bf5
...
...
@@ -1969,6 +1969,11 @@ static TransposeInplaceFunc transposeInplaceTab[] =
void
cv
::
transpose
(
InputArray
_src
,
OutputArray
_dst
)
{
Mat
src
=
_src
.
getMat
();
if
(
src
.
empty
()
)
{
_dst
.
release
();
return
;
}
size_t
esz
=
src
.
elemSize
();
CV_Assert
(
src
.
dims
<=
2
&&
esz
<=
(
size_t
)
32
);
...
...
modules/imgproc/perf/perf_houghLines.cpp
View file @
78402bf5
...
...
@@ -31,12 +31,11 @@ PERF_TEST_P(Image_RhoStep_ThetaStep_Threshold, HoughLines,
Canny
(
image
,
image
,
0
,
0
);
Mat
lines
_t
,
lines
;
Mat
lines
;
declare
.
time
(
60
);
TEST_CYCLE
()
HoughLines
(
image
,
lines
_t
,
rhoStep
,
thetaStep
,
threshold
);
TEST_CYCLE
()
HoughLines
(
image
,
lines
,
rhoStep
,
thetaStep
,
threshold
);
if
(
!
lines_t
.
empty
()
)
transpose
(
lines_t
,
lines
);
transpose
(
lines
,
lines
);
SANITY_CHECK
(
lines
);
}
modules/imgproc/src/cornersubpix.cpp
View file @
78402bf5
...
...
@@ -60,7 +60,7 @@ void cv::cornerSubPix( InputArray _image, InputOutputArray _corners,
return
;
CV_Assert
(
win
.
width
>
0
&&
win
.
height
>
0
);
CV_Assert
(
src
.
cols
>=
win
_w
+
4
&&
src
.
rows
>=
win_h
+
4
);
CV_Assert
(
src
.
cols
>=
win
.
width
*
2
+
5
&&
src
.
rows
>=
win
.
height
*
2
+
5
);
CV_Assert
(
src
.
channels
()
==
1
);
Mat
maskm
(
win_h
,
win_w
,
CV_32F
),
subpix_buf
(
win_h
+
2
,
win_w
+
2
,
CV_32F
);
...
...
modules/imgproc/src/distransform.cpp
View file @
78402bf5
...
...
@@ -592,6 +592,88 @@ trueDistTrans( const Mat& src, Mat& dst )
cv
::
parallel_for
(
cv
::
BlockedRange
(
0
,
m
),
cv
::
DTRowInvoker
(
&
dst
,
sqr_tab
,
inv_tab
));
}
/****************************************************************************************\
Non-inplace and Inplace 8u->8u Distance Transform for CityBlock (a.k.a. L1) metric
(C) 2006 by Jay Stavinzky.
\****************************************************************************************/
//BEGIN ATS ADDITION
// 8-bit grayscale distance transform function
static
void
distanceATS_L1_8u
(
const
Mat
&
src
,
Mat
&
dst
)
{
int
width
=
src
.
cols
,
height
=
src
.
rows
;
int
a
;
uchar
lut
[
256
];
int
x
,
y
;
const
uchar
*
sbase
=
src
.
data
;
uchar
*
dbase
=
dst
.
data
;
int
srcstep
=
(
int
)
src
.
step
;
int
dststep
=
(
int
)
dst
.
step
;
CV_Assert
(
src
.
type
()
==
CV_8UC1
&&
dst
.
type
()
==
CV_8UC1
);
CV_Assert
(
src
.
size
()
==
dst
.
size
()
);
////////////////////// forward scan ////////////////////////
for
(
x
=
0
;
x
<
256
;
x
++
)
lut
[
x
]
=
CV_CAST_8U
(
x
+
1
);
//init first pixel to max (we're going to be skipping it)
dbase
[
0
]
=
(
uchar
)(
sbase
[
0
]
==
0
?
0
:
255
);
//first row (scan west only, skip first pixel)
for
(
x
=
1
;
x
<
width
;
x
++
)
dbase
[
x
]
=
(
uchar
)(
sbase
[
x
]
==
0
?
0
:
lut
[
dbase
[
x
-
1
]]);
for
(
y
=
1
;
y
<
height
;
y
++
)
{
sbase
+=
srcstep
;
dbase
+=
dststep
;
//for left edge, scan north only
a
=
sbase
[
0
]
==
0
?
0
:
lut
[
dbase
[
-
dststep
]];
dbase
[
0
]
=
(
uchar
)
a
;
for
(
x
=
1
;
x
<
width
;
x
++
)
{
a
=
sbase
[
x
]
==
0
?
0
:
lut
[
MIN
(
a
,
dbase
[
x
-
dststep
])];
dbase
[
x
]
=
(
uchar
)
a
;
}
}
////////////////////// backward scan ///////////////////////
a
=
dbase
[
width
-
1
];
// do last row east pixel scan here (skip bottom right pixel)
for
(
x
=
width
-
2
;
x
>=
0
;
x
--
)
{
a
=
lut
[
a
];
dbase
[
x
]
=
(
uchar
)(
CV_CALC_MIN_8U
(
a
,
dbase
[
x
]));
}
// right edge is the only error case
for
(
y
=
height
-
2
;
y
>=
0
;
y
--
)
{
dbase
-=
dststep
;
// do right edge
a
=
lut
[
dbase
[
width
-
1
+
dststep
]];
dbase
[
width
-
1
]
=
(
uchar
)(
MIN
(
a
,
dbase
[
width
-
1
]));
for
(
x
=
width
-
2
;
x
>=
0
;
x
--
)
{
int
b
=
dbase
[
x
+
dststep
];
a
=
lut
[
MIN
(
a
,
b
)];
dbase
[
x
]
=
(
uchar
)(
MIN
(
a
,
dbase
[
x
]));
}
}
}
//END ATS ADDITION
}
...
...
@@ -599,11 +681,19 @@ trueDistTrans( const Mat& src, Mat& dst )
void
cv
::
distanceTransform
(
InputArray
_src
,
OutputArray
_dst
,
OutputArray
_labels
,
int
distType
,
int
maskSize
,
int
labelType
)
{
Mat
src
=
_src
.
getMat
();
_dst
.
create
(
src
.
size
(),
CV_32F
);
Mat
dst
=
_dst
.
getMat
(),
labels
;
Mat
src
=
_src
.
getMat
(),
dst
=
_dst
.
getMat
(),
labels
;
bool
need_labels
=
_labels
.
needed
();
CV_Assert
(
src
.
type
()
==
CV_8U
);
if
(
dst
.
size
==
src
.
size
&&
dst
.
type
()
==
CV_8U
&&
!
need_labels
&&
distType
==
CV_DIST_L1
)
{
distanceATS_L1_8u
(
src
,
dst
);
return
;
}
_dst
.
create
(
src
.
size
(),
CV_32F
);
dst
=
_dst
.
getMat
();
if
(
need_labels
)
{
CV_Assert
(
labelType
==
DIST_LABEL_PIXEL
||
labelType
==
DIST_LABEL_CCOMP
);
...
...
@@ -682,98 +772,15 @@ void cv::distanceTransform( InputArray _src, OutputArray _dst,
}
/****************************************************************************************\
Non-inplace and Inplace 8u->8u Distance Transform for CityBlock (a.k.a. L1) metric
(C) 2006 by Jay Stavinzky.
\****************************************************************************************/
//BEGIN ATS ADDITION
/* 8-bit grayscale distance transform function */
static
void
icvDistanceATS_L1_8u
(
const
cv
::
Mat
&
src
,
cv
::
Mat
&
dst
)
{
int
width
=
src
.
cols
,
height
=
src
.
rows
;
int
a
;
uchar
lut
[
256
];
int
x
,
y
;
const
uchar
*
sbase
=
src
.
data
;
uchar
*
dbase
=
dst
.
data
;
int
srcstep
=
(
int
)
src
.
step
;
int
dststep
=
(
int
)
dst
.
step
;
CV_Assert
(
src
.
type
()
==
CV_8UC1
&&
dst
.
type
()
==
CV_8UC1
);
CV_Assert
(
src
.
size
()
==
dst
.
size
()
);
////////////////////// forward scan ////////////////////////
for
(
x
=
0
;
x
<
256
;
x
++
)
lut
[
x
]
=
CV_CAST_8U
(
x
+
1
);
//init first pixel to max (we're going to be skipping it)
dbase
[
0
]
=
(
uchar
)(
sbase
[
0
]
==
0
?
0
:
255
);
//first row (scan west only, skip first pixel)
for
(
x
=
1
;
x
<
width
;
x
++
)
dbase
[
x
]
=
(
uchar
)(
sbase
[
x
]
==
0
?
0
:
lut
[
dbase
[
x
-
1
]]);
for
(
y
=
1
;
y
<
height
;
y
++
)
{
sbase
+=
srcstep
;
dbase
+=
dststep
;
//for left edge, scan north only
a
=
sbase
[
0
]
==
0
?
0
:
lut
[
dbase
[
-
dststep
]];
dbase
[
0
]
=
(
uchar
)
a
;
for
(
x
=
1
;
x
<
width
;
x
++
)
{
a
=
sbase
[
x
]
==
0
?
0
:
lut
[
MIN
(
a
,
dbase
[
x
-
dststep
])];
dbase
[
x
]
=
(
uchar
)
a
;
}
}
////////////////////// backward scan ///////////////////////
a
=
dbase
[
width
-
1
];
// do last row east pixel scan here (skip bottom right pixel)
for
(
x
=
width
-
2
;
x
>=
0
;
x
--
)
{
a
=
lut
[
a
];
dbase
[
x
]
=
(
uchar
)(
CV_CALC_MIN_8U
(
a
,
dbase
[
x
]));
}
// right edge is the only error case
for
(
y
=
height
-
2
;
y
>=
0
;
y
--
)
{
dbase
-=
dststep
;
// do right edge
a
=
lut
[
dbase
[
width
-
1
+
dststep
]];
dbase
[
width
-
1
]
=
(
uchar
)(
MIN
(
a
,
dbase
[
width
-
1
]));
for
(
x
=
width
-
2
;
x
>=
0
;
x
--
)
{
int
b
=
dbase
[
x
+
dststep
];
a
=
lut
[
MIN
(
a
,
b
)];
dbase
[
x
]
=
(
uchar
)(
MIN
(
a
,
dbase
[
x
]));
}
}
}
//END ATS ADDITION
CV_IMPL
void
cvDistTransform
(
const
void
*
srcarr
,
void
*
dstarr
,
int
distType
,
int
maskSize
,
const
float
*
/*mask*/
,
void
*
labelsarr
,
int
labelType
)
{
cv
::
Mat
src
=
cv
::
cvarrToMat
(
srcarr
),
dst
=
cv
::
cvarrToMat
(
dstarr
);
cv
::
Mat
labels
=
cv
::
cvarrToMat
(
labelsarr
);
if
(
!
labelsarr
&&
distType
==
CV_DIST_L1
&&
dst
.
type
()
==
CV_8U
)
icvDistanceATS_L1_8u
(
src
,
dst
);
cv
::
Mat
src
=
cv
::
cvarrToMat
(
srcarr
);
const
cv
::
Mat
dst
=
cv
::
cvarrToMat
(
dstarr
);
const
cv
::
Mat
labels
=
cv
::
cvarrToMat
(
labelsarr
);
cv
::
distanceTransform
(
src
,
dst
,
labelsarr
?
cv
::
_OutputArray
(
labels
)
:
cv
::
_OutputArray
(),
distType
,
maskSize
,
labelType
);
...
...
modules/imgproc/src/hough.cpp
View file @
78402bf5
...
...
@@ -7,10 +7,11 @@
// copy or use the software.
//
//
//
Intel
License Agreement
//
License Agreement
// For Open Source Computer Vision Library
//
// Copyright (C) 2000, Intel Corporation, all rights reserved.
// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
// Third party copyrights are property of their respective owners.
//
// Redistribution and use in source and binary forms, with or without modification,
...
...
@@ -23,7 +24,7 @@
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// * The name of
Intel Corporation
may not be used to endorse or promote products
// * The name of
the copyright holders
may not be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// This software is provided by the copyright holders and contributors "as is" and
...
...
@@ -398,8 +399,8 @@ HoughLinesProbabilistic( Mat& image,
for
(
int
n
=
0
;
n
<
numangle
;
n
++
)
{
trigtab
[
n
*
2
]
=
(
float
)(
cos
(
n
*
theta
)
*
irho
);
trigtab
[
n
*
2
+
1
]
=
(
float
)(
sin
(
n
*
theta
)
*
irho
);
trigtab
[
n
*
2
]
=
(
float
)(
cos
(
(
double
)
n
*
theta
)
*
irho
);
trigtab
[
n
*
2
+
1
]
=
(
float
)(
sin
(
(
double
)
n
*
theta
)
*
irho
);
}
const
float
*
ttab
=
&
trigtab
[
0
];
uchar
*
mdata0
=
mask
.
data
;
...
...
modules/imgproc/src/samplers.cpp
View file @
78402bf5
...
...
@@ -298,7 +298,8 @@ void cv::getRectSubPix( InputArray _image, Size patchSize, Point2f center,
CV_IMPL
void
cvGetRectSubPix
(
const
void
*
srcarr
,
void
*
dstarr
,
CvPoint2D32f
center
)
{
cv
::
Mat
src
=
cv
::
cvarrToMat
(
srcarr
),
dst
=
cv
::
cvarrToMat
(
dstarr
);
cv
::
Mat
src
=
cv
::
cvarrToMat
(
srcarr
);
const
cv
::
Mat
dst
=
cv
::
cvarrToMat
(
dstarr
);
CV_Assert
(
src
.
channels
()
==
dst
.
channels
()
);
cv
::
getRectSubPix
(
src
,
dst
.
size
(),
center
,
dst
,
dst
.
type
());
...
...
@@ -308,7 +309,8 @@ cvGetRectSubPix( const void* srcarr, void* dstarr, CvPoint2D32f center )
CV_IMPL
void
cvGetQuadrangleSubPix
(
const
void
*
srcarr
,
void
*
dstarr
,
const
CvMat
*
mat
)
{
cv
::
Mat
src
=
cv
::
cvarrToMat
(
srcarr
),
dst
=
cv
::
cvarrToMat
(
dstarr
),
m
=
cv
::
cvarrToMat
(
mat
);
cv
::
Mat
src
=
cv
::
cvarrToMat
(
srcarr
),
m
=
cv
::
cvarrToMat
(
mat
);
const
cv
::
Mat
dst
=
cv
::
cvarrToMat
(
dstarr
);
cv
::
Size
win_size
=
dst
.
size
();
double
matrix
[
6
];
cv
::
Mat
M
(
2
,
3
,
CV_64F
,
matrix
);
...
...
modules/imgproc/src/segmentation.cpp
View file @
78402bf5
...
...
@@ -7,10 +7,11 @@
// copy or use the software.
//
//
//
Intel
License Agreement
//
License Agreement
// For Open Source Computer Vision Library
//
// Copyright (C) 2000, Intel Corporation, all rights reserved.
// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
// Third party copyrights are property of their respective owners.
//
// Redistribution and use in source and binary forms, with or without modification,
...
...
@@ -23,7 +24,7 @@
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// * The name of
Intel Corporation
may not be used to endorse or promote products
// * The name of
the copyright holders
may not be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// This software is provided by the copyright holders and contributors "as is" and
...
...
@@ -529,7 +530,7 @@ cvPyrMeanShiftFiltering( const CvArr* srcarr, CvArr* dstarr,
CvTermCriteria
termcrit
)
{
cv
::
Mat
src
=
cv
::
cvarrToMat
(
srcarr
);
cv
::
Mat
dst
=
cv
::
cvarrToMat
(
dstarr
);
c
onst
c
v
::
Mat
dst
=
cv
::
cvarrToMat
(
dstarr
);
cv
::
pyrMeanShiftFiltering
(
src
,
dst
,
sp0
,
sr
,
max_level
,
termcrit
);
}
...
...
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