{"id":13737413,"url":"https://github.com/alkasm/magicwand","last_synced_at":"2025-03-21T08:31:51.166Z","repository":{"id":123352119,"uuid":"101159209","full_name":"alkasm/magicwand","owner":"alkasm","description":"A Python+OpenCV implementation similar to Adobe Photoshop's magic wand selection tool.","archived":false,"fork":false,"pushed_at":"2019-09-03T06:18:35.000Z","size":1118,"stargazers_count":95,"open_issues_count":0,"forks_count":26,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-17T23:12:23.938Z","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/alkasm.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2017-08-23T08:52:00.000Z","updated_at":"2025-01-13T00:22:30.000Z","dependencies_parsed_at":"2023-10-20T16:40:59.534Z","dependency_job_id":null,"html_url":"https://github.com/alkasm/magicwand","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alkasm%2Fmagicwand","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alkasm%2Fmagicwand/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alkasm%2Fmagicwand/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alkasm%2Fmagicwand/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alkasm","download_url":"https://codeload.github.com/alkasm/magicwand/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244765453,"owners_count":20506818,"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","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-08-03T03:01:46.949Z","updated_at":"2025-03-21T08:31:50.463Z","avatar_url":"https://github.com/alkasm.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"## magicwand\n\nFlood filling masking tool.\n\nDisplays an image with a tolerance trackbar. A user can click anywhere on the image to seed a selection, where the range of allowable deviation from a color is given by the trackbar value. The mean and standard deviation of the selected region is displayed in the window's status bar.\n\n![Example Image](readme-example.png)\n\n## Getting Started\n\nInstall into a Python virtual environment, as you would any other Python project.\n\n```sh\n$ python3 -m venv venv\n$ source venv/bin/activate\n(venv) $ pip install git+https://github.com/alkasm/magicwand\n```\n\nRun the module as a script on any image you want:\n\n```sh\n(venv) $ python3 -m magicwand path/to/image.png\n```\n\n## Usage\n\nAs a script, just run the module directly as above. You can always check the `--help` flag when running the module as a script for more info:\n\n```sh\n(venv) $ python3 -m magicwand --help\nusage: magic wand selector [-h] image\n\npositional arguments:\n  image       path to image\n\noptional arguments:\n  -h, --help  show this help message and exit\n```\n\nUse inside your own Python projects:\n\n```python\n\u003e\u003e\u003e from magicwand import SelectionWindow\n\u003e\u003e\u003e import cv2 as cv\n\u003e\u003e\u003e \n\u003e\u003e\u003e img = cv.imread(\"lane.jpg\")\n\u003e\u003e\u003e window = SelectionWindow(img)\n\u003e\u003e\u003e window.show()\n\u003e\u003e\u003e \n\u003e\u003e\u003e print(f\"Selection mean: {window.mean[:, 0]}.\")\nSelection mean: [106.76420172  93.78792503  89.71121334].\n```\n\nThe window object has a few properties you might be interested in after successfully filtering your image:\n\n```python\n\u003e\u003e\u003e window.mean     # average value for each channel - from cv.meanStdDev(img, mask)\n\u003e\u003e\u003e window.stddev   # standard deviation for each channel - from cv.meanStdDev(img, mask)\n\u003e\u003e\u003e window.mask     # mask from cv.floodFill()\n\u003e\u003e\u003e window.img      # image input into the window\n\u003e\u003e\u003e window.seed     # most recent seed point for cv.floodFill()\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falkasm%2Fmagicwand","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falkasm%2Fmagicwand","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falkasm%2Fmagicwand/lists"}