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
54c68309
Commit
54c68309
authored
Sep 10, 2013
by
Roman Donchenko
Committed by
OpenCV Buildbot
Sep 10, 2013
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1422 from SpecLad:nat-act-upd
parents
4ee5599d
3609bb41
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
9 deletions
+10
-9
OpenCVDetectAndroidSDK.cmake
cmake/OpenCVDetectAndroidSDK.cmake
+1
-1
native.cpp
samples/android/native-activity/jni/native.cpp
+9
-8
No files found.
cmake/OpenCVDetectAndroidSDK.cmake
View file @
54c68309
...
...
@@ -283,7 +283,7 @@ macro(add_android_project target path)
ocv_include_modules_recurse
(
${
android_proj_NATIVE_DEPS
}
)
ocv_include_directories
(
"
${
path
}
/jni"
)
if
(
NATIVE_APP_GLUE AND 0
)
if
(
NATIVE_APP_GLUE
)
include_directories
(
${
ANDROID_NDK
}
/sources/android/native_app_glue
)
list
(
APPEND android_proj_jni_files
${
ANDROID_NDK
}
/sources/android/native_app_glue/android_native_app_glue.c
)
ocv_warnings_disable
(
CMAKE_C_FLAGS -Wstrict-prototypes -Wunused-parameter -Wmissing-prototypes
)
...
...
samples/android/native-activity/jni/native.cpp
View file @
54c68309
...
...
@@ -11,9 +11,10 @@
#include <math.h>
#include <queue>
#include <opencv2/core/core.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/core.hpp>
#include <opencv2/core/utility.hpp>
#include <opencv2/imgproc.hpp>
#include <opencv2/highgui.hpp>
#define LOG_TAG "OCV:libnative_activity"
#define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG,LOG_TAG,__VA_ARGS__)
...
...
@@ -115,10 +116,10 @@ static void engine_handle_cmd(android_app* app, int32_t cmd)
{
LOGI
(
"APP_CMD_INIT_WINDOW"
);
engine
->
capture
=
new
cv
::
VideoCapture
(
0
);
engine
->
capture
=
cv
::
makePtr
<
cv
::
VideoCapture
>
(
0
);
union
{
double
prop
;
const
char
*
name
;}
u
;
u
.
prop
=
engine
->
capture
->
get
(
CV_CAP_PROP_SUPPORTE
D_PREVIEW_SIZES_STRING
);
u
.
prop
=
engine
->
capture
->
get
(
cv
::
CAP_PROP_ANDROI
D_PREVIEW_SIZES_STRING
);
int
view_width
=
ANativeWindow_getWidth
(
app
->
window
);
int
view_height
=
ANativeWindow_getHeight
(
app
->
window
);
...
...
@@ -135,8 +136,8 @@ static void engine_handle_cmd(android_app* app, int32_t cmd)
if
((
camera_resolution
.
width
!=
0
)
&&
(
camera_resolution
.
height
!=
0
))
{
engine
->
capture
->
set
(
CV_
CAP_PROP_FRAME_WIDTH
,
camera_resolution
.
width
);
engine
->
capture
->
set
(
CV_
CAP_PROP_FRAME_HEIGHT
,
camera_resolution
.
height
);
engine
->
capture
->
set
(
cv
::
CAP_PROP_FRAME_WIDTH
,
camera_resolution
.
width
);
engine
->
capture
->
set
(
cv
::
CAP_PROP_FRAME_HEIGHT
,
camera_resolution
.
height
);
}
float
scale
=
std
::
min
((
float
)
view_width
/
camera_resolution
.
width
,
...
...
@@ -210,7 +211,7 @@ void android_main(android_app* app)
if
(
!
engine
.
capture
.
empty
())
{
if
(
engine
.
capture
->
grab
())
engine
.
capture
->
retrieve
(
drawing_frame
,
CV_
CAP_ANDROID_COLOR_FRAME_RGBA
);
engine
.
capture
->
retrieve
(
drawing_frame
,
cv
::
CAP_ANDROID_COLOR_FRAME_RGBA
);
char
buffer
[
256
];
sprintf
(
buffer
,
"Display performance: %dx%d @ %.3f"
,
drawing_frame
.
cols
,
drawing_frame
.
rows
,
fps
);
...
...
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