0

私は、位相のみの再構成の重要性に基づいた画像処理のプロジェクトに取り組んでいます。詳細については、https://dsp.stackexchange.com/questions/16462/how-moving-part-pixel-intensity-values-of-video-frames-becomes-dominant-comparedでgeometrikalの回答を読むことができます

プロジェクトには 2 つの部分があります。

  1. 道路上のトラフィックのビデオから移動オブジェクトを検出します( (ステップ 1)再生ボタンをクリックし、 (ステップ 2) ビデオを右クリックし、(ステップ 3) オプションとして保存をクリックして、1.47 MB​​ のビデオをダウンロードしてください)

  2. ビデオから単一の移動オブジェクトの追跡を実行します。

今、私はプロジェクトの最初の部分でかなり成功しています。そのためのアルゴリズムは

アルゴリズムその1 提案手法

要件: ビデオから抽出された入力画像シーケンス I(x, y, n) (x と y は画像の次元、n はビデオのフレーム番号を表す)。

結果: 各フレームの移動オブジェクトのセグメンテーション マスク

  1. 入力ビデオの各フレームに対して、ステップ 2 を実行し、ステップ 2 を追加して、結果の配列 'I(x, y, n)' を取得します。</p>

  2. 2D ガウス フィルターを使用して現在のフレームを滑らかにする

  3. (Eq.4.1)を使用して、シーケンス全体 I(x, y, n) に対して 3D FFT を実行します。

  4. 3D DFT の実数部と虚数部を使用して位相スペクトルを計算します

  5. (Eq.4.2) を使用して、再構築されたシーケンス Î(x, y, n) を計算します。

  6. 入力ビデオの各フレームに対して、ステップ 7 からステップ 10 を実行して各フレームのセグメンテーション マスクを取得し、ステップ 10 を追加して結果のセグメンテーション マスク配列 BW(x,y,n)' を取得します。</p>

  7. 平均化フィルターを使用して Î(x, y, n) の再構成されたフレームを滑らかにします。

  8. 現在のフレームの平均値を計算します

  9. 平均値をしきい値として使用して、現在のフレームをバイナリ イメージに変換します。

  10. モルフォロジー処理、つまり、塗りつぶしとクロージングを実行して、現在のフレームの移動オブジェクトのセグメント化されたマスクを取得します

  11. アルゴリズムを終了します。

上記のアルゴリズムを使用すると、ビデオからすべての動くオブジェクトを見つけることができました。ここで、第 2 部に移りたいと思います。つまり、ビデオから任意の単一の移動オブジェクトの追跡を実行します。

ここに画像の説明を入力

図でわかるように、1 列目に示されている結果を達成しました。1 列目の結果までしか到達していません。しかし、私の目標は、図の 2 列目に示すように、1 台の車両を追跡することです。(Photoshop を使用して、2 番目の列に示す結果を作成しました)

誰でも私を助けることができますか?

 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 video


i=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
4

1 に答える 1

0

追跡するオブジェクトを特定したら、カルマン フィルターを実装すると、探している目的の追跡が得られます。

そこにはかなりのリソースがありますが、手動でやりたい場合は、YouTube での StudentDave の説明を使用することをお勧めします。https://www.youtube.com/watch?v=FkCT_LV9Syk

于 2015-05-27T20:04:58.320 に答える