The Encode function method base64-encodes GeoJSON code containing bounding box information. It compresses the code for writing to the header of an object detection raster.
This method is part of ENVI Deep Learning, which requires a separate license and installation.
Example
Sample data files are available on our ENVI Tutorials web page. Click the "Deep Learning" link in the ENVI Tutorial Data section to download a .zip file containing the data. Extract the contents of the .zip file to a local directory. Files are located in the object_detection folder.
This example removes two bounding boxes from an object detection raster. It then updates the metadata of the object detection raster.
e = ENVI(/HEADLESS)
File = 'C:\MyTutorialFiles\ObjectDetectionRaster_HandicapParkingSpots1.dat'
Raster = ENVIDeepLearningObjectDetectionRaster(File)
bboxInfo = ENVIDeepLearningObjectDetectionRaster.Decode( $
Raster.METADATA['dlobjectbounds'])
bboxSet = ENVIBoundingBoxSet(INPUT_GEOJSON = bboxInfo)
bboxSet.RemoveBoundingBox, CLASS=0, INDEX=0
bboxSet.RemoveBoundingBox, CLASS=0, INDEX=13
updatedGeoJSON = bboxSet.GetGeoJSON()
updatedRaster = $
ENVIDeepLearningObjectDetectionRaster.Encode(updatedGeoJSON)
updatedRaster.WriteMetadata
Syntax
Result = ENVIDeepLearningObjectDetectionRaster.Encode(InputGeoJSON [, ERROR=value])
Return Value
This method returns base64-encoded and compressed GeoJSON code.
Arguments
InputGeoJSON
Specify standard GeoJSON code containing bounding box information. This can be an input file (.json), string, Hash, Ordered Hash, or an ENVIGeoJSON object.
Keywords
ERROR
Set this keyword to a named variable that will contain any error message issued during execution of this routine. If no error occurs, the ERROR variable will be set to a null string (''). If an error occurs and the routine is a function, then the function result will be undefined.
When this keyword is not set and an error occurs, ENVI returns to the caller and execution halts. In this case, the error message is contained within !ERROR_STATE and can be caught using IDL's CATCH routine. See IDL Help for more information on !ERROR_STATE and CATCH.
See the Manage Errors topic in ENVI Help for more information on error handling.
Version History
See Also
ENVIDeepLearningObjectDetectionRaster