Batch picture subtraction

Hello everybody,

I have a batch of 200 pictures taken from the same spot with a fix camera. In some of them there are fish and in some of the there are not. I want to take one without fish and set is as a background and then substract it from the other pictures. This is the code I am using:

dir1 = getDirectory("/Users/davidizquierdogomez/Desktop/source/");
dir2 = getDirectory("/Users/davidizquierdogomez/Desktop/destination/");
list = getFileList(dir1);
setBatchMode(true);
for (i=0; i<list.length; i++) {
    imageCalculator("Subtract create", list[i], "/Users/davidizquierdogomez/Desktop/source/G0044190.jpg");
}

but I get an error. It is said that:

  1. No picture is found in line number six
  2. I get the list[i] in this way: list[i <]>

Thanks for helping…

Good day David,

you don’t open the images.

Regards

Herbie

1 Like

@david_biology

Take a look at this old forum post with some helpful links regarding Batch processing:

This has an example script that you might find helpful:

@anon96376101 is right - you need to first open the image files.

If you have more questions on this - feel free to ask !!! We are here to help!

eta :slight_smile: