{"id":21476748,"url":"https://github.com/kazuhito00/grabcut-annotation-tool","last_synced_at":"2025-06-13T11:37:43.268Z","repository":{"id":45447507,"uuid":"402068880","full_name":"Kazuhito00/GrabCut-Annotation-Tool","owner":"Kazuhito00","description":"OpenCVのGrabCut()を利用したセマンティックセグメンテーション向けアノテーションツール(Annotation tool using GrabCut() of OpenCV. It can be used to create datasets for semantic segmentation.)","archived":false,"fork":false,"pushed_at":"2021-12-13T13:13:10.000Z","size":566,"stargazers_count":38,"open_issues_count":2,"forks_count":8,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-13T08:11:41.175Z","etag":null,"topics":["grabcut","opencv","pillow","pysimplegui","semantic-segmentation"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Kazuhito00.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}},"created_at":"2021-09-01T13:21:40.000Z","updated_at":"2024-12-09T03:48:44.000Z","dependencies_parsed_at":"2022-08-04T15:15:46.910Z","dependency_job_id":null,"html_url":"https://github.com/Kazuhito00/GrabCut-Annotation-Tool","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/Kazuhito00/GrabCut-Annotation-Tool","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kazuhito00%2FGrabCut-Annotation-Tool","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kazuhito00%2FGrabCut-Annotation-Tool/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kazuhito00%2FGrabCut-Annotation-Tool/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kazuhito00%2FGrabCut-Annotation-Tool/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Kazuhito00","download_url":"https://codeload.github.com/Kazuhito00/GrabCut-Annotation-Tool/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kazuhito00%2FGrabCut-Annotation-Tool/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259638655,"owners_count":22888480,"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":["grabcut","opencv","pillow","pysimplegui","semantic-segmentation"],"created_at":"2024-11-23T11:10:09.591Z","updated_at":"2025-06-13T11:37:43.241Z","avatar_url":"https://github.com/Kazuhito00.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"[Japanese/[English](https://github.com/Kazuhito00/GrabCut-Annotation-Tool/blob/main/README_EN.md)]\n\n# GrabCut-Annotation-Tool\nhttps://user-images.githubusercontent.com/37477845/131681382-020df52c-dbc7-4750-80d1-42ff141ba829.mp4\n\nOpenCVのGrabCut()を利用したアノテーションツールです。\u003cbr\u003e\nセマンティックセグメンテーション向けのデータセット作成にご使用いただけます。\u003cbr\u003e\n※GrabCutのアルゴリズムの都合上、境界がはっきりしているデータのアノテーションに向いています。\u003cbr\u003e\n\n# Requirement \n* opencv-python 4.5.2.54 or later\n* Pillow 7.2.0 or later\n* PySimpleGUI 4.32.1 or later\n\n# Directory\n\u003cpre\u003e\n│  app.py\n│  config.json\n│  \n├─core\n│  │  gui.py\n│  └─util.py\n│          \n├─input\n│      \n└─output\n    ├─image\n    └─annotation\n\u003c/pre\u003e\n\n#### app.py, core/gui.py, core/util.py\nソースコードです。\n\n#### input\nアノテーション対象の画像ファイルを格納するディレクトリです。\n\n#### output\nアノテーション結果を保存するディレクトリです。\n* image：リサイズした画像が格納されます\n* annotation：アノテーション結果が格納されます\u003cbr\u003e※パレットモードのPNG形式で保存\n\n# Usage\n次のコマンドで起動してください。\n```\npython app.py\n```\n起動時には以下オプションが指定可能です。\n* --input\u003cbr\u003e\n入力画像格納パス\u003cbr\u003e\nデフォルト：input\n* --output_image\u003cbr\u003e\nアノテーション結果(画像)の格納パス\u003cbr\u003e\nデフォルト：output/image\n* --output_annotation\u003cbr\u003e\nアノテーション結果(セグメンテーション画像)の格納パス\u003cbr\u003e\nデフォルト：output/annotation\n* --config\u003cbr\u003e\nロードするコンフィグファイル\u003cbr\u003e\nデフォルト：config.json\n\n# Using GrabCut-Annotation-Tool\n### ファイル選択\nファイル一覧をクリックすることでアノテーション対象を切り替えることが出来ます。\u003cbr\u003e\nショートカットキー　↑、p：上のファイルへ　↓、n：下のファイルへ\u003cbr\u003e\n\u003cimg src=\"https://user-images.githubusercontent.com/37477845/131686101-c94132bc-4b76-488a-85fe-69d9d9c216bd.png\" width=\"80%\"\u003e\n\n### 初期ROI指定\n「Select ROI」と表示されている時にマウス右ドラッグで初期ROIを指定できます。\u003cbr\u003e\n\u003cimg src=\"https://user-images.githubusercontent.com/37477845/131687291-4f4c06d5-89fa-452d-925f-5576edc5af64.png\" width=\"80%\"\u003e\u003cbr\u003e\u003cbr\u003e\n\nドラッグ終了後、GrabCut処理が行われます。\u003cbr\u003e\n\u003cimg src=\"https://user-images.githubusercontent.com/37477845/131687690-295dc463-f82e-447b-86f8-65bbf6cf4e2d.png\" width=\"80%\"\u003e\u003cbr\u003e\u003cbr\u003e\n\n領域が選択されます。\u003cbr\u003e\n\u003cimg src=\"https://user-images.githubusercontent.com/37477845/131688127-3fc1c00e-0f99-435a-aa29-d9392c7af6d0.png\" width=\"80%\"\u003e\u003cbr\u003e\u003cbr\u003e\n\n### 後景指定\nマウス右ドラッグで後景の指定が出来ます。\u003cbr\u003e\n\u003cimg src=\"https://user-images.githubusercontent.com/37477845/131688309-c47184d9-f793-49f0-aa26-445ea2c2b431.png\" width=\"80%\"\u003e\u003cbr\u003e\u003cbr\u003e\n\n\u003cimg src=\"https://user-images.githubusercontent.com/37477845/131688599-dc78e307-8a3b-4ec7-a9be-05325486ee5e.png\" width=\"80%\"\u003e\u003cbr\u003e\u003cbr\u003e\n\n### 前景指定\n「Manually label background」のチェックを外すことで前景指定に切り替えることが出来ます\u003cbr\u003e\nショートカットキー　Ctrl\u003cbr\u003e\n\u003cimg src=\"https://user-images.githubusercontent.com/37477845/131688947-ab0505ca-8413-4afe-8d5a-c42ae1f25a3f.png\" width=\"80%\"\u003e\u003cbr\u003e\u003cbr\u003e\n\nマウス右ドラッグで前景の指定が出来ます。\u003cbr\u003e\n\u003cimg src=\"https://user-images.githubusercontent.com/37477845/131689310-5447308d-2019-48d7-8a43-df7707969599.png\" width=\"80%\"\u003e\u003cbr\u003e\u003cbr\u003e\n\n\u003cimg src=\"https://user-images.githubusercontent.com/37477845/131689509-ea0597a4-939a-4821-a077-40720687e8b1.png\" width=\"80%\"\u003e\u003cbr\u003e\u003cbr\u003e\n\n### クラスID切り替え\nClass IDのチェックボックスを押すことでクラスIDを切り替えることが出来ます。\u003cbr\u003e\n一桁のIDはショートカットキーでの切り替えも可能です。\u003cbr\u003e\nショートカットキー　0-9\u003cbr\u003e\n\u003cimg src=\"https://user-images.githubusercontent.com/37477845/131690009-862e763d-9714-4420-bf9c-7185daa0bbff.png\" width=\"80%\"\u003e\u003cbr\u003e\u003cbr\u003e\n\nクラスID切り替え後はROI指定を行う必要があります。\u003cbr\u003e\n\u003cimg src=\"https://user-images.githubusercontent.com/37477845/131690463-667530d6-6e89-4eec-88ff-8a5aaf55a8a1.png\" width=\"80%\"\u003e\u003cbr\u003e\u003cbr\u003e\n\n\u003cimg src=\"https://user-images.githubusercontent.com/37477845/131690674-293340bc-eedb-48dc-9a20-8a5e4e61d1db.png\" width=\"80%\"\u003e\u003cbr\u003e\u003cbr\u003e\n\n### 自動保存\nリサイズ画像とアノテーション画像はGrabCut処理毎に自動保存されます。\u003cbr\u003e\n\u003cimg src=\"https://user-images.githubusercontent.com/37477845/131691035-ab98cf83-f659-4efe-89aa-896badcee985.png\" width=\"50%\"\u003e\u003cbr\u003e\u003cbr\u003e\n\n自動保存をしたくない場合は「Auto save」のチェックを外してください。\u003cbr\u003e\n自動保存以外で保存したい場合は、キーボード「s」を押してください。\u003cbr\u003e\n\u003cimg src=\"https://user-images.githubusercontent.com/37477845/131691394-72adf13c-c4dc-4df3-b1b2-f33d38acf226.png\" width=\"80%\"\u003e\u003cbr\u003e\u003cbr\u003e\n\n### その他設定\n\u003cimg src=\"https://user-images.githubusercontent.com/37477845/131691853-0ce525ee-34dc-4328-9978-2ee8903a4d8e.png\" width=\"80%\"\u003e\u003cbr\u003e\n* Mask alpha：画像のマスク重畳表示の濃淡具合\n* Iteration：GrabCutアルゴリズムのイテレーション回数\n* Draw thickness：前景/後景指定時の線の太さ\n* Output width：出力画像の横幅\n* Output height：出力画像の縦幅\n\n# ToDo\n- [x] ~~メモリリーク対策~~\n- [x] ~~ROI選択時に左上→右下ドラッグ以外も可能にする~~\n- [x] ~~クラスIDをショートカットキーで選択した際にROI選択表示にする~~\n\n# Author\n高橋かずひと(https://twitter.com/KzhtTkhs)\n \n# License \nGrabCut-Annotation-Tool is under [Apache-2.0 License](LICENSE).\n\nサンプル画像は[フリー素材ぱくたそ](https://www.pakutaso.com)様の写真を利用しています。\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkazuhito00%2Fgrabcut-annotation-tool","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkazuhito00%2Fgrabcut-annotation-tool","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkazuhito00%2Fgrabcut-annotation-tool/lists"}