Attempt to reference field of non-structure array.

2 次查看(过去 30 天)
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);

回答(1 个)

Azzi Abdelmalek
Azzi Abdelmalek 2013-5-21
What is IntegralImages.ii? this causes the error
  2 个评论
divya
divya 2013-5-21
编辑:Azzi Abdelmalek 2013-5-21
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 2013-5-21
@divya: No, it is your turn to tell us the error. How could we guess, what the expected "correct" result is?

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Geometric Transformation and Image Registration 的更多信息

标签

尚未输入任何标签。

Community Treasure Hunt

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

Start Hunting!

Translated by