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
af0040ea
Commit
af0040ea
authored
Feb 05, 2014
by
Ilya Lavrenov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
condition for Mat step
parent
9493a4ec
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
3 deletions
+22
-3
mat.inl.hpp
modules/core/include/opencv2/core/mat.inl.hpp
+14
-2
matrix.cpp
modules/core/src/matrix.cpp
+8
-1
No files found.
modules/core/include/opencv2/core/mat.inl.hpp
View file @
af0040ea
...
@@ -372,7 +372,7 @@ Mat::Mat(int _rows, int _cols, int _type, void* _data, size_t _step)
...
@@ -372,7 +372,7 @@ Mat::Mat(int _rows, int _cols, int _type, void* _data, size_t _step)
data
((
uchar
*
)
_data
),
datastart
((
uchar
*
)
_data
),
dataend
(
0
),
datalimit
(
0
),
data
((
uchar
*
)
_data
),
datastart
((
uchar
*
)
_data
),
dataend
(
0
),
datalimit
(
0
),
allocator
(
0
),
u
(
0
),
size
(
&
rows
)
allocator
(
0
),
u
(
0
),
size
(
&
rows
)
{
{
size_t
esz
=
CV_ELEM_SIZE
(
_type
);
size_t
esz
=
CV_ELEM_SIZE
(
_type
)
,
esz1
=
CV_ELEM_SIZE1
(
_type
)
;
size_t
minstep
=
cols
*
esz
;
size_t
minstep
=
cols
*
esz
;
if
(
_step
==
AUTO_STEP
)
if
(
_step
==
AUTO_STEP
)
{
{
...
@@ -383,6 +383,12 @@ Mat::Mat(int _rows, int _cols, int _type, void* _data, size_t _step)
...
@@ -383,6 +383,12 @@ Mat::Mat(int _rows, int _cols, int _type, void* _data, size_t _step)
{
{
if
(
rows
==
1
)
_step
=
minstep
;
if
(
rows
==
1
)
_step
=
minstep
;
CV_DbgAssert
(
_step
>=
minstep
);
CV_DbgAssert
(
_step
>=
minstep
);
if
(
_step
%
esz1
!=
0
)
{
CV_Error
(
Error
::
BadStep
,
"Step must be a multiple of esz1"
);
}
flags
|=
_step
==
minstep
?
CONTINUOUS_FLAG
:
0
;
flags
|=
_step
==
minstep
?
CONTINUOUS_FLAG
:
0
;
}
}
step
[
0
]
=
_step
;
step
[
0
]
=
_step
;
...
@@ -397,7 +403,7 @@ Mat::Mat(Size _sz, int _type, void* _data, size_t _step)
...
@@ -397,7 +403,7 @@ Mat::Mat(Size _sz, int _type, void* _data, size_t _step)
data
((
uchar
*
)
_data
),
datastart
((
uchar
*
)
_data
),
dataend
(
0
),
datalimit
(
0
),
data
((
uchar
*
)
_data
),
datastart
((
uchar
*
)
_data
),
dataend
(
0
),
datalimit
(
0
),
allocator
(
0
),
u
(
0
),
size
(
&
rows
)
allocator
(
0
),
u
(
0
),
size
(
&
rows
)
{
{
size_t
esz
=
CV_ELEM_SIZE
(
_type
);
size_t
esz
=
CV_ELEM_SIZE
(
_type
)
,
esz1
=
CV_ELEM_SIZE1
(
_type
)
;
size_t
minstep
=
cols
*
esz
;
size_t
minstep
=
cols
*
esz
;
if
(
_step
==
AUTO_STEP
)
if
(
_step
==
AUTO_STEP
)
{
{
...
@@ -408,6 +414,12 @@ Mat::Mat(Size _sz, int _type, void* _data, size_t _step)
...
@@ -408,6 +414,12 @@ Mat::Mat(Size _sz, int _type, void* _data, size_t _step)
{
{
if
(
rows
==
1
)
_step
=
minstep
;
if
(
rows
==
1
)
_step
=
minstep
;
CV_DbgAssert
(
_step
>=
minstep
);
CV_DbgAssert
(
_step
>=
minstep
);
if
(
_step
%
esz1
!=
0
)
{
CV_Error
(
Error
::
BadStep
,
"Step must be a multiple of esz1"
);
}
flags
|=
_step
==
minstep
?
CONTINUOUS_FLAG
:
0
;
flags
|=
_step
==
minstep
?
CONTINUOUS_FLAG
:
0
;
}
}
step
[
0
]
=
_step
;
step
[
0
]
=
_step
;
...
...
modules/core/src/matrix.cpp
View file @
af0040ea
...
@@ -282,7 +282,7 @@ static inline void setSize( Mat& m, int _dims, const int* _sz,
...
@@ -282,7 +282,7 @@ static inline void setSize( Mat& m, int _dims, const int* _sz,
if
(
!
_sz
)
if
(
!
_sz
)
return
;
return
;
size_t
esz
=
CV_ELEM_SIZE
(
m
.
flags
),
total
=
esz
;
size_t
esz
=
CV_ELEM_SIZE
(
m
.
flags
),
esz1
=
CV_ELEM_SIZE1
(
m
.
flags
),
total
=
esz
;
int
i
;
int
i
;
for
(
i
=
_dims
-
1
;
i
>=
0
;
i
--
)
for
(
i
=
_dims
-
1
;
i
>=
0
;
i
--
)
{
{
...
@@ -291,7 +291,14 @@ static inline void setSize( Mat& m, int _dims, const int* _sz,
...
@@ -291,7 +291,14 @@ static inline void setSize( Mat& m, int _dims, const int* _sz,
m
.
size
.
p
[
i
]
=
s
;
m
.
size
.
p
[
i
]
=
s
;
if
(
_steps
)
if
(
_steps
)
{
if
(
_steps
[
i
]
%
esz1
!=
0
)
{
CV_Error
(
Error
::
BadStep
,
"Step must be a multiple of esz1"
);
}
m
.
step
.
p
[
i
]
=
i
<
_dims
-
1
?
_steps
[
i
]
:
esz
;
m
.
step
.
p
[
i
]
=
i
<
_dims
-
1
?
_steps
[
i
]
:
esz
;
}
else
if
(
autoSteps
)
else
if
(
autoSteps
)
{
{
m
.
step
.
p
[
i
]
=
total
;
m
.
step
.
p
[
i
]
=
total
;
...
...
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