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
8b16dbe7
Commit
8b16dbe7
authored
Aug 03, 2011
by
Andrey Pavlenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Java API: calcOpticalFlowPyrLK() args types are changed to vector<>
Testing: 1130/0/585
parent
0595ca74
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
77 additions
and
37 deletions
+77
-37
videoTest.java
...ava/android_test/src/org/opencv/test/video/videoTest.java
+42
-34
gen_java.py
modules/java/gen_java.py
+2
-0
converters.cpp
modules/java/src/cpp/converters.cpp
+10
-0
converters.h
modules/java/src/cpp/converters.h
+3
-0
utils+Converters.java
modules/java/src/java/utils+Converters.java
+20
-3
No files found.
modules/java/android_test/src/org/opencv/test/video/videoTest.java
View file @
8b16dbe7
package
org
.
opencv
.
test
.
video
;
import
java.util.ArrayList
;
import
java.util.List
;
import
org.opencv.core.Core
;
import
org.opencv.core.CvType
;
import
org.opencv.core.Mat
;
import
org.opencv.core.Point
;
import
org.opencv.core.Size
;
import
org.opencv.test.OpenCVTestCase
;
import
org.opencv.utils.Converters
;
import
org.opencv.video.Video
;
public
class
videoTest
extends
OpenCVTestCase
{
...
...
@@ -17,9 +21,10 @@ public class videoTest extends OpenCVTestCase {
private
Mat
subLena1
=
null
;
private
Mat
subLena2
=
null
;
private
Mat
nextPts
=
null
;
private
Mat
status
=
null
;
private
Mat
err
=
null
;
List
<
Point
>
prevPts
=
null
;
private
List
<
Point
>
nextPts
=
null
;
private
List
<
Byte
>
status
=
null
;
private
List
<
Float
>
err
=
null
;
@Override
protected
void
setUp
()
throws
Exception
{
...
...
@@ -33,9 +38,14 @@ public class videoTest extends OpenCVTestCase {
subLena1
=
rgbLena
.
submat
(
shift1
,
h
+
shift1
,
shift1
,
w
+
shift1
);
subLena2
=
rgbLena
.
submat
(
shift2
,
h
+
shift2
,
shift2
,
w
+
shift2
);
nextPts
=
new
Mat
();
status
=
new
Mat
();
err
=
new
Mat
();
prevPts
=
new
ArrayList
<
Point
>();
prevPts
.
add
(
new
Point
(
1.0
,
1.0
));
prevPts
.
add
(
new
Point
(
5.0
,
5.0
));
prevPts
.
add
(
new
Point
(
10.0
,
10.0
));
nextPts
=
new
ArrayList
<
Point
>();
status
=
new
ArrayList
<
Byte
>();
err
=
new
ArrayList
<
Float
>();
}
public
void
testCalcGlobalOrientation
()
{
...
...
@@ -54,39 +64,37 @@ public class videoTest extends OpenCVTestCase {
fail
(
"Not yet implemented"
);
}
public
void
testCalcOpticalFlowPyrLKMatMatMatMatMatMat
()
{
Mat
prevPts
=
new
Mat
(
1
,
3
,
CvType
.
CV_32FC2
);
prevPts
.
put
(
0
,
0
,
1.0
,
1.0
,
5.0
,
5.0
,
10.0
,
10.0
);
Video
.
calcOpticalFlowPyrLK
(
subLena1
,
subLena2
,
prevPts
,
nextPts
,
status
,
err
);
assertEquals
(
3
,
Core
.
countNonZero
(
status
));
}
public
void
testCalcOpticalFlowPyrLKMatMatMatMatMatMatSize
()
{
Mat
prevPts
=
new
Mat
(
1
,
3
,
CvType
.
CV_32FC2
);
prevPts
.
put
(
0
,
0
,
1.0
,
1.0
,
5.0
,
5.0
,
10.0
,
10.0
);
public
void
testCalcOpticalFlowPyrLKMatMatListOfPointListOfPointListOfByteListOfFloatSizeIntTermCriteriaDoubleIntDouble
()
{
fail
(
"Not yet implemented"
);
}
Size
sz
=
new
Size
(
3
,
3
);
Video
.
calcOpticalFlowPyrLK
(
subLena1
,
subLena2
,
prevPts
,
nextPts
,
status
,
err
,
sz
);
assertEquals
(
0
,
Core
.
countNonZero
(
status
));
}
public
void
testCalcOpticalFlowPyrLKMatMatListOfPointListOfPointListOfByteListOfFloatSizeIntTermCriteriaDoubleInt
()
{
fail
(
"Not yet implemented"
);
}
public
void
testCalcOpticalFlowPyrLKMatMatMatMatMatMatSizeInt
()
{
fail
(
"Not yet implemented"
);
}
public
void
testCalcOpticalFlowPyrLKMatMatListOfPointListOfPointListOfByteListOfFloatSizeIntTermCriteriaDouble
()
{
fail
(
"Not yet implemented"
);
}
public
void
testCalcOpticalFlowPyrLKMatMatMatMatMatM
atSizeIntTermCriteria
()
{
fail
(
"Not yet implemented"
);
}
public
void
testCalcOpticalFlowPyrLKMatMatListOfPointListOfPointListOfByteListOfFlo
atSizeIntTermCriteria
()
{
fail
(
"Not yet implemented"
);
}
public
void
testCalcOpticalFlowPyrLKMatMatMatMatMatMatSizeIntTermCriteriaDouble
()
{
fail
(
"Not yet implemented"
);
}
public
void
testCalcOpticalFlowPyrLKMatMatListOfPointListOfPointListOfByteListOfFloatSizeInt
()
{
fail
(
"Not yet implemented"
);
}
public
void
testCalcOpticalFlowPyrLKMatMatMatMatMatMatSizeIntTermCriteriaDoubleInt
()
{
fail
(
"Not yet implemented"
);
}
public
void
testCalcOpticalFlowPyrLKMatMatListOfPointListOfPointListOfByteListOfFloatSize
()
{
Size
sz
=
new
Size
(
3
,
3
);
Video
.
calcOpticalFlowPyrLK
(
subLena1
,
subLena2
,
prevPts
,
nextPts
,
status
,
err
,
sz
);
assertEquals
(
0
,
Core
.
countNonZero
(
Converters
.
vector_uchar_to_Mat
(
status
)
));
}
public
void
testCalcOpticalFlowPyrLKMatMatListOfPointListOfPointListOfByteListOfFloat
()
{
Video
.
calcOpticalFlowPyrLK
(
subLena1
,
subLena2
,
prevPts
,
nextPts
,
status
,
err
);
assertEquals
(
3
,
Core
.
countNonZero
(
Converters
.
vector_uchar_to_Mat
(
status
)
));
}
public
void
testCamShift
()
{
fail
(
"Not yet implemented"
);
}
...
...
modules/java/gen_java.py
View file @
8b16dbe7
...
...
@@ -478,6 +478,8 @@ func_arg_fix = {
'findHomography'
:
{
'srcPoints'
:
'vector_Point2f'
,
'dstPoints'
:
'vector_Point2f'
,
},
'solvePnP'
:
{
'objectPoints'
:
'vector_Point3f'
,
'imagePoints'
:
'vector_Point2f'
,
},
'solvePnPRansac'
:
{
'objectPoints'
:
'vector_Point3f'
,
'imagePoints'
:
'vector_Point2f'
,
},
'calcOpticalFlowPyrLK'
:
{
'prevPts'
:
'vector_Point2f'
,
'nextPts'
:
'vector_Point2f'
,
'status'
:
'vector_uchar'
,
'err'
:
'vector_float'
,
},
},
# '', i.e. no class
}
# func_arg_fix
...
...
modules/java/src/cpp/converters.cpp
View file @
8b16dbe7
...
...
@@ -67,6 +67,11 @@ void Mat_to_vector_uchar(Mat& mat, vector<uchar>& v_uchar)
v_uchar
=
(
vector
<
uchar
>
)
mat
;
}
void
vector_uchar_to_Mat
(
vector
<
uchar
>&
v_uchar
,
Mat
&
mat
)
{
mat
=
Mat
(
v_uchar
,
true
);
}
void
Mat_to_vector_char
(
Mat
&
mat
,
vector
<
char
>&
v_char
)
{
v_char
.
clear
();
...
...
@@ -74,6 +79,11 @@ void Mat_to_vector_char(Mat& mat, vector<char>& v_char)
v_char
=
(
vector
<
char
>
)
mat
;
}
void
vector_char_to_Mat
(
vector
<
char
>&
v_char
,
Mat
&
mat
)
{
mat
=
Mat
(
v_char
,
true
);
}
//vector_Rect
...
...
modules/java/src/cpp/converters.h
View file @
8b16dbe7
...
...
@@ -15,7 +15,10 @@ void Mat_to_vector_float(cv::Mat& mat, std::vector<float>& v_float);
void
vector_float_to_Mat
(
std
::
vector
<
float
>&
v_float
,
cv
::
Mat
&
mat
);
void
Mat_to_vector_uchar
(
cv
::
Mat
&
mat
,
std
::
vector
<
uchar
>&
v_uchar
);
void
vector_uchar_to_Mat
(
std
::
vector
<
uchar
>&
v_uchar
,
cv
::
Mat
&
mat
);
void
Mat_to_vector_char
(
cv
::
Mat
&
mat
,
std
::
vector
<
char
>&
v_char
);
void
vector_char_to_Mat
(
std
::
vector
<
char
>&
v_char
,
cv
::
Mat
&
mat
);
void
Mat_to_vector_Rect
(
cv
::
Mat
&
mat
,
std
::
vector
<
cv
::
Rect
>&
v_rect
);
void
vector_Rect_to_Mat
(
std
::
vector
<
cv
::
Rect
>&
v_rect
,
cv
::
Mat
&
mat
);
...
...
modules/java/src/java/utils+Converters.java
View file @
8b16dbe7
...
...
@@ -293,7 +293,7 @@ public class Converters {
float
[]
buff
=
new
float
[
count
];
m
.
get
(
0
,
0
,
buff
);
for
(
int
i
=
0
;
i
<
count
;
i
++)
{
fs
.
add
(
new
Float
(
buff
[
i
])
);
fs
.
add
(
buff
[
i
]
);
}
}
...
...
@@ -314,6 +314,23 @@ public class Converters {
return
res
;
}
public
static
void
Mat_to_vector_uchar
(
Mat
m
,
List
<
Byte
>
us
)
{
if
(
us
==
null
)
throw
new
java
.
lang
.
IllegalArgumentException
(
"Output List can't be null"
);
int
count
=
m
.
rows
();
if
(
CvType
.
CV_8UC1
!=
m
.
type
()
||
m
.
cols
()!=
1
)
throw
new
java
.
lang
.
IllegalArgumentException
(
"CvType.CV_8UC1 != m.type() || m.cols()!=1\n"
+
m
);
us
.
clear
();
byte
[]
buff
=
new
byte
[
count
];
m
.
get
(
0
,
0
,
buff
);
for
(
int
i
=
0
;
i
<
count
;
i
++)
{
us
.
add
(
buff
[
i
]
);
}
}
public
static
Mat
vector_char_to_Mat
(
List
<
Byte
>
bs
)
{
Mat
res
;
int
count
=
(
bs
!=
null
)
?
bs
.
size
()
:
0
;
...
...
@@ -360,7 +377,7 @@ public class Converters {
int
[]
buff
=
new
int
[
count
];
m
.
get
(
0
,
0
,
buff
);
for
(
int
i
=
0
;
i
<
count
;
i
++)
{
is
.
add
(
new
Integer
(
buff
[
i
])
);
is
.
add
(
buff
[
i
]
);
}
}
...
...
@@ -376,7 +393,7 @@ public class Converters {
byte
[]
buff
=
new
byte
[
count
];
m
.
get
(
0
,
0
,
buff
);
for
(
int
i
=
0
;
i
<
count
;
i
++)
{
bs
.
add
(
new
Byte
(
buff
[
i
])
);
bs
.
add
(
buff
[
i
]
);
}
}
...
...
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