So first I have this class:
public float getPixel(int height, int width)
{
return data[height][width];
}
public void setPixel(float value, int height, int width)
{
if (value > getMax())
value = getMax();
if (value < 0)
value = 0;
data[height][width] = value;
}
private Image(String magicNumber, int height, int width, float max) {
this.magicNumber = magicNumber;
this.width = width;
this.height = height;
this.max = max;
data = new float[height][width];
}
...
public Image clone()
{
Image clone = new Image(getMagicNumber(), getHeight(), getWidth(), getMax());
for (int i = 0; i < getHeight(); i++)
{
for (int j = 0; j < getWidth(); j++)
{
clone.setPixel(getPixel(i, j), i, j);
}
}
return clone;
}
And then this class:
public class Filter {
public Filter() {
}
public Image linearFilter(Image image, float[][] kernel)
{
Image filtered = image.clone();
for (int i = 0; i < getHeight(); i++)
{ /* cannot resolve getHeight*/
...
}
return filtered;
}
}
I have two questions:
1) Why do I don't need to create an instance of the class Image. Here I can already use filtered.setPixels...
2) How do I fix the Problem with "cannot resolve method"?