フィルターのクリア

objectDetection from 6 element vector

3 ビュー (過去 30 日間)
Márton Cserni
Márton Cserni 2019 年 10 月 27 日
回答済み: Elad Kivelevitch 2019 年 11 月 4 日
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

回答 (1 件)

Elad Kivelevitch
Elad Kivelevitch 2019 年 11 月 4 日
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.

Community Treasure Hunt

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

Start Hunting!

Translated by