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.

4 visualizaciones (últimos 30 días)
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

Respuestas (1)

yanqi liu
yanqi liu el 26 de Feb. de 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);

Categorías

Más información sobre Fractals en Help Center y File Exchange.

Productos


Versión

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by