# 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://i.ytimg.com/vi/bhLRYlK0cts/maxresdefault.jpg)](https://www.youtube.com/watch?v=bhLRYlK0cts)
[https://www.youtube.com/watch?v=bhLRYlK0cts]()
```python
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)
```
Raw data
{
"_id": null,
"home_page": "https://github.com/hansalemaos/chopchopcolorc",
"name": "chopchopcolorc",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "multiprocessing,c,rgb",
"author": "Johannes Fischer",
"author_email": "aulasparticularesdealemaosp@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/a7/c0/bf562672089a6ff138707485ae7251579765f3574c4f5fc3385d2177828b/chopchopcolorc-0.10.tar.gz",
"platform": null,
"description": "\r\n# Locate RGB colors faster than ever with this efficient color search module (C + multiprocessing)!\r\n\r\n## pip install chopchopcolorc\r\n\r\n\r\n## Tested against Python 3.11 / Windows 10\r\n\r\n\r\n### In Action - one CPU only:\r\n\r\n[![YT](https://i.ytimg.com/vi/bhLRYlK0cts/maxresdefault.jpg)](https://www.youtube.com/watch?v=bhLRYlK0cts)\r\n[https://www.youtube.com/watch?v=bhLRYlK0cts]()\r\n\r\n\r\n```python\r\nThis module provides functions for parallel color search in a collection of images.\r\nIt utilizes multiprocessing and a code written in C to efficiently process images concurrently.\r\n\r\nFunctions:\r\n1. **_color_search_c(pic, colors):**\r\n - Internal function for color search in a single image.\r\n - Utilizes the 'locate_pixelcolor_c' module to search for specified colors.\r\n - Returns an array of coordinates where the colors are found.\r\n\r\n2. **color_search_c(pics, rgb_tuples, cpus=5, chunks=1, print_stderr=True, print_stdout=False, usecache=True):**\r\n - Executes parallel color search on a list of images using multiprocessing.\r\n - Utilizes '_color_search_c' for each image in parallel.\r\n - Returns a dictionary with image indices mapped to their corresponding color search results.\r\n\r\nExample Usage:\r\n from chopchopcolorc import color_search_c\r\n from list_all_files_recursively import get_folder_file_complete_path # optional\r\n folder=r\"C:\\testfolderall\"\r\n colors2find = (\r\n (69, 71, 66),\r\n (255, 255, 255),\r\n (153, 155, 144),\r\n (55, 57, 52),\r\n (136, 138, 127),\r\n (56, 58, 53),\r\n (54, 56, 51),\r\n (0, 180, 252),\r\n )\r\n allpi = [\r\n x.path\r\n for x in get_folder_file_complete_path(folder)\r\n if x.ext == \".png\"\r\n ]\r\n\r\n\r\n colorresults=color_search_c(pics=allpi, rgb_tuples=colors2find, cpus=6, chunks=1, print_stderr=True,\r\n print_stdout=False, usecache=True,)\r\n print(colorresults)\r\n\r\n\r\n```\r\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Locate RGB colors faster than ever with this efficient color search module (C + multiprocessing)!",
"version": "0.10",
"project_urls": {
"Homepage": "https://github.com/hansalemaos/chopchopcolorc"
},
"split_keywords": [
"multiprocessing",
"c",
"rgb"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "65fe4c112329e8f30f9fb828d886a935d7b7697369e334efd1f155d4287fafcc",
"md5": "bddb619d30bb00cc0cfb6c232ceed6f1",
"sha256": "73eecf6efba9589da6e2adfcd71316f499589e528d926900e9e4564a99b4b744"
},
"downloads": -1,
"filename": "chopchopcolorc-0.10-py3-none-any.whl",
"has_sig": false,
"md5_digest": "bddb619d30bb00cc0cfb6c232ceed6f1",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 57254,
"upload_time": "2023-11-12T01:51:05",
"upload_time_iso_8601": "2023-11-12T01:51:05.051540Z",
"url": "https://files.pythonhosted.org/packages/65/fe/4c112329e8f30f9fb828d886a935d7b7697369e334efd1f155d4287fafcc/chopchopcolorc-0.10-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "a7c0bf562672089a6ff138707485ae7251579765f3574c4f5fc3385d2177828b",
"md5": "4f0fe6d708f8f47c26309d225695af90",
"sha256": "77082944cf1e99a9d9f302d59c56e6f660980a88167d4621baa1d9217ac042d6"
},
"downloads": -1,
"filename": "chopchopcolorc-0.10.tar.gz",
"has_sig": false,
"md5_digest": "4f0fe6d708f8f47c26309d225695af90",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 56015,
"upload_time": "2023-11-12T01:51:07",
"upload_time_iso_8601": "2023-11-12T01:51:07.003461Z",
"url": "https://files.pythonhosted.org/packages/a7/c0/bf562672089a6ff138707485ae7251579765f3574c4f5fc3385d2177828b/chopchopcolorc-0.10.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-11-12 01:51:07",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "hansalemaos",
"github_project": "chopchopcolorc",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [],
"lcname": "chopchopcolorc"
}