Uses OpenCV to find image ' region ' boundaries. Returns set of boundary points for further tweaking as needed.
Project description
ImageBoundaryPointsGeneration takes an image..
.. identifies the " region " in it and returns a list of points bounding the region.
This is meant to be used with a procedural generation project that generates 2D tile maps from provided tile sets within specified regions. It facilitates specifying those regions by uploading pictures in which the specification is clearly present.
Example:
The above is a region assembled from pieces I picked up at a fair.
Approximation is done by calling RegionBordersApproximator.approximate:
RegionBordersApproximator.approximate(base_image_data=base_image_data, base_image_width=400, base_image_height=300, min_canny_threshold=100, max_canny_threshold=200, min_segmenting_threshold=70, max_segmenting_threshold=255, contour_thickness=2)
base_image_data: image in Base64base_image_width,base_image_height: image width/heightmin_canny_threshold,max_canny_threshold: Canny edge detection thresholdsmin_segmenting_threshold,max_segmenting_threshold: Image segmenting thresholdscontour_thickness: thickness of lines drawn for region borders
Results are output as
@dataclass(frozen=True)
class RegionBordersApproximation:
border_points: dict[uuid4, Point]
border_segments: tuple[RegionBordersApproximator.RegionBorderSegment]
RegionBorderSegment.point_Id values correspond to border_points keys.
Examples (visual):
Borders highlighted:
Borders & boundary points highlit:
The idea is that the border points can be more finely, manually tweaked from this initial state. Future iterations will reliably automate that tweaking.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file imageboundarypointsgeneration-0.1.0.2.1.tar.gz.
File metadata
- Download URL: imageboundarypointsgeneration-0.1.0.2.1.tar.gz
- Upload date:
- Size: 6.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
44345280c84a16c8c5205eb3bd1bb71e4f77fc7062adb92266a5b78af1e631f3
|
|
| MD5 |
798cc921d42b6fc8f433bad131d21336
|
|
| BLAKE2b-256 |
30b41cb006d3242df08a51a2fb67249331225cf1b0f8bc3333247f2503513563
|
File details
Details for the file imageboundarypointsgeneration-0.1.0.2.1-py3-none-any.whl.
File metadata
- Download URL: imageboundarypointsgeneration-0.1.0.2.1-py3-none-any.whl
- Upload date:
- Size: 6.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
baa00c0029f53938f53e6a723218f1bb985647d250b5f30ac5d3bf2742933619
|
|
| MD5 |
23050bd036af3836abf0650963a6cbc2
|
|
| BLAKE2b-256 |
523f116d930e0b02657ebfb4380ff27cc6d55eba8f0faa00cf629eef508b84fa
|