i want to calculate the variance of image in opencv..here is the code...its giving error while executing..please suggest solution -


this code not give correct output of variance of image.please tell how correct give right value of variance

the code in opencv.please suggest method calculate variance of pixels in image

for(i=1;i<h-1;i++) {     for(j=1;j<w-1;j++)     {         sum=0;         for(a=-1;a<=1;a++)         {             for(b=-1;b<=1;b++)             {                 sum=sum+inputimage(i+a,j+b);             }             //calculate mean             mean(i,j)=sum/imagesize*imagesize         }     } }  for(i=1;i<h-1;i++) {     for(j=1;j<w-1;j++)     {         sum=0;         for(a=-1;a<=1;a++)         {             for(b=-1;b<=1;b++)             {                 sum=((inputimage(i+a,j+b)-meanimg(i,j))^2);             }         }         //calculate variance         var=sum/((windowsize*windowsize)-1);     } } 


Comments

Popular posts from this blog

php - cannot display multiple markers in google maps v3 from traceroute result -

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -