imgsmlr
Overview
| Package | Version | Category | License | Language |
|---|---|---|---|---|
imgsmlr | 1.0 | FEAT | PostgreSQL | C |
| ID | Extension | Bin | Lib | Load | Create | Trust | Reloc | Schema |
|---|---|---|---|---|---|---|---|---|
| 2830 | imgsmlr | No | Yes | No | Yes | No | Yes | - |
breaks on el10
Version
| Type | Repo | Version | PG Ver | Package | Deps |
|---|---|---|---|---|---|
| EXT | PIGSTY | 1.0 | 1817161514 | imgsmlr | - |
| RPM | PIGSTY | 1.0 | 1817161514 | imgsmlr_$v | - |
| DEB | PIGSTY | 1.0 | 1817161514 | postgresql-$v-imgsmlr | - |
Build
You can build the RPM / DEB packages for imgsmlr using pig build:
Install
You can install imgsmlr directly. First, make sure the PGDG and PIGSTY repositories are added and enabled:
Install the extension using pig or apt/yum/dnf:
Create Extension:
Usage
imgsmlr: similar images search for PostgreSQL using Haar wavelet transform
The imgsmlr extension implements similar image searching functionality based on Haar wavelet transforms. It provides two data types and functions for converting images into searchable signatures.
Data Types
| Datatype | Storage Length | Description |
|---|---|---|
pattern | 16388 bytes | Result of Haar wavelet transform on the image |
signature | 64 bytes | Short representation of pattern for fast GiST index searches |
Functions
| Function | Return Type | Description |
|---|---|---|
jpeg2pattern(bytea) | pattern | Convert JPEG image data into pattern |
png2pattern(bytea) | pattern | Convert PNG image data into pattern |
gif2pattern(bytea) | pattern | Convert GIF image data into pattern |
pattern2signature(pattern) | signature | Create signature from pattern |
shuffle_pattern(pattern) | pattern | Shuffle pattern for less sensitivity to image shift |
Operators
| Operator | Left | Right | Return | Description |
|---|---|---|---|---|
<-> | pattern | pattern | float8 | Euclidean distance between two patterns |
<-> | signature | signature | float8 | Euclidean distance between two signatures |
The signature type supports GiST indexing with KNN on the <-> operator.
Example
Create a table of patterns and signatures from JPEG images:
Search for the top 10 similar images to a given image:
The inner query selects the top 100 candidates by signature using the GiST index. The outer query refines to the top 10 by pattern distance.
Was this page helpful?
Thanks—your feedback helps us improve this page.
What got in the way? (optional)