Single vehicle tracking using Fourier transform-MATLAB

In summary, the conversation discusses a project involving the importance of phase only reconstruction of a signal obtained from FFT. The speaker has successfully detected vehicles in a video using MATLAB code but now wants to track only one vehicle. They share their code and ask for help in modifying it to detect and track a single vehicle. Two possible approaches are discussed - detecting all vehicles and then tracking a single one, or directly detecting and tracking a single vehicle.
  • #1
ramdas
79
0
I am working on a project which is based on importance of phase only reconstruction of a signal obtained from fft.

Now ,I have detected vehicles from the Video of Traffic on road taken using stationary camera ( Please download the 1.47 MB video for testing MATLAB Code by ( step1) click on the play button then (step2) right clicking on video then ( step3 ) click on save as option )

If you run the code in MATLAB, you can observe that I am quite successful in detecting all the vehicles in each video frames. But now I want to do tracking of only one vehicle with changes in my code.So can anybody help me how to detect single vehicle by doing changes in my MATLAB Code ?

Matlab:
tic
clc;
clear all;
close all;

%read video file
video = VideoReader('D:\dvd\Matlab code\test videos\5.mp4');

T= video.NumberOfFrames  ;           %number of frames%

frameHeight = video.Height;          %frame height

frameWidth = video.Width ;           %frameWidth

get(video);                          %return graphics properties of videoi=1;

for t=300:15:550  %select frames between 300 to 550 with interval of 15 from the video
    frame_x(:,:,:,i)= read(video, t);
    frame_y=frame_x(:,:,:,i);

    %figure,
    %imshow(f1),title(['test frames :' num2str(i)]);
    frame_z=rgb2gray(frame_y);                 %convert each colour frame into gray

    frame_m(:,:,:,i)=frame_y; %Store colour frames in the frame_m array

    %Perform Gaussian Filtering
    h1=(1/8)*(1/8)*[1 3 3 1]'*[1 3 3 1]  ;   % 4*4 Gaussian Kernel
    convn=conv2(frame_z,h1,'same');
   
    g1=uint8(convn);

               
    Filtered_Image_Array(:,:,i)=g1; %Store filtered images into an array
    i=i+1;
end

%Apply 3-D Fourier Transform on video sequences
f_transform=fftn(Filtered_Image_Array);

%Compute phase spectrum array from f_transform
phase_spectrum_array =exp(1j*angle(f_transform));

%Apply 3-D Inverse Fourier Transform on phase spectrum array and
%reconstruct the frames
reconstructed_frame_array=(ifftn(phase_spectrum_array));k=i;

i=1;
for t=1:k-1

    %Smooth the reconstructed frame of Î(x, y, n) using the averaging filter.
    Reconstructed_frame_magnitude=abs(reconstructed_frame_array(:,:,t));
    H = fspecial('disk',4);
    circular_avg(:,:,t) = imfilter(Reconstructed_frame_magnitude,H);
   

    %Convert the current frame into binary image using mean value as the threshold
    mean_value=mean2(circular_avg(:,:,t));
    binary_frame = im2bw(circular_avg(:,:,t),1.6*mean_value);    %Perform Morphological operations
    se = strel('square',3);
    morphological_closing = imclose(binary_frame,se);
    morphological_closing=imclearborder(morphological_closing); %clear noise present at the borders of the frames    %Superimpose segmented masks on it's respective frames to obtain moving
    %objects
    moving_object_frame = frame_m(:,:,:,i);
    moving_object_frame(morphological_closing) = 255;
    figure,
    imshow(moving_object_frame,[]), title(['Moving objects in Frame :' num2str(i)]);

i=i+1;
end
toc
 
Last edited:
Physics news on Phys.org
  • #2
So my question is that is it possible to
detect a single vehicle and perform
tracking of it using Fourier transform ?

1. Should I 1st detect all the
vehicles and perform tracking of
single vehicle from it ?

or2. Is it possible to detect only one
vehicle and perform tracking from
it ?
 

1. What is Fourier transform and how does it relate to single vehicle tracking?

Fourier transform is a mathematical tool used to analyze the frequency components of a signal. In single vehicle tracking, it is used to extract the frequency signature of a moving vehicle from a video or image sequence and track its movement over time.

2. What is the advantage of using Fourier transform for single vehicle tracking?

The advantage of using Fourier transform for single vehicle tracking is that it can handle complex and noisy data sets, making it more robust and accurate compared to traditional tracking methods.

3. Can MATLAB be used for single vehicle tracking using Fourier transform?

Yes, MATLAB has built-in functions for Fourier transform analysis and image processing, making it a suitable platform for implementing single vehicle tracking using Fourier transform.

4. Is single vehicle tracking using Fourier transform limited to only one vehicle?

No, single vehicle tracking using Fourier transform can be applied to multiple vehicles in a scene. However, it may become more computationally intensive as the number of vehicles increases.

5. What are the potential applications of single vehicle tracking using Fourier transform?

Some potential applications of single vehicle tracking using Fourier transform include traffic monitoring, surveillance, and autonomous vehicle navigation. It can also be used in sports analysis to track the movement of players on a field or court.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
8
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
7
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
748
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
Back
Top