{"id":19905305,"url":"https://github.com/jonaylor89/image-segmentation","last_synced_at":"2025-10-09T11:37:51.219Z","repository":{"id":40960683,"uuid":"253096082","full_name":"jonaylor89/image-segmentation","owner":"jonaylor89","description":"CMSC 630 Image Analysis Project 2","archived":false,"fork":false,"pushed_at":"2025-09-19T23:29:22.000Z","size":7208,"stargazers_count":0,"open_issues_count":2,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-10-09T11:37:50.352Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jonaylor89.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-04-04T20:49:15.000Z","updated_at":"2025-09-19T23:29:27.000Z","dependencies_parsed_at":"2024-11-12T20:33:51.633Z","dependency_job_id":"11ccd3d1-d3cb-4ff2-a26d-472e3f756c2e","html_url":"https://github.com/jonaylor89/image-segmentation","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/jonaylor89/image-segmentation","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonaylor89%2Fimage-segmentation","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonaylor89%2Fimage-segmentation/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonaylor89%2Fimage-segmentation/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonaylor89%2Fimage-segmentation/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jonaylor89","download_url":"https://codeload.github.com/jonaylor89/image-segmentation/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonaylor89%2Fimage-segmentation/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279001305,"owners_count":26083058,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-09T02:00:07.460Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-12T20:32:29.513Z","updated_at":"2025-10-09T11:37:51.209Z","avatar_url":"https://github.com/jonaylor89.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CMSC 630 Project 2\n\n### Image Segmentation and Clustering\n\n## Overview\n\nThis program is designed to take a batch of images as input, and run given set of operations on them (Edge Detection, Histogram Clustering, Histogram Thresholding, Dilation, and Erosion). All of these operations output a new image for each image in the batch. A TOML file in the root directory of the source code is used to configure the operations such as the strength of noise and the weights for filters. All important operations are implemented from scratch except for array operations that use the third-party mathematics library `numpy`. \n\n### Usage\n\n    Usage: main.py [OPTIONS]\n    \n    Options:\n      -c, --config PATH  [default: config.toml]\n      --help             Show this message and exit.\n\n### Execution\n\n    git clone https://github.com/jonaylor89/image-segmentation.git\n    cd image-segmentation\n    uv sync\n    uv run python main.py\n\nOr\n\n    docker run -it -v $HOME/Repos/CMSC_630_Project_2/datasets:/app/datasets jonaylor/cmsc_project_2\n\n*(this should pull the image already on dockerhub so the image won't be built locally)*\n\n## Implementation\n\nThe programming language of choice for this project was python. The high level reason for making the decision to write everything in python was that it gives the ability to rapidly develop and integrate each operation as well as for python's `numpy` library which allows for idiomatic and fast array operations. Python's fairly obvious downside is its speed. To mitigate the problem of speed for the image operations, `numba` , a third-party python library used for mathematics, is being used. `numba` has a python function decorator for just-in-time compiling functions to machine code before executing. Using this decorator on functions that use heavy math and looping (i.g. convolving) provides major speed increases with speeds similar to using a lower level compiled language like C/C++ or Rust. Compilation time effects the first image in the batch, but every image thereafter uses the precompiled machine code. Image batches, rather than being operated on synchronously, are thrown into a process pool where a preconfigured number of worker processes pulls images off a queue and runs them through the operation pipelines. \n\n**Full Third-Party Dependency List**\n\n    # pyproject.toml dependencies\n    pillow\u003e=11.3.0    # reading and writing images\n    numpy\u003e=2.3.3      # fast array operations\n    click\u003e=8.3.0      # command line interface utility\n    numba\u003e=0.62.0     # just-in-time compiler for operations\n    toml\u003e=0.10.2      # reading configuration file\n    tqdm\u003e=4.67.1      # progress bar\n\n*These can be found in the pyproject.toml at the root of the source code*\n\n---\n\n## Results\n\nThe output of this program can be seen in two places. The first is in the output directory specified in the `toml` configuration file. In the output directory there are the gray scale images from each operation with the file name `{operation}_{original image}.BMP` (e.g. `edges_svar53.BMP`).\n\n    canny_edge_detection(img_array: np.array) -\u003e np.array\n\n![assets/let60.bmp](assets/let60.bmp)\n\nOriginal\n\n![assets/edges_let60.bmp](assets/edges_let60.bmp)\n\nAfter Edge Detection\n\n    dilate(img_array: np.array, win: int = 1) -\u003e np.array\n\n![assets/svar12.bmp](assets/svar12.bmp)\n\noriginal\n\n![assets/dilated_svar12.BMP.bmp](assets/dilated_svar12.BMP.bmp)\n\nSegmented and Dilated\n\n    erode(img_array: np.array, win: int = 1) -\u003e np.array\n\n![assets/svar12.bmp](assets/svar12.bmp)\n\noriginal\n\n![assets/eroded_svar12.BMP.bmp](assets/eroded_svar12.BMP.bmp)\n\nSegmented and Eroded\n\n    histogram_thresholding(img_array: np.array) -\u003e np.array\n\n![assets/super14.bmp](assets/super14.bmp)\n\noriginal\n\n![assets/seg_thresholding_super14.BMP.bmp](assets/seg_thresholding_super14.BMP.bmp)\n\nsegmented\n\n    histogram_clustering(img_array: np.array) -\u003e np.array\n\n---\n\n![assets/inter25.bmp](assets/inter25.BMP)\n\noriginal\n\n![assets/seg_clusting_inter25.bmp](assets/seg_clusting_inter25.BMP)\n\nsegmented\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonaylor89%2Fimage-segmentation","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjonaylor89%2Fimage-segmentation","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonaylor89%2Fimage-segmentation/lists"}