How to create excel sheet for the following code

조회 수: 11 (최근 30일)
Poreddy ajaykumar reddy
Poreddy ajaykumar reddy 2021년 2월 16일
댓글: Poreddy ajaykumar reddy 2021년 2월 16일
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.
Poreddy ajaykumar reddy
Poreddy ajaykumar reddy 2021년 2월 16일
@KALYAN ACHARJYA sir can you help me for the above 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