0

I'm studying weed optimization algorithm of brain MRI images using Matlab R2017a. I obtained sample code from the Matlab File Exchange of Weed Optimization Algorithm. When I rand code with a binary image, I got an error message:

Undefined function 'colon' for input arguments of type 'uint8' and attributes 'full 3d real'.

What should I do to solve this problem?

This problem doesn't occur for some images. Sometimes, I get a matrix dimension error. Despite all errors, sample code works great 100%.

I=imread('brainxx.jpeg');
x=graytresh(I);
w=im2bw(I,x);

for.....
  %min pixel value
  %max pixel value
       %image area[pixels]
            .....
          within-class variance (sum of weighted bg and fg variance)
          % lowest within-class variance = optimal threshold (t)

    %find and set the optimal threshold and generate binary image
         [dat,indx]=min(var_tot);
         opt_td = im2double(opt_t)...
Cris Luengo
  • 55,762
  • 10
  • 62
  • 120
faniiruh
  • 29
  • 4
  • Are you actually using the MATLAB Compiler, or are you just running the script in MATLAB? There is a difference between compiling and running. When compiling, the image would not be read, so you would not expect different results for different images. – Cris Luengo Jul 18 '19 at 19:40
  • I mentioned to receive from matlab community that's it is sample code. https://www.mathworks.com/matlabcentral/fileexchange/26532-image-segmentation-using-otsu-thresholding – faniiruh Jul 18 '19 at 19:48
  • 1
    OK, I've fixed your question accordingly. Next, please include the shortest version the program that still produces this error, as per [mre]. You've given the error message, but no clue as to where in the program it occurs. If we can't see the program, and can't reproduce the error on our own computer, it will not be possible for us to know why this error is generated or how you should fix it. – Cris Luengo Jul 18 '19 at 19:54

0 Answers0