why it is showing Undefined function for input arguments of type 'uint8'

129 views (last 30 days)
basically i want to divide given image in to 4 segment using crop1 function but it is showing
Undefined function 'crop1' for input arguments of type 'uint8'.
function crop1 is
where I in an intensity image
function s = crop1(I)
%RGB input image
%"s" structure of croped images
%Assuming size be 2104*1000
%Segmente the give input image in to four unequal part
%First segment having s(1)= 100 vertical pixel
%Second segment having s(2)= 100 vertical pixel
%Third segment having s(3)= 250 vertical pixel
%Fourth segment having s(4)= 450 vertical pixel
a=[100,150,250,500];
% b=[150,650];
s(4).new=[];% Pre allocation of structure for rapid iteration
% for a
s(1).new(:,:,:)=I(1:a(1),:,:);
s(2).new(:,:,:)=I(a(1):a(1)+a(2),:,:);
s(3).new(:,:,:)=I(a(1)+a(2):a(1)+a(2)+a(3),:,:);
s(4).new(:,:,:)=I(a(1)+a(2)+a(3):end,:,:);

Accepted Answer

Wayne King
Wayne King on 25 Mar 2012
Did you save crop1.m in a folder that is on the MATLAB path?
If you save crop1.m in c:\mfiles for example, then use addpath() or pathtool to add that folder to the MATLAB search path so you can use the function.
If you have added it correctly, you should be able to type
>>which crop1
and MATLAB returns the path to the Matlab program.

More Answers (1)

Walter Roberson
Walter Roberson on 25 Mar 2012
And make sure that you are consistent about whether it is crop followed by the digit one, or crop followed by lower-case-L
  2 Comments
sheroo
sheroo on 21 Dec 2022
>> RGB = imread('013.jpg');
RGB = imresize(RGB,0.5);
imshow(RGB)
L = imsegkmeans(RGB,2);
B = labeloverlay(RGB,L);
imshow(B)
title('Labeled Image');
Warning: Image is too big to fit on screen; displaying at 67%
> In imuitools\private\initSize at 72
In imshow at 283
Undefined function 'imsegkmeans' for input arguments of type 'uint8'.
im facing that problem kindly help me

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!