Can anyone help with this error? (I just want to see the contour of the bluish area at the bottom of the image)
조회 수: 1 (최근 30일)
이전 댓글 표시
close all
clear all
clc
I = imread('frame75.jpg');
imshow(I)
imcontour(I,3)
Error:
Error in imcontour>ParseInputs (line 110)
validateattributes(a,{'uint8','int16','uint16','double','logical','single'}, ...
Error in imcontour (line 40)
[x,y,a,extra_args] = ParseInputs(varargin{:});
Error in contour (line 8)
imcontour(I,3)
댓글 수: 0
채택된 답변
darova
2020년 7월 1일
Detect blue region properly
I0 = imread('frame75.jpg');
I1 = double(I0);
% colors from blue region
R = [80 50 0];
G = [160 110 70];
B = [180 120 70];
B1 = logical(I1(:,:,1)*0);
% detect regions and merge
for i = 1:length(R)
B0 = abs(I1(:,:,1)-R(i)) < 20 & ...
abs(I1(:,:,2)-G(i)) < 50 & ...
abs(I1(:,:,3)-B(i)) < 50;
B1 = B1 | B0;
end
% B1 = uint8( cat(3,B1,B1,B1) );
imshowpair(I0,B1)
% imshow(B1.*I0)
추가 답변 (1개)
Ameer Hamza
2020년 6월 27일
You need to specify a single channel image to imcontour(). For example, just provide the blue channel
imcontour(I(:,:,3), 3)
or convert image to grayscale
imcontour(rgb2gray(I), 3)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!