Sample patches from a image

4 ビュー (過去 30 日間)
shantanu
shantanu 2012 年 2 月 2 日
There is a 128*128 image which has to be sampled into 32*32 image patches such that the distance(horizontal and vertical) between adjacent patches' centers is 3 pixels.
How do i find the center of a 32*32 matrix?
Can U give code?
Many thanks

回答 (1 件)

Image Analyst
Image Analyst 2012 年 2 月 2 日
Well it would be at 16.5 pixels, but you don't need that at all. If the centers, wherever they may be, are 3 pixels apart, then so are the left sides, right sides, top edges, and bottom edges, so your left edges would be at 1,4,7,10,13, etc.
for col = 1:3:128
for row = 1:3:128
subMatrix = fullMatrix(row:row+31, col:col+31);
end
end
  3 件のコメント
shantanu
shantanu 2012 年 2 月 2 日
Instead of 128 it should be 97
shantanu
shantanu 2012 年 2 月 2 日
thanx

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

Community Treasure Hunt

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

Start Hunting!

Translated by