# detects and analyzes shapes in images using parallel processing.
## pip install multiprocshapefinder
### Tested against Python 3.11 / Windows 10
### Advantages:
#### Parallel Processing:
The module utilizes parallel processing (cpus parameter) to speed up the shape detection process,
which can be advantageous for analyzing multiple images simultaneously.
#### Flexible Input:
It accepts images in various formats, providing flexibility in the source of the images.
#### Caching:
The option to use caching (usecache) can save time on the same images.
#### Visualization:
The module provides a function (draw_results) for visualizing the detected shapes on the original images,
making it easier for users to interpret and verify the results.
#### Configurability:
The module exposes various parameters, such as Canny edge detection thresholds and contour approximation factors,
allowing users to fine-tune the shape detection process based on their requirements.
```python
# Importing functions from the multiprocshapefinder module
from multiprocshapefinder import find_all_shapes, draw_results
# List of image URLs to be processed
images = [
r"https://raw.githubusercontent.com/hansalemaos/screenshots/main/findshapes_1.png",
] # accepts almost all formats (url/path/buffer/base64/np/PIL) - https://github.com/hansalemaos/a_cv_imwrite_imread_plus
# Calling find_all_shapes function to detect and analyze shapes in the given images
df = find_all_shapes(
images,
threshold1=10,
threshold2=90,
approxPolyDPvar=0.01,
cpus=5, # Number of CPU cores to use for parallel processing
chunks=1, # Number of chunks to split the image processing into
print_stderr=True, # Print error messages to stderr
print_stdout=False, # Do not print standard output messages
usecache=True, # Use caching for intermediate results
)
# Printing the resulting DataFrame containing shape information
print(df)
# Calling draw_results function to visualize the detected shapes on the original image
draw_results(
df,
images[0], # Using the first image in the list - filter the DF (df.loc) if len(images)>1
min_area=5, # Minimum area threshold for shapes to be considered
shapes=("rectangle", "triangle", "circle", "pentagon", "hexagon", "oval"), # Shapes to be visualized
cv2show=True, # Display the result using OpenCV
)
```
Raw data
{
"_id": null,
"home_page": "https://github.com/hansalemaos/multiprocshapefinder",
"name": "multiprocshapefinder",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "multiprocessing,shape,matching,finder",
"author": "Johannes Fischer",
"author_email": "aulasparticularesdealemaosp@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/fe/bf/a17c6e22b771bebd68a16dc85009d3df5be9cf05096b193169181dd636e9/multiprocshapefinder-0.12.tar.gz",
"platform": null,
"description": "\r\n# detects and analyzes shapes in images using parallel processing. \r\n\r\n## pip install multiprocshapefinder\r\n\r\n### Tested against Python 3.11 / Windows 10\r\n\r\n\r\n### Advantages:\r\n\r\n#### Parallel Processing: \r\n\r\nThe module utilizes parallel processing (cpus parameter) to speed up the shape detection process, \r\nwhich can be advantageous for analyzing multiple images simultaneously.\r\n\r\n#### Flexible Input: \r\n\r\nIt accepts images in various formats, providing flexibility in the source of the images.\r\n\r\n#### Caching: \r\n\r\nThe option to use caching (usecache) can save time on the same images.\r\n\r\n#### Visualization: \r\n\r\nThe module provides a function (draw_results) for visualizing the detected shapes on the original images,\r\nmaking it easier for users to interpret and verify the results.\r\n\r\n#### Configurability: \r\n\r\nThe module exposes various parameters, such as Canny edge detection thresholds and contour approximation factors, \r\nallowing users to fine-tune the shape detection process based on their requirements.\r\n\r\n\r\n```python\r\n\r\n# Importing functions from the multiprocshapefinder module\r\nfrom multiprocshapefinder import find_all_shapes, draw_results\r\n\r\n# List of image URLs to be processed\r\nimages = [\r\n r\"https://raw.githubusercontent.com/hansalemaos/screenshots/main/findshapes_1.png\",\r\n] # accepts almost all formats (url/path/buffer/base64/np/PIL) - https://github.com/hansalemaos/a_cv_imwrite_imread_plus\r\n\r\n# Calling find_all_shapes function to detect and analyze shapes in the given images\r\ndf = find_all_shapes(\r\n images,\r\n threshold1=10,\r\n threshold2=90,\r\n approxPolyDPvar=0.01,\r\n cpus=5, # Number of CPU cores to use for parallel processing\r\n chunks=1, # Number of chunks to split the image processing into\r\n print_stderr=True, # Print error messages to stderr\r\n print_stdout=False, # Do not print standard output messages\r\n usecache=True, # Use caching for intermediate results\r\n)\r\n\r\n# Printing the resulting DataFrame containing shape information\r\nprint(df)\r\n\r\n# Calling draw_results function to visualize the detected shapes on the original image\r\ndraw_results(\r\n df,\r\n images[0], # Using the first image in the list - filter the DF (df.loc) if len(images)>1\r\n min_area=5, # Minimum area threshold for shapes to be considered\r\n shapes=(\"rectangle\", \"triangle\", \"circle\", \"pentagon\", \"hexagon\", \"oval\"), # Shapes to be visualized\r\n cv2show=True, # Display the result using OpenCV\r\n)\r\n\r\n\r\n```\r\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "detects and analyzes shapes in images using parallel processing.",
"version": "0.12",
"project_urls": {
"Homepage": "https://github.com/hansalemaos/multiprocshapefinder"
},
"split_keywords": [
"multiprocessing",
"shape",
"matching",
"finder"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "0003287d519f7f7c0487093ffec7bb39480787e2c9d61b0e936c01de7da6d47b",
"md5": "ad21635077e4f9e634f07ce0a88e7173",
"sha256": "c7046907a477191be0844dbd646595d6934f62c93a31ab9e4aae2d7693c3aaf7"
},
"downloads": -1,
"filename": "multiprocshapefinder-0.12-py3-none-any.whl",
"has_sig": false,
"md5_digest": "ad21635077e4f9e634f07ce0a88e7173",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 60403,
"upload_time": "2023-11-13T01:54:44",
"upload_time_iso_8601": "2023-11-13T01:54:44.348274Z",
"url": "https://files.pythonhosted.org/packages/00/03/287d519f7f7c0487093ffec7bb39480787e2c9d61b0e936c01de7da6d47b/multiprocshapefinder-0.12-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "febfa17c6e22b771bebd68a16dc85009d3df5be9cf05096b193169181dd636e9",
"md5": "a72a7ca84f3bdb8137e069fb68a5b47c",
"sha256": "7fe2a715e3d328e6b881e64e483e07b8f996af0f0294a8b1302021ddec0b0593"
},
"downloads": -1,
"filename": "multiprocshapefinder-0.12.tar.gz",
"has_sig": false,
"md5_digest": "a72a7ca84f3bdb8137e069fb68a5b47c",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 59866,
"upload_time": "2023-11-13T01:54:46",
"upload_time_iso_8601": "2023-11-13T01:54:46.083284Z",
"url": "https://files.pythonhosted.org/packages/fe/bf/a17c6e22b771bebd68a16dc85009d3df5be9cf05096b193169181dd636e9/multiprocshapefinder-0.12.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-11-13 01:54:46",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "hansalemaos",
"github_project": "multiprocshapefinder",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [],
"lcname": "multiprocshapefinder"
}