Error using rgb2gray>parse_inputs (line 82)

y=audioread('one1.wav'); y1=audioread('one2.wav'); y2=audioread('one3.wav'); y3=audioread('one4.wav');
figure,plot(y); imwrite(y,'one1.png'); figure,plot(y1); imwrite(y,'one2.png'); figure,plot(y2); imwrite(y,'one3.png'); figure,plot(y3); imwrite(y,'one4.png');
img1=imread('one1.png');
img2=imread('one2.png'); img3=imread('one3.png'); img4=imread('one4.png');
image1=rgb2gray(img1);
image2=rgb2gray(img2); image3=rgb2gray(img3); image4=rgb2gray(img4);
i1=imcrop(img1,[300,66,50,300]); i2=imcrop(img2,[300,66,50,300]); i3=imcrop(img3,[300,66,50,300]); i4=imcrop(img4,[300,66,50,300]); figure,imshow(i1); figure,imshow(i2); figure,imshow(i3); figure,imshow(i4);
I used above code but I got Error using rgb2gray>parse_inputs (line 82) MAP must be a m x 3 array.
Error in rgb2gray (line 37) X = parse_inputs(X);
Error in voicerecognition (line 21) image1=rgb2gray(img1); this error. what should I do for this

Réponses (1)

KSSV
KSSV le 17 Juil 2017

0 votes

You can apply rgb2gray to a colored/rgb image. In your case your images are not colored images. A color image will be a 3D matrix.

Catégories

En savoir plus sur MATLAB dans Centre d'aide et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by