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
fe991052
Commit
fe991052
authored
Feb 15, 2012
by
Andrey Pavlenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#1283, adding JavaDoc comments for Mat <->Bitmap converters.
parent
0588e626
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
0 deletions
+24
-0
android+Utils.java
modules/java/src/java/android+Utils.java
+24
-0
No files found.
modules/java/src/java/android+Utils.java
View file @
fe991052
...
...
@@ -73,6 +73,18 @@ public class Utils {
return
decoded
;
}
/**
* Converts Android Bitmap to OpenCV Mat.
* <p>
* The function converts an image in the Android Bitmap representation to the OpenCV Mat.
* <br>The 'ARGB_8888' and 'RGB_565' input Bitmap formats are supported.
* <br>The output Mat is always created of the same size as the input Bitmap and of the 'CV_8UC4' type,
* it keeps the image in RGBA format.
* <br>The function throws an exception if the conversion fails.
*
* @param b is a valid input Bitmap object of the type 'ARGB_8888' or 'RGB_565'.
* @param m is a valid output Mat object, it will be reallocated if needed, so it's possible to pass an empty Mat.
*/
public
static
void
bitmapToMat
(
Bitmap
b
,
Mat
m
)
{
if
(
b
==
null
)
throw
new
java
.
lang
.
IllegalArgumentException
(
"Bitmap b == null"
);
...
...
@@ -81,6 +93,18 @@ public class Utils {
nBitmapToMat
(
b
,
m
.
nativeObj
);
}
/**
* Converts OpenCV Mat to Android Bitmap.
* <p>
* <br>The function converts an image in the OpenCV Mat representation to the Android Bitmap.
* <br>The input Mat object has to be of the types 'CV_8UC1' (gray-scale), 'CV_8UC3' (RGB) or 'CV_8UC4' (RGBA).
* <br>The output Bitmap object has to be of the same size as the input Mat and of the types 'ARGB_8888' or 'RGB_565'.
* <br>The function throws an exception if the conversion fails.
*
* @param m is a valid input Mat object of the types 'CV_8UC1', 'CV_8UC3' or 'CV_8UC4'.
* @param b is a valid Bitmap object of the same size as the Mat m and of type 'ARGB_8888' or 'RGB_565'.
*/
public
static
void
matToBitmap
(
Mat
m
,
Bitmap
b
)
{
if
(
m
==
null
)
throw
new
java
.
lang
.
IllegalArgumentException
(
"Mat m == 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