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

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

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -