フィルターのクリア

How can I crop image 1.jpg from 2.jpg in matlab(if it doesn't have boundary)?

2 ビュー (過去 30 日間)
How can I crop image 1.jpg from 2.jpg in matlab? Is there any function? 1.jpg is a binary image and it hasn't a boundary and noice. I use blue color for white color here to understandable.
1.jpg
2.jpg

採用された回答

Image Analyst
Image Analyst 2014 年 6 月 1 日
Here are the steps (one way at least - there are several ways to do it).
  1. convert to gray with rgb2gray()
  2. threshold binaryImage = grayImage < 128
  3. call bwconvhull
  4. call bwlabel to get labeledImage
  5. call regionprops(labeledImage..... and ask for 'BoundingBox'.
  6. expand bounding box coordinates by whatever amount you want.
  7. call imcrop(originalImage, boundingBox)
That pretty much does it, except for some things like imshow() to display your progress. See if you can do it all by yourself from this point on. Let me know how it goes.
  2 件のコメント
Indunie Florence
Indunie Florence 2014 年 6 月 1 日
編集済み: Indunie Florence 2014 年 6 月 1 日
[Ilabel num] = bwlabel(Ifinal1);
Iprops = regionprops(Ilabel);
Ibox = [Iprops.BoundingBox];
Icrop = imcrop(I,Ibox);
I used this code segment and it doesn't work.
I can't set the boundary mannually because I don't know where the objects are in the image.
Indunie Florence
Indunie Florence 2014 年 6 月 1 日
As you said, bwconvhull method solve the problem.. thank you thank you very much...

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGeometric Transformation and Image Registration についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by