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
c9d8e990
Commit
c9d8e990
authored
Jan 30, 2013
by
Andrey Kamaev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow input of calcOpticalFlowPyrLK be submats of different size images
This fixes bug #2075
parent
6a29b13c
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
12 deletions
+12
-12
lkpyramid.cpp
modules/video/src/lkpyramid.cpp
+12
-12
No files found.
modules/video/src/lkpyramid.cpp
View file @
c9d8e990
...
...
@@ -213,8 +213,8 @@ void cv::detail::LKTrackerInvoker::operator()(const BlockedRange& range) const
int
iw11
=
(
1
<<
W_BITS
)
-
iw00
-
iw01
-
iw10
;
int
dstep
=
(
int
)(
derivI
.
step
/
derivI
.
elemSize1
());
int
step
=
(
int
)(
I
.
step
/
I
.
elemSize1
());
CV_Assert
(
step
==
(
int
)(
J
.
step
/
J
.
elemSize1
())
);
int
step
I
=
(
int
)(
I
.
step
/
I
.
elemSize1
());
int
stepJ
=
(
int
)(
J
.
step
/
J
.
elemSize1
()
);
float
A11
=
0
,
A12
=
0
,
A22
=
0
;
#if CV_SSE2
...
...
@@ -230,7 +230,7 @@ void cv::detail::LKTrackerInvoker::operator()(const BlockedRange& range) const
int
x
,
y
;
for
(
y
=
0
;
y
<
winSize
.
height
;
y
++
)
{
const
uchar
*
src
=
(
const
uchar
*
)
I
.
data
+
(
y
+
iprevPt
.
y
)
*
step
+
iprevPt
.
x
*
cn
;
const
uchar
*
src
=
(
const
uchar
*
)
I
.
data
+
(
y
+
iprevPt
.
y
)
*
step
I
+
iprevPt
.
x
*
cn
;
const
deriv_type
*
dsrc
=
(
const
deriv_type
*
)
derivI
.
data
+
(
y
+
iprevPt
.
y
)
*
dstep
+
iprevPt
.
x
*
cn2
;
deriv_type
*
Iptr
=
(
deriv_type
*
)(
IWinBuf
.
data
+
y
*
IWinBuf
.
step
);
...
...
@@ -245,8 +245,8 @@ void cv::detail::LKTrackerInvoker::operator()(const BlockedRange& range) const
v00
=
_mm_unpacklo_epi8
(
_mm_cvtsi32_si128
(
*
(
const
int
*
)(
src
+
x
)),
z
);
v01
=
_mm_unpacklo_epi8
(
_mm_cvtsi32_si128
(
*
(
const
int
*
)(
src
+
x
+
cn
)),
z
);
v10
=
_mm_unpacklo_epi8
(
_mm_cvtsi32_si128
(
*
(
const
int
*
)(
src
+
x
+
step
)),
z
);
v11
=
_mm_unpacklo_epi8
(
_mm_cvtsi32_si128
(
*
(
const
int
*
)(
src
+
x
+
step
+
cn
)),
z
);
v10
=
_mm_unpacklo_epi8
(
_mm_cvtsi32_si128
(
*
(
const
int
*
)(
src
+
x
+
step
I
)),
z
);
v11
=
_mm_unpacklo_epi8
(
_mm_cvtsi32_si128
(
*
(
const
int
*
)(
src
+
x
+
step
I
+
cn
)),
z
);
t0
=
_mm_add_epi32
(
_mm_madd_epi16
(
_mm_unpacklo_epi16
(
v00
,
v01
),
qw0
),
_mm_madd_epi16
(
_mm_unpacklo_epi16
(
v10
,
v11
),
qw1
));
...
...
@@ -282,7 +282,7 @@ void cv::detail::LKTrackerInvoker::operator()(const BlockedRange& range) const
for
(
;
x
<
winSize
.
width
*
cn
;
x
++
,
dsrc
+=
2
,
dIptr
+=
2
)
{
int
ival
=
CV_DESCALE
(
src
[
x
]
*
iw00
+
src
[
x
+
cn
]
*
iw01
+
src
[
x
+
step
]
*
iw10
+
src
[
x
+
step
+
cn
]
*
iw11
,
W_BITS1
-
5
);
src
[
x
+
step
I
]
*
iw10
+
src
[
x
+
stepI
+
cn
]
*
iw11
,
W_BITS1
-
5
);
int
ixval
=
CV_DESCALE
(
dsrc
[
0
]
*
iw00
+
dsrc
[
cn2
]
*
iw01
+
dsrc
[
dstep
]
*
iw10
+
dsrc
[
dstep
+
cn2
]
*
iw11
,
W_BITS1
);
int
iyval
=
CV_DESCALE
(
dsrc
[
1
]
*
iw00
+
dsrc
[
cn2
+
1
]
*
iw01
+
dsrc
[
dstep
+
1
]
*
iw10
+
...
...
@@ -359,7 +359,7 @@ void cv::detail::LKTrackerInvoker::operator()(const BlockedRange& range) const
for
(
y
=
0
;
y
<
winSize
.
height
;
y
++
)
{
const
uchar
*
Jptr
=
(
const
uchar
*
)
J
.
data
+
(
y
+
inextPt
.
y
)
*
step
+
inextPt
.
x
*
cn
;
const
uchar
*
Jptr
=
(
const
uchar
*
)
J
.
data
+
(
y
+
inextPt
.
y
)
*
step
J
+
inextPt
.
x
*
cn
;
const
deriv_type
*
Iptr
=
(
const
deriv_type
*
)(
IWinBuf
.
data
+
y
*
IWinBuf
.
step
);
const
deriv_type
*
dIptr
=
(
const
deriv_type
*
)(
derivIWinBuf
.
data
+
y
*
derivIWinBuf
.
step
);
...
...
@@ -371,8 +371,8 @@ void cv::detail::LKTrackerInvoker::operator()(const BlockedRange& range) const
__m128i
diff0
=
_mm_loadu_si128
((
const
__m128i
*
)(
Iptr
+
x
)),
diff1
;
__m128i
v00
=
_mm_unpacklo_epi8
(
_mm_loadl_epi64
((
const
__m128i
*
)(
Jptr
+
x
)),
z
);
__m128i
v01
=
_mm_unpacklo_epi8
(
_mm_loadl_epi64
((
const
__m128i
*
)(
Jptr
+
x
+
cn
)),
z
);
__m128i
v10
=
_mm_unpacklo_epi8
(
_mm_loadl_epi64
((
const
__m128i
*
)(
Jptr
+
x
+
step
)),
z
);
__m128i
v11
=
_mm_unpacklo_epi8
(
_mm_loadl_epi64
((
const
__m128i
*
)(
Jptr
+
x
+
step
+
cn
)),
z
);
__m128i
v10
=
_mm_unpacklo_epi8
(
_mm_loadl_epi64
((
const
__m128i
*
)(
Jptr
+
x
+
step
J
)),
z
);
__m128i
v11
=
_mm_unpacklo_epi8
(
_mm_loadl_epi64
((
const
__m128i
*
)(
Jptr
+
x
+
step
J
+
cn
)),
z
);
__m128i
t0
=
_mm_add_epi32
(
_mm_madd_epi16
(
_mm_unpacklo_epi16
(
v00
,
v01
),
qw0
),
_mm_madd_epi16
(
_mm_unpacklo_epi16
(
v10
,
v11
),
qw1
));
...
...
@@ -403,7 +403,7 @@ void cv::detail::LKTrackerInvoker::operator()(const BlockedRange& range) const
for
(
;
x
<
winSize
.
width
*
cn
;
x
++
,
dIptr
+=
2
)
{
int
diff
=
CV_DESCALE
(
Jptr
[
x
]
*
iw00
+
Jptr
[
x
+
cn
]
*
iw01
+
Jptr
[
x
+
step
]
*
iw10
+
Jptr
[
x
+
step
+
cn
]
*
iw11
,
Jptr
[
x
+
step
J
]
*
iw10
+
Jptr
[
x
+
stepJ
+
cn
]
*
iw11
,
W_BITS1
-
5
)
-
Iptr
[
x
];
b1
+=
(
float
)(
diff
*
dIptr
[
0
]);
b2
+=
(
float
)(
diff
*
dIptr
[
1
]);
...
...
@@ -465,13 +465,13 @@ void cv::detail::LKTrackerInvoker::operator()(const BlockedRange& range) const
for
(
y
=
0
;
y
<
winSize
.
height
;
y
++
)
{
const
uchar
*
Jptr
=
(
const
uchar
*
)
J
.
data
+
(
y
+
inextPoint
.
y
)
*
step
+
inextPoint
.
x
*
cn
;
const
uchar
*
Jptr
=
(
const
uchar
*
)
J
.
data
+
(
y
+
inextPoint
.
y
)
*
step
J
+
inextPoint
.
x
*
cn
;
const
deriv_type
*
Iptr
=
(
const
deriv_type
*
)(
IWinBuf
.
data
+
y
*
IWinBuf
.
step
);
for
(
x
=
0
;
x
<
winSize
.
width
*
cn
;
x
++
)
{
int
diff
=
CV_DESCALE
(
Jptr
[
x
]
*
iw00
+
Jptr
[
x
+
cn
]
*
iw01
+
Jptr
[
x
+
step
]
*
iw10
+
Jptr
[
x
+
step
+
cn
]
*
iw11
,
Jptr
[
x
+
step
J
]
*
iw10
+
Jptr
[
x
+
stepJ
+
cn
]
*
iw11
,
W_BITS1
-
5
)
-
Iptr
[
x
];
errval
+=
std
::
abs
((
float
)
diff
);
}
...
...
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