raster2ML is a utility designed to process a Raster file and its corresponding shapefile to produce a raster mask file. The mask assigns class names based on the specified field in the shapefile.
The result is an 8-bit PNG file where a different color represents each distinct class from the shapefile.
Converts a Raster image into an 8-bit PNG.
Command:
test_raster2png.py [-h] src_raster output_folderExample:
!python tutorial/test_raster2png.py tutorial/in_folder/myraster.tif tutorial/out_folderGenerate a labelme JSON structure using raster and shapefile data.
Command:
test_shp2labelme.py [-h] raster_file shapefile_path label_fieldExample:
!python tutorial/test_shp2labelme.py tutorial/out_folder/myraster_8bit.png tutorial/in_folder/myvector.shp idlinDefines a set of functions that transform a given labelme JSON file into a labeled image (mask).
Command:
test_labelme2mask.py [-h] source_json_file target_folderExample:
!python tutorial/test_labelme2mask.py tutorial/out_folder/myraster_8bit.json tutorial/out_folderEnsure you have all the necessary dependencies installed. Refer to requirements.txt for a list of required packages.
If you use raster2ML in your research, please consider citing:
@misc{spatiallysaying_2023_raster2ML,
title={raster2ML: [ Utility designed to process a Raster file and its corresponding shapefile to produce a raster mask file]},
author={Durga Prasad, Dhulipudi},
year={2023},
url={https://github.com/spatiallysaying/raster2ML}
}