libimgsmlr


Namelibimgsmlr JSON
Version 0.1.5 PyPI version JSON
download
home_pagehttps://github.com/jie123108/libimgsmlr
SummaryImplement the feature extraction function of the ``imgsmlr`` extension for ``PostgreSQL``.
upload_time2023-11-28 12:29:57
maintainer
docs_urlNone
authorjie123108
requires_python
license
keywords imgsmlr postgres image similarity search
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            libimgsmlr
----------

Implement the feature extraction function of the ``imgsmlr`` extension, in
languages such as: ``c(so file)``, ``Python``. Other languages should
probably call dynamic libraries to adapt.

When using the ``PostgreSQL`` extension
`imgsmlr <https://github.com/postgrespro/imgsmlr>`__, I found that the
feature extraction functions provided by ``imgsmlr`` are all PostgreSQL
functions. This poses a problem, as the files need to be uploaded to and
stored in the database during testing. This is generally not possible in
service development, where text is usually stored separately in the file
system, and only paths and ``pattern``, ``signature`` are stored in the
database. Therefore, it is necessary to implement the feature extraction
functions used by the service development language.

Depends
-------

This library depends on the gd library. Please install it yourself first.

On Mac OSX: ``brew install gd``

On Linux: ``yum install -y gd-devel``

Installation
------------

::

    pip install --global-option=build_ext libimgsmlr

Errors
------

If the following error is encountered on Mac OSX.

::

    fatal error: 'gd.h' file not found
    #include "gd.h"

The solution is to set the environment variable first:

::

    export CFLAGS="-I$(brew --prefix gd)/include"
    export LFDLAGS="-L$(brew --prefix gd)/lib"

Examples
--------

.. code:: python

    from libimgsmlr import img2pattern, pattern2signature, shuffle_pattern
    if __name__ == "__main__":
        import argparse
        parser = argparse.ArgumentParser(description="libimgsmlr test")
        parser.add_argument('filename',help='image (jpeg/png/gif) file')

        args = parser.parse_args()
        print("filename: %s" % (args.filename))
        filename = args.filename
        content = open(filename, "rb").read()
        try:
            pattern = img2pattern(content)
            pattern2 = shuffle_pattern(pattern)
            print("pattern: %s" % (pattern2.as_array()))
            signature = pattern2signature(pattern)
            print("signature: %s" % (signature))
        except ValueError as err:
            print("ERROR: img2pattern(%s) failed! %s" % (filename, err))

LICENSE
-------

`MIT <./LICENSE>`__
            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/jie123108/libimgsmlr",
    "name": "libimgsmlr",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "imgsmlr,postgres,image similarity search",
    "author": "jie123108",
    "author_email": "jie123108@163.com",
    "download_url": "https://files.pythonhosted.org/packages/c8/93/79d3a45e606d7a1844e2c6cf0e9312a557a1a696ba78c227a69cbdc637b2/libimgsmlr-0.1.5.tar.gz",
    "platform": null,
    "description": "libimgsmlr\n----------\n\nImplement the feature extraction function of the ``imgsmlr`` extension, in\nlanguages such as: ``c(so file)``, ``Python``. Other languages should\nprobably call dynamic libraries to adapt.\n\nWhen using the ``PostgreSQL`` extension\n`imgsmlr <https://github.com/postgrespro/imgsmlr>`__, I found that the\nfeature extraction functions provided by ``imgsmlr`` are all PostgreSQL\nfunctions. This poses a problem, as the files need to be uploaded to and\nstored in the database during testing. This is generally not possible in\nservice development, where text is usually stored separately in the file\nsystem, and only paths and ``pattern``, ``signature`` are stored in the\ndatabase. Therefore, it is necessary to implement the feature extraction\nfunctions used by the service development language.\n\nDepends\n-------\n\nThis library depends on the gd library. Please install it yourself first.\n\nOn Mac OSX: ``brew install gd``\n\nOn Linux: ``yum install -y gd-devel``\n\nInstallation\n------------\n\n::\n\n    pip install --global-option=build_ext libimgsmlr\n\nErrors\n------\n\nIf the following error is encountered on Mac OSX.\n\n::\n\n    fatal error: 'gd.h' file not found\n    #include \"gd.h\"\n\nThe solution is to set the environment variable first:\n\n::\n\n    export CFLAGS=\"-I$(brew --prefix gd)/include\"\n    export LFDLAGS=\"-L$(brew --prefix gd)/lib\"\n\nExamples\n--------\n\n.. code:: python\n\n    from libimgsmlr import img2pattern, pattern2signature, shuffle_pattern\n    if __name__ == \"__main__\":\n        import argparse\n        parser = argparse.ArgumentParser(description=\"libimgsmlr test\")\n        parser.add_argument('filename',help='image (jpeg/png/gif) file')\n\n        args = parser.parse_args()\n        print(\"filename: %s\" % (args.filename))\n        filename = args.filename\n        content = open(filename, \"rb\").read()\n        try:\n            pattern = img2pattern(content)\n            pattern2 = shuffle_pattern(pattern)\n            print(\"pattern: %s\" % (pattern2.as_array()))\n            signature = pattern2signature(pattern)\n            print(\"signature: %s\" % (signature))\n        except ValueError as err:\n            print(\"ERROR: img2pattern(%s) failed! %s\" % (filename, err))\n\nLICENSE\n-------\n\n`MIT <./LICENSE>`__",
    "bugtrack_url": null,
    "license": "",
    "summary": "Implement the feature extraction function of the ``imgsmlr`` extension for ``PostgreSQL``.",
    "version": "0.1.5",
    "project_urls": {
        "Homepage": "https://github.com/jie123108/libimgsmlr"
    },
    "split_keywords": [
        "imgsmlr",
        "postgres",
        "image similarity search"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c89379d3a45e606d7a1844e2c6cf0e9312a557a1a696ba78c227a69cbdc637b2",
                "md5": "8fa303e8a84be5ac74f091908c5dd644",
                "sha256": "45b9cc2c46e4e29f3b44b35e6a12fa8ea78076fa8a9bc0ab43aab4bc8ba54db8"
            },
            "downloads": -1,
            "filename": "libimgsmlr-0.1.5.tar.gz",
            "has_sig": false,
            "md5_digest": "8fa303e8a84be5ac74f091908c5dd644",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 6872,
            "upload_time": "2023-11-28T12:29:57",
            "upload_time_iso_8601": "2023-11-28T12:29:57.437020Z",
            "url": "https://files.pythonhosted.org/packages/c8/93/79d3a45e606d7a1844e2c6cf0e9312a557a1a696ba78c227a69cbdc637b2/libimgsmlr-0.1.5.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-11-28 12:29:57",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "jie123108",
    "github_project": "libimgsmlr",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "libimgsmlr"
}
        
Elapsed time: 0.14148s