필터 지우기
필터 지우기

Extract color map from a video ?

조회 수: 4 (최근 30일)
Szillat
Szillat 2018년 1월 10일
Hi,
I try to follow this steps that I see in Matlab conference: https://www.mathworks.com/content/dam/mathworks/mathworks-dot-com/company/events/conferences/matlab-conference-australia/2017/proceedings/detecting-moving-objects-in-aerial-imagery-captured-from-unmanned-aerial-vehicles.pdf
And there I try to extract some points from a video using "detectSURFFeatures", for this case I use rgb2gray. But after all process, I get a modified image, named with '481x641xsingle' proprieties, but to use "foreground = step(foregroundDetector, videoFrame);" I need to transform it in '480x640x3xsingle', but I can't extract the color map from the video. How can I do that?
there is my code:
v = vision.VideoFileReader('C:\Users\rafae\Desktop\DRONE desafio street car.mp4');
%%Create Video Player
videoPlayer = vision.VideoPlayer;
fgPlayer = vision.VideoPlayer;
%%Create Foreground Detector (Background Subtraction)
foregroundDetector = vision.ForegroundDetector('NumGaussians', 3,'NumTrainingFrames', 50);
for i = 1:30
vidFrame = step(v);
I2 = rgb2gray(vidFrame);
point2 = detectSURFFeatures(I2);
[features2,valid_points2] = extractFeatures(I2,point2);
if(rem(i,2)==0)
if(rem(i,2)==0)
vidFrame = step(v);
I1=rgb2gray(vidFrame);
point1=detectSURFFeatures(I1);
[features1,valid_points1] = extractFeatures(I1,point1);
% imshow(I1); hold on;
% plot(point1.selectStrongest(10));
else
vidFrame = step(v);
I2=rgb2gray(vidFrame);
point2=detectSURFFeatures(I2);
[features2,valid_points2] = extractFeatures(I2,point2);
% imshow(I2); hold on;
% plot(point2.selectStrongest(10));
end
indexPairs = matchFeatures(features1,features2);
matchedPoints1 = valid_points1(indexPairs(:,1),:);
matchedPoints2 = valid_points2(indexPairs(:,2),:);
%figure; showMatchedFeatures(I1,I2,matchedPoints1,matchedPoints2);
pointTracker = vision.PointTracker;
movingPoints = matchedPoints2.Location;
fixedPoints = matchedPoints1.Location;
tform = fitgeotrans(movingPoints,fixedPoints,'projective');
B = imwarp(I2,tform);
%frameDifferences = diff(framesWithWhiteBlobs);
ind2gray
videoFrame = step(B); %here is my error
else
videoFrame = step(v);
end
foreground = step(foregroundDetector,videoFrame);
end

답변 (0개)

카테고리

Help CenterFile Exchange에서 Convert Image Type에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by