clc;
clear all;
close all;
workspace;
hasIPT = license('test', 'image_toolbox');
if ~hasIPT
message = sprintf('Sorry, but you do not seem to have the Image Processing Toolbox.\nDo you want to try to continue anyway?');
reply = questdlg(message, 'Toolbox missing', 'Yes', 'No', 'Yes');
if strcmpi(reply, 'No')
return;
end
end
monochromeImage = imread('pout.tif');
subplot(2, 2, 1);
imshow(monochromeImage);
title('Original Image');
subplot(2, 2, 2);
imshow(monochromeImage);
title('Original Image with line in overlay');
set(gcf, 'units','normalized','outerposition',[0 0 1 1]);
set(gcf,'name','Image Analysis Demo','numbertitle','off')
burnedImage = imread('pout.tif');
hLine = imline(gca,[10 100],[10 100]);
binaryImage2 = hLine.createMask();
subplot(2, 2, 3);
imshow(binaryImage2);
title('Binary mask of the line');
burnedImage(binaryImage2) = 255;
subplot(2, 2, 4);
imshow(burnedImage);
title('New image with line burned into image');
Best Answer