Extracting Frames and resizing each frame

조회 수: 12 (최근 30일)
Iqra Saleem
Iqra Saleem 2019년 2월 15일
댓글: kousar majeed 2019년 6월 14일
Hy, i convert YUV video file to frames but now i want to change size of every frames , how can i do that?
My code is:
clc; clear; close all;
VideoSequence = 'sampleQCIF.yuv';
width = 176;
height = 144;
nframes = 300;
[Y,U,V] = yuvRead(VideoSequence, width, height, nframes);
figure;
c = 0; % counter
for iFrame = 1:10
c = c + 1;
subplot(4,5,c),
imshow(Y(:,:,iFrame));
title(['frame #', num2str(iFrame)]);
end
  댓글 수: 6
Iqra Saleem
Iqra Saleem 2019년 2월 15일
Name Size Bytes Class Attributes
RGB 1x1 1 uint8
columns 1x1 8 double
grayImage 1x1 1 uint8
rows 1x1 8 double
This is about class.
Iqra Saleem
Iqra Saleem 2019년 2월 15일
sorry, my problem is different.
I attached original Matlab code and also output.
This code extract frames from YUV video precisley, but when i save those frames in laptop folder,they are not opening.
kinfly check my attach code and output.

댓글을 달려면 로그인하십시오.

답변 (2개)

KALYAN ACHARJYA
KALYAN ACHARJYA 2019년 2월 15일
편집: madhan ravi 2019년 2월 15일
Frames are images use the following, read here imresize
frame_resize=imresize(frame_names,scaling_value)
For multiple frames, you can call those and do the same. Also similar question answer is available, please look here, still unable to solve it, let me know.
  댓글 수: 15
Iqra Saleem
Iqra Saleem 2019년 2월 17일
oh sorry, now again check attachments.
Walter Roberson
Walter Roberson 2019년 2월 17일
Why did you remove the basefilename / fullfile code ? You are now specifying the name of a folder as the only output location. MATLAB will not be able to automatically figure out what file name to output to by guessing that you want to use the same output file name as the last file you input: you need to tell it the output file name.
I am not going to bother to type in the repaired code for you by reading your code off of your image. If you continue to have problems with this, post your code as code.

댓글을 달려면 로그인하십시오.


kousar majeed
kousar majeed 2019년 6월 14일
how can i extract the frame and save like 1-1.jpg in the folder with the name frame folder
  댓글 수: 3
kousar majeed
kousar majeed 2019년 6월 14일
vidobj = VideoReader(thisfile);
giving me error in this line
kousar majeed
kousar majeed 2019년 6월 14일
clc;
close all;
clear all;
% assigning the name of sample avi file to a variable
filename = 'Chili.avi.mp4';
%reading a video file
mov = VideoReader(filename);
% Defining Output folder as 'Frames'
opFolder = fullfile(cd, 'Frames');
%if not existing
if ~exist(opFolder, 'dir')
%make directory & execute as indicated in opfolder variable
mkdir(opFolder);
end
%getting no of frames
numFrames = mov.NumberOfFrames;
%setting current status of number of frames written to zero
numFramesWritten = 0;
%for loop to traverse & process from frame '1' to 'last' frames
for t = 1 : numFrames
currFrame = read(mov, t); %reading individual frames
opBaseFileName = sprintf('%3.3d.png', t);
opFullFileName = fullfile(opFolder, opBaseFileName);
imwrite(currFrame, opFullFileName, 'png'); %saving as 'png' file
%indicating the current progress of the file/frame written
progIndication = sprintf('Wrote frame %4d of %d.', t, numFrames);
disp(progIndication);
numFramesWritten = numFramesWritten + 1;
end %end of 'for' loop
progIndication = sprintf('Wrote %d frames to folder "%s"',numFramesWritten, opFolder);
disp(progIndication);
%End of the code
% make another folder with the name of Faces
mkdir Faces
===== upto here i run the video and it save in folder of frame. create another folder with the name of faces.now how can i extract the face using move command to load from frame folder and extract the face and save it into face folder=============

댓글을 달려면 로그인하십시오.

태그

Community Treasure Hunt

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

Start Hunting!

Translated by