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
ccc35682
Commit
ccc35682
authored
Aug 05, 2011
by
Andrey Kamaev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed color conversion bug
parent
7db3dd4f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
6 deletions
+8
-6
jni_part.cpp
samples/android/tutorial-3-native/jni/jni_part.cpp
+8
-6
No files found.
samples/android/tutorial-3-native/jni/jni_part.cpp
View file @
ccc35682
...
@@ -8,25 +8,27 @@ using namespace std;
...
@@ -8,25 +8,27 @@ using namespace std;
using
namespace
cv
;
using
namespace
cv
;
extern
"C"
{
extern
"C"
{
JNIEXPORT
void
JNICALL
Java_org_opencv_samples_tutorial3_Sample3View_FindFeatures
(
JNIEnv
*
env
,
jobject
thiz
,
jint
width
,
jint
height
,
jbyteArray
yuv
,
jintArray
rgb
a
)
JNIEXPORT
void
JNICALL
Java_org_opencv_samples_tutorial3_Sample3View_FindFeatures
(
JNIEnv
*
env
,
jobject
thiz
,
jint
width
,
jint
height
,
jbyteArray
yuv
,
jintArray
bgr
a
)
{
{
jbyte
*
_yuv
=
env
->
GetByteArrayElements
(
yuv
,
0
);
jbyte
*
_yuv
=
env
->
GetByteArrayElements
(
yuv
,
0
);
jint
*
_
rgba
=
env
->
GetIntArrayElements
(
rgb
a
,
0
);
jint
*
_
bgra
=
env
->
GetIntArrayElements
(
bgr
a
,
0
);
Mat
myuv
(
height
+
height
/
2
,
width
,
CV_8UC1
,
(
unsigned
char
*
)
_yuv
);
Mat
myuv
(
height
+
height
/
2
,
width
,
CV_8UC1
,
(
unsigned
char
*
)
_yuv
);
Mat
m
rgba
(
height
,
width
,
CV_8UC4
,
(
unsigned
char
*
)
_rgb
a
);
Mat
m
bgra
(
height
,
width
,
CV_8UC4
,
(
unsigned
char
*
)
_bgr
a
);
Mat
mgray
(
height
,
width
,
CV_8UC1
,
(
unsigned
char
*
)
_yuv
);
Mat
mgray
(
height
,
width
,
CV_8UC1
,
(
unsigned
char
*
)
_yuv
);
cvtColor
(
myuv
,
mrgba
,
CV_YUV420i2BGR
,
4
);
//Please make attention about BGRA byte order
//ARGB stored in java as int array becomes BGRA at native level
cvtColor
(
myuv
,
mbgra
,
CV_YUV420sp2BGR
,
4
);
vector
<
KeyPoint
>
v
;
vector
<
KeyPoint
>
v
;
FastFeatureDetector
detector
(
50
);
FastFeatureDetector
detector
(
50
);
detector
.
detect
(
mgray
,
v
);
detector
.
detect
(
mgray
,
v
);
for
(
size_t
i
=
0
;
i
<
v
.
size
();
i
++
)
for
(
size_t
i
=
0
;
i
<
v
.
size
();
i
++
)
circle
(
m
rgb
a
,
Point
(
v
[
i
].
pt
.
x
,
v
[
i
].
pt
.
y
),
10
,
Scalar
(
0
,
0
,
255
,
255
));
circle
(
m
bgr
a
,
Point
(
v
[
i
].
pt
.
x
,
v
[
i
].
pt
.
y
),
10
,
Scalar
(
0
,
0
,
255
,
255
));
env
->
ReleaseIntArrayElements
(
rgba
,
_rgb
a
,
0
);
env
->
ReleaseIntArrayElements
(
bgra
,
_bgr
a
,
0
);
env
->
ReleaseByteArrayElements
(
yuv
,
_yuv
,
0
);
env
->
ReleaseByteArrayElements
(
yuv
,
_yuv
,
0
);
}
}
...
...
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