how to remove padarray from image?

5 ビュー (過去 30 日間)
kashika sharma
kashika sharma 2016 年 2 月 8 日
コメント済み: Image Analyst 2016 年 2 月 8 日
adding padarray makes the image from 256x256 image to 258x258. how to make image back to 256x256 ?

回答 (2 件)

Jos (10584)
Jos (10584) 2016 年 2 月 8 日
A = magic(4)
n = 2
B = padarray(A,[n n]) % pad
A2 = B(n+1:end-n,n+1:end-n) % unpad
or directly:
A2 = A

Image Analyst
Image Analyst 2016 年 2 月 8 日
Simply don't call it. Why did you call it if you don't want what it does?
  2 件のコメント
kashika sharma
kashika sharma 2016 年 2 月 8 日
i an new to matlab. just learning how things work.
Image Analyst
Image Analyst 2016 年 2 月 8 日
Like Jos says, you can just extract the central part with indexing:
out = yourArray(2:end-1, 2:end-1);

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

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by