objectDetection from 6 element vector
조회 수: 1 (최근 30일)
이전 댓글 표시
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?
댓글 수: 0
답변 (1개)
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.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Tracking and Sensor Fusion에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!