### Method for fractal dimension

Having issues with displaying the output results.just showing blank at the console output screen.Can someone know what d problem is?

#include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdlib.h>
//#include <iostream>

#define N 512 //Image size
double v1[10],v2[10];
//double Bnorm[N][N], alfa[N][N]; //Normalized intensity, alfa values

double lreg(int k, double v1[], double v2[]){
double x,y,cn=0.0,sumx=0.0,sumy=0.0,sumxy=0.0,sumx2=0.0;
double d1,d2;
cn=(double)k;
for(int i=0; i<k; i++){
x=v1[i]; //x variable
y=v2[i]; //y variable
sumx+=x;
sumy+=y;
sumxy+=x*y;
sumx2+=x*x;
}
d1=(cn*sumxy-sumx*sumy);
d2=(cn*sumx2-sumx*sumx);
if(fabs(d1)<1.e-10 || fabs(d2)<1.e-10) return 0.0;
else return d1/d2;
}
int main (int argc, char **argv)
{
int i,m,x,k=10;
double v1[10],v2[10],Lmk[10],Lmk1[10],FD,Hmax,Ng;
Lmk[0] = 0.0;Lmk1[0] = 0.0;
double Lk=0.0;
for(m=1;m<=k;m++)
{
Hmax =(int)((N-m)/k);
}
for(x=1;x<=N;++x)
{
for(i=0;i<=Hmax;i++)
{
Lmk[i]= abs(x*(m+i*k) - x*(m*(i-1)*k));
}
}
Ng = (N-1)/(Hmax)*k;
Lmk1[i] = (Lmk[i]*Ng)/k;
Lk+= Lmk1[i];
for(i=0;i<10;i++)
{
v1[i] = -log(Lk);
v2[i] = log (1./k);
}
FD =lreg(10,v1,v2);
printf("FD=%f\n",FD);
return(0);
}

Topic archived. No new replies allowed.