How can I split the image into blocks and then extract the features from each block?

Hello
I extracts image features (invariant moment) using this code
[filename, pathname] = uigetfile({'*.*';'*.bmp';'*.jpg';'*.gif'}, 'Pick a Degraded Fingerprint Image File');
im = imread([pathname,filename]);
figure, imshow(im);title('Fingerprint Image');
n1=invmoments(im);
How can I split the image into blocks(every block like 32x32) and then extract the features from each block?

その他の回答 (1 件)

Yuvaraj Venkataswamy
Yuvaraj Venkataswamy 2018 年 8 月 14 日
if true
mat2cell(I,size(I,1)/32*ones(32,1), size(I,2)/32*ones(32,1), 3)
end
This will split an image into 32 x 32 blocks. Then you can extract image features from each blocks using for loop.

6 件のコメント

wisam kh
wisam kh 2018 年 8 月 14 日
編集済み: wisam kh 2018 年 8 月 14 日
thank you
[filename, pathname] = uigetfile({'*.*';'*.bmp';'*.jpg';'*.gif'}, 'Pick a Degraded Fingerprint Image File');
im = imread([pathname,filename]);
if true
mat2cell(im,size(im,1)/32*ones(32,1), size(im,2)/32*ones(32,1), 3)
end
give me this error
Error using mat2cell (line 80)
Number of input vector arguments, 3, does not match the input matrix's number of dimensions, 2.
@wisam kh Try this,
mat2cell(I,size(I,1)/4*ones(4,1), size(I,2)/4*ones(4,1), 3)
wisam kh
wisam kh 2018 年 8 月 14 日
@Yuvaraj V
Sorry to bother you, but the same error appears.
By the way the picture type is grayscale
Yuvaraj Venkataswamy
Yuvaraj Venkataswamy 2018 年 8 月 14 日
Check this,
https://in.mathworks.com/matlabcentral/answers/223978-how-to-divide-an-image-into-blocks
wisam kh
wisam kh 2018 年 8 月 14 日
Thank you for this interaction
Yuvaraj Venkataswamy
Yuvaraj Venkataswamy 2018 年 8 月 14 日
You are welcome.

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

質問済み:

2018 年 8 月 14 日

コメント済み:

2018 年 8 月 14 日

Community Treasure Hunt

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

Start Hunting!

Translated by