|
OpenCV 3.0.0 | |||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.opencv.android.Utils
public class Utils
Constructor Summary | |
---|---|
Utils()
|
Method Summary | |
---|---|
static void |
bitmapToMat(android.graphics.Bitmap bmp,
Mat mat)
Short form of the bitmapToMat(bmp, mat, unPremultiplyAlpha=false). |
static void |
bitmapToMat(android.graphics.Bitmap bmp,
Mat mat,
boolean unPremultiplyAlpha)
Converts Android Bitmap to OpenCV Mat. |
static java.lang.String |
exportResource(android.content.Context context,
int resourceId)
|
static java.lang.String |
exportResource(android.content.Context context,
int resourceId,
java.lang.String dirname)
|
static Mat |
loadResource(android.content.Context context,
int resourceId)
|
static Mat |
loadResource(android.content.Context context,
int resourceId,
int flags)
|
static void |
matToBitmap(Mat mat,
android.graphics.Bitmap bmp)
Short form of the matToBitmap(mat, bmp, premultiplyAlpha=false) |
static void |
matToBitmap(Mat mat,
android.graphics.Bitmap bmp,
boolean premultiplyAlpha)
Converts OpenCV Mat to Android Bitmap. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Utils()
Method Detail |
---|
public static void bitmapToMat(android.graphics.Bitmap bmp, Mat mat)
bmp
- is a valid input Bitmap object of the type 'ARGB_8888' or 'RGB_565'.mat
- is a valid output Mat object, it will be reallocated if needed, so Mat may be empty.public static void bitmapToMat(android.graphics.Bitmap bmp, Mat mat, boolean unPremultiplyAlpha)
This function converts an Android Bitmap image to the OpenCV Mat.
'ARGB_8888' and 'RGB_565' input Bitmap formats are supported.
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.
This function throws an exception if the conversion fails.
bmp
- is a valid input Bitmap object of the type 'ARGB_8888' or 'RGB_565'.mat
- is a valid output Mat object, it will be reallocated if needed, so it may be empty.unPremultiplyAlpha
- is a flag, that determines, whether the bitmap needs to be converted from alpha premultiplied format (like Android keeps 'ARGB_8888' ones) to regular one; this flag is ignored for 'RGB_565' bitmaps.public static java.lang.String exportResource(android.content.Context context, int resourceId)
public static java.lang.String exportResource(android.content.Context context, int resourceId, java.lang.String dirname)
public static Mat loadResource(android.content.Context context, int resourceId) throws java.io.IOException
java.io.IOException
public static Mat loadResource(android.content.Context context, int resourceId, int flags) throws java.io.IOException
java.io.IOException
public static void matToBitmap(Mat mat, android.graphics.Bitmap bmp)
mat
- is a valid input Mat object of the types 'CV_8UC1', 'CV_8UC3' or 'CV_8UC4'.bmp
- is a valid Bitmap object of the same size as the Mat and of type 'ARGB_8888' or 'RGB_565'.public static void matToBitmap(Mat mat, android.graphics.Bitmap bmp, boolean premultiplyAlpha)
This function converts an image in the OpenCV Mat representation to the Android Bitmap.
The input Mat object has to be of the types 'CV_8UC1' (gray-scale), 'CV_8UC3' (RGB) or 'CV_8UC4' (RGBA).
The output Bitmap object has to be of the same size as the input Mat and of the types 'ARGB_8888' or 'RGB_565'.
This function throws an exception if the conversion fails.
mat
- is a valid input Mat object of types 'CV_8UC1', 'CV_8UC3' or 'CV_8UC4'.bmp
- is a valid Bitmap object of the same size as the Mat and of type 'ARGB_8888' or 'RGB_565'.premultiplyAlpha
- is a flag, that determines, whether the Mat needs to be converted to alpha premultiplied format (like Android keeps 'ARGB_8888' bitmaps); the flag is ignored for 'RGB_565' bitmaps.
|
OpenCV 3.0.0 Documentation | |||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |