Info

此问题已关闭。 请重新打开它进行编辑或回答。

assigning colour to a block

1 次查看(过去 30 天)
nkumar
nkumar 2013-5-16
关闭: MATLAB Answer Bot 2021-8-20
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

回答(0 个)

此问题已关闭。

标签

Community Treasure Hunt

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

Start Hunting!

Translated by