I want to convert all frames in my video from RGB color model to HSV color model.But I'm getting error and I couldn't solve it.Matlab code is:
obj=mmreader('C:\Users\newendo.avi');
nFrames=obj.NumberOfFrames;
for k=1:3000
img=read(obj,k);
[m,n] = size(img); % get size of your image
imvector = reshape(img, m*n, 1); % reshape your image to a vector to compute DCT
imdct = dct2(imvector); % compute DCT
imagedct = reshape(imdct,m,n); %reshape result back to original form of your image
hsv_image = rgb2hsv(imagedct) ;
figure(1)
imshow(img,[]);
end
ERROR is :
Attempted to access r(:,2); index out of bounds because size(r)=[921600,1,1].
Error in rgb2hsv (line 74) g = r(:,2); b = r(:,3); r = r(:,1);
Error in file2 (line 9) hsv_image = rgb2hsv(imvector);
My aim is to read the video, calculate dct and then convert to HSV model.
Help me out.