how to calculate distance ?
Show older comments
I want to calculate the distance between two points of an edge there is my code
{
clc
clear all
close all
I = imread('C:\Users\PC\Pictures\matlab.bmp');
imshow(I)
BW = im2bw(I);
imshow(BW)
dim = size(BW)
col = round(dim(2)/2)-90;
row = min(find(BW(:,col)));
boundary = bwtraceboundary(BW,[row, col],'N');
imshow(I)
hold on;
plot(boundary(:,2),boundary(:,1),'g','LineWidth',3);
}
can someone help me
Answers (1)
Image Analyst
on 9 Apr 2013
0 votes
Use bwboundaries(), not bwtraceboundary(). Then, what 2 points do you want the distance between? Why can't you just use hypot()?
Categories
Find more on Read, Write, and Modify Image in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!