I divided the cameraman.tif to 3x3 blocks and I want to apply histeq function to all of these 3x3 blocks and trying to get a new image. I need a help with histogram equalization of these 3x3 blocks on MATLAB.
I = imread("cameraman.tif");
for i = 2:3:255
for j = 2:3:255
B = I(i:i 2 , j:j 2);
J = double(B);
end
end
CodePudding user response:
Try this:
img = imread('cameraman.tif');
fun = @(heq) histeq(heq.data)
b = blockproc(img,[3,3],fun);
figure, imshow(imtile([img b],[]));