2016-09-26 5 views
-1

여기에 같은 장소에서 유지 한 프레임입니다 :나는 걷는 남자의 비디오를 가지고있다. 나는이 남자를 그의 움직임을 그대로 유지하면서 중간에 가져와야한다. 즉 걷고있을 것처럼 보이지만

Here is one frame

그것은 검은 색과 흰색 실루엣의 형태입니다. (맨 - 화이트, 레스트 - 블랙). 이 사람은 첫 번째 프레임에서 마지막 프레임까지 오른쪽에서 왼쪽으로 걷고 있습니다. 나는 그가 항상 중앙에 있기를 원하지만 그는 움직이는 것처럼보아야한다. 그가 디딜 방아를 걷고있는 것처럼 보입니다.

자르기 부분을했습니다. 한 지점에서 중심을 고정하는 방법을 모르므로 사람이 진동하는 것처럼 보이지 않습니다. 여기에 지금

clc; 
close all; 
clear all; 

video_read = VideoReader('D:\PROJECT M.Tech\Databases\Videos\DATA SET B\009\bg-01\090\090.avi'); 
numframes = video_read.NumberOfFrames; 

for j= 1:numframes 
    frame=read(video_read,j); 
    im=rgb2gray(frame); 
    im = bwareaopen(im,50); 
    siz=size(im); % image dimensions 
    % Label the disconnected foreground regions (using 8 conned neighbourhood) 
    L=bwlabel(im,8); 
    % Get the bounding box around each object 
    bb=regionprops(L,'BoundingBox'); 
    % Crop the individual objects and store them in a cell 
    n=max(L(:)); % number of objects 
    ObjCell=cell(n,1); 
    for i=1:n 
    % Get the bb of the i-th object and offest by 2 pixels in all 
    % directions 
    bb_i=ceil(bb(i).BoundingBox); 
    idx_x=[bb_i(1)-2 bb_i(1)+bb_i(3)+2]; 
    idx_y=[bb_i(2)-2 bb_i(2)+bb_i(4)+2]; 
    if idx_x(1)<1, idx_x(1)=1; end 
    if idx_y(1)<1, idx_y(1)=1; end 
    if idx_x(2)>siz(2), idx_x(2)=siz(2); end 
    if idx_y(2)>siz(1), idx_y(2)=siz(1); end 
    % Crop the object and write to ObjCell 
    im=L==i; 
    ObjCell{i}=im(idx_y(1):idx_y(2),idx_x(1):idx_x(2)); 
    end 
    % Visualize the individual objects 
    figure 
    for i=1:n 
    subplot(1,n,i) 
    imshow(ObjCell{i}) 
    end 
    %bbox=regionprops(frame_im,'BoundingBox') 
    F(j)=getframe; 
end 
+0

무엇을 이미 시도 했습니까? – GameOfThrows

+0

5 엔지니어와 한달 줘, 그것에 대한 좋은 알고리즘을 작성하고 과학 저널 –

+0

@ GameOfThrows 내가 BoundingBox 및 Centroid를 사용하여 생각한 그것을 게시 할 수 있습니다. 즉, 사람을 경계 상자에 넣고 각 프레임의 중앙에 그의 중심을 유지하려고합니다. – Anuragkush

답변

0

알겠습니다. 경계 상자를 사용하고 이미지를 중앙에 놓습니다.

0

매우 순진 대답까지 코드는 큰 이미지 또는 프레임에 대한 많은 매우 느려질 수

for number_of_frame 
    [m,n] = find(frame); 
    imshow(min(m):max(m),min(n):max(n))); 

    drawnow; 
end 

이다.