I\'m working on an image processing project in MATLAB. In order to preprocess the image more easily, I\'ve divided it in rows and columns, so from a original image (a 2D uin
If I am understanding your question correctly, then this is how I would do it: Assume we have some data matrix with dimensions m by n
[m n] = size(data);
rows_wanted = 10;
cols_wanted = 10;
submatrix_rows = rows_wanted*ones(1,m/rows_wanted);
submatrix_cols = cols_wanted*ones(1,n/cols_wanted);
data_cells = mat2cell(data,submatrix_rows,submatrix_cols);
for k1 = 1:submatrix_rows;
for k2 = 1:submatrix_cols;
proc_data_cells{k1,k2} = function_for_matrics(data_cells{k,l});
end
end
proc_data_mtx = cell2mat(proc_data_cells);
convert your data into a cell, where each element of the cell is a submatrix, then go through each element, preform your function, and output it to a new cell. Use cell2mat to output a fully concatenated processed matrix.
If you have access to the Image Processing Toolbox, I would also check out the 'blkproc' function.