imgdb

package module
v0.0.0-...-33ee4bf Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 8, 2018 License: MIT Imports: 18 Imported by: 0

README

imgdb

Image DB persists and groups images and avoids duplicates. It accomplishes this by extracts image features used as index and compares these features to potentially similar images.

Documentation

Overview

Package imgdb ... Is a wrapper database management api for storing and grouping image and avoiding duplicates

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cluster

type Cluster struct {
	gorm.Model
	Name       string `gorm:"not null;unique"`
	ImageFiles []ImageFile
}

Cluster ... Specifies a grouping of images

type DupFileError

type DupFileError struct {
	// contains filtered or unexported fields
}

func (DupFileError) Error

func (this DupFileError) Error() string

Error ... Implements error method for duplicate files

type ImageFile

type ImageFile struct {
	gorm.Model
	Name      string `gorm:"not null;unique"`
	Format    string `gorm:"not null"`
	Index     []byte `gorm:"not null"`
	Sources   []Source
	ClusterID int
}

ImageFile ... Specifies name information and image features

type ImgDB

type ImgDB struct {
	*gorm.DB
	MinW uint
	MinH uint
	// contains filtered or unexported fields
}

ImgDB ... Is a wrapper gorm for images

func New

func New(dialect, source, filedir string) (out *ImgDB, err error)

New ... Initializes and migrates relevant schemas

func (*ImgDB) AddImg

func (this *ImgDB) AddImg(name string, data []byte) (imgModel *ImageFile, err error)

AddImg ... Extracts image features as search index Save to file system then add in database Filters out images too small beyond a limit Index and logic inspired from https://tinyurl.com/yaup47bg

func (*ImgDB) AddSource

func (this *ImgDB) AddSource(imgModel *ImageFile, link string)

AddSource ... Associate a link to a imagefile

func (*ImgDB) SourceExists

func (this *ImgDB) SourceExists(link string) bool

SourceExists ... Check if there is already an associated link in the database

type Source

type Source struct {
	gorm.Model
	Link        string `gorm:"not null;unique"`
	ImageFileID int
}

Source ... Specifies image link

Directories

Path Synopsis
Package imgutil ...
Package imgutil ...

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL