image processing - Convert color video to grayscale video in MATLAB -
i trying operations on color video in matlab however, facing 2 problems:
i getting error while converting color video grayscale video. mean need convert color video grayscale video , write .avi file
how can perform operation (say edge detection) on grayscale frames (extracted color video) , can write result of edge detection in .avi video format?
my incomplete code (which consist of color format conversion) follows:
vid = videoreader('big_buck_bunny_480p_cut.avi'); numimgs = get(vid, 'numberofframes'); frames = read(vid); i=1:numimgs frames(:,:,:,i)=rgb2gray(frames(:,:,:,i)); end
any pointer fix these 2 problems?
your first problem due trying assign 2d output of rgb2gray 3d array. can fix converting gray image rgb format:
frames(:,:,:,i)=repmat(rgb2gray(frames(:,:,:,i)),[1 1 3]);
Comments
Post a Comment