MATLAB Answers

0

i want to concatenate local geometric mean and take histogram for it. Is it possible?

Asked by Shan Sha on 20 Sep 2018
Latest activity Commented on by Shan Sha on 20 Sep 2018
%my code
mean1 = imfilter(grayImage, Q1) / (middleRow * middleColumn);
mean2 = imfilter(grayImage, Q2) / (middleRow * middleColumn);
mean3 = imfilter(grayImage, Q3) / (middleRow * middleColumn);
mean4 = imfilter(grayImage, Q4) / (middleRow * middleColumn);
I cant able to view the image after concatenation. after concatenation i m getting in dimension of 128x 128. but i need a single mean value. What should i do?

  2 Comments

can i concatenate the following mean value and take hitogram for it? i have to concatenate this hist with other features histogram. is it possible? but the dimensions of both hitogram are different? how can i match the dimension size code for mean is given below
function M = meant(inputImage,windowWidth)
[rows, columns, numberOfColorChannels] = size(inputImage);
% Set up the four quadrant masks.
middleRow = ceil(windowWidth/2);
middleColumn = middleRow;
% first initialize all 4 quadrant kernels to all zeros.
Q1 = zeros(windowWidth, windowWidth);
Q2=Q1;
Q3=Q1;
Q4=Q1;
% Next set the appropriate quadrants to 1.
Q1(1:middleRow, 1:middleColumn) = 1;
Q2(middleRow:end, 1:middleColumn) = 1;
Q3(1:middleRow, middleColumn:end) = 1;
Q4(middleRow:end, middleColumn:end) = 1;
% Need to handle gray scale images and color images differently. if numberOfColorChannels == 1 % Input image is a gray scale image. grayImage = inputImage; end % [minSDImage, quadrantLocations] = min(SD, [], 3); % Note: we do not use the minSDImage image and you can use ~ instead of it if you wish.
if numberOfColorChannels == 1 % Scan the image with each Q and get the means of each of the 4 quadrants. mean1 = imfilter(grayImage, Q1) / (middleRow * middleColumn); mean2 = imfilter(grayImage, Q2) / (middleRow * middleColumn); mean3 = imfilter(grayImage, Q3) / (middleRow * middleColumn); mean4 = imfilter(grayImage, Q4) / (middleRow * middleColumn);
M = cat(3, mean1, mean2, mean3, mean4); end end

Sign in to comment.

0 Answers