フィルターのクリア

How do I pad an image after translating it ?

2 ビュー (過去 30 日間)
RuiQi
RuiQi 2016 年 6 月 22 日
コメント済み: Walter Roberson 2016 年 6 月 23 日
How do I pad the 'borders' of the image after translation by copying the nearest pixel values ? Like in this tutorial http://www.mathworks.com/help/images/translate-an-image.html, the image was translated but the boundaries are not black. I would like the border to be 'replicated' so that the new image does not have black borders.

回答 (1 件)

Walter Roberson
Walter Roberson 2016 年 6 月 22 日
  2 件のコメント
RuiQi
RuiQi 2016 年 6 月 23 日
Hi Walter. Sorry for not being clear but what I meant was if my image was
1 2 3
4 5 6
7 8 9
Then if i translate it one unit to the right i would like it to give me
1 1 2
4 4 5
7 7 8
Walter Roberson
Walter Roberson 2016 年 6 月 23 日
padarray with replicate, then throw away the part you do not need.
You would use that order instead of throwing away and then padding, because of the possibility that you might have translated completely out of the frame, which would leave an empty matrix if you threw away before padding.

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by