Class VisionSource
- java.lang.Object
-
- com.azure.android.ai.vision.common.VisionSource
-
- All Implemented Interfaces:
AutoCloseable
public final class VisionSource extends Object implements AutoCloseable
VisionSource class represents a source for vision-related operations.Note: close() must be called in order to release underlying resources held by the object.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Explicitly frees any external resource attached to the objectstatic VisionSource
fromByteBuffer(ByteBuffer buffer)
Create VisionSource from a byte buffer Using this factory method, the byte buffer is read without decoding.static VisionSource
fromDefaultCamera(VisionSourceOptions ops)
Create VisionSource from Android VisionSourceOptionsstatic VisionSource
fromFile(String filePath)
Create VisionSource from image filestatic VisionSource
fromFile(String filePath, FrameFormat frameFormat)
Create VisionSource from image file Using this factory method, the image is transferred directly from the file to SDK and configured as format given in parameter.static VisionSource
fromFrameSource(FrameSource source)
Creates a new frame-oriented VisionSourcestatic VisionSource
fromImageSourceBuffer(ImageSourceBuffer source)
Create VisionSource from anImageSourceBuffer
, allowing the application to pass in an image from a memory buffer.FrameFormat
getCameraPreviewFormat()
Get camera internal preview formatSafeHandle
getHandle()
Gets the internal native handle.String
getId()
Gets the identification string of the vision source.PropertyCollection
getProperties()
Gets the property collection associated to vision source object
-
-
-
Method Detail
-
fromImageSourceBuffer
public static VisionSource fromImageSourceBuffer(ImageSourceBuffer source)
Create VisionSource from anImageSourceBuffer
, allowing the application to pass in an image from a memory buffer.- Parameters:
source
- The image source buffer containing the image to process.- Returns:
- A new VisionSource instance that uses the specified input source buffer.
-
fromFrameSource
public static VisionSource fromFrameSource(FrameSource source)
Creates a new frame-oriented VisionSource- Parameters:
source
- The FrameSource to be bound to the VisionSource.- Returns:
- A new VisionSource instance.
-
fromFile
public static VisionSource fromFile(String filePath, FrameFormat frameFormat)
Create VisionSource from image file Using this factory method, the image is transferred directly from the file to SDK and configured as format given in parameter.- Parameters:
filePath
- The file path to the imageframeFormat
- The format of the image frame- Returns:
- A new VisionSource instance.
-
fromByteBuffer
public static VisionSource fromByteBuffer(ByteBuffer buffer)
Create VisionSource from a byte buffer Using this factory method, the byte buffer is read without decoding.- Parameters:
buffer
- The byte buffer- Returns:
- A new VisionSource instance.
-
getId
public final String getId()
Gets the identification string of the vision source.- Returns:
- Identification string
-
getProperties
public final PropertyCollection getProperties()
Gets the property collection associated to vision source object- Returns:
- PropertyCollection object
-
getHandle
public final SafeHandle getHandle()
Gets the internal native handle.- Returns:
- Native handle as SafeHandle
-
close
public final void close()
Explicitly frees any external resource attached to the object- Specified by:
close
in interfaceAutoCloseable
-
fromFile
public static VisionSource fromFile(String filePath)
Create VisionSource from image file- Parameters:
filePath
- The file path to the image- Returns:
- A new VisionSource instance.
-
fromDefaultCamera
public static VisionSource fromDefaultCamera(VisionSourceOptions ops)
Create VisionSource from Android VisionSourceOptions- Parameters:
ops
- The vision source options- Returns:
- A new VisionSource instance
-
getCameraPreviewFormat
public final FrameFormat getCameraPreviewFormat()
Get camera internal preview format- Returns:
- A FrameFormat instance
-
-