objectDetection from 6 element vector

1 visualización (últimos 30 días)
Márton Cserni
Márton Cserni el 27 de Oct. de 2019
Respondida: Elad Kivelevitch el 4 de Nov. de 2019
I have calculated detections (160 times a 6 element vector for each timeframe of the simulation) and I want to make objectDetection bus arrays from these to imput to a multiObjectTracker block. Any idea, how?
x.png

Respuestas (1)

Elad Kivelevitch
Elad Kivelevitch el 4 de Nov. de 2019
I am not sure that I understand your questions, but let me see if I can help a little.
If I understand correctly, you have 160x6xN array of measurements, where each measurement is a 6-element array, there are 160 detections, and N time frames. You want to create a bus that provides, at each timeframe, the detections to the multiObjectTracker.
In Simulink, the multiObjectTracker expects a Simulink Bus, defined in 2 or more levels. See this page for details:
In Simulink, you will need to create a MATLAB function block. The main body of the function simply takes your array, let's call it A, and the simulation time (e.g., from a digital clock in Simulink) and does the following:
function dets = readDets(A,t)
% A is the measurements array, 160x6 (at each timestep)
% t is the current simulation time, from a digital clock
oneDet = struct('Time',t,'Measurement',A(1,:)','MeasurementNoise',eye(size(A,2)),'SensorIndex',1,'ObjectClassID',0);
myDets = repmat(oneDet,160,1);
for i = 2:160
myDets(i).Measurement = A(i,:)';
end
dets = struct('NumDetections',160,'Detections',myDets);
end
In the MATLAB workspace, you need to define the bus that will carry this struct. For example, use
busInfo = Simulink.Bus.createObject(dets)
% Refer to https://www.mathworks.com/help/simulink/slref/simulink.bus.createobject.html
with dets being the output of the function above. This will give you a bus object. Note the busName.
Finally, use the name of the bus you created to define the output of the MATLAB function block in Simulink and attach the Multi-Object Tracker block to the MATLAB function block you created.

Categorías

Más información sobre Computer Vision with Simulink en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by