Skip to main content

Locate RGB colors faster than ever with this efficient color search module (C + multiprocessing)!

Project description

Locate RGB colors faster than ever with this efficient color search module (C + multiprocessing)!

pip install chopchopcolorc

Tested against Python 3.11 / Windows 10

In Action - one CPU only:

YT https://www.youtube.com/watch?v=bhLRYlK0cts

This module provides functions for parallel color search in a collection of images.
It utilizes multiprocessing and a code written in C to efficiently process images concurrently.

Functions:
1. **_color_search_c(pic, colors):**
    - Internal function for color search in a single image.
    - Utilizes the 'locate_pixelcolor_c' module to search for specified colors.
    - Returns an array of coordinates where the colors are found.

2. **color_search_c(pics, rgb_tuples, cpus=5, chunks=1, print_stderr=True, print_stdout=False, usecache=True):**
    - Executes parallel color search on a list of images using multiprocessing.
    - Utilizes '_color_search_c' for each image in parallel.
    - Returns a dictionary with image indices mapped to their corresponding color search results.

Example Usage:
    from chopchopcolorc import color_search_c
    from list_all_files_recursively import get_folder_file_complete_path # optional
    folder=r"C:\testfolderall"
    colors2find = (
        (69, 71, 66),
        (255, 255, 255),
        (153, 155, 144),
        (55, 57, 52),
        (136, 138, 127),
        (56, 58, 53),
        (54, 56, 51),
        (0, 180, 252),
    )
    allpi = [
        x.path
        for x in get_folder_file_complete_path(folder)
        if x.ext == ".png"
    ]


    colorresults=color_search_c(pics=allpi, rgb_tuples=colors2find, cpus=6, chunks=1, print_stderr=True,
    print_stdout=False, usecache=True,)
    print(colorresults)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

chopchopcolorc-0.10.tar.gz (56.0 kB view details)

Uploaded Source

Built Distribution

chopchopcolorc-0.10-py3-none-any.whl (57.3 kB view details)

Uploaded Python 3

File details

Details for the file chopchopcolorc-0.10.tar.gz.

File metadata

  • Download URL: chopchopcolorc-0.10.tar.gz
  • Upload date:
  • Size: 56.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.5

File hashes

Hashes for chopchopcolorc-0.10.tar.gz
Algorithm Hash digest
SHA256 77082944cf1e99a9d9f302d59c56e6f660980a88167d4621baa1d9217ac042d6
MD5 4f0fe6d708f8f47c26309d225695af90
BLAKE2b-256 a7c0bf562672089a6ff138707485ae7251579765f3574c4f5fc3385d2177828b

See more details on using hashes here.

File details

Details for the file chopchopcolorc-0.10-py3-none-any.whl.

File metadata

File hashes

Hashes for chopchopcolorc-0.10-py3-none-any.whl
Algorithm Hash digest
SHA256 73eecf6efba9589da6e2adfcd71316f499589e528d926900e9e4564a99b4b744
MD5 bddb619d30bb00cc0cfb6c232ceed6f1
BLAKE2b-256 65fe4c112329e8f30f9fb828d886a935d7b7697369e334efd1f155d4287fafcc

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page