MATLAB: How do you make lines solid and/or thicker? How do you “split” an image by drawing a line at the desired location? Image Segmentation

area calcualationimage analysisimage processingImage Processing Toolboximage segmentationimlineregionprops

I'm trying to split up an image that I have into separate regions so I can then find the area of those separated regions. The code which I received help in making is shown below:
% % % % % COLOR ANALYSIS FOR SHELL COLOR % % % % %
% % % reads and crops % % %
f = imread('IMG_0001.jpg');
g = imcrop(f,[750 500 1800 1300]);
figure, imshow(g); title ('Cropped Image');
% % % Converts to BW Image to fill shell and cut out parts that are not shell % % %
burnedImage = g;
BW = im2bw(burnedImage, .5); % converts the truecolor image RGB to a binary image %
BW=~BW; % Inverse of the BW image %
filled = imfill(BW, 'holes'); % Fills the holes of the shell %
filled=~filled; % Inverse of the filled image %
figure, imshow(filled); title('Filled Black and White Image');
% % % DRAW LINES % % %
burnedImage = filled;
% % % Line1 % % %
hLine = imline();
binaryImage1 = hLine.createMask();
burnedImage(binaryImage1) = 255;
imshow(burnedImage); title('BurnedImage1');
% % % Line2 % % %
hLine=imline();
binaryImage2 = hLine.createMask();
burnedImage(binaryImage2) = 255;
imshow(burnedImage); title('BurnedImage2');
% % % Line3 % % %
hLine=imline();
binaryImage3 = hLine.createMask();
burnedImage(binaryImage3) = 255;
imshow(burnedImage); title('BurnedImage3');
% % % Line4 % % %
hLine=imline();
binaryImage4 = hLine.createMask();
burnedImage(binaryImage4) = 255;
imshow(burnedImage); title('BurnedImage4');
% % % Line5 % % %
hLine=imline();
binaryImage5 = hLine.createMask();
burnedImage(binaryImage5) = 255;
imshow(burnedImage); title('BurnedImage5');
set( findobj(gcf,'type','line'), 'LineWidth', 500);
burnedImage = ~burnedImage;
figure, imshow(burnedImage); title('Image for Analysis');
% % % Find Area of each Region % % %
STATS = regionprops(burnedImage, 'Area');
allArea = [STATS.Area]
% % % % % Optional % % % % %
% A = numel(burnedImage(burnedImage==0)) % % % Counts off Pixels % % %
% B = numel(burnedImage(burnedImage==1)) % % % Counts on Pixels % % %
I am trying to find the area of only the shell of the turtle (you can use this link to see the images, http://www.facebook.com/pages/Terrapin-Station-and-Freshwater-Turtles/118675974883450 -they are the recently added turtle images). I was helped in making this code, and was told to use the method in the previous code to separate the head, legs, and tail from the shell body of the turtle. The problem is that when I draw the lines, they show up dotted, and dont actually separate the regions… Any help would be greatly appreciated! Thanks!

Best Answer

You can use imdilate() on the binaryImage1 to thicken the line before burning it into the image.