Attempt to reference field of non-structure array.

1 view (last 30 days)
whenever i run the code with parameter(3,2,2*19,4,5)..it gives error attempt to reference field of non structure array..please help to resolve error
function [x,y]=Untitled2( x, y, IntegralImages, w,h)
% [x,y]=Untitled2( x, y, IntegralImages, w,h)
%
% Calculate the mean
InverseArea = 1 / (w*h);
mean = GetSumRect(IntegralImages.ii,x,y,w,h)*InverseArea;
% Use the mean and squared integral image to calculate the grey-level
% Varianceiance, of every search window
Variance = GetSumRect(IntegralImages.ii2,x,y,w,h)*InverseArea - (mean.^2);

Answers (1)

Azzi Abdelmalek
Azzi Abdelmalek on 21 May 2013
What is IntegralImages.ii? this causes the error
  2 Comments
divya
divya on 21 May 2013
Edited: Azzi Abdelmalek on 21 May 2013
i Want to calculate the mean and variance of image using integral images ..it is not giving me correct answers..can u tell me the error?
function [x,y]=Untitled2( x, y, w,h)
% [x,y]=Untitled2( x, y, IntegralImages, w,h)
function IntegralImages = GetIntergralImages(Picture)
IntegralImages=GetIntergralImages('RunAppDownload.jpg');
Picture=double(Picture);
% Resize the image to decrease the processing-time
%if(Options.Resize)
% if (size(Picture,2) > size(Picture,1)),
% Ratio = size(Picture,2) / 384;
% else
% Ratio = size(Picture,1) / 384;
%end
%Picture = imresize(Picture, [size(Picture,1) size(Picture,2) ]/ Ratio);
%else
% Ratio=1;
%end
% Convert the picture to greyscale (this line is the same as rgb2gray, see help)
if(size(Picture,3)>1),
Picture=0.2989*Picture(:,:,1) + 0.5870*Picture(:,:,2)+ 0.1140*Picture(:,:,3);
end
% Make the integral image for fast region sum look up
IntegralImages.ii=cumsum(cumsum(Picture,1),2);
IntegralImages.ii=padarray(IntegralImages.ii,[1 1], 0, 'pre');
% Make integral image to calculate fast a local standard deviation of the
% pixel data
IntegralImages.ii2=cumsum(cumsum(Picture.^2,1),2);
IntegralImages.ii2=padarray(IntegralImages.ii2,[1 1], 0, 'pre');
% Store other data
IntegralImages.width = size(Picture,2);
IntegralImages.height = size(Picture,1);
%IntegralImages.Ratio=Ratio;
% Calculate the mean
InverseArea = 1 / (w*h);
mean = GetSumRect(IntegralImages.ii,x,y,w,h)*InverseArea;
% Use the mean and squared integral image to calculate the grey-level
% Varianceiance, of every search window
Variance = GetSumRect(IntegralImages.ii2,x,y,w,h)*InverseArea - (mean.^2);
Jan
Jan on 21 May 2013
@divya: No, it is your turn to tell us the error. How could we guess, what the expected "correct" result is?

Sign in to comment.

Tags

No tags entered yet.

Community Treasure Hunt

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

Start Hunting!