For a uni project I've been writing a program to simulate video feedback. So basically I have 2D arrays representing the 'screen' and the 'camera' and I'm copying a portion of the screen to the camera then putting the resulting 'image' back on the screen. I'm creating really basic fractals with this and I've written a piece of code to calculate approximately the fractal dimension of my resulting 'images' (the screen is initially an array of ones and zeros representing black and white, eventually I end up with decimals representing a sort of greyscale image). My tutor has said I need to check that my calculation for fractal dimension works, so I should take something I know the fractal dimension of and see if I get an answer close to what it should be. He suggested I read in a file and tested it on that. I've been googling image handling all day and I think I'm sort of starting to understand how to read in a file but I don't really know how to get the data from the file into a format that my program can use - i.e. a 2D array of doubles between 0 and 1. I'm a total beginner at C++, I asked my tutor for a hint and he said it should be relatively easy and could all be done with the standard iostream library but all the code snippets I've found on the internet that I've been trying (unsuccesfully) to amend have seemed really complicated to me! My final program doesn't even need to be able to read in files or anything - I just need to work out how to do it to test part of it. I don't really have code to include to do with the image stuff but here's what I have for fractal dimension: (it basically takes different sized 'boxes' and for each different size box it gives the average number of boxes with an average 'brightness' greater than 0.1. It then outputs this info to a textfile)

```
//fractal dimension calculation:
//screen width is 120, screen hieght is 90
int maxheight, maxwidth, p, height, width, r, s;
double averagesqrs, screenh=90, screenw=120, whitesqrs, numboxes, av1, avbright;
for(p=1; p<11; p=p+1)
{
whitesqrs=0;
maxheight=floor(screenh/p);
maxwidth=floor(screenw/p);
for(height=0; height<maxheight; height=height+p)
{
for(width=0; width<maxwidth; width=width+p)
{
avbright=0;
av1=0;
for(r=0; r<p; r=r+1)
{
for(s=0; s<p; s=s+1)
{
av1=av1+screen[height+r][width+s];
}
}
avbright=double(av1/(p*p));
if(avbright>0.1)
{
whitesqrs=whitesqrs+1;
}
}
}
numboxes=(maxheight*maxwidth);
averagesqrs=double(whitesqrs/numboxes);
fractaldimension << "Box size: " << p << endl;
fractaldimension << "Average number of >0.1 average brightness boxes: " << averagesqrs << endl;
fractaldimension << endl;
}
```

and the image my tutor said would be a good test is the one on the top right of this webpage: http://en.wikipedia.org/wiki/Sierpinski_triangle

Sorry for the long and slightly muddled post! I'm just pretty confused and hoped someone could point me in the right direction? I've been googling this for hours and haven't managed to solve the problem!

Thanks in advance,

Mini