
I want to partition an image into 8x8 ranges(non-overlapping) and 16x16 domain (overlapping) blocks. I have used the code mentioned below for 8x8 ranges(non-overlapping). I'm not sure if I can use mat2cell for creating 16x16 domain blocks.
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
clc;
% Read Image
A = imread('football.jpg');
B = imfinfo('football.jpg');
[r1, c1, depth] = size(A);
imshow(A)
blockSizeR = 8; % Rows in block.
blockSizeC = 8; % Columns in block.
wholeBlockRows = floor(r1 / blockSizeR);
blockVectorR = [blockSizeR * ones(1, wholeBlockRows), rem(r1, blockSizeR)];
wholeBlockCols = floor(c1 / blockSizeC);
blockVectorC = [blockSizeC * ones(1, wholeBlockCols), rem(c1, blockSizeC)];
if depth > 1
ca = mat2cell(A, blockVectorR, blockVectorC, depth);
else
ca = mat2cell(A, blockVectorR, blockVectorC);
end
0 commentaires
Réponses (1)
yanqi liu
le 26 Fév 2021
sir,may be use this
clc; clear all; close all;
I = imread('cameraman.tif');
sz = size(I);
th = 8;
[x, y] = meshgrid(linspace(1,sz(2),th), linspace(1,sz(1),th));
z = ones(size(x));
figure;
imshow(I, []);
hold on; axis off;
mesh(x, y, z, 'FaceColor', 'none', ...
'EdgeColor', 'r', 'LineWidth', 1, ...
'Marker', 'o', 'MarkerFaceColor', 'k', ...
'MarkerSize', 3);

0 commentaires
Voir également
Catégories
En savoir plus sur Fractals dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!