how to run a code regarding regionfill() to obtain the background of an image in matlab 2014 because it is giving error that Undefined function 'regionfill' for input arguments of type 'uint8'.
    5 views (last 30 days)
  
       Show older comments
    
    Debarpita Chaudhuri
 on 9 Sep 2015
  
    
    
    
    
    Commented: Walter Roberson
      
      
 on 22 Sep 2015
            I am giving the code here.
grayImage = imread('brain_tumor.png');
figure,imshow(grayImage);
%h = impoly;
%position = wait(h);
mask = roipoly(grayImage);
figure, imshow(mask);
BackGround = regionfill(grayImage, mask);
figure, imshow(BackGround);
Sir, I have also attached the image herewith.
0 Comments
Accepted Answer
  Walter Roberson
      
      
 on 9 Sep 2015
        regionfill requires the Image Processing Toolbox, R2015a or newer.
Change your code
BackGround = regionfill(grayImage, mask);
to
BackGround = grayImage;
BackGround(mask) = 0;
with no regionfill() call.
10 Comments
  Walter Roberson
      
      
 on 22 Sep 2015
				Jpeg images should seldom be used for this kind of work. Jpeg blurs sharp edges making edge detection more difficult.
  Walter Roberson
      
      
 on 22 Sep 2015
				That code prompts for the image to open. You can select any of a number of image file formats including jpeg and png. Jpeg just won't do a good job.
Dicom would require a few more lines to read in.
More Answers (0)
See Also
Categories
				Find more on DICOM Format 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!


