I am trying to create a method that will get all of the red values in an image and display only the red values. I am having trouble with my getRedImage() method. I am new to thi
I finally figured it out:
public SimpleRGB getRedImage()
{
SimpleRGB redImage = new SimpleRGB(width, height);
for (int i = 0; i < width; i++)
{
for (int j = 0; j < height; j++)
{
redImage.setRed(i, j, getRed(i, j));
redImage.setGreen(i, j, getGreen(i, j, 0);
redImage.setBlue(i, j, getBlue(i, j, 0));
}
}
return redImage;
}
I had the basic structure correct but I was altering THIS red/green/blue instead of adding redImage.setRed to modify the NEW object.