wrek
wrek

Reputation: 309

bwboundaries and axes - Matlab

In the script below I outline an object but in the final plot I have noticed that the left bottom of the plot is not 0,0. How can I fix it in the plot and also the X/Ycoord data?

enter image description here enter image description here Code:

clc
clear
close all

Iorig = imread('E:/drop.jpg');
I = rgb2gray(Iorig); 
axis on
imshow(I)


T = adaptthresh(I, 0.65);
BW = imbinarize(I,T);
BW2 = imcomplement(BW);
BW2 = imfill(BW2, 'holes');


axis on
hold on;
[B,L] = bwboundaries(BW2,'noholes');

boundary = B{1};
Xcoord = boundary(:,2);
Ycoord = boundary(:,1);
plot(Xcoord, Ycoord, 'g', 'LineWidth', 2)

Upvotes: 2

Views: 193

Answers (1)

flawr
flawr

Reputation: 11628

You can flip they y-axis using

set(gca,'YDir','normal')

Upvotes: 2

Related Questions