MATLAB: How to change color space of any video

video color space changing

how to change color space of any video, e.g video in rgb color space is converting into hsv or gray?

Best Answer

vidObj = VideoReader('C:\Users\Public\Videos\Sample Videos\Wildlife.wmv'); % video file
%% Read the video frame by frame
numFrames = 0;
iwant = cell([],1) ;
while hasFrame(vidObj)
F = readFrame(vidObj);
numFrames = numFrames + 1;
imagesc(F)
drawnow
iwant{numFrames} = F ;
end
%% Write to video
v = VideoWriter('myFile','Archival');
v.VideoCompressionMethod
open(v)
for i = 1:numFrames
writeVideo(v,rgb2gray(iwant{i}))
end
close(v)
Related Question