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
3609bb41
Commit
3609bb41
authored
Sep 09, 2013
by
Roman Donchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updated the native activity sample to master's API.
parent
59dd5aea
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
8 deletions
+9
-8
native.cpp
samples/android/native-activity/jni/native.cpp
+9
-8
No files found.
samples/android/native-activity/jni/native.cpp
View file @
3609bb41
...
...
@@ -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