Error in image processing.

4 ビュー (過去 30 日間)
Massimo Colavita
Massimo Colavita 2015 年 5 月 25 日
編集済み: Walter Roberson 2015 年 5 月 27 日
Hello, I made a program with the following code:
I = imread('ppc.png');
corners = detectFASTFeatures(I,'MinContrast',0.1);
J = insertMarker(I,corners,'circle');
imshow(J);
and shows me the following error
Error using vision.internal.detector.fast.parseInputs (line 4)
Expected I to be of size MxN when it is actually size 255x559x3.
Error in detectFASTFeatures>parseInputs (line 97)
params = vision.internal.detector.fast.parseInputs(I, varargin{:});
Error in detectFASTFeatures (line 63)
params = parseInputs(I, varargin{:});
Error in zz (line 2)
corners = detectFASTFeatures(I,'MinContrast',0.1);

回答 (3 件)

Walter Roberson
Walter Roberson 2015 年 5 月 25 日
points = detectFASTFeatures(I) returns a cornerPoints object, points. The object contains information about the feature points detected in a 2-D grayscale input image, I.
You are not passing in a grayscale image, you are passing in a color image.

Dima Lisin
Dima Lisin 2015 年 5 月 26 日
編集済み: Dima Lisin 2015 年 5 月 26 日
Hi Massimo,
As Walter pointed out, detectFASTFeatures takes a grayscale image. Please use rgb2gray to convert I to grayscale.

Massimo Colavita
Massimo Colavita 2015 年 5 月 26 日
編集済み: Walter Roberson 2015 年 5 月 27 日
Thanks. Another question, I want to detect circles in the image: Why I see the whole picture 3 blank? and How should I apply the function "Strel"?
I = imread('ppc.png');
gr = rgb2gray(I);
level = graythresh(gr);
bw = im2bw(gr, level);
figure, imshow(bw);
title(1)
bw2 = bwareaopen(bw, 200);
figure, imshow(bw2);
title(2)
bw3 = imfill(bw2, 'holes');
figure;
imshow(bw3);
title(3);

カテゴリ

Help Center および File ExchangeComputer Vision with Simulink についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by