フィルターのクリア

How to translate image and pad border ?

2 ビュー (過去 30 日間)
RuiQi
RuiQi 2016 年 6 月 24 日
編集済み: Adam 2016 年 6 月 24 日
Hi I would like to use imtranslate but i want the output to not have black borders and be of same size as input. Like if my input is
1 2 3
4 5 6
7 8 9
and i translate 1 pixel to the right, then the output is
1 1 2
4 4 5
7 7 8

回答 (1 件)

Adam
Adam 2016 年 6 月 24 日
You could do this manually just as
mat = [ 1 2 3; 4 5 6; 7 8 9 ];
res = [ mat(:,1), mat(:,1:end-1) ];
  2 件のコメント
RuiQi
RuiQi 2016 年 6 月 24 日
Well I have thousands of images that I want to randomly translate to generate thousands more images. It would be nice if there is a function like in OpenCV that handle the padding for you so all I have to do is generate the function to randomly jitter the images.
Adam
Adam 2016 年 6 月 24 日
編集済み: Adam 2016 年 6 月 24 日
Well, it depends what you mean by "randomly translate". I tend to write my own functions for most of the things I want to do based on the components available in Matlab. It is true that I then sometimes discover a Matlab builtin or toolbox function that does exactly the same thing though.

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

カテゴリ

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