GithubHelp home page GithubHelp logo

vitali-fedulov / images4 Goto Github PK

View Code? Open in Web Editor NEW
73.0 1.0 10.0 911 KB

Image similarity in Golang. Version 4 (LATEST)

Home Page: https://vitali-fedulov.github.io/similar.pictures/

License: MIT License

Go 100.00%
image-deduplication image-hash image-hashing-algorithms image-similarity near-duplicate-detection similar-images

images4's Issues

Solutions to Improve Accuracy

Hi, it's an awesome project for duplicate image removal. I use this project to detect and delete images, but I encountered some issues.

For example, there are two thumbnails which are very alike from my raw eyes. But images4.Similar returns false in this case.

1stars00325jp-1-small 1stars00325ps-crop

Is there any way to optimize this situation?

Add JSON marshal to Icon - reduce JSON size

Could you please add the MarshalJSON function to null the Icon type in JSON encoding, or add the json:",omitempty" flag to omit empty values in Icon and ImgSize types?

I have loads of images in my data and when I want to browse through them in JSON format, I get bigger than necessary JSON files since there are lots of empty images. ๐Ÿ™ƒ

Current marshal result:

{
    "Icon": {
        "Pixels": null,
        "ImgSize": {
            "X": 0,
            "Y": 0
        }
    }
}

You can imagine how big it gets when there are lots of empty icons in the array. ๐Ÿ˜ต

Suggestion 1 - MarshalJSON function

This results in smaller size than the suggestion 2.

func (i IconT) MarshalJSON() ([]byte, error) {
    if i.Pixels == nil {
        return []byte("null"), nil
    }
    
    return json.Marshal(struct {
        Pixels  []uint16
        ImgSize Point
    }{i.Pixels, i.ImgSize})
}

Output:

{
    "Icon": null
}

Suggestion 2 - json:",omitempty" flag

This reduces the size by removing the "Pixels", "X" and "Y" fields.

type IconT struct {
    Pixels    []uint16 `json:",omitempty"` // Visual signature.
    ImgSize image.Point `json:",omitempty"` // Original image size.
}

type Point struct {
    X, Y int `json:",omitempty"`
}

Output:

{
    "Icon": {
         "ImgSize": {}
    }
}

Suggestion 3

Do you have any better suggestions? ๐Ÿค”

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.