What's the problem here?

2 ビュー (過去 30 日間)
Andrew Killian
Andrew Killian 2021 年 9 月 30 日
回答済み: Simon Chan 2021 年 9 月 30 日
I just wanted to do some simple edge detection with this code. But I get error:
"MAP must be a m x 3 array. Use im2gray for RGB and grayscale images."
I tried the im2gray function and it didn't work any better
pic = imread('good_day.jpg');
gray_pic = im2gray('good_day.jpg');
BW1 = edge(gray_pic,'Canny');
BW2 = edge(gray_pic,'Prewitt');
imshowpair(BW1,BW2,'montage');

採用された回答

Simon Chan
Simon Chan 2021 年 9 月 30 日
function im2gray does not accept the jpg image, it accepts the image in pixel values
Try the following:
pic = imread('good_day.jpg');
gray_pic = im2gray(pic);

その他の回答 (0 件)

カテゴリ

Find more on Images in Help Center and File Exchange

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by