track vehicles using lidar: from point cloud to track list -凯发k8网页登录
this examples shows how to track vehicles using measurements from a lidar sensor mounted on top of an ego vehicle. lidar sensors report measurements as a point cloud. the example illustrates the workflow in matlab® for processing the point cloud and tracking the objects. for a simulink® version of the example, refer to track vehicles using lidar data in simulink.the lidar data used in this example is recorded from a highway driving scenario. in this example, you use the recorded data to track vehicles with a joint probabilistic data association (jpda) tracker and an interacting multiple model (imm) approach.
3-d bounding box detector model
due to high resolution capabilities of the lidar sensor, each scan from the sensor contains a large number of points, commonly known as a point cloud. this raw data must be preprocessed to extract objects of interest, such as cars, cyclists, and pedestrians. in this example, you use a classical segmentation algorithm using a distance-based clustering algorithm. for more details about segmentation of lidar data into objects such as the ground plane and obstacles, refer to the (automated driving toolbox) example. for a deep learning segmentation workflow, refer to the detect, classify, and track vehicles using lidar (lidar toolbox) example. in this example, the point clouds belonging to obstacles are further classified into clusters using the pcsegdist
function, and each cluster is converted to a bounding box detection with the following format:
, and refer to the x-, y- and z-positions of the bounding box, refers to its yaw angle and , and refer to its length, width, and height, respectively. the (lidar toolbox) function uses l-shape fitting algorithm to determine the yaw angle of the bounding box.
the detector is implemented by a supporting class helperboundingboxdetector
, which wraps around point cloud segmentation and clustering functionalities. an object of this class accepts a pointcloud
input and returns a list of objectdetection
objects with bounding box measurements.
the diagram shows the processes involved in the bounding box detector model and the lidar toolbox™ functions used to implement each process. it also shows the properties of the supporting class that control each process.
the lidar data is available at the following location:
download the data files into your temporary directory, whose location is specified by matlab's tempdir
function. if you want to place the files in a different folder, change the directory name in the subsequent instructions.
% load data if unavailable. the lidar data is stored as a cell array of % pointcloud objects. if ~exist('lidardata','var') dataurl = 'https://ssd.mathworks.com/supportfiles/lidar/data/trackvehiclesusinglidarexampledata.zip'; datasetfolder = fullfile(tempdir,'lidarexampledataset'); if ~exist(datasetfolder,'dir') unzip(dataurl,datasetfolder); end % specify initial and final time for simulation. inittime = 0; finaltime = 35; [lidardata, imagedata] = loadlidarandimagedata(datasetfolder,inittime,finaltime); end % set random seed to generate reproducible results. s = rng(2018); % a bounding box detector model. detectormodel = helperboundingboxdetector(... 'xlimits',[-50 75],... % min-max 'ylimits',[-5 5],... % min-max 'zlimits',[-2 5],... % min-max 'segmentationmindistance',1.8,... % minimum euclidian distance 'mindetectionspercluster',1,... % minimum points per cluster 'measurementnoise',blkdiag(0.25*eye(3),25,eye(3)),... % measurement noise in detection report 'groundmaxdistance',0.3); % maximum distance of ground points from ground plane
target state and sensor measurement model
the first step in tracking an object is defining its state, and the models that define the transition of state and the corresponding measurement. these two sets of equations are collectively known as the state-space model of the target. to model the state of vehicles for tracking using lidar, this example uses a cuboid model with following convention:
refers to the portion of the state that controls the kinematics of the motion center, and is the yaw angle. the length, width, and height of the cuboid are modeled as constants, whose estimates evolve in time during correction stages of the filter.
in this example, you use two state-space models: a constant velocity (cv) cuboid model and a constant turn-rate (ct) cuboid model. these models differ in the way they define the kinematic part of the state, as described below:
for information about their state transition, refer to the helperconstvelcuboid
and helperconstturncuboid
functions used in this example.
the helpercvmeascuboid
and helperctmeascuboid
measurement models describe how the sensor perceives the constant velocity and constant turn-rate states respectively, and they return bounding box measurements. because the state contains information about size of the target, the measurement model includes the effect of center-point offset and bounding box shrinkage, as perceived by the sensor, due to effects like self-occlusion [1]. this effect is modeled by a shrinkage factor that is directly proportional to the distance from the tracked vehicle to the sensor.
the image below demonstrates the measurement model operating at different state-space samples. notice the modeled effects of bounding box shrinkage and center-point offset as the objects move around the ego vehicle.
set up tracker and visualization
the image below shows the complete workflow to obtain a list of tracks from a pointcloud input.
now, set up the tracker and the visualization used in the example.
a joint probabilistic data association tracker (trackerjpda
) coupled with an imm filter (trackingimm
) is used to track objects in this example. the imm filter uses a constant velocity and constant turn-rate model and is initialized using the supporting function, helperinitimmfilter
, included with this example. the imm approach helps a track to switch between motion models and thus achieve good estimation accuracy during events like maneuvering or lane changing. the animation below shows the effect of mixing the constant velocity and constant turn-rate model during prediction stages of the imm filter.
the imm filter updates the probability of each model when it is corrected with detections from the object. the animation below shows the estimated trajectory of a vehicle during a lane change event and the corresponding estimated probabilities of each model.
set the hasdetectabletrackidsinput
property of the tracker as true
, which enables you to specify a state-dependent probability of detection. the detection probability of a track is calculated by the helpercalcdetectability
function, listed at the end of this example.
assignmentgate = [75 1000]; % assignment threshold; confthreshold = [7 10]; % confirmation threshold for history logic delthreshold = [8 10]; % deletion threshold for history logic kc = 1e-9; % false-alarm rate per unit volume % imm filter initialization function filterinitfcn = @helperinitimmfilter; % a joint probabilistic data association tracker with imm filter tracker = trackerjpda('filterinitializationfcn',filterinitfcn,... 'tracklogic','history',... 'assignmentthreshold',assignmentgate,... 'clutterdensity',kc,... 'confirmationthreshold',confthreshold,... 'deletionthreshold',delthreshold,... 'hasdetectabletrackidsinput',true,... 'initializationthreshold',0,... 'hitmissthreshold',0.1);
the visualization is divided into these main categories:
lidar preprocessing and tracking - this display shows the raw point cloud, segmented ground, and obstacles. it also shows the resulting detections from the detector model and the tracks of vehicles generated by the tracker.
ego vehicle display - this display shows the 2-d bird's-eye view of the scenario. it shows the obstacle point cloud, bounding box detections, and the tracks generated by the tracker. for reference, it also displays the image recorded from a camera mounted on the ego vehicle and its field of view.
tracking details - this display shows the scenario zoomed around the ego vehicle. it also shows finer tracking details, such as error covariance in estimated position of each track and its motion model probabilities, denoted by cv and ct.
% create display displayobject = helperlidarexampledisplay(imagedata{1},... 'positionindex',[1 3 6],... 'velocityindex',[2 4 7],... 'dimensionindex',[9 10 11],... 'yawindex',8,... 'moviename','',... % specify a movie name to record a movie. 'recordgif',false); % specify true to record new gifs
loop through data
loop through the recorded lidar data, generate detections from the current point cloud using the detector model and then process the detections using the tracker.
time = 0; % start time dt = 0.1; % time step % initiate all tracks. alltracks = struct([]); % initiate variables for comparing matlab and mex simulation. numtracks = zeros(numel(lidardata),2); % loop through the data for i = 1:numel(lidardata) % update time time = time dt; % get current lidar scan currentlidar = lidardata{i}; % generator detections from lidar scan. [detections,obstacleindices,groundindices,croppedindices] = detectormodel(currentlidar,time); % calculate detectability of each track. detectabletracksinput = helpercalcdetectability(alltracks,[1 3 6]); % pass detections to track. [confirmedtracks,tentativetracks,alltracks,info] = tracker(detections,time,detectabletracksinput); numtracks(i,1) = numel(confirmedtracks); % get model probabilities from imm filter of each track using % gettrackfilterproperties function of the tracker. modelprobs = zeros(2,numel(confirmedtracks)); for k = 1:numel(confirmedtracks) c1 = gettrackfilterproperties(tracker,confirmedtracks(k).trackid,'modelprobabilities'); modelprobs(:,k) = c1{1}; end % update display if isvalid(displayobject.pointcloudprocessingdisplay.obstacleplotter) % get current image scan for reference image currentimage = imagedata{i}; % update display object displayobject(detections,confirmedtracks,currentlidar,obstacleindices,... groundindices,croppedindices,currentimage,modelprobs); end % snap a figure at time = 18 if abs(time - 18) < dt/2 snapnow(displayobject); end end % write movie if requested if ~isempty(displayobject.moviename) writemovie(displayobject); end % write new gifs if requested. if displayobject.recordgif % second input is start frame, third input is end frame and last input % is a character vector specifying the panel to record. writeanimatedgif(displayobject,10,170,'trackmaintenance','ego'); writeanimatedgif(displayobject,310,330,'jpda','processing'); writeanimatedgif(displayobject,120,140,'imm','details'); end
the figure above shows the three displays at time = 18 seconds. the tracks are represented by green bounding boxes. the bounding box detections are represented by orange bounding boxes. the detections also have orange points inside them, representing the point cloud segmented as obstacles. the segmented ground is shown in purple. the cropped or discarded point cloud is shown in blue.
generate c code
you can generate c code from the matlab® code for the tracking and the preprocessing algorithm using matlab coder™. c code generation enables you to accelerate matlab code for simulation. to generate c code, the algorithm must be restructured as a matlab function, which can be compiled into a mex file or a shared library. for this purpose, the point cloud processing algorithm and the tracking algorithm is restructured into a matlab function, mexlidartracker
. some variables are defined as persistent
to preserve their state between multiple calls to the function (see ). the inputs and outputs of the function can be observed in the function description provided in the "supporting files" section at the end of this example.
matlab coder requires specifying the properties of all the input arguments. an easy way to do this is by defining the input properties by example at the command line using the -args
option. for more information, see (matlab coder). note that the top-level input arguments cannot be objects of the handle
class. therefore, the function accepts the x, y and z locations of the point cloud as an input. from the stored point cloud, this information can be extracted using the location
property of the pointcloud
object. this information is also directly available as the raw data from the lidar sensor.
% input lists inputexample = {lidardata{1}.location, 0}; % create configuration for mex generation cfg = coder.config('mex'); % replace cfg with the following to generate static library and perform % software-in-the-loop simulation. this requires an embedded coder license. % % cfg = coder.config('lib'); % static library % cfg.verificationmode = 'sil'; % software-in-the-loop % generate code if file does not exist. if ~exist('mexlidartracker_mex','file') h = msgbox({'generating code. this may take a few minutes...';'this message box will close when done.'},'codegen message'); % -config allows specifying the codegen configuration % -o allows specifying the name of the output file codegen -config cfg -o mexlidartracker_mex mexlidartracker -args inputexample close(h); else clear mexlidartracker_mex; end
code generation successful.
rerun simulation with mex code
rerun the simulation using the generated mex code, mexlidartracker_mex
. reset time
time = 0; for i = 1:numel(lidardata) time = time dt; currentlidar = lidardata{i}; [detectionsmex,obstacleindicesmex,groundindicesmex,croppedindicesmex,... confirmedtracksmex, modelprobsmex] = mexlidartracker_mex(currentlidar.location,time); % record data for comparison with matlab execution. numtracks(i,2) = numel(confirmedtracksmex); end
compare results between matlab and mex execution
disp(isequal(numtracks(:,1),numtracks(:,2)));
1
notice that the number of confirmed tracks is the same for matlab and mex code execution. this assures that the lidar preprocessing and tracking algorithm returns the same results with generated c code as with the matlab code.
results
now, analyze different events in the scenario and understand how the combination of lidar measurement model, joint probabilistic data association, and interacting multiple model filter, helps achieve a good estimation of the vehicle tracks.
track maintenance
the animation above shows the simulation between time = 3 seconds and time = 16 seconds. notice that tracks such as t10 and t6 maintain their ids and trajectory during the time span. however, track t9 is lost because the tracked vehicle was missed (not detected) for a long time by the sensor. also, notice that the tracked objects are able to maintain their shape and kinematic center by positioning the detections onto the visible portions of the vehicles. for example, as track t7 moves forward, bounding box detections start to fall on its visible rear portion and the track maintains the actual size of the vehicle. this illustrates the offset and shrinkage effect modeled in the measurement functions.
capturing maneuvers
the animation shows that using an imm filter helps the tracker to maintain tracks on maneuvering vehicles. notice that the vehicle tracked by t4 changes lanes behind the ego vehicle. the tracker is able maintain a track on the vehicle during this maneuvering event. also notice in the display that its probability of following the constant turn model, denoted by ct, increases during the lane change maneuver.
joint probabilistic data association
this animation shows that using a joint probabilistic data association tracker helps in maintaining tracks during ambiguous situations. here, vehicles tracked by t43 and t73, have a low probability of detection due to their large distance from the sensor. notice that the tracker is able to maintain tracks during events when one of the vehicles is not detected. during the event, the tracks first coalesce, which is a known phenomenon in jpda, and then separate as soon as the vehicle was detected again.
summary
this example showed how to use a jpda tracker with an imm filter to track objects using a lidar sensor. you learned how a raw point cloud can be preprocessed to generate detections for conventional trackers, which assume one detection per object per sensor scan. you also learned how to define a cuboid model to describe the kinematics, dimensions, and measurements of extended objects being tracked by the jpda tracker. in addition, you generated c code from the algorithm and verified its execution results with the matlab simulation.
supporting files
this section highlights the code from some important supporting files used in this example. the complete list of supporting files can be found in the current working directory after opening the example in matlab.
% *helperlidarmodel* % % this function defines the lidar model to simulate shrinkage of the % bounding box measurement and center-point offset. this function is used % in the |helpercvmeascuboid| and |helperctmeascuboid| functions to obtain % bounding box measurement from the state. % %helperlidarmodel.m %
helperinverselidarmodel
this function defines the inverse lidar model to initiate a tracking filter using a lidar bounding box measurement. this function is used in the helperinitimmfilter
function to obtain state estimates from a bounding box measurement.
function [pos,poscov,dim,dimcov,yaw,yawcov] = helperinverselidarmodel(meas,meascov) % this function returns the position, dimension, yaw using a bounding % box measurement. % 凯发官网入口首页 copyright 2019 the mathworks, inc. % shrink rate. s = 3/50; sz = 2/50; % x,y and z of measurement x = meas(1,:); y = meas(2,:); z = meas(3,:); [az,~,r] = cart2sph(x,y,z); % shift x and y position. lshrink = abs(s*r.*(cos(az))); wshrink = abs(s*r.*(sin(az))); hshrink = sz*r; shiftx = lshrink; shifty = wshrink; shiftz = hshrink; x = x sign(x).*shiftx/2; y = y sign(y).*shifty/2; z = z - shiftz/2; pos = [x;y;z]; poscov = meascov(1:3,1:3,:); yaw = meas(4,:); yawcov = meascov(4,4,:); % dimensions are initialized for a standard passenger car with low % uncertainity. dim = [4.7;1.8;1.4]; dimcov = 0.01*eye(3); end
helperboundingboxdetector
this is the supporting class helperboundingboxdetector
to accept a point cloud input and return a list of objectdetection
classdef helperboundingboxdetector < matlab.system % helperboundingboxdetector a helper class to segment the point cloud % into bounding box detections. % the step call to the object does the following things: % % 1. removes point cloud outside the limits. % 2. from the survived point cloud, segments out ground % 3. from the obstacle point cloud, forms clusters and puts bounding % box on each cluster. % cropping properties properties % xlimits xlimits for the scene xlimits = [-70 70]; % ylimits ylimits for the scene ylimits = [-6 6]; % zlimits zlimits fot the scene zlimits = [-2 10]; end % ground segmentation properties properties % groundmaxdistance maximum distance of point to the ground plane groundmaxdistance = 0.3; % groundreferencevector reference vector of ground plane groundreferencevector = [0 0 1]; % groundmaxangulardistance maximum angular distance of point to reference vector groundmaxangulardistance = 5; end % bounding box segmentation properties properties % segmentationmindistance distance threshold for segmentation segmentationmindistance = 1.6; % mindetectionspercluster minimum number of detections per cluster mindetectionspercluster = 2; % maxzdistancecluster maximum z-coordinate of cluster maxzdistancecluster = 3; % minzdistancecluster minimum z-coordinate of cluster minzdistancecluster = -3; end % ego vehicle radius to remove ego vehicle point cloud. properties % egovehicleradius radius of ego vehicle egovehicleradius = 3; end properties % measurementnoise measurement noise for the bounding box detection measurementnoise = blkdiag(eye(3),10,eye(3)); end properties (nontunable) measurementparameters = struct.empty(0,1); end methods function obj = helperboundingboxdetector(varargin) setproperties(obj,nargin,varargin{:}) end end methods (access = protected) function [bboxdets,obstacleindices,groundindices,croppedindices] = stepimpl(obj,currentpointcloud,time) % crop point cloud [pcsurvived,survivedindices,croppedindices] = croppointcloud(currentpointcloud,obj.xlimits,obj.ylimits,obj.zlimits,obj.egovehicleradius); % remove ground plane [pcobstacles,obstacleindices,groundindices] = removegroundplane(pcsurvived,obj.groundmaxdistance,obj.groundreferencevector,obj.groundmaxangulardistance,survivedindices); % form clusters and get bounding boxes detbboxes = getboundingboxes(pcobstacles,obj.segmentationmindistance,obj.mindetectionspercluster,obj.maxzdistancecluster,obj.minzdistancecluster); % assemble detections if isempty(obj.measurementparameters) measparams = {}; else measparams = obj.measurementparameters; end bboxdets = assembledetections(detbboxes,obj.measurementnoise,measparams,time); end end end function detections = assembledetections(bboxes,measnoise,measparams,time) % this method assembles the detections in objectdetection format. numboxes = size(bboxes,2); detections = cell(numboxes,1); for i = 1:numboxes detections{i} = objectdetection(time,cast(bboxes(:,i),'double'),... 'measurementnoise',double(measnoise),'objectattributes',struct,... 'measurementparameters',measparams); end end function bboxes = getboundingboxes(ptcloud,mindistance,mindetspercluster,maxzdistance,minzdistance) % this method fits bounding boxes on each cluster with some basic % rules. % cluster must have at least mindetspercluster points. % its mean z must be between maxzdistance and minzdistance. % length, width and height are calculated using min and max from each % dimension. [labels,numclusters] = pcsegdist(ptcloud,mindistance); pointdata = ptcloud.location; bboxes = nan(7,numclusters,'like',pointdata); isvalidcluster = false(1,numclusters); for i = 1:numclusters thispointdata = pointdata(labels == i,:); meanpoint = mean(thispointdata,1); if size(thispointdata,1) > mindetspercluster && ... meanpoint(3) < maxzdistance && meanpoint(3) > minzdistance cuboid = pcfitcuboid(pointcloud(thispointdata)); yaw = cuboid.orientation(3); l = cuboid.dimensions(1); w = cuboid.dimensions(2); h = cuboid.dimensions(3); if abs(yaw) > 45 possibles = yaw [-90;90]; [~,tochoose] = min(abs(possibles)); yaw = possibles(tochoose); temp = l; l = w; w = temp; end bboxes(:,i) = [cuboid.center yaw l w h]'; isvalidcluster(i) = l < 20 & w < 20; end end bboxes = bboxes(:,isvalidcluster); end function [ptcloudout,obstacleindices,groundindices] = removegroundplane(ptcloudin,maxgrounddist,referencevector,maxangulardist,currentindices) % this method removes the ground plane from point cloud using % pcfitplane. [~,groundindices,outliers] = pcfitplane(ptcloudin,maxgrounddist,referencevector,maxangulardist); ptcloudout = select(ptcloudin,outliers); obstacleindices = currentindices(outliers); groundindices = currentindices(groundindices); end function [ptcloudout,indices,croppedindices] = croppointcloud(ptcloudin,xlim,ylim,zlim,egovehicleradius) % this method selects the point cloud within limits and removes the % ego vehicle point cloud using findneighborsinradius locations = ptcloudin.location; locations = reshape(locations,[],3); insidex = locations(:,1) < xlim(2) & locations(:,1) > xlim(1); insidey = locations(:,2) < ylim(2) & locations(:,2) > ylim(1); insidez = locations(:,3) < zlim(2) & locations(:,3) > zlim(1); inside = insidex & insidey & insidez; % remove ego vehicle nearindices = findneighborsinradius(ptcloudin,[0 0 0],egovehicleradius); nonegoindices = true(ptcloudin.count,1); nonegoindices(nearindices) = false; validindices = inside & nonegoindices; indices = find(validindices); croppedindices = find(~validindices); ptcloudout = select(ptcloudin,indices); end
mexlidartracker
this function implements the point cloud preprocessing display and the tracking algorithm using a functional interface for code generation.
function [detections,obstacleindices,groundindices,croppedindices,... confirmedtracks, modelprobs] = mexlidartracker(ptcloudlocations,time) persistent detectormodel tracker detectabletracksinput currentnumtracks if isempty(detectormodel) || isempty(tracker) || isempty(detectabletracksinput) || isempty(currentnumtracks) % use the same starting seed as matlab to reproduce results in sil % simulation. rng(2018); % a bounding box detector model. detectormodel = helperboundingboxdetector(... 'xlimits',[-50 75],... % min-max 'ylimits',[-5 5],... % min-max 'zlimits',[-2 5],... % min-max 'segmentationmindistance',1.8,... % minimum euclidian distance 'mindetectionspercluster',1,... % minimum points per cluster 'measurementnoise',blkdiag(0.25*eye(3),25,eye(3)),... % measurement noise in detection report. 'groundmaxdistance',0.3); % maximum distance of ground points from ground plane assignmentgate = [75 1000]; % assignment threshold; confthreshold = [7 10]; % confirmation threshold for history logic delthreshold = [8 10]; % deletion threshold for history logic kc = 1e-9; % false-alarm rate per unit volume filterinitfcn = @helperinitimmfilter; tracker = trackerjpda('filterinitializationfcn',filterinitfcn,... 'tracklogic','history',... 'assignmentthreshold',assignmentgate,... 'clutterdensity',kc,... 'confirmationthreshold',confthreshold,... 'deletionthreshold',delthreshold,... 'hasdetectabletrackidsinput',true,... 'initializationthreshold',0,... 'maxnumtracks',30,... 'hitmissthreshold',0.1); detectabletracksinput = zeros(tracker.maxnumtracks,2); currentnumtracks = 0; end ptcloud = pointcloud(ptcloudlocations); % detector model [detections,obstacleindices,groundindices,croppedindices] = detectormodel(ptcloud,time); % call tracker [confirmedtracks,~,alltracks] = tracker(detections,time,detectabletracksinput(1:currentnumtracks,:)); % update the detectability input currentnumtracks = numel(alltracks); detectabletracksinput(1:currentnumtracks,:) = helpercalcdetectability(alltracks,[1 3 6]); % get model probabilities modelprobs = zeros(2,numel(confirmedtracks)); if islocked(tracker) for k = 1:numel(confirmedtracks) c1 = gettrackfilterproperties(tracker,confirmedtracks(k).trackid,'modelprobabilities'); probs = c1{1}; modelprobs(1,k) = probs(1); modelprobs(2,k) = probs(2); end end end
helpercalcdetectability
the function calculates the probability of detection for each track. this function is used to generate the "detectabletracksids" input for the trackerjpda
.
function detectabletracksinput = helpercalcdetectability(tracks,posindices) % this is a helper function to calculate the detection probability of % tracks for the lidar tracking example. it may be removed in a future % release. % 凯发官网入口首页 copyright 2019 the mathworks, inc. % the bounding box detector has low probability of segmenting point clouds % into bounding boxes are distances greater than 40 meters. this function % models this effect using a state-dependent probability of detection for % each tracker. after a maximum range, the pd is set to a high value to % enable deletion of track at a faster rate. if isempty(tracks) detectabletracksinput = zeros(0,2); return; end rmax = 75; rambig = 40; statesize = numel(tracks(1).state); posselector = zeros(3,statesize); posselector(1,posindices(1)) = 1; posselector(2,posindices(2)) = 1; posselector(3,posindices(3)) = 1; pos = gettrackpositions(tracks,posselector); if coder.target('matlab') trackids = [tracks.trackid]; else trackids = zeros(1,numel(tracks),'uint32'); for i = 1:numel(tracks) trackids(i) = tracks(i).trackid; end end [~,~,r] = cart2sph(pos(:,1),pos(:,2),pos(:,3)); probdetection = 0.9*ones(numel(tracks),1); probdetection(r > rambig) = 0.4; probdetection(r > rmax) = 0.99; detectabletracksinput = [double(trackids(:)) probdetection(:)]; end
loadlidarandimagedata
stitches lidar and camera data for processing using initial and final time specified.
function [lidardata,imagedata] = loadlidarandimagedata(datasetfolder,inittime,finaltime) initframe = max(1,floor(inittime*10)); lastframe = min(350,ceil(finaltime*10)); load (fullfile(datasetfolder,'imagedata_35seconds.mat'),'allimagedata'); imagedata = allimagedata(initframe:lastframe); numframes = lastframe - initframe 1; lidardata = cell(numframes,1); % each file contains 70 frames. initfileindex = floor(initframe/70) 1; lastfileindex = ceil(lastframe/70); frameindices = [1:70:numframes numframes 1]; counter = 1; for i = initfileindex:lastfileindex startframe = frameindices(counter); endframe = frameindices(counter 1) - 1; load(fullfile(datasetfolder,['lidardata_',num2str(i)]),'currentlidardata'); lidardata(startframe:endframe) = currentlidardata(1:(endframe 1 - startframe)); counter = counter 1; end end
references
[1] arya senna abdul rachman, arya. "3d-lidar multi object tracking for autonomous driving: multi-target detection and tracking under urban road uncertainties." (2017).