ENVIDeepLearningObjectDetectionRaster::Encode

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.

; Start the application

e = ENVI(/HEADLESS)

 

; Open an object detection raster

; Update the following line with the correct path

; to the tutorial data files

File = 'C:\MyTutorialFiles\ObjectDetectionRaster_HandicapParkingSpots1.dat'

Raster = ENVIDeepLearningObjectDetectionRaster(File)

 

; Decode the GeoJSON bounding box information from the

; object detection raster metadata

bboxInfo = ENVIDeepLearningObjectDetectionRaster.Decode( $

Raster.METADATA['dlobjectbounds'])

 

; Create a bounding box set

bboxSet = ENVIBoundingBoxSet(INPUT_GEOJSON = bboxInfo)

 

; Remove two bounding boxes

bboxSet.RemoveBoundingBox, CLASS=0, INDEX=0

bboxSet.RemoveBoundingBox, CLASS=0, INDEX=13

 

; Get the updated bounding box information

updatedGeoJSON = bboxSet.GetGeoJSON()

 

; Encode the bounding box information

updatedRaster = $

  ENVIDeepLearningObjectDetectionRaster.Encode(updatedGeoJSON)

 

; Update the object detection raster metadata with

; the new bounding box information

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

1.2

Introduced

See Also

ENVIDeepLearningObjectDetectionRaster