Change size of a binary image

조회 수: 1 (최근 30일)
Andrii
Andrii 2012년 2월 20일
Hi everyone. I have a binary image with black background and white objects. Size 1638*1638. I need to add rows and columns to background thus new image size would be 1640*1640 in order to get a boundary without touched to this boundary objects. I have tried function resize, but as result the scale changed only. Is it a way to do it?

채택된 답변

Image Analyst
Image Analyst 2012년 2월 20일
Try padarray():
mPadded = padarray(m, [1 1]);
By the way, why was touching the edge a problem? Were you calling imclearborder()? Maybe you can just not do that.
  댓글 수: 2
Andrii
Andrii 2012년 2월 20일
I need to simplify objects' borders. But after simplification coordinates of new border sometimes exceed image size. Thank you very much for the advise and I'll try imclearborder too.
Image Analyst
Image Analyst 2012년 2월 21일
No, you wouldn't have posted this if you *wanted* to do imclearborder. That will get rid of things touching the border, but you added a layer of black pixels so you must NOT want things touching the border to be removed. Why don't you just post your original image and binary image and say what you want to do or measure so we can advise on the best approach? By the way, what does it mean to "simplify" an object's border and how does adding a layer of black pixels around the edge simply borders?

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

태그

Community Treasure Hunt

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

Start Hunting!

Translated by