help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Plot object boundaries overlaying an image


From: Francisco Lopez de la Franca
Subject: Plot object boundaries overlaying an image
Date: Tue, 14 Jan 2014 12:44:18 +0100

Hi.

I’d like to highlight the object boundaries in an image, that is, plotting the object boundaries over the image.

I’ve written the code below and the result is that the image is displayed on the window but the plot calls seem not to work.

They do not have any effect.

I do not know if I am doing something wrong.

I also attach the image to the e-mail.

Thanks a lot in advance.

 

>> The code:

 

figure;

clf reset

grayImage = imread("saturno.jpeg");

grayImage = rgb2gray(grayImage);

imshow(grayImage)

% Enlarge figure to full screen.

set(gcf, 'Units', 'Normalized', 'OuterPosition', [0 0 1 1]);

% Threshold to binarize the image.

BW = im2bw(grayImage, graythresh(grayImage));

% Find boundaries.

[B,L] = bwboundaries(BW);

hold on

% Plot boundaries over original gray scale image.

for k=1:length(B)

boundary = B{k};

plot(boundary(:,2), boundary(:,1),'r-', 'LineWidth', 3)

end

title('Jupiter and Saturn with boundaries overlaid', 'FontSize', 25);

Attachment: saturno.jpeg
Description: JPEG image


reply via email to

[Prev in Thread] Current Thread [Next in Thread]