Extracting center most submatrix from kspace
Show older comments
I have an image of [256,256]
I want the center most submatrix of [32,32] and equate the rest of kspace to zero
1 Comment
Walter Roberson
on 11 Sep 2021
You flagged your own Question as being a Duplicate, but you have only posted this Question, so it is not clear what it is a duplicate of ?
Accepted Answer
More Answers (1)
YourImage = imread('cameraman.tif');
subsize = [32, 32];
[r, c, p] = size(YourImage);
start_r = floor((r-subsize(1))/2);
start_c = floor((c-subsize(2))/2);
kspace = zeros(size(YourImage), 'like', YourImage);
kspace(start_r:start_r+subsize(1)-1, start_c:start_c+subsize(2)-1,:) = YourImage(start_r:start_r+subsize(1)-1, start_c:start_c+subsize(2)-1,:);
imshow(YourImage)
imshow(kspace)
Categories
Find more on Neuroimaging in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
