A utility script to convert Run-Length-Encoded Binary Masks in Darwin JSON 2.0 from V7 Labs to PNG.
The script must receive a JSON document that complies with the Darwin JSON 2.0 Format. Refer here.
Binary Mask annotated in JSON. See here.
![]() |
---|
Binary Mask in PNG Format |
-
Clone the Repository
git clone https://github.com/mukund-ks/RLE-To-PNG.git
-
Move into your local copy of repo
cd RLE-to-PNG
-
Setup a Virtual Environment
python -m venv env
-
Activate the Virtual Environment
env/Scripts/activate
-
Install Dependencies
pip install -r requirements.txt
- Run the 'help' command to see accepted arguments.
python main.py --help
Usage: main.py [OPTIONS]
Utility script to convert Darwin 2.0 JSON Binary Masks from V7Labs to PNG. The masks should be
Run-Length-Encoded and the JSON document should be following the Darwin 2.0 JSON Format.
Args:
mask_dir (str): Mask Directory with Darwin 2.0 JSON files.
save_dir (str): Saving Directory for PNG Masks.
Raises:
OSError: In the event that provided directory does not exist.
Options:
-M, --mask-dir TEXT Directory with Masks as JSON files [required]
-S, --save-dir TEXT Directory to save PNG Masks in [required]
--help Show this message and exit.
- An example
python main.py --mask-dir Data --save-dir Mask