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
8286e1a5
Commit
8286e1a5
authored
Nov 26, 2012
by
Andrey Kamaev
Committed by
OpenCV Buildbot
Nov 26, 2012
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #185 from apavlenko:bug2569/simplify_samples_jni_code
parents
39da17a0
b19f6728
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
30 deletions
+34
-30
DetectionBasedTracker_jni.cpp
.../android/face-detection/jni/DetectionBasedTracker_jni.cpp
+18
-18
jni_part.cpp
samples/android/tutorial-3-native/jni/jni_part.cpp
+8
-6
jni_part.cpp
samples/android/tutorial-4-mixed/jni/jni_part.cpp
+8
-6
No files found.
samples/android/face-detection/jni/DetectionBasedTracker_jni.cpp
View file @
8286e1a5
...
...
@@ -33,9 +33,9 @@ JNIEXPORT jlong JNICALL Java_org_opencv_samples_facedetect_DetectionBasedTracker
DetectorParams
.
minObjectSize
=
faceSize
;
result
=
(
jlong
)
new
DetectionBasedTracker
(
stdFileName
,
DetectorParams
);
}
catch
(
cv
::
Exception
e
)
catch
(
cv
::
Exception
&
e
)
{
LOGD
(
"nativeCreateObject ca
tched
cv::Exception: %s"
,
e
.
what
());
LOGD
(
"nativeCreateObject ca
ught
cv::Exception: %s"
,
e
.
what
());
jclass
je
=
jenv
->
FindClass
(
"org/opencv/core/CvException"
);
if
(
!
je
)
je
=
jenv
->
FindClass
(
"java/lang/Exception"
);
...
...
@@ -43,7 +43,7 @@ JNIEXPORT jlong JNICALL Java_org_opencv_samples_facedetect_DetectionBasedTracker
}
catch
(...)
{
LOGD
(
"nativeCreateObject ca
tched
unknown exception"
);
LOGD
(
"nativeCreateObject ca
ught
unknown exception"
);
jclass
je
=
jenv
->
FindClass
(
"java/lang/Exception"
);
jenv
->
ThrowNew
(
je
,
"Unknown exception in JNI code {highgui::VideoCapture_n_1VideoCapture__()}"
);
return
0
;
...
...
@@ -65,9 +65,9 @@ JNIEXPORT void JNICALL Java_org_opencv_samples_facedetect_DetectionBasedTracker_
delete
(
DetectionBasedTracker
*
)
thiz
;
}
}
catch
(
cv
::
Exception
e
)
catch
(
cv
::
Exception
&
e
)
{
LOGD
(
"nativeestroyObject ca
tched
cv::Exception: %s"
,
e
.
what
());
LOGD
(
"nativeestroyObject ca
ught
cv::Exception: %s"
,
e
.
what
());
jclass
je
=
jenv
->
FindClass
(
"org/opencv/core/CvException"
);
if
(
!
je
)
je
=
jenv
->
FindClass
(
"java/lang/Exception"
);
...
...
@@ -75,7 +75,7 @@ JNIEXPORT void JNICALL Java_org_opencv_samples_facedetect_DetectionBasedTracker_
}
catch
(...)
{
LOGD
(
"nativeDestroyObject ca
tched
unknown exception"
);
LOGD
(
"nativeDestroyObject ca
ught
unknown exception"
);
jclass
je
=
jenv
->
FindClass
(
"java/lang/Exception"
);
jenv
->
ThrowNew
(
je
,
"Unknown exception in JNI code {highgui::VideoCapture_n_1VideoCapture__()}"
);
}
...
...
@@ -90,9 +90,9 @@ JNIEXPORT void JNICALL Java_org_opencv_samples_facedetect_DetectionBasedTracker_
{
((
DetectionBasedTracker
*
)
thiz
)
->
run
();
}
catch
(
cv
::
Exception
e
)
catch
(
cv
::
Exception
&
e
)
{
LOGD
(
"nativeStart ca
tched
cv::Exception: %s"
,
e
.
what
());
LOGD
(
"nativeStart ca
ught
cv::Exception: %s"
,
e
.
what
());
jclass
je
=
jenv
->
FindClass
(
"org/opencv/core/CvException"
);
if
(
!
je
)
je
=
jenv
->
FindClass
(
"java/lang/Exception"
);
...
...
@@ -100,7 +100,7 @@ JNIEXPORT void JNICALL Java_org_opencv_samples_facedetect_DetectionBasedTracker_
}
catch
(...)
{
LOGD
(
"nativeStart ca
tched
unknown exception"
);
LOGD
(
"nativeStart ca
ught
unknown exception"
);
jclass
je
=
jenv
->
FindClass
(
"java/lang/Exception"
);
jenv
->
ThrowNew
(
je
,
"Unknown exception in JNI code {highgui::VideoCapture_n_1VideoCapture__()}"
);
}
...
...
@@ -115,9 +115,9 @@ JNIEXPORT void JNICALL Java_org_opencv_samples_facedetect_DetectionBasedTracker_
{
((
DetectionBasedTracker
*
)
thiz
)
->
stop
();
}
catch
(
cv
::
Exception
e
)
catch
(
cv
::
Exception
&
e
)
{
LOGD
(
"nativeStop ca
tched
cv::Exception: %s"
,
e
.
what
());
LOGD
(
"nativeStop ca
ught
cv::Exception: %s"
,
e
.
what
());
jclass
je
=
jenv
->
FindClass
(
"org/opencv/core/CvException"
);
if
(
!
je
)
je
=
jenv
->
FindClass
(
"java/lang/Exception"
);
...
...
@@ -125,7 +125,7 @@ JNIEXPORT void JNICALL Java_org_opencv_samples_facedetect_DetectionBasedTracker_
}
catch
(...)
{
LOGD
(
"nativeStop ca
tched
unknown exception"
);
LOGD
(
"nativeStop ca
ught
unknown exception"
);
jclass
je
=
jenv
->
FindClass
(
"java/lang/Exception"
);
jenv
->
ThrowNew
(
je
,
"Unknown exception in JNI code {highgui::VideoCapture_n_1VideoCapture__()}"
);
}
...
...
@@ -146,9 +146,9 @@ JNIEXPORT void JNICALL Java_org_opencv_samples_facedetect_DetectionBasedTracker_
((
DetectionBasedTracker
*
)
thiz
)
->
setParameters
(
DetectorParams
);
}
}
catch
(
cv
::
Exception
e
)
catch
(
cv
::
Exception
&
e
)
{
LOGD
(
"nativeStop ca
tched
cv::Exception: %s"
,
e
.
what
());
LOGD
(
"nativeStop ca
ught
cv::Exception: %s"
,
e
.
what
());
jclass
je
=
jenv
->
FindClass
(
"org/opencv/core/CvException"
);
if
(
!
je
)
je
=
jenv
->
FindClass
(
"java/lang/Exception"
);
...
...
@@ -156,7 +156,7 @@ JNIEXPORT void JNICALL Java_org_opencv_samples_facedetect_DetectionBasedTracker_
}
catch
(...)
{
LOGD
(
"nativeSetFaceSize ca
tched
unknown exception"
);
LOGD
(
"nativeSetFaceSize ca
ught
unknown exception"
);
jclass
je
=
jenv
->
FindClass
(
"java/lang/Exception"
);
jenv
->
ThrowNew
(
je
,
"Unknown exception in JNI code {highgui::VideoCapture_n_1VideoCapture__()}"
);
}
...
...
@@ -175,9 +175,9 @@ JNIEXPORT void JNICALL Java_org_opencv_samples_facedetect_DetectionBasedTracker_
((
DetectionBasedTracker
*
)
thiz
)
->
getObjects
(
RectFaces
);
vector_Rect_to_Mat
(
RectFaces
,
*
((
Mat
*
)
faces
));
}
catch
(
cv
::
Exception
e
)
catch
(
cv
::
Exception
&
e
)
{
LOGD
(
"nativeCreateObject ca
tched
cv::Exception: %s"
,
e
.
what
());
LOGD
(
"nativeCreateObject ca
ught
cv::Exception: %s"
,
e
.
what
());
jclass
je
=
jenv
->
FindClass
(
"org/opencv/core/CvException"
);
if
(
!
je
)
je
=
jenv
->
FindClass
(
"java/lang/Exception"
);
...
...
@@ -185,7 +185,7 @@ JNIEXPORT void JNICALL Java_org_opencv_samples_facedetect_DetectionBasedTracker_
}
catch
(...)
{
LOGD
(
"nativeDetect ca
tched
unknown exception"
);
LOGD
(
"nativeDetect ca
ught
unknown exception"
);
jclass
je
=
jenv
->
FindClass
(
"java/lang/Exception"
);
jenv
->
ThrowNew
(
je
,
"Unknown exception in JNI code {highgui::VideoCapture_n_1VideoCapture__()}"
);
}
...
...
samples/android/tutorial-3-native/jni/jni_part.cpp
View file @
8286e1a5
...
...
@@ -12,14 +12,16 @@ JNIEXPORT void JNICALL Java_org_opencv_samples_tutorial3_Sample3Native_FindFeatu
JNIEXPORT
void
JNICALL
Java_org_opencv_samples_tutorial3_Sample3Native_FindFeatures
(
JNIEnv
*
,
jobject
,
jlong
addrGray
,
jlong
addrRgba
)
{
Mat
*
pMatGr
=
(
Mat
*
)
addrGray
;
Mat
*
pMatRgb
=
(
Mat
*
)
addrRgba
;
Mat
&
mGr
=
*
(
Mat
*
)
addrGray
;
Mat
&
mRgb
=
*
(
Mat
*
)
addrRgba
;
vector
<
KeyPoint
>
v
;
FastFeatureDetector
detector
(
50
);
detector
.
detect
(
*
pMatGr
,
v
);
for
(
size_t
i
=
0
;
i
<
v
.
size
();
i
++
)
circle
(
*
pMatRgb
,
Point
(
v
[
i
].
pt
.
x
,
v
[
i
].
pt
.
y
),
10
,
Scalar
(
255
,
0
,
0
,
255
));
detector
.
detect
(
mGr
,
v
);
for
(
unsigned
int
i
=
0
;
i
<
v
.
size
();
i
++
)
{
const
KeyPoint
&
kp
=
v
[
i
];
circle
(
mRgb
,
Point
(
kp
.
pt
.
x
,
kp
.
pt
.
y
),
10
,
Scalar
(
255
,
0
,
0
,
255
));
}
}
}
samples/android/tutorial-4-mixed/jni/jni_part.cpp
View file @
8286e1a5
...
...
@@ -12,14 +12,16 @@ JNIEXPORT void JNICALL Java_org_opencv_samples_tutorial4_Sample4Mixed_FindFeatur
JNIEXPORT
void
JNICALL
Java_org_opencv_samples_tutorial4_Sample4Mixed_FindFeatures
(
JNIEnv
*
,
jobject
,
jlong
addrGray
,
jlong
addrRgba
)
{
Mat
*
pMatGr
=
(
Mat
*
)
addrGray
;
Mat
*
pMatRgb
=
(
Mat
*
)
addrRgba
;
Mat
&
mGr
=
*
(
Mat
*
)
addrGray
;
Mat
&
mRgb
=
*
(
Mat
*
)
addrRgba
;
vector
<
KeyPoint
>
v
;
FastFeatureDetector
detector
(
50
);
detector
.
detect
(
*
pMatGr
,
v
);
for
(
size_t
i
=
0
;
i
<
v
.
size
();
i
++
)
circle
(
*
pMatRgb
,
Point
(
v
[
i
].
pt
.
x
,
v
[
i
].
pt
.
y
),
10
,
Scalar
(
255
,
0
,
0
,
255
));
detector
.
detect
(
mGr
,
v
);
for
(
unsigned
int
i
=
0
;
i
<
v
.
size
();
i
++
)
{
const
KeyPoint
&
kp
=
v
[
i
];
circle
(
mRgb
,
Point
(
kp
.
pt
.
x
,
kp
.
pt
.
y
),
10
,
Scalar
(
255
,
0
,
0
,
255
));
}
}
}
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