assigning colour to a block
Info
This question is closed. Reopen it to edit or answer.
Show older comments
I have a code below
clc
clear all
grayImage = imread('cameraman.tif');
[rows columns numberOfColorBands] = size(grayImage);
figure;
subplot(2, 2, 1);
imshow(grayImage, []);
title('Original Grayscale Image', 'FontSize', 6);
set(gcf, 'units','normalized','outerposition',[0 0 1 1]);
blockSizeR =64;
blockSizeC =64;
wholeBlockRows = floor(rows / blockSizeR);
wholeBlockCols = floor(columns / blockSizeC);
image3d = zeros(wholeBlockRows, wholeBlockCols, 3);
sliceNumber = 1;
k=1:16;
for row = 1 : blockSizeR : rows
for col = 1 : blockSizeC : columns
row1 = row;
row2 = row1 + blockSizeR - 1;
row2 = min(rows, row2);
col1 = col;
col2 = col1 + blockSizeC - 1;
col2 = min(columns, col2);
oneBlock = grayImage(row1:row2, col1:col2);
subplot(4, 4, sliceNumber);
imshow(oneBlock);
caption = sprintf('Block #%d of 4', sliceNumber);
title(caption, 'FontSize', 8);
S{sliceNumber}=mean(mean(oneBlock)
sliceNumber = sliceNumber + 1;
end
end
here i have stored the mean value for all blocks in variable S
now i want to colour blocks in red colour which are having mean value greater than 160
plz help
Answers (0)
This question is closed.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!