フィルターのクリア

how to find perimeter of object without using bwperim?

5 ビュー (過去 30 日間)
santosh patil
santosh patil 2015 年 4 月 27 日
回答済み: Image Analyst 2015 年 4 月 27 日
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?

回答 (1 件)

Image Analyst
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.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by