cythonimagever


Namecythonimagever JSON
Version 0.10 PyPI version JSON
download
home_pagehttps://github.com/hansalemaos/cythonimagever
Summarysome stuff for images
upload_time2024-07-19 04:18:07
maintainerNone
docs_urlNone
authorJohannes Fischer
requires_pythonNone
licenseMIT
keywords cython images
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            
# some stuff for images

### Tested against Windows 10 / Python 3.11 / Anaconda

### pip install cythonimagever

### Cython and a C compiler must be installed! 

```PY
import numpy as np
import cv2
from cythonimagever import all_colors_in,any_colors_in,average_rgb,find_colors,rgb_color_count_numpy,rgb_color_count_sorted_by_qty_numpy,rgb_color_count_sorted_by_color_numpy
from a_cv_imwrite_imread_plus import open_image_in_cv
from time import perf_counter
# 4525 x 6623 x 3 picture https://www.pexels.com/pt-br/foto/foto-da-raposa-sentada-no-chao-2295744/
picpath = r"C:\Users\hansc\Downloads\pexels-alex-andrews-2295744.jpg"
picture = open_image_in_cv(picpath, channels_in_output=3)
colors1 = np.array(
    [
        (66, 71, 69),
        (62, 67, 65),
        (144, 155, 153),
        (52, 57, 55),
        (127, 138, 136),
        (53, 58, 56),
        (51, 56, 54),
        (32, 27, 18),
        (24, 17, 8),
        (10, 15, 122),
    ],
    dtype=np.uint8,
)
print(f'{rgb_color_count_numpy(picture, picture.shape) =}')
print(f'{rgb_color_count_sorted_by_qty_numpy(picture, picture.shape) =}')
print(f'{rgb_color_count_sorted_by_color_numpy(picture, picture.shape) =}')
print(f'{find_colors(picture, colors1) =}')
print(f'{average_rgb(picture) =}')
print(f'{any_colors_in(picture, colors1) =}')
print(f'{all_colors_in(picture, colors1) =}')

# rgb_color_count_numpy(picture, picture.shape) =array([[   0,    0,    0,   38],
#        [   1,    0,    0,   33],
#        [   3,    0,    0,   41],
#        ...,
#        [ 252,  255,  255,  183],
#        [ 254,  255,  255, 1495],
#        [ 255,  255,  255, 4588]], dtype=uint32)
# rgb_color_count_sorted_by_qty_numpy(picture, picture.shape) =array([[   132,     83,     76,      1],
#        [   184,     71,     31,      1],
#        [   189,     71,     31,      1],
#        ...,
#        [    12,     21,     26, 417740],
#        [    13,     22,     27, 418847],
#        [    11,     20,     25, 447605]], dtype=uint32)
# rgb_color_count_sorted_by_color_numpy(picture, picture.shape) =array([[   0,    0,    0,   38],
#        [   1,    0,    0,   33],
#        [   3,    0,    0,   41],
#        ...,
#        [ 252,  255,  255,  183],
#        [ 254,  255,  255, 1495],
#        [ 255,  255,  255, 4588]], dtype=uint32)
# find_colors(picture, colors1) =array([[ 127,  138,  136,   38,    0],
#        [  66,   71,   69, 4522,    0],
#        [  62,   67,   65, 4523,    0],
#        ...,
#        [  24,   17,    8, 4522, 6622],
#        [  24,   17,    8, 4523, 6622],
#        [  24,   17,    8, 4524, 6622]], dtype=int64)
# average_rgb(picture) =(76, 83, 85)
# any_colors_in(picture, colors1) =True
# all_colors_in(picture, colors1) =array([[ 66,  71,  69,   1],
#        [ 62,  67,  65,   1],
#        [144, 155, 153,   1],
#        [ 52,  57,  55,   1],
#        [127, 138, 136,   1],
#        [ 53,  58,  56,   1],
#        [ 51,  56,  54,   1],
#        [ 32,  27,  18,   1],
#        [ 24,  17,   8,   1],
#        [ 10,  15, 122,   0]], dtype=uint8)
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/hansalemaos/cythonimagever",
    "name": "cythonimagever",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "cython, images",
    "author": "Johannes Fischer",
    "author_email": "aulasparticularesdealemaosp@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/6c/6a/3a16ed5a488fa35c5d846343a01853a342c0b901e7f1f815f282c5ef18a0/cythonimagever-0.10.tar.gz",
    "platform": null,
    "description": "\r\n# some stuff for images\r\n\r\n### Tested against Windows 10 / Python 3.11 / Anaconda\r\n\r\n### pip install cythonimagever\r\n\r\n### Cython and a C compiler must be installed! \r\n\r\n```PY\r\nimport numpy as np\r\nimport cv2\r\nfrom cythonimagever import all_colors_in,any_colors_in,average_rgb,find_colors,rgb_color_count_numpy,rgb_color_count_sorted_by_qty_numpy,rgb_color_count_sorted_by_color_numpy\r\nfrom a_cv_imwrite_imread_plus import open_image_in_cv\r\nfrom time import perf_counter\r\n# 4525 x 6623 x 3 picture https://www.pexels.com/pt-br/foto/foto-da-raposa-sentada-no-chao-2295744/\r\npicpath = r\"C:\\Users\\hansc\\Downloads\\pexels-alex-andrews-2295744.jpg\"\r\npicture = open_image_in_cv(picpath, channels_in_output=3)\r\ncolors1 = np.array(\r\n    [\r\n        (66, 71, 69),\r\n        (62, 67, 65),\r\n        (144, 155, 153),\r\n        (52, 57, 55),\r\n        (127, 138, 136),\r\n        (53, 58, 56),\r\n        (51, 56, 54),\r\n        (32, 27, 18),\r\n        (24, 17, 8),\r\n        (10, 15, 122),\r\n    ],\r\n    dtype=np.uint8,\r\n)\r\nprint(f'{rgb_color_count_numpy(picture, picture.shape) =}')\r\nprint(f'{rgb_color_count_sorted_by_qty_numpy(picture, picture.shape) =}')\r\nprint(f'{rgb_color_count_sorted_by_color_numpy(picture, picture.shape) =}')\r\nprint(f'{find_colors(picture, colors1) =}')\r\nprint(f'{average_rgb(picture) =}')\r\nprint(f'{any_colors_in(picture, colors1) =}')\r\nprint(f'{all_colors_in(picture, colors1) =}')\r\n\r\n# rgb_color_count_numpy(picture, picture.shape) =array([[   0,    0,    0,   38],\r\n#        [   1,    0,    0,   33],\r\n#        [   3,    0,    0,   41],\r\n#        ...,\r\n#        [ 252,  255,  255,  183],\r\n#        [ 254,  255,  255, 1495],\r\n#        [ 255,  255,  255, 4588]], dtype=uint32)\r\n# rgb_color_count_sorted_by_qty_numpy(picture, picture.shape) =array([[   132,     83,     76,      1],\r\n#        [   184,     71,     31,      1],\r\n#        [   189,     71,     31,      1],\r\n#        ...,\r\n#        [    12,     21,     26, 417740],\r\n#        [    13,     22,     27, 418847],\r\n#        [    11,     20,     25, 447605]], dtype=uint32)\r\n# rgb_color_count_sorted_by_color_numpy(picture, picture.shape) =array([[   0,    0,    0,   38],\r\n#        [   1,    0,    0,   33],\r\n#        [   3,    0,    0,   41],\r\n#        ...,\r\n#        [ 252,  255,  255,  183],\r\n#        [ 254,  255,  255, 1495],\r\n#        [ 255,  255,  255, 4588]], dtype=uint32)\r\n# find_colors(picture, colors1) =array([[ 127,  138,  136,   38,    0],\r\n#        [  66,   71,   69, 4522,    0],\r\n#        [  62,   67,   65, 4523,    0],\r\n#        ...,\r\n#        [  24,   17,    8, 4522, 6622],\r\n#        [  24,   17,    8, 4523, 6622],\r\n#        [  24,   17,    8, 4524, 6622]], dtype=int64)\r\n# average_rgb(picture) =(76, 83, 85)\r\n# any_colors_in(picture, colors1) =True\r\n# all_colors_in(picture, colors1) =array([[ 66,  71,  69,   1],\r\n#        [ 62,  67,  65,   1],\r\n#        [144, 155, 153,   1],\r\n#        [ 52,  57,  55,   1],\r\n#        [127, 138, 136,   1],\r\n#        [ 53,  58,  56,   1],\r\n#        [ 51,  56,  54,   1],\r\n#        [ 32,  27,  18,   1],\r\n#        [ 24,  17,   8,   1],\r\n#        [ 10,  15, 122,   0]], dtype=uint8)\r\n```\r\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "some stuff for images",
    "version": "0.10",
    "project_urls": {
        "Homepage": "https://github.com/hansalemaos/cythonimagever"
    },
    "split_keywords": [
        "cython",
        " images"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "bbd764c72b130fc16080a4a121f59bcb06080cdd6d3e96291a0a40c60ed05d7c",
                "md5": "78a2dd1ea2bde4e48802b8b85e4532b7",
                "sha256": "0a8d61472f77ba45e4fe357153af06d661aa6fff0876352da2215d1f30005347"
            },
            "downloads": -1,
            "filename": "cythonimagever-0.10-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "78a2dd1ea2bde4e48802b8b85e4532b7",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 24962,
            "upload_time": "2024-07-19T04:18:05",
            "upload_time_iso_8601": "2024-07-19T04:18:05.567581Z",
            "url": "https://files.pythonhosted.org/packages/bb/d7/64c72b130fc16080a4a121f59bcb06080cdd6d3e96291a0a40c60ed05d7c/cythonimagever-0.10-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "6c6a3a16ed5a488fa35c5d846343a01853a342c0b901e7f1f815f282c5ef18a0",
                "md5": "45911701c000f018712f16544190e0b2",
                "sha256": "bb130e73187b9d15de8cf91e899cf4b970ad346fc9ae58b59ea06831bbedca1c"
            },
            "downloads": -1,
            "filename": "cythonimagever-0.10.tar.gz",
            "has_sig": false,
            "md5_digest": "45911701c000f018712f16544190e0b2",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 24149,
            "upload_time": "2024-07-19T04:18:07",
            "upload_time_iso_8601": "2024-07-19T04:18:07.249393Z",
            "url": "https://files.pythonhosted.org/packages/6c/6a/3a16ed5a488fa35c5d846343a01853a342c0b901e7f1f815f282c5ef18a0/cythonimagever-0.10.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-07-19 04:18:07",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "hansalemaos",
    "github_project": "cythonimagever",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [],
    "lcname": "cythonimagever"
}
        
Elapsed time: 0.39516s