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 hashes)

Uploaded Source

Built Distribution

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

Uploaded Python 3

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