find homogeneities of each block of quadtree decomposed image

2 views (last 30 days)
Hello,
The above image is the light house image and its quadtree decomposed image using Matlab.
What I'd like to do is to find the homogeneity of each block from the quadtree decomposed image.
I think I need to get the exact position of black region of each block and then find the homogeneity from RGB (or gray) image with these position of black region.
Any advice is warmly welcome. Thank you.

Accepted Answer

Image Analyst
Image Analyst on 8 Jan 2023
Try this:
grayImage = imread('liftingbody.png');
S = qtdecomp(grayImage,.27);
blocks = repmat(uint8(0),size(S));
[rows, columns] = size(S)
for row = 1 : rows
for col = 1 : columns
if S(row, col) ~=0
upperLeftRow = row;
upperLeftCol = col;
width = S(row, col);
height = S(row, col);
hold on;
boundingBox = [upperLeftCol, upperLeftRow, width, height];
rectangle('position', boundingBox, 'EdgeColor','r', 'LineWidth',2)
% Extract the subimage
thisBlock = imcrop(grayImage, boundingBox);
% Compute mean
thisMean = mean2(thisBlock);
stdDev = std2(thisBlock);
end
end
end

More Answers (0)

Community Treasure Hunt

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

Start Hunting!