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
3f421223
Commit
3f421223
authored
Mar 13, 2019
by
Alexander Alekhin
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #14043 from alalek:revert_13843
parents
a534af68
f73b4f4a
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
22 deletions
+14
-22
imgproc.hpp
modules/imgproc/include/opencv2/imgproc.hpp
+2
-10
drawing.cpp
modules/imgproc/src/drawing.cpp
+12
-12
No files found.
modules/imgproc/include/opencv2/imgproc.hpp
View file @
3f421223
...
@@ -4689,15 +4689,7 @@ public:
...
@@ -4689,15 +4689,7 @@ public:
not to depend on the ordering of pt1 and pt2 parameters
not to depend on the ordering of pt1 and pt2 parameters
*/
*/
LineIterator
(
const
Mat
&
img
,
Point
pt1
,
Point
pt2
,
LineIterator
(
const
Mat
&
img
,
Point
pt1
,
Point
pt2
,
int
connectivity
=
8
,
bool
leftToRight
=
false
)
{
int
connectivity
=
8
,
bool
leftToRight
=
false
);
init
(
img
.
size
(),
img
.
type
(),
(
uchar
*
)
img
.
ptr
(),
img
.
step1
()
*
img
.
elemSize1
(),
pt1
,
pt2
,
connectivity
,
leftToRight
);
}
LineIterator
(
const
Size
&
size
,
int
type
,
Point
pt1
,
Point
pt2
,
int
connectivity
=
8
,
bool
leftToRight
=
false
)
{
init
(
size
,
type
,
0
,
CV_ELEM_SIZE
(
type
)
*
size
.
width
,
pt1
,
pt2
,
connectivity
,
leftToRight
);
}
void
init
(
const
Size
&
size
,
int
type
,
uchar
*
data
,
size_t
dataStep
,
Point
pt1
,
Point
pt2
,
int
connectivity
=
8
,
bool
leftToRight
=
false
);
/** @brief returns pointer to the current pixel
/** @brief returns pointer to the current pixel
*/
*/
uchar
*
operator
*
();
uchar
*
operator
*
();
...
@@ -4726,7 +4718,7 @@ public:
...
@@ -4726,7 +4718,7 @@ public:
inline
inline
uchar
*
LineIterator
::
operator
*
()
uchar
*
LineIterator
::
operator
*
()
{
{
return
!
ptr0
?
0
:
ptr
;
//when no Mat is attached, ptr is just a dummy address and should not be dereferenced
return
ptr
;
}
}
inline
inline
...
...
modules/imgproc/src/drawing.cpp
View file @
3f421223
...
@@ -160,21 +160,21 @@ bool clipLine( Rect img_rect, Point& pt1, Point& pt2 )
...
@@ -160,21 +160,21 @@ bool clipLine( Rect img_rect, Point& pt1, Point& pt2 )
Initializes line iterator.
Initializes line iterator.
Returns number of points on the line or negative number if error.
Returns number of points on the line or negative number if error.
*/
*/
void
LineIterator
::
init
(
const
Size
&
size
,
int
type
,
uchar
*
data
,
size_t
dataStep
,
Point
pt1
,
Point
pt2
,
LineIterator
::
LineIterator
(
const
Mat
&
img
,
Point
pt1
,
Point
pt2
,
int
connectivity
,
bool
left_to_right
)
int
connectivity
,
bool
left_to_right
)
{
{
count
=
-
1
;
count
=
-
1
;
CV_Assert
(
connectivity
==
8
||
connectivity
==
4
);
CV_Assert
(
connectivity
==
8
||
connectivity
==
4
);
if
(
(
unsigned
)
pt1
.
x
>=
(
unsigned
)(
size
.
width
)
||
if
(
(
unsigned
)
pt1
.
x
>=
(
unsigned
)(
img
.
cols
)
||
(
unsigned
)
pt2
.
x
>=
(
unsigned
)(
size
.
width
)
||
(
unsigned
)
pt2
.
x
>=
(
unsigned
)(
img
.
cols
)
||
(
unsigned
)
pt1
.
y
>=
(
unsigned
)(
size
.
height
)
||
(
unsigned
)
pt1
.
y
>=
(
unsigned
)(
img
.
rows
)
||
(
unsigned
)
pt2
.
y
>=
(
unsigned
)(
size
.
height
)
)
(
unsigned
)
pt2
.
y
>=
(
unsigned
)(
img
.
rows
)
)
{
{
if
(
!
clipLine
(
size
,
pt1
,
pt2
)
)
if
(
!
clipLine
(
img
.
size
()
,
pt1
,
pt2
)
)
{
{
ptr
=
data
;
ptr
=
img
.
data
;
err
=
plusDelta
=
minusDelta
=
plusStep
=
minusStep
=
count
=
0
;
err
=
plusDelta
=
minusDelta
=
plusStep
=
minusStep
=
count
=
0
;
ptr0
=
0
;
ptr0
=
0
;
step
=
0
;
step
=
0
;
...
@@ -183,8 +183,8 @@ void LineIterator::init(const Size& size, int type, uchar* data, size_t dataStep
...
@@ -183,8 +183,8 @@ void LineIterator::init(const Size& size, int type, uchar* data, size_t dataStep
}
}
}
}
size_t
bt_pix0
=
CV_ELEM_SIZE
(
type
),
bt_pix
=
bt_pix0
;
size_t
bt_pix0
=
img
.
elemSize
(
),
bt_pix
=
bt_pix0
;
size_t
istep
=
dataS
tep
;
size_t
istep
=
img
.
s
tep
;
int
dx
=
pt2
.
x
-
pt1
.
x
;
int
dx
=
pt2
.
x
-
pt1
.
x
;
int
dy
=
pt2
.
y
-
pt1
.
y
;
int
dy
=
pt2
.
y
-
pt1
.
y
;
...
@@ -203,7 +203,7 @@ void LineIterator::init(const Size& size, int type, uchar* data, size_t dataStep
...
@@ -203,7 +203,7 @@ void LineIterator::init(const Size& size, int type, uchar* data, size_t dataStep
bt_pix
=
(
bt_pix
^
s
)
-
s
;
bt_pix
=
(
bt_pix
^
s
)
-
s
;
}
}
ptr
=
(
uchar
*
)(
data
+
pt1
.
y
*
istep
+
pt1
.
x
*
bt_pix0
);
//when no Mat is attached, ptr is just a dummy address and should not be dereferenced
ptr
=
(
uchar
*
)(
img
.
data
+
pt1
.
y
*
istep
+
pt1
.
x
*
bt_pix0
);
s
=
dy
<
0
?
-
1
:
0
;
s
=
dy
<
0
?
-
1
:
0
;
dy
=
(
dy
^
s
)
-
s
;
dy
=
(
dy
^
s
)
-
s
;
...
@@ -243,8 +243,8 @@ void LineIterator::init(const Size& size, int type, uchar* data, size_t dataStep
...
@@ -243,8 +243,8 @@ void LineIterator::init(const Size& size, int type, uchar* data, size_t dataStep
count
=
dx
+
dy
+
1
;
count
=
dx
+
dy
+
1
;
}
}
this
->
ptr0
=
data
;
this
->
ptr0
=
img
.
ptr
()
;
this
->
step
=
static_cast
<
int
>
(
dataStep
)
;
this
->
step
=
(
int
)
img
.
step
;
this
->
elemSize
=
(
int
)
bt_pix0
;
this
->
elemSize
=
(
int
)
bt_pix0
;
}
}
...
...
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