Processes image media IDs, generates embeddings, and stores them in an embedding store.
Constructor:
ImageIndexer(
embedder: ImageEmbeddingProvider,
store: EmbeddingStore,
maxImageSize: Int = 225,
quantize: Boolean = false,
context: Context,
listener: ProcessorListener<Long, Pair<Long, Embedding>>? = null,
memoryOptions: MemoryOptions = MemoryOptions(),
batchSize: Int = 10
)Processes a single image media ID.
Behavior:
- Resolves the
MediaStore.Images.MediaURI from the media ID. - Loads the bitmap using the configured maximum image size.
- Generates an embedding using the
ImageEmbeddingProvider. - Returns either an
Embedding.F32orEmbedding.QInt8depending on thequantizesetting.
Output:
Pair<Long, Embedding>containing the media ID and generated embedding.
Behavior:
- Retrieves the
DATE_ADDEDtimestamp for each processed image. - Creates
StoredEmbeddinginstances for the batch. - Persists the embeddings using the configured
EmbeddingStore. - Forwards the batch event to the listener, if present.
- Built on
BatchProcessor. - Reads images directly from
MediaStore. - Supports optional embedding quantization.
- Storage is decoupled from embedding generation.
Processes video media IDs, generates prototype embeddings from sampled frames, and stores them in an embedding store.
Constructor:
VideoIndexer(
embedder: ImageEmbeddingProvider,
frameCount: Int = 10,
width: Int,
height: Int,
quantize: Boolean = false,
context: Context,
listener: ProcessorListener<Long, Pair<Long, Embedding>>? = null,
batchSize: Int = 10,
memoryOptions: MemoryOptions = MemoryOptions(),
store: EmbeddingStore
)Processes a single video media ID.
Behavior:
- Resolves the
MediaStore.Video.MediaURI from the media ID. - Extracts representative video frames.
- Resizes frames to the configured dimensions.
- Generates embeddings for each frame.
- Produces a prototype embedding from the frame embeddings.
- Returns either an
Embedding.F32orEmbedding.QInt8depending on thequantizesetting.
Output:
Pair<Long, Embedding>containing the media ID and generated prototype embedding.
Behavior:
- Retrieves the
DATE_ADDEDtimestamp for each processed video. - Creates
StoredEmbeddinginstances for the batch. - Persists the embeddings using the configured
EmbeddingStore. - Forwards the batch event to the listener, if present.
- Built on
BatchProcessor. - Uses sampled video frames to represent video content.
- Aggregates frame embeddings into a single prototype embedding.
- Supports optional embedding quantization.
- Frame extraction may fail for videos with unsupported codecs.
- Intended for semantic retrieval, clustering, and classification pipelines.