필터 지우기
필터 지우기

Attempt to reference field of non-structure array.

조회 수: 2 (최근 30일)
divya
divya 2013년 5월 21일
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