フィルターのクリア

Reshape an object in binary image

2 ビュー (過去 30 日間)
Maa Kari
Maa Kari 2016 年 1 月 28 日
編集済み: Maa Kari 2016 年 1 月 31 日
Hi dear;
I have a binary image that contains an object (some times a lot of objects), I want to reshape the object as showing in the image 1 to the one as showing in the image 2. My goal is to have an object tha has a straight boundaries.
Any help and suggestion will be appreciated.
  4 件のコメント
Walter Roberson
Walter Roberson 2016 年 1 月 29 日
Maybe you would like to skeletonize, remove spurs, and then dilate out again??
Maa Kari
Maa Kari 2016 年 1 月 31 日
編集済み: Maa Kari 2016 年 1 月 31 日
Hi Mr Image analyst
sorry I didnt pay attention to those coments
no i dont want any black padding around the rectangle, the resut is like what you get bellow for the simple binary image, but for a complex binary image my goal is to have the result as in the http://www.mathworks.com/matlabcentral/answers/265581#comment_339054
for clarification the binary image is after a segmentation of initial image that contains a lot of object and our goal is to have a straight boundaries for the connected component in the binary image i hope that my question is clear and I'm available for any clarification
Thank you very much

サインインしてコメントする。

採用された回答

Image Analyst
Image Analyst 2016 年 1 月 28 日
編集済み: Image Analyst 2016 年 1 月 28 日
Use
[labeledImage, numBlobs] = bwlabel(binaryImage);
measurements = regionprops(labeledImage, 'BoundingBox');
then for each blob in a for loop over all blobs, get the bounding box and get the bounding rows and columns,
for k = 1 : numBlobs
xLeft = ceil(measurements(k).BoundingBox(1));
% etc.
binaryImage(yTop:yBottom, xLeft:xRight) = true;
end
Let me know if you can't figure out the rest.
  7 件のコメント
Image Analyst
Image Analyst 2016 年 1 月 30 日
Aha, we knew it! You didn't actually want what you asked for (and so all my prior effort went to waste, perhaps). Now, with this image it looks like you actually want some kind of "envelope" of the blob. So it seems like you want activecontour(). This time I'll simply attach my canned demo and you can adapt it yourself.
Maa Kari
Maa Kari 2016 年 1 月 30 日
thank you very mutch your first prosition is very helpful for me, and thank you for the answer and for your efforts it is really appreciated i will try the activecontour().

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeImage Processing Toolbox についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by