cloftus96 / Synthetic-Data-Generation

13 stars 0 forks source link

Image File Management #4

Open hahnf1 opened 5 years ago

hahnf1 commented 5 years ago

Use Python to create a way to manage the images once they have been captured in Arma 3

cloftus96 commented 5 years ago

Thinking about using Python's multiprocessing module to spawn a new process that can take care of moving the image files around while Arma 3 executes. New process will utilize shutil to move the files to the target directory(ies). @ColinLeongUDRI what do you think about this?

ColinLeongUDRI commented 5 years ago

As I understand it, the main problem is that the in-game screenshot function can take a max number of screenshots before the folder fills up, right? Thus the need to constantly move files out.

So there's two possible solutions I can see:

  1. Spin off a subprocess/thread something like that to constantly move the files out. Multiprocessing can be challenging to get right and complex to debug, but I think this could work.
  2. Take screenshots some other way, perhaps also through Python?

I personally would lean towards (2), simply because I haven't done much work with multiprocessing code and I'd need to spin up on it.

shutil can work. The other main Python library for these sorts of things is os.

It's up to you all.

Whatever you do go with, it is good to document the thought process behind the decision. "We thought about x, y, and z options, and went with y because q". If you later discover that q was invalid, you can go back and try one of the other ones instead.

cloftus96 commented 5 years ago

We can look into (2), however since Python knows nothing about the Arma script execution, we would have to see if we can call out to Python from within Arma to correctly time the screenshots, or at least find some way to synchronize the timing between moving the camera position in Arma and then taking the screenshot via Python. I am not sure as to the difficulty level of achieving this.

As for (1), the reason I suggested shutil is that within the documentation for Python's os module, it mentions that

for high-level file and directory handling see the shutil module

and it looks like the shutil.move function is good enough for what we need to do (and is customizable if we want to change the copy function that gets called). If you think it is better to use the lower-level functions provided in os , that is fine too.

ColinLeongUDRI commented 5 years ago

Seems like sound reasoning, makes sense to me. Good luck, and have fun!