Author Topic: How to apply process to many images?  (Read 9332 times)

Offline georg.viehoever

  • PTeam Member
  • PixInsight Jedi Master
  • ******
  • Posts: 2132
How to apply process to many images?
« on: 2009 April 11 05:14:41 »
Hello,

I have a process (stored in a process container), and  would like to apply it to *all* images in a directory (i.e. load image, apply process, store result). I am sure this can be done with a Java Script script.

- I need to avoid loading all images at once. Otherwise, Windows just gives up...
- I just dont know how to script that.

Any hints welcome.

Georg
Georg (6 inch Newton, unmodified Canon EOS40D+80D, unguided EQ5 mount)

Offline Niall Saunders

  • PTeam Member
  • PixInsight Jedi Knight
  • *****
  • Posts: 1456
  • We have cookies? Where ?
How to apply process to many images?
« Reply #1 on: 2009 April 11 08:00:13 »
Hi Georg,

I am 95% of the way through a process to achieve just exactly what you are looking for - except that I have a dedicated scriptlet that I will be applying to each image.

My code is based almost entirely on the BatchFormatConversion sample script that is currently included with each release of PixInsight - however, I have been breaking the original script down, and adding my own, more detailed, comments - so that I can learn the process as well

I am not yet sure how you would implement the application of a 'process container' within the code - others may be better able to help. It is a stage that I have not yet 'had' to learn.

That said, my 'commented' script really offers only ONE place to 'insert' your requirement, so it should (hopefully) be easy enough to adapt.

Just, please, bear in mind that I am NOT a 'professional' programmer, and that I have little or no knowledge of JavaScript - other than its use as a 'basic tool'. So some of my comments may not be 'technically correct' in the use of 'proper' terminology. I am hoping that any errors will be corrected by others far more experienced than I.

I still have some further work to do, but will gladly post my 'upgrade' to the BatchFormatConversion routine as soon as I have addressed the section dealing with the implementation of the user interface Dialog box.

Cheers,
Cheers,
Niall Saunders
Clinterty Observatories
Aberdeen, UK

Altair Astro GSO 10" f/8 Ritchey Chrétien CF OTA on EQ8 mount with homebrew 3D Balance and Pier
Moonfish ED80 APO & Celestron Omni XLT 120
QHY10 CCD & QHY5L-II Colour
9mm TS-OAG and Meade DSI-IIC

Offline Andres.Pozo

  • PTeam Member
  • PixInsight Padawan
  • ****
  • Posts: 927
How to apply process to many images?
« Reply #2 on: 2009 April 11 08:04:27 »
You could use an Image Container. To apply a Process Container to an Image Container you should click on the triangle button of the Image Container and drag it over the lower bar of the Process Container.

I think this is one of the least intuitive functions of PixInsight. It should be the other way: dragging the Process Container over the Image Container. Also, the active part for the drag should be the whole panel, not only the lower bar.

Offline Niall Saunders

  • PTeam Member
  • PixInsight Jedi Knight
  • *****
  • Posts: 1456
  • We have cookies? Where ?
How to apply process to many images?
« Reply #3 on: 2009 April 11 08:21:45 »
Hi Andres,

Yes - I agree about this not being intuitive.

However, I think Georg has a more fundamental problem - he cannot load all of the images into PI at one time, and therefore he cannot use the 'Image Container' solution.

He, I believe, is going to HAVE to use something like a 'batch' script, dealing with a directory, or selection, of images as a whole, but processing them one at a time.

Depending on the complexity of the contents of his Process Container, I wonder whether he could just 'cut and paste' the generated code straight into the script editor - at the point in my script where this would apply?

Perhaps he might need the assistance of an 'expert' like yourself, who could take my 'bare bones' batching script, and the script from the History Explorer that refers to his Process Container, and who could quickly merge them together.

This is what I have to face next - taking my Batching Script and my Meade DSI DeBayer script - and merging them together (but I also have to merge two towally independent Dialog sections, as well as two script routines that were created in entirely different ways. Fun, fun, fun !!!)

Cheers,
Cheers,
Niall Saunders
Clinterty Observatories
Aberdeen, UK

Altair Astro GSO 10" f/8 Ritchey Chrétien CF OTA on EQ8 mount with homebrew 3D Balance and Pier
Moonfish ED80 APO & Celestron Omni XLT 120
QHY10 CCD & QHY5L-II Colour
9mm TS-OAG and Meade DSI-IIC

Offline georg.viehoever

  • PTeam Member
  • PixInsight Jedi Master
  • ******
  • Posts: 2132
How to apply process to many images?
« Reply #4 on: 2009 April 11 08:57:19 »
Niall,

the batch conversion script is indeed a good starting point. Thanks for pointing me to this script. The missing bit is how to apply a process container.

I cannot use Image containers because my 200+ images just would not fit into memory. I tried ito load all of them into Pixinsight this afternoon, and Windows just came to a halt very soon. I had to reboot.


Georg
Georg (6 inch Newton, unmodified Canon EOS40D+80D, unguided EQ5 mount)

