How to create excel sheet for the following code

11 次查看(过去 30 天)
this is the code
i have converted an image into six faces(top, back, front,left, right, =bottom) for my preprocessing
1.now i need to write a loop for all faces and i need to save them seperately in the following format ( top_msss.jpg) for other faces too
2.i need to create an ecxel file for computation of entropy in each face
rows as (reference image, rating_2, rating_2, rating_3, rating_4, rating_5} and columns as (top_entropy, bottom_entropy, left_entropy, right entropy, back_entropy,front entropy_
after computation , entropy valued need to stored in excel sheet
pleasr help me as i am new to matlab
%---------------------------------------------------------
clear all; close all;
inputfilename = 'back_1.jpg';
img = imread(inputfilename);%Provide input image path
dim = size(img);
width = dim(2);height = dim(1);
gfrgb = imfilter(img, fspecial('gaussian', 3, 3), 'symmetric', 'conv');
%---------------------------------------------------------
% Perform sRGB to CIE Lab color space conversion (using D65)
%---------------------------------------------------------
cform = makecform('srgb2lab', 'AdaptedWhitePoint', whitepoint('d65'));
lab = applycform(gfrgb,cform);
l = double(lab(:,:,1));
a = double(lab(:,:,2));
b = double(lab(:,:,3));
%[l a b] = RGB2Lab(gfrgb(:,:,1),gfrgb(:,:,2), gfrgb(:,:,3));
%---------------------------------------------------------
% Create integral images
%---------------------------------------------------------
li = cumsum(cumsum(l,2));
ai = cumsum(cumsum(a,2));
bi = cumsum(cumsum(b,2));
%---------------------------------------------------------
% Compute Lab average values (note that in the paper this
% averages are found from the unblurred original image, but
% the results are quite similar)
%---------------------------------------------------------
sm = zeros(height, width);
sm2 = zeros(height, width);
for j = 1:height
yo = min(j, height-j);
y1 = max(1,j-yo); y2 = min(j+yo,height);
for k = 1:width
xo = min(k,width-k);
x1 = max(1,k-xo); x2 = min(k+xo,width);
invarea = 1.0/((y2-y1+1)*(x2-x1+1));
lm = iisum(li,x1,y1,x2,y2)*invarea;
am = iisum(ai,x1,y1,x2,y2)*invarea;
bm = iisum(bi,x1,y1,x2,y2)*invarea;
%---------------------------------------------------------
% Compute the saliency map
%---------------------------------------------------------
sm(j,k) = (l(j,k)-lm).^2 + (a(j,k)-am).^2 + (b(j,k)-bm).^2;
end
end
figure()
imshow(sm,[]);
back_entropy=entropy(sm)
%---------------------------------------------------------
  2 个评论
KALYAN ACHARJYA
KALYAN ACHARJYA 2021-2-16
It is easy to answer if the question is asked for one specific issue at a time with sample data/examples/code.

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Convert Image Type 的更多信息

产品


版本

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by