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
3780685f
Commit
3780685f
authored
May 31, 2012
by
Alexander Smorkalov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
CodeReview #1512 notes fixed.
parent
834a0b51
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
139 additions
and
90 deletions
+139
-90
Android.mk
samples/android/face-detection/jni/Android.mk
+4
-3
DetectionBasedTracker_jni.cpp
.../android/face-detection/jni/DetectionBasedTracker_jni.cpp
+49
-13
DetectionBasedTracker_jni.h
...es/android/face-detection/jni/DetectionBasedTracker_jni.h
+15
-15
DetectionBasedTracker.java
...tion/src/org/opencv/samples/fd/DetectionBasedTracker.java
+13
-13
FdActivity.java
.../face-detection/src/org/opencv/samples/fd/FdActivity.java
+5
-4
FdView.java
...roid/face-detection/src/org/opencv/samples/fd/FdView.java
+53
-42
No files found.
samples/android/face-detection/jni/Android.mk
View file @
3780685f
...
...
@@ -12,10 +12,10 @@ else
include $(OPENCV_MK_PATH)
endif
LOCAL_SRC_FILES := DetectionBase
Tracker
.cpp
LOCAL_C_INCLUDES := $(LOCAL_PATH)
LOCAL_SRC_FILES := DetectionBase
dTracker_jni
.cpp
LOCAL_C_INCLUDES := $(LOCAL_PATH)
LOCAL_LDLIBS += -llog -ldl
LOCAL_MODULE := detection_base_tacker
LOCAL_MODULE := detection_base
d
_tacker
include $(BUILD_SHARED_LIBRARY)
\ No newline at end of file
samples/android/face-detection/jni/DetectionBase
Tracker
.cpp
→
samples/android/face-detection/jni/DetectionBase
dTracker_jni
.cpp
View file @
3780685f
#include <DetectionBase
Tracker
.h>
#include <opencv2/core/core.hpp>
#include <DetectionBase
dTracker_jni
.h>
#include <opencv2/core/core.hpp>
#include <opencv2/contrib/detection_based_tracker.hpp>
#include <string>
...
...
@@ -13,14 +13,12 @@
using
namespace
std
;
using
namespace
cv
;
vector
<
Rect
>
RectFaces
;
inline
void
vector_Rect_to_Mat
(
vector
<
Rect
>&
v_rect
,
Mat
&
mat
)
{
mat
=
Mat
(
v_rect
,
true
);
}
JNIEXPORT
jlong
JNICALL
Java_org_opencv_samples_fd_DetectionBaseTracker_nativeCreateObject
JNIEXPORT
jlong
JNICALL
Java_org_opencv_samples_fd_DetectionBase
d
Tracker_nativeCreateObject
(
JNIEnv
*
jenv
,
jclass
jobj
,
jstring
jFileName
,
jint
faceSize
)
{
const
char
*
jnamestr
=
jenv
->
GetStringUTFChars
(
jFileName
,
NULL
);
...
...
@@ -42,11 +40,18 @@ JNIEXPORT jlong JNICALL Java_org_opencv_samples_fd_DetectionBaseTracker_nativeCr
je
=
jenv
->
FindClass
(
"java/lang/Exception"
);
jenv
->
ThrowNew
(
je
,
e
.
what
());
}
catch
(...)
{
LOGD
(
"nativeCreateObject catched unknown exception"
);
jclass
je
=
jenv
->
FindClass
(
"java/lang/Exception"
);
jenv
->
ThrowNew
(
je
,
"Unknown exception in JNI code {highgui::VideoCapture_n_1VideoCapture__()}"
);
return
0
;
}
return
result
;
}
JNIEXPORT
void
JNICALL
Java_org_opencv_samples_fd_DetectionBaseTracker_nativeDestroyObject
JNIEXPORT
void
JNICALL
Java_org_opencv_samples_fd_DetectionBase
d
Tracker_nativeDestroyObject
(
JNIEnv
*
jenv
,
jclass
jobj
,
jlong
thiz
)
{
try
...
...
@@ -62,9 +67,15 @@ JNIEXPORT void JNICALL Java_org_opencv_samples_fd_DetectionBaseTracker_nativeDes
je
=
jenv
->
FindClass
(
"java/lang/Exception"
);
jenv
->
ThrowNew
(
je
,
e
.
what
());
}
catch
(...)
{
LOGD
(
"nativeDestroyObject catched unknown exception"
);
jclass
je
=
jenv
->
FindClass
(
"java/lang/Exception"
);
jenv
->
ThrowNew
(
je
,
"Unknown exception in JNI code {highgui::VideoCapture_n_1VideoCapture__()}"
);
}
}
JNIEXPORT
void
JNICALL
Java_org_opencv_samples_fd_DetectionBaseTracker_nativeStart
JNIEXPORT
void
JNICALL
Java_org_opencv_samples_fd_DetectionBase
d
Tracker_nativeStart
(
JNIEnv
*
jenv
,
jclass
jobj
,
jlong
thiz
)
{
try
...
...
@@ -79,10 +90,15 @@ JNIEXPORT void JNICALL Java_org_opencv_samples_fd_DetectionBaseTracker_nativeSta
je
=
jenv
->
FindClass
(
"java/lang/Exception"
);
jenv
->
ThrowNew
(
je
,
e
.
what
());
}
catch
(...)
{
LOGD
(
"nativeStart catched unknown exception"
);
jclass
je
=
jenv
->
FindClass
(
"java/lang/Exception"
);
jenv
->
ThrowNew
(
je
,
"Unknown exception in JNI code {highgui::VideoCapture_n_1VideoCapture__()}"
);
}
}
JNIEXPORT
void
JNICALL
Java_org_opencv_samples_fd_DetectionBaseTracker_nativeStop
JNIEXPORT
void
JNICALL
Java_org_opencv_samples_fd_DetectionBase
d
Tracker_nativeStop
(
JNIEnv
*
jenv
,
jclass
jobj
,
jlong
thiz
)
{
try
...
...
@@ -97,9 +113,15 @@ JNIEXPORT void JNICALL Java_org_opencv_samples_fd_DetectionBaseTracker_nativeSto
je
=
jenv
->
FindClass
(
"java/lang/Exception"
);
jenv
->
ThrowNew
(
je
,
e
.
what
());
}
catch
(...)
{
LOGD
(
"nativeStop catched unknown exception"
);
jclass
je
=
jenv
->
FindClass
(
"java/lang/Exception"
);
jenv
->
ThrowNew
(
je
,
"Unknown exception in JNI code {highgui::VideoCapture_n_1VideoCapture__()}"
);
}
}
JNIEXPORT
void
JNICALL
Java_org_opencv_samples_fd_DetectionBaseTracker_nativeSetFaceSize
JNIEXPORT
void
JNICALL
Java_org_opencv_samples_fd_DetectionBase
d
Tracker_nativeSetFaceSize
(
JNIEnv
*
jenv
,
jclass
jobj
,
jlong
thiz
,
jint
faceSize
)
{
try
...
...
@@ -120,15 +142,22 @@ JNIEXPORT void JNICALL Java_org_opencv_samples_fd_DetectionBaseTracker_nativeSet
if
(
!
je
)
je
=
jenv
->
FindClass
(
"java/lang/Exception"
);
jenv
->
ThrowNew
(
je
,
e
.
what
());
}
}
catch
(...)
{
LOGD
(
"nativeSetFaceSize catched unknown exception"
);
jclass
je
=
jenv
->
FindClass
(
"java/lang/Exception"
);
jenv
->
ThrowNew
(
je
,
"Unknown exception in JNI code {highgui::VideoCapture_n_1VideoCapture__()}"
);
}
}
JNIEXPORT
void
JNICALL
Java_org_opencv_samples_fd_DetectionBaseTracker_nativeDetect
JNIEXPORT
void
JNICALL
Java_org_opencv_samples_fd_DetectionBase
d
Tracker_nativeDetect
(
JNIEnv
*
jenv
,
jclass
jobj
,
jlong
thiz
,
jlong
imageGray
,
jlong
faces
)
{
try
{
vector
<
Rect
>
RectFaces
;
((
DetectionBasedTracker
*
)
thiz
)
->
process
(
*
((
Mat
*
)
imageGray
));
((
DetectionBasedTracker
*
)
thiz
)
->
getObjects
(
RectFaces
);
vector_Rect_to_Mat
(
RectFaces
,
*
((
Mat
*
)
faces
));
...
...
@@ -137,8 +166,14 @@ JNIEXPORT void JNICALL Java_org_opencv_samples_fd_DetectionBaseTracker_nativeDet
{
LOGD
(
"nativeCreateObject catched cv::Exception: %s"
,
e
.
what
());
jclass
je
=
jenv
->
FindClass
(
"org/opencv/core/CvException"
);
if
(
!
je
)
if
(
!
je
)
je
=
jenv
->
FindClass
(
"java/lang/Exception"
);
jenv
->
ThrowNew
(
je
,
e
.
what
());
}
catch
(...)
{
LOGD
(
"nativeDetect catched unknown exception"
);
jclass
je
=
jenv
->
FindClass
(
"java/lang/Exception"
);
jenv
->
ThrowNew
(
je
,
"Unknown exception in JNI code {highgui::VideoCapture_n_1VideoCapture__()}"
);
}
}
\ No newline at end of file
samples/android/face-detection/jni/DetectionBase
Tracker
.h
→
samples/android/face-detection/jni/DetectionBase
dTracker_jni
.h
View file @
3780685f
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class org_opencv_samples_fd_DetectionBaseTracker */
/* Header for class org_opencv_samples_fd_DetectionBase
d
Tracker */
#ifndef _Included_org_opencv_samples_fd_DetectionBaseTracker
#define _Included_org_opencv_samples_fd_DetectionBaseTracker
#ifndef _Included_org_opencv_samples_fd_DetectionBase
d
Tracker
#define _Included_org_opencv_samples_fd_DetectionBase
d
Tracker
#ifdef __cplusplus
extern
"C"
{
#endif
/*
* Class: org_opencv_samples_fd_DetectionBaseTracker
* Class: org_opencv_samples_fd_DetectionBase
d
Tracker
* Method: nativeCreateObject
* Signature: (Ljava/lang/String;F)J
*/
JNIEXPORT
jlong
JNICALL
Java_org_opencv_samples_fd_DetectionBaseTracker_nativeCreateObject
JNIEXPORT
jlong
JNICALL
Java_org_opencv_samples_fd_DetectionBase
d
Tracker_nativeCreateObject
(
JNIEnv
*
,
jclass
,
jstring
,
jint
);
/*
* Class: org_opencv_samples_fd_DetectionBaseTracker
* Class: org_opencv_samples_fd_DetectionBase
d
Tracker
* Method: nativeDestroyObject
* Signature: (J)V
*/
JNIEXPORT
void
JNICALL
Java_org_opencv_samples_fd_DetectionBaseTracker_nativeDestroyObject
JNIEXPORT
void
JNICALL
Java_org_opencv_samples_fd_DetectionBase
d
Tracker_nativeDestroyObject
(
JNIEnv
*
,
jclass
,
jlong
);
/*
* Class: org_opencv_samples_fd_DetectionBaseTracker
* Class: org_opencv_samples_fd_DetectionBase
d
Tracker
* Method: nativeStart
* Signature: (J)V
*/
JNIEXPORT
void
JNICALL
Java_org_opencv_samples_fd_DetectionBaseTracker_nativeStart
JNIEXPORT
void
JNICALL
Java_org_opencv_samples_fd_DetectionBase
d
Tracker_nativeStart
(
JNIEnv
*
,
jclass
,
jlong
);
/*
* Class: org_opencv_samples_fd_DetectionBaseTracker
* Class: org_opencv_samples_fd_DetectionBase
d
Tracker
* Method: nativeStop
* Signature: (J)V
*/
JNIEXPORT
void
JNICALL
Java_org_opencv_samples_fd_DetectionBaseTracker_nativeStop
JNIEXPORT
void
JNICALL
Java_org_opencv_samples_fd_DetectionBase
d
Tracker_nativeStop
(
JNIEnv
*
,
jclass
,
jlong
);
/*
* Class: org_opencv_samples_fd_DetectionBaseTracker
* Class: org_opencv_samples_fd_DetectionBase
d
Tracker
* Method: nativeSetFaceSize
* Signature: (JI)V
*/
JNIEXPORT
void
JNICALL
Java_org_opencv_samples_fd_DetectionBaseTracker_nativeSetFaceSize
JNIEXPORT
void
JNICALL
Java_org_opencv_samples_fd_DetectionBase
d
Tracker_nativeSetFaceSize
(
JNIEnv
*
,
jclass
,
jlong
,
jint
);
/*
* Class: org_opencv_samples_fd_DetectionBaseTracker
* Class: org_opencv_samples_fd_DetectionBase
d
Tracker
* Method: nativeDetect
* Signature: (JJJ)V
*/
JNIEXPORT
void
JNICALL
Java_org_opencv_samples_fd_DetectionBaseTracker_nativeDetect
JNIEXPORT
void
JNICALL
Java_org_opencv_samples_fd_DetectionBase
d
Tracker_nativeDetect
(
JNIEnv
*
,
jclass
,
jlong
,
jlong
,
jlong
);
#ifdef __cplusplus
...
...
samples/android/face-detection/src/org/opencv/samples/fd/DetectionBaseTracker.java
→
samples/android/face-detection/src/org/opencv/samples/fd/DetectionBase
d
Tracker.java
View file @
3780685f
...
...
@@ -3,11 +3,11 @@ package org.opencv.samples.fd;
import
org.opencv.core.Mat
;
import
org.opencv.core.MatOfRect
;
public
class
DetectionBaseTracker
public
class
DetectionBase
d
Tracker
{
public
DetectionBase
Tracker
(
String
filename
,
int
f
aceSize
)
public
DetectionBase
dTracker
(
String
cascadeName
,
int
minF
aceSize
)
{
mNativeObj
=
nativeCreateObject
(
filename
,
f
aceSize
);
mNativeObj
=
nativeCreateObject
(
cascadeName
,
minF
aceSize
);
}
public
void
start
()
...
...
@@ -20,9 +20,9 @@ public class DetectionBaseTracker
nativeStop
(
mNativeObj
);
}
public
void
setMinFaceSize
(
int
faceS
ize
)
public
void
setMinFaceSize
(
int
s
ize
)
{
nativeSetFaceSize
(
mNativeObj
,
faceS
ize
);
nativeSetFaceSize
(
mNativeObj
,
s
ize
);
}
public
void
detect
(
Mat
imageGray
,
MatOfRect
faces
)
...
...
@@ -36,17 +36,17 @@ public class DetectionBaseTracker
mNativeObj
=
0
;
}
pr
otected
long
mNativeObj
=
0
;
pr
ivate
long
mNativeObj
=
0
;
pr
otected
static
native
long
nativeCreateObject
(
String
filename
,
int
f
aceSize
);
pr
otected
static
native
void
nativeDestroyObject
(
long
thiz
);
pr
otected
static
native
void
nativeStart
(
long
thiz
);
pr
otected
static
native
void
nativeStop
(
long
thiz
);
pr
otected
static
native
void
nativeSetFaceSize
(
long
thiz
,
int
faceS
ize
);
pr
otected
static
native
void
nativeDetect
(
long
thiz
,
long
inputImage
,
long
resultMat
);
pr
ivate
static
native
long
nativeCreateObject
(
String
cascadeName
,
int
minF
aceSize
);
pr
ivate
static
native
void
nativeDestroyObject
(
long
thiz
);
pr
ivate
static
native
void
nativeStart
(
long
thiz
);
pr
ivate
static
native
void
nativeStop
(
long
thiz
);
pr
ivate
static
native
void
nativeSetFaceSize
(
long
thiz
,
int
s
ize
);
pr
ivate
static
native
void
nativeDetect
(
long
thiz
,
long
inputImage
,
long
faces
);
static
{
System
.
loadLibrary
(
"detection_base_tacker"
);
System
.
loadLibrary
(
"detection_base
d
_tacker"
);
}
}
samples/android/face-detection/src/org/opencv/samples/fd/FdActivity.java
View file @
3780685f
...
...
@@ -26,8 +26,8 @@ public class FdActivity extends Activity {
public
FdActivity
()
{
Log
.
i
(
TAG
,
"Instantiated new "
+
this
.
getClass
());
mDetectorName
=
new
String
[
2
];
mDetectorName
[
0
]
=
"Cascade
"
;
mDetectorName
[
1
]
=
"DBT
"
;
mDetectorName
[
FdView
.
JAVA_DETECTOR
]
=
"Java
"
;
mDetectorName
[
FdView
.
NATIVE_DETECTOR
]
=
"Native (tracking)
"
;
}
@Override
...
...
@@ -62,7 +62,8 @@ public class FdActivity extends Activity {
super
.
onCreate
(
savedInstanceState
);
requestWindowFeature
(
Window
.
FEATURE_NO_TITLE
);
mView
=
new
FdView
(
this
);
mView
.
setDtetectorType
(
mDetectorType
);
mView
.
setDetectorType
(
mDetectorType
);
mView
.
setMinFaceSize
(
0.2f
);
setContentView
(
mView
);
}
...
...
@@ -93,7 +94,7 @@ public class FdActivity extends Activity {
{
mDetectorType
=
(
mDetectorType
+
1
)
%
mDetectorName
.
length
;
item
.
setTitle
(
mDetectorName
[
mDetectorType
]);
mView
.
setD
t
etectorType
(
mDetectorType
);
mView
.
setDetectorType
(
mDetectorType
);
}
return
true
;
}
...
...
samples/android/face-detection/src/org/opencv/samples/fd/FdView.java
View file @
3780685f
...
...
@@ -22,45 +22,44 @@ import android.util.Log;
import
android.view.SurfaceHolder
;
class
FdView
extends
SampleCvViewBase
{
private
static
final
String
TAG
=
"Sample::FdView"
;
private
Mat
mRgba
;
private
Mat
mGray
;
private
File
mCascadeFile
;
private
CascadeClassifier
mCascade
;
private
DetectionBaseTracker
mTracker
;
public
final
int
CASCADE_DETECTOR
=
0
;
public
final
int
DBT_DETECTOR
=
1
;
private
static
final
String
TAG
=
"Sample::FdView"
;
private
Mat
mRgba
;
private
Mat
mGray
;
private
File
mCascadeFile
;
private
CascadeClassifier
mJavaDetector
;
private
DetectionBasedTracker
mNativeDetector
;
private
static
final
Scalar
FACE_RECT_COLOR
=
new
Scalar
(
0
,
255
,
0
,
255
);
private
int
mDetectorType
=
CASCADE_DETECTOR
;
public
static
final
int
JAVA_DETECTOR
=
0
;
public
static
final
int
NATIVE_DETECTOR
=
1
;
private
int
mDetectorType
=
JAVA_DETECTOR
;
public
static
int
mFaceSize
=
200
;
private
float
mRelativeFaceSize
=
0
;
private
int
mAbsoluteFaceSize
=
0
;
public
void
setMinFaceSize
(
float
faceSize
)
{
int
height
=
mGray
.
rows
();
if
(
Math
.
round
(
height
*
faceSize
)
>
0
);
{
mFaceSize
=
Math
.
round
(
height
*
faceSize
);
}
mTracker
.
setMinFaceSize
(
mFaceSize
);
mRelativeFaceSize
=
faceSize
;
mAbsoluteFaceSize
=
0
;
}
public
void
setD
t
etectorType
(
int
type
)
public
void
setDetectorType
(
int
type
)
{
if
(
mDetectorType
!=
type
)
{
mDetectorType
=
type
;
if
(
type
==
DBT
_DETECTOR
)
if
(
type
==
NATIVE
_DETECTOR
)
{
Log
.
i
(
TAG
,
"Detection Base Tracker enabled"
);
m
Tracke
r
.
start
();
Log
.
i
(
TAG
,
"Detection Base
d
Tracker enabled"
);
m
NativeDetecto
r
.
start
();
}
else
{
Log
.
i
(
TAG
,
"Cascade detect
i
or enabled"
);
m
Tracke
r
.
stop
();
Log
.
i
(
TAG
,
"Cascade detector enabled"
);
m
NativeDetecto
r
.
stop
();
}
}
}
...
...
@@ -82,14 +81,14 @@ class FdView extends SampleCvViewBase {
is
.
close
();
os
.
close
();
m
Cascade
=
new
CascadeClassifier
(
mCascadeFile
.
getAbsolutePath
());
if
(
m
Cascade
.
empty
())
{
m
JavaDetector
=
new
CascadeClassifier
(
mCascadeFile
.
getAbsolutePath
());
if
(
m
JavaDetector
.
empty
())
{
Log
.
e
(
TAG
,
"Failed to load cascade classifier"
);
m
Cascade
=
null
;
m
JavaDetector
=
null
;
}
else
Log
.
i
(
TAG
,
"Loaded cascade classifier from "
+
mCascadeFile
.
getAbsolutePath
());
m
Tracker
=
new
DetectionBase
Tracker
(
mCascadeFile
.
getAbsolutePath
(),
0
);
m
NativeDetector
=
new
DetectionBased
Tracker
(
mCascadeFile
.
getAbsolutePath
(),
0
);
cascadeDir
.
delete
();
...
...
@@ -115,37 +114,49 @@ class FdView extends SampleCvViewBase {
capture
.
retrieve
(
mRgba
,
Highgui
.
CV_CAP_ANDROID_COLOR_FRAME_RGBA
);
capture
.
retrieve
(
mGray
,
Highgui
.
CV_CAP_ANDROID_GREY_FRAME
);
if
(
mAbsoluteFaceSize
==
0
)
{
int
height
=
mGray
.
rows
();
if
(
Math
.
round
(
height
*
mRelativeFaceSize
)
>
0
);
{
mAbsoluteFaceSize
=
Math
.
round
(
height
*
mRelativeFaceSize
);
}
mNativeDetector
.
setMinFaceSize
(
mAbsoluteFaceSize
);
}
MatOfRect
faces
=
new
MatOfRect
();
if
(
mDetectorType
==
CASCADE
_DETECTOR
)
if
(
mDetectorType
==
JAVA
_DETECTOR
)
{
if
(
m
Cascade
!=
null
)
m
Cascade
.
detectMultiScale
(
mGray
,
faces
,
1.1
,
2
,
2
// TODO: objdetect.CV_HAAR_SCALE_IMAGE
,
new
Size
(
m
FaceSize
,
m
FaceSize
),
new
Size
());
if
(
m
JavaDetector
!=
null
)
m
JavaDetector
.
detectMultiScale
(
mGray
,
faces
,
1.1
,
2
,
2
// TODO: objdetect.CV_HAAR_SCALE_IMAGE
,
new
Size
(
m
AbsoluteFaceSize
,
mAbsolute
FaceSize
),
new
Size
());
}
else
if
(
mDetectorType
==
DBT
_DETECTOR
)
else
if
(
mDetectorType
==
NATIVE
_DETECTOR
)
{
if
(
m
Tracke
r
!=
null
)
m
Tracke
r
.
detect
(
mGray
,
faces
);
if
(
m
NativeDetecto
r
!=
null
)
m
NativeDetecto
r
.
detect
(
mGray
,
faces
);
}
else
{
Log
.
e
(
TAG
,
"Detection method is not selected!"
);
}
for
(
Rect
r
:
faces
.
toArray
())
Core
.
rectangle
(
mRgba
,
r
.
tl
(),
r
.
br
(),
new
Scalar
(
0
,
255
,
0
,
255
),
3
);
Rect
[]
facesArray
=
faces
.
toArray
();
for
(
int
i
=
0
;
i
<
facesArray
.
length
;
i
++)
Core
.
rectangle
(
mRgba
,
facesArray
[
i
].
tl
(),
facesArray
[
i
].
br
(),
FACE_RECT_COLOR
,
3
);
Bitmap
bmp
=
Bitmap
.
createBitmap
(
mRgba
.
cols
(),
mRgba
.
rows
(),
Bitmap
.
Config
.
RGB_565
/*.ARGB_8888*/
);
Bitmap
bmp
=
Bitmap
.
createBitmap
(
mRgba
.
cols
(),
mRgba
.
rows
(),
Bitmap
.
Config
.
ARGB_8888
);
try
{
Utils
.
matToBitmap
(
mRgba
,
bmp
);
return
bmp
;
}
catch
(
Exception
e
)
{
Log
.
e
(
"org.opencv.samples.puzzle15"
,
"Utils.matToBitmap() throws an exception: "
+
e
.
getMessage
());
Log
.
e
(
TAG
,
"Utils.matToBitmap() throws an exception: "
+
e
.
getMessage
());
bmp
.
recycle
();
return
null
;
bmp
=
null
;
}
return
bmp
;
}
@Override
...
...
@@ -160,8 +171,8 @@ class FdView extends SampleCvViewBase {
mGray
.
release
();
if
(
mCascadeFile
!=
null
)
mCascadeFile
.
delete
();
if
(
m
Tracke
r
!=
null
)
m
Tracke
r
.
release
();
if
(
m
NativeDetecto
r
!=
null
)
m
NativeDetecto
r
.
release
();
mRgba
=
null
;
mGray
=
null
;
...
...
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