Resizing cells to the same dimensions

3 views (last 30 days)
Hey guys,
I have a cell array like this: znaki4 =
Columns 1 through 6
[38x27 logical] [38x26 logical] [38x20 logical] [37x20 logical] [37x20 logical] [36x21 logical]
Column 7
[37x21 logical]
and I want to make them all the same dimension. I already tried to use method posted by ~Image Analyst:
cellContents = znaki{cellNumber}; % Extract array from this cell.
cellContents(42,30) = 0; % Pad down and to the left with 0's.
znaki{cellNumber} = cellContents; % Stuff back in.
and it works very well but unfortunately it's not a good way because I want to use corr2 function and I wanted to have a letter centrally. For now it looks like this:
In second row, they are all the same dimension but they aren't in central position. Is there any way to achieve it?

Accepted Answer

Image Analyst
Image Analyst on 23 Mar 2014
What you originally asked for in http://www.mathworks.com/matlabcentral/answers/122297#answer_129190 (and where you should have posted this instead of to a new thread) was "So can I change the dimensions by somehow filling it up with "fake" zeros?" So that's what I did. I gave you instructions to pad it out with zeros. If you wanted to scale the image instead of pad it, you should have said so. So what you can do is to use imresize:
cellContents = znaki{cellNumber}; % Extract array from this cell.
cellContents = imresize(cellContents, [42,30]); % Resize to 42x30.
znaki{cellNumber} = cellContents; % Stuff back in.
This will, of course, keep the letter centered.

More Answers (0)

Categories

Find more on Images 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!