Offline vicent_peris

  • PTeam Member
  • PixInsight Padawan
  • ****
  • Posts: 988
    • http://www.astrofoto.es/
How to apply process to many images?
« Reply #5 on: 2009 April 11 09:04:33 »
Hi George,

An image container will load your images sequentially, not at same time! I know some people makes this job with 300 - 400 images and just works fine.

You must create an image container with all the images you want to process, and drag the process container over it.


Good luck,
Vicent.

Offline Andres.Pozo

  • PTeam Member
  • PixInsight Padawan
  • ****
  • Posts: 927
How to apply process to many images?
« Reply #6 on: 2009 April 11 09:04:43 »
Quote from: "georg.viehoever"
Niall,

the batch conversion script is indeed a good starting point. Thanks for pointing me to this script. The missing bit is how to apply a process container.

I cannot use Image containers because my 200+ images just would not fit into memory. I tried ito load all of them into Pixinsight this afternoon, and Windows just came to a halt very soon. I had to reboot.


Georg

You can add images to a Image Container without loading them into memory using the button "Add files...". Then, when you applies a Process Container to it, each image is loaded, processed, saved and discarded.
I haven't tried it with 200 images, but I can not see why it shouldn't work.

Offline georg.viehoever

  • PTeam Member
  • PixInsight Jedi Master
  • ******
  • Posts: 2132
How to apply process to many images?
« Reply #7 on: 2009 April 11 09:34:51 »
Wow, Pixinsight is just cool ...I ll try it ASAP
Georg
Georg (6 inch Newton, unmodified Canon EOS40D+80D, unguided EQ5 mount)

Offline vicent_peris

  • PTeam Member
  • PixInsight Padawan
  • ****
  • Posts: 988
    • http://www.astrofoto.es/
How to apply process to many images?
« Reply #8 on: 2009 April 11 09:42:04 »
Here you can see some videos made by my friend Javier Díez:

http://www.jdiez.com/subtema.asp?opmenu=1

Just click on the images to see the videos. He made them with a Canon 20D, and completely processed with PixInsight using image and process containters. For video editing he uses the Mac specific software.


Regards,
Vicent.

Offline georg.viehoever

  • PTeam Member
  • PixInsight Jedi Master
  • ******
  • Posts: 2132
How to apply process to many images?
« Reply #9 on: 2009 April 11 10:15:57 »
Vincent, the videos are very nice, and I am playing with a similar idea right now.

The trick with Image container works! Real nice. However, part of my process is an ABE, which creates a new background image with each image processed. So this leaves my RAM filled with backgrounds. Any way to get rid of these?
Georg (6 inch Newton, unmodified Canon EOS40D+80D, unguided EQ5 mount)

Offline Juan Conejero

  • PTeam Member
  • PixInsight Jedi Grand Master
  • ********
  • Posts: 7111
    • http://pixinsight.com/
How to apply process to many images?
« Reply #10 on: 2009 April 13 12:29:27 »
Hi Georg,

As I've said on a bug reports thread, ABE isn't up-to-date and needs an urgent revision.

The new version of DynamicBackgroundExtraction includes target image correction capabilities, and has a "Discard background model" option. I'll try to add a similar option to ABE. That should ease your work :)
Juan Conejero
PixInsight Development Team
http://pixinsight.com/

Offline vicent_peris

  • PTeam Member
  • PixInsight Padawan
  • ****
  • Posts: 988
    • http://www.astrofoto.es/
How to apply process to many images?
« Reply #11 on: 2009 April 13 12:58:26 »
George,


Perhaps doing this:

- Increase the "downsampling factor" to make a smaller background image.

- Make several image containers with 30 - 40 images each one? This takes a bit of time, but perhaps will work...

Regards,
Vicent.

Offline georg.viehoever

  • PTeam Member
  • PixInsight Jedi Master
  • ******
  • Posts: 2132
How to apply process to many images?
« Reply #12 on: 2009 April 13 13:54:40 »
Vincent,

thanks for the valuable help! The image container actually did the trick for me, and some memory issue was overcome by doing it in batches of 20. I now have a nice video of the stars passing behind my house. Nothing as spectactular as the video of Javier Díez. But we all have to start somewhere  :)


Georg
Georg (6 inch Newton, unmodified Canon EOS40D+80D, unguided EQ5 mount)

Offline vicent_peris

  • PTeam Member
  • PixInsight Padawan
  • ****
  • Posts: 988
    • http://www.astrofoto.es/
How to apply process to many images?
« Reply #13 on: 2009 April 13 14:30:02 »
Quote from: "georg.viehoever"
Vincent,

thanks for the valuable help! The image container actually did the trick for me, and some memory issue was overcome by doing it in batches of 20. I now have a nice video of the stars passing behind my house. Nothing as spectactular as the video of Javier Díez. But we all have to start somewhere  :)


Georg



Great! Please show us the video! :)

Try to do one video on a bad night, with some clouds passing through, it will give a spectacular deepness to the scene.

Javier has bought now a small altazimuth mount that coordinates regular axis movements with camera shoots. This gives you the ability of making moving time lapses.


Good luck with your experiments!
Vicent.