JSON to mask

Reads a json file (.json) with a fixed format and converts this to a grayscale png mask. With:

  • White (#FF): as the color of the road

  • Black (#00): as the background

Usage: json2mask.py <json_file> <rgb_image>

json_file: path to the json file
rgb_image: path to the rgb image

The script outputs the mask as <image_stem>_mask.png to the same folder as the original image.

Requires OpenCV & NumPy:

pip install opencv-python pip install numpy

This documentation page was generated from a python file. The file is located in the repo folder corresponding to this documentation page. You can also click the `suggest edit` link (GitHub logo, top right) to open the file for editing in GitHub.