@Deprecated
public final class SDngCreator
extends java.lang.Object
implements java.lang.AutoCloseable
SDngCreator
class provides functions to write raw pixel data as a DNG file.
This class is designed to be used with the ImageFormat.RAW_SENSOR
buffers available from SCameraDevice
, or with Bayer-type raw
pixel data that is otherwise generated by an application. The DNG metadata tags will be
generated from a SCaptureResult
object or set directly.
The DNG file format is a cross-platform file format that is used to store pixel data from camera sensors with minimal pre-processing applied. DNG files allow for pixel data to be defined in a user-defined colorspace, and have associated metadata that allow for this pixel data to be converted to the standard CIE XYZ colorspace during post-processing.
For more information on the DNG file format and associated metadata, please refer to the Adobe DNG 1.4.0.0 specification.
Modifier and Type | Field and Description |
---|---|
static int |
MAX_THUMBNAIL_DIMENSION
Deprecated.
Max width or height dimension for thumbnails.
|
Constructor and Description |
---|
SDngCreator(SCameraCharacteristics characteristics,
SCaptureResult metadata)
Deprecated.
Create a new DNG object.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Deprecated.
Closes the object and release any system resources it holds.
|
SDngCreator |
setDescription(java.lang.String description)
Deprecated.
Set the user description string to write.
|
SDngCreator |
setLocation(android.location.Location location)
Deprecated.
Set image location metadata.
|
SDngCreator |
setOrientation(int orientation)
Deprecated.
Set the orientation value to write.
|
SDngCreator |
setThumbnail(android.graphics.Bitmap pixels)
Deprecated.
Set the thumbnail image.
|
SDngCreator |
setThumbnail(android.media.Image pixels)
Deprecated.
Set the thumbnail image.
|
void |
writeByteBuffer(java.io.OutputStream dngOutput,
android.util.Size size,
java.nio.ByteBuffer pixels,
long offset)
Deprecated.
Write the
ImageFormat.RAW_SENSOR pixel data to a DNG file with
the currently configured metadata. |
void |
writeImage(java.io.OutputStream dngOutput,
android.media.Image pixels)
Deprecated.
Write the pixel data to a DNG file with the currently configured metadata.
|
void |
writeInputStream(java.io.OutputStream dngOutput,
android.util.Size size,
java.io.InputStream pixels,
long offset)
Deprecated.
Write the
ImageFormat.RAW_SENSOR pixel data to a DNG file with
the currently configured metadata. |
public static final int MAX_THUMBNAIL_DIMENSION
public SDngCreator(SCameraCharacteristics characteristics, SCaptureResult metadata)
It is not necessary to call any set methods to write a well-formatted DNG file.
DNG metadata tags will be generated from the corresponding parameters in the
SCaptureResult
object.
For best quality DNG files, it is strongly recommended that lens shading map output is
enabled if supported. See SCaptureRequest.STATISTICS_LENS_SHADING_MAP_MODE
.
characteristics
- an object containing the static
SCameraCharacteristics
.metadata
- a metadata object to generate tags from.java.lang.IllegalArgumentException
- if characteristics or metadata is invalid.public SDngCreator setOrientation(int orientation)
This will be written as the TIFF "Orientation" tag (0x0112)
.
Calling this will override any prior settings for this tag.
orientation
- the orientation value to set, one of:
ExifInterface.ORIENTATION_NORMAL
ExifInterface.ORIENTATION_FLIP_HORIZONTAL
ExifInterface.ORIENTATION_ROTATE_180
ExifInterface.ORIENTATION_FLIP_VERTICAL
ExifInterface.ORIENTATION_TRANSPOSE
ExifInterface.ORIENTATION_ROTATE_90
ExifInterface.ORIENTATION_TRANSVERSE
ExifInterface.ORIENTATION_ROTATE_270
SDngCreator(com.samsung.android.sdk.camera.SCameraCharacteristics, com.samsung.android.sdk.camera.SCaptureResult)
object.java.lang.IllegalArgumentException
- if orientation is invalid.public SDngCreator setThumbnail(android.graphics.Bitmap pixels)
Pixel data will be converted to a Baseline TIFF RGB image, with 8 bits per color channel.
The alpha channel will be discarded. Thumbnail images with a dimension larger than
MAX_THUMBNAIL_DIMENSION
will be rejected.
pixels
- a Bitmap
of pixel data.SDngCreator(com.samsung.android.sdk.camera.SCameraCharacteristics, com.samsung.android.sdk.camera.SCaptureResult)
object.java.lang.IllegalArgumentException
- if the given thumbnail image has a dimension
larger than MAX_THUMBNAIL_DIMENSION
.public SDngCreator setThumbnail(android.media.Image pixels)
Pixel data is interpreted as a ImageFormat.YUV_420_888
image.
Thumbnail images with a dimension larger than MAX_THUMBNAIL_DIMENSION
will be
rejected.
pixels
- an Image
object with the format
ImageFormat.YUV_420_888
.SDngCreator(com.samsung.android.sdk.camera.SCameraCharacteristics, com.samsung.android.sdk.camera.SCaptureResult)
object.java.lang.IllegalArgumentException
- if the given thumbnail image has a dimension
larger than MAX_THUMBNAIL_DIMENSION
or if the given thumbnail image is null.public SDngCreator setLocation(android.location.Location location)
The given location object must contain at least a valid time, latitude, and longitude
(equivalent to the values returned by Location.getTime()
,
Location.getLatitude()
, and
Location.getLongitude()
methods).
location
- an Location
object to set.SDngCreator(com.samsung.android.sdk.camera.SCameraCharacteristics, com.samsung.android.sdk.camera.SCaptureResult)
object.java.lang.IllegalArgumentException
- if the given location object doesn't
contain enough information to set location metadata.public SDngCreator setDescription(java.lang.String description)
This is equivalent to setting the TIFF "ImageDescription" tag (0x010E)
.
description
- the user description string.SDngCreator(com.samsung.android.sdk.camera.SCameraCharacteristics, com.samsung.android.sdk.camera.SCaptureResult)
object.java.lang.IllegalArgumentException
- if description is invalid.public void writeInputStream(java.io.OutputStream dngOutput, android.util.Size size, java.io.InputStream pixels, long offset) throws java.io.IOException
ImageFormat.RAW_SENSOR
pixel data to a DNG file with
the currently configured metadata.
Raw pixel data must have 16 bits per pixel, and the input must contain at least
offset + 2 * width * height)
bytes. The width and height of
the input are taken from the width and height set in the SDngCreator
metadata tags,
and will typically be equal to the width and height of
SCameraCharacteristics.SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE
. Prior to
API level 23, this was always the same as
SCameraCharacteristics.SENSOR_INFO_ACTIVE_ARRAY_SIZE
.
The pixel layout in the input is determined from the reported color filter arrangement (CFA)
set in SCameraCharacteristics.SENSOR_INFO_COLOR_FILTER_ARRANGEMENT
. If insufficient
metadata is available to write a well-formatted DNG file, an
IllegalStateException
will be thrown.
dngOutput
- an OutputStream
to write the DNG file to.size
- the Size
of the image to write, in pixels.pixels
- an InputStream
of pixel data to write.offset
- the offset of the raw image in bytes. This indicates how many bytes will
be skipped in the input before any pixel data is read.java.io.IOException
- if an error was encountered in the input or output stream.java.lang.IllegalStateException
- if not enough metadata information has been
set to write a well-formatted DNG file.java.lang.IllegalArgumentException
- if the size passed in does not match thepublic void writeByteBuffer(java.io.OutputStream dngOutput, android.util.Size size, java.nio.ByteBuffer pixels, long offset) throws java.io.IOException
ImageFormat.RAW_SENSOR
pixel data to a DNG file with
the currently configured metadata.
Raw pixel data must have 16 bits per pixel, and the input must contain at least
offset + 2 * width * height)
bytes. The width and height of
the input are taken from the width and height set in the SDngCreator
metadata tags,
and will typically be equal to the width and height of
SCameraCharacteristics.SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE
. Prior to
API level 23, this was always the same as
SCameraCharacteristics.SENSOR_INFO_ACTIVE_ARRAY_SIZE
.
The pixel layout in the input is determined from the reported color filter arrangement (CFA)
set in SCameraCharacteristics.SENSOR_INFO_COLOR_FILTER_ARRANGEMENT
. If insufficient
metadata is available to write a well-formatted DNG file, an
IllegalStateException
will be thrown.
Any mark or limit set on this ByteBuffer
is ignored, and will be cleared by this
method.
dngOutput
- an OutputStream
to write the DNG file to.size
- the Size
of the image to write, in pixels.pixels
- an ByteBuffer
of pixel data to write.offset
- the offset of the raw image in bytes. This indicates how many bytes will
be skipped in the input before any pixel data is read.java.io.IOException
- if an error was encountered in the input or output stream.java.lang.IllegalArgumentException
- if any of given arguments is invalidjava.lang.IllegalStateException
- if not enough metadata information has been
set to write a well-formatted DNG file.public void writeImage(java.io.OutputStream dngOutput, android.media.Image pixels) throws java.io.IOException
For this method to succeed, the Image
input must contain
ImageFormat.RAW_SENSOR
pixel data, otherwise an
IllegalArgumentException
will be thrown.
dngOutput
- an OutputStream
to write the DNG file to.pixels
- an Image
to write.java.io.IOException
- if an error was encountered in the output stream.java.lang.IllegalArgumentException
- if an image with an unsupported format was used.java.lang.IllegalStateException
- if not enough metadata information has been
set to write a well-formatted DNG file.public void close()
Copyright © Samsung Electronics, Co., Ltd. All rights reserved.