how to find perimeter of object without using bwperim?
1 次查看(过去 30 天)
显示 更早的评论
i am using BW2 = bwperim(BW) inbuilt function to find perimeter of an image. now i want to undestand how this exactly works? how this image is passesd to other function and how the function retruns perimeter.so where can i find complete hard code of inbuilt function??
i mean to say is i find perimeter of object without using bwperim function?
0 个评论
回答(1 个)
Image Analyst
2015-4-27
What "other function"?
Anyway, bwperim returns the outer layer of a binary image. If you know what 8-connected and 4-connected means, it should be obvious what you'll get out of it. One way might be to erode the image and then eXclusive OR it, like the Mathworks does, from the original. Why do you need to know? I just treat it as a black box and don't need to know and don't care about the details. I have higher level operations to worry about. Even though I might know how low level routines work in principle, I don't feel I need to know them down to the actual lines of source code. If you really want to know, you can edit the file
>> edit bwperim
and find code such as this:
b_eroded = imerode(b,conn);
p = b & ~b_eroded;
which is the heart of the algorithm.
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!