How can I pass an array of filenames into the following method:
public static double getFitness(int x, int y, int r, BufferedImage image);
I currently have a method which creates an array of filenames from a given directory:
//Default image directory (to convert to greyscale).
static File dir = new File("images");
//Array of original image filenames.
static File imgList[] = dir.listFiles();
public static void processGreyscale(){
if(dir.isDirectory()){
for(File img : imgList){
if(img.isFile()){
//functions are carried out here.
}
else{
//functions are carried out here.
}
}
}
}
The getFitness method scores the fitness of an image (...BufferedImage image);) based on the main region of interest (ROI).
What I am looking for is a way to run the getFitness method on the array of filenames; something like this:
public static double getFitness(int x, int y, int r, fileArray)
Can this be done?
UPDATE:
Thank you all for your great suggestions; however, I should mention that I wish to leave the method parameters the same/unchanged as the fitness function is affected (negatively) if I change the passed parameters.
Is there any way that I can run the fitness function on all files/filenames within imgList[]?
What I'm hoping for is this:
public static double getFitness(int x, int y, int r, BufferedImage image){
use filenames stored in imgList[] to take place of 'image'
getFitness of `image`
next image name
}
Is this possible?