public class SCameraImage extends Object
com.samsung.android.sdk.camera.image
package.
This class allows you to create image buffer for usage of com.samsung.android.sdk.camera.image
package processing
from image byte data or from a stored image path.
It supports image buffer with high quality image size.
Supported formats are FORMAT_RGB24, FORMAT_NV21, FORMAT_YUYV. Default format is FORMAT_NV21. If we do not specify any format, then default format is taken for creating the SCameraImage instance.
If the device does not support SCamera.SCAMERA_IMAGE
feature or the SCamera
is not initialized, all methods on this class will throw an UnsupportedOperationException.Modifier and Type | Field and Description |
---|---|
static int |
FORMAT_DEFAULT |
static int |
FORMAT_NV21 |
static int |
FORMAT_RGB24 |
static int |
FORMAT_YUYV |
Constructor and Description |
---|
SCameraImage(int format,
byte[] jpegbuffer)
Creates SCameraImage for a given jpegbuffer and format.
|
SCameraImage(int width,
int height,
int format)
Creates SCameraImage for given width, height and format.
|
SCameraImage(int width,
int height,
int format,
byte[] yuvbuffer)
Creates an SCameraImage from given byte data.
|
SCameraImage(String filepath)
Creates SCameraImage from a given file path.
|
SCameraImage(String filepath,
int format)
Creates an SCameraImage for a given file path and format.
|
Modifier and Type | Method and Description |
---|---|
Bitmap |
getBitmap()
Converts the SCameraImage to Bitmap.
|
Bitmap |
getBitmap(int width,
int height)
Converts the SCameraImage to Bitmap.
|
int |
getBpp()
Gets the BPP(Bits Per Pixel).
|
int |
getFormat()
Gets the format for this image.
|
int |
getHeight()
The height of the image in pixels.
|
int |
getPixel(int x,
int y)
Gets the pixel color value.
|
byte[] |
getPixels()
Gets the Complete Pixel data.
|
int |
getWidth()
The width of the image in pixels.
|
void |
release()
Frees up the SCameraImage data and releases all resources allocated to it.
|
void |
saveAsJpeg(String pathname,
int quality)
Saves the SCameraImage with the specified quality in the specified path.
|
void |
saveAsRaw(String pathname)
Saves raw format SCameraImage in the specified path.
|
void |
setPixel(int x,
int y,
int color)
Sets the pixel color value.
|
void |
setPixels(byte[] buffer)
Sets the complete Pixel data from byte Data.
|
public static final int FORMAT_RGB24
public static final int FORMAT_NV21
public static final int FORMAT_YUYV
public static final int FORMAT_DEFAULT
public SCameraImage(String filepath)
filepath
- Complete path name for the image fileIllegalArgumentException
- if file does not existpublic SCameraImage(int width, int height, int format)
width
- The width of the imageheight
- The height of the imageformat
- Image formatIllegalArgumentException
- If width or height is smaller than 0 or the unsupported format.FORMAT_RGB24
,
FORMAT_NV21
,
FORMAT_YUYV
public SCameraImage(int width, int height, int format, byte[] yuvbuffer)
width
- The width of the imageheight
- The height of the imageformat
- Image formatyuvbuffer
- Byte array of image dataIllegalArgumentException
- If yuvbuffer is null, width or height is smaller than 0 or the unsupported format.FORMAT_RGB24
,
FORMAT_NV21
,
FORMAT_YUYV
public SCameraImage(String filepath, int format)
filepath
- Complete path name for the image fileformat
- Image formatIllegalArgumentException
- If file does not exist or unsupported format.FORMAT_RGB24
,
FORMAT_NV21
,
FORMAT_YUYV
public SCameraImage(int format, byte[] jpegbuffer)
jpegbuffer
- byte array of the image fileformat
- Image formatIllegalArgumentException
- If data is null or an unsupported format.FORMAT_RGB24
,
FORMAT_NV21
,
FORMAT_YUYV
public int getWidth()
public int getHeight()
public int getFormat()
public int getPixel(int x, int y)
x
- X-ordinatey
- Y-ordinateIllegalArgumentException
- If x or y is smaller than 0 or bigger than image size.public void setPixel(int x, int y, int color)
x
- X-ordinatey
- Y-ordinatecolor
- Color ValuesIllegalArgumentException
- If x or y is smaller than 0 or bigger than image size. If SCameraImage has an unsupported format.public void saveAsJpeg(String pathname, int quality)
pathname
- Complete path name for the output image filequality
- Image JpegQualityIllegalArgumentException
- If pathname is null or cannot make given path or quality is invalid.public void saveAsRaw(String pathname)
pathname
- Complete path name for the output image fileIllegalArgumentException
- If pathname is null or cannot make given path.public byte[] getPixels()
IllegalArgumentException
- If data is null.public void setPixels(byte[] buffer)
buffer
- Byte Pixel DataIllegalArgumentException
- If buffer is null or buffer is too short.public int getBpp()
IllegalArgumentException
- If data is null.public void release()
public Bitmap getBitmap()
IllegalArgumentException
- if data is nullpublic Bitmap getBitmap(int width, int height)
IllegalArgumentException
- If data is null or param has too short or too big.Copyright © Samsung Electronics, Co., Ltd. All rights reserved.