Main Content

plotDetection

Plot detections in trackingGlobeViewer

Since R2021b

Description

plotDetection(viewer,detections) plots detections on the tracking globe viewer.

plotDetection(___,frame) specifies the reference frame used to interpret the coordinates of the detections.

example

plotDetection(___,Name=Value) specifies options using one or more name-value arguments. For example, plotDetection(viewer,detect,Color=[1 0 0]) specifies the color of the plotted detections as the RGB triplet [1 0 0].

example

Examples

collapse all

Create a tracking globe viewer and specify its reference location. Specify the camera position and orientation.

refloc = [42.366978 -71.022362 50];
viewer = trackingGlobeViewer(ReferenceLocation=refloc);
campos(viewer,42.3374,-71.0605,872.7615);
camorient(viewer,[39 0 -2.7]);

Plot a Cartesian measurement of [0 100 –300] expressed in the sensor frame, which is an NED frame whose origin position is [1000 0 0] with respect to the local NED frame of the viewer. The origin of this local NED frame is the same as the reference location of the viewer.

det1 = objectDetection(0,[0 100 -300],MeasurementParameters=struct("Frame","rectangular",...
    "OriginPosition",[1000 0 0]));
plotDetection(viewer,det1,"NED");

Plot a Cartesian measurement of [0 100 350] expressed in the sensor frame, which a ENU frame whose origin position is [1000 0 0] with respect to the local ENU frame of the viewer. The origin of this local ENU frame is the same as the reference location of the viewer.

det2 = objectDetection(0,[0 100 350],MeasurementParameters= ...
    struct("Frame","rectangular", ...
    "OriginPosition",[1000 0 0], ... 
    "Orientation",eye(3)), ...
    SensorIndex=2); 
plotDetection(viewer,det2,"ENU",Color=[0.5 0.5 0]); 

Plot a Cartesian measurement expressed in the sensor frame, which overlaps the ECEF frame.

det3 = objectDetection(0,[1.5349; -4.4634; 4.2761]*1e6,MeasurementParameters= ...
    struct("Frame","rectangular", ... 
    "OriginPosition",[0 0 0], ... 
    "Orientation",eye(3)), ...
    SensorIndex=3);
plotDetection(viewer,det3,"ECEF",Color=[0 0.5 0]); 

Take a snapshot and show the results.

drawnow
snapshot(viewer)

Create a tracking globe viewer and specify its reference location and coordinate frame. Specify the camera position and orientation.

frame = "ENU";
refloc = [42.366978 -71.022362 50];
viewer = trackingGlobeViewer(ReferenceLocation=refloc);
campos(viewer,42.3374,-71.0605,872.7615);
camorient(viewer,[39 0 -2.7]);

Create an angle-only detection with an azimuth of 0 degrees.

MP1 = struct(Frame="Spherical",HasAzimuth=true, ...
    HasElevation=false,HasRange=false,HasVelocity=false);
det1 = objectDetection(0,0,SensorIndex=1,MeasurementParameters=MP1);

Create an angle-only detection with an azimuth of 90 degrees and an elevation of 50 degrees.

MP2 = struct(Frame="Spherical",HasAzimuth=true, ...
    HasElevation=true,HasRange=false,HasVelocity=false);
det2 = objectDetection(0,[90; 50],SensorIndex=2,MeasurementParameters=MP2);

Create a range-only detection with a range of 1500 meters.

MP3 = struct(Frame="Spherical",HasAzimuth=false, ...
    HasElevation=false,HasRange=true,HasVelocity=false);
det3 = objectDetection(0,1500,SensorIndex=3,MeasurementParameters=MP3);

Plot the detections using the plotDetection object function. Specify the color for the detections from each sensor.

plotDetection(viewer,{det1,det2,det3},"ENU",Color=[1 0 0; 0 1 0; 0 0 1]);

Take a snapshot and show the results.

drawnow
snapshot(viewer)

Figure contains an axes object. The axes object contains an object of type image.

Input Arguments

collapse all

Tracking globe viewer, specified as a trackingGlobeViewer object.1

Object detections, specified as an objectDetection object, an array of objectDetection objects, or a cell array of objectDetection objects. Alternately, you can specify detections as a structure, an array of structures, or a cell array of structures. The fields of each structure should be equivalent to the properties of the objectDetection object. Each structure must at least have the Measurement, MeasurementNoise, and SensorIndex fields.

Reference frame, specified as "NED" for north-east down, "ENU" for east-north-up, or "ECEF" for Earth-centered-Earth-fixed. When specified as "NED" or "ENU", the origin of the reference frame is at the location specified by the ReferenceLocation property of the viewer object.

Data Types: char | string

Name-Value Arguments

Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

Example: plotDetection(viewer,detect,Color=[1 0 0])

Color of detections, specified as:

  • "Auto" — Automatically select the color from a limited set of colors based on the SensorIndex property or field of each detection.

  • A 1-by-3 RGB triplet — Plot all the detections with the same color.

  • An N-by-3 matrix of RGB triplets — Plot detections from each sensor with a different color. N is the number of unique SensorIndex in the detections input. In this way, you can specify different colors for detections generated from different sensors.

Transparency of the sphere for range-only detection plotting, specified as a scalar in the range [0, 1]. A value of 1 is fully opaque and 0 is completely transparent. Values between 0 and 1 are semitransparent.

Define a range-only detection using the objectDetection object by specifying its MeasurementParameters property as a structure with these fields. Set the:

  • Frame field to "Spherical".

  • HasRange field to true.

  • HasAzimuth field to false.

  • HasElevation field to false.

See Plot Range-Only and Angle-Only Detections in trackingGlobeViewer for an example.

Length of ray for angle-only detection plotting, specified as a positive scalar in meters.

Define an angle-only detection using the objectDetection object by specifying its MeasurementParameters property as a structure with these fields. Set the:

  • Frame field as "Spherical".

  • HasRange field as false.

  • HasAzimuth field as true.

  • HasElevation field as true or false. When you specify this field as false, the function assumes the elevation angle is 0.

See Plot Range-Only and Angle-Only Detections in trackingGlobeViewer for an example.

Version History

Introduced in R2021b

expand all


1 Alignment of boundaries and region labels are a presentation of the feature provided by the data vendors and do not imply endorsement by MathWorks®.