Add operation to save image snapshots to local disk.#573
Add operation to save image snapshots to local disk.#573PeterJohnson wants to merge 2 commits intoWPIRoboticsProjects:masterfrom team294:image-snapshots
Conversation
The period and path prefix and suffix can be set, and the operation enabled and disabled at will (this is particularly useful in combination with PR #572).
Current coverage is 53.49%
@@ master #573 diff @@
=====================================
Files 158 159 +1
Lines 4699 4776 +77
Methods 0 0
Branches 500 507 +7
=====================================
+ Hits 2522 2555 +33
- Misses 2037 2077 +40
- Partials 140 144 +4
|
| suffix = this.suffix; | ||
| } | ||
| } catch (InterruptedException e) { | ||
| break; |
There was a problem hiding this comment.
You need to reset the interrupt flag here.
Thread.interrupt()
|
Thanks for this. This is not something I thought people would want. I like the idea though. |
| private final BytePointer imagePointer = new BytePointer(); | ||
| private Optional<Thread> saveThread = Optional.empty(); | ||
| private volatile boolean connected = false; | ||
| private long startTime = System.nanoTime(); |
There was a problem hiding this comment.
Guava has the stopwatch that may be more apropreate here. Up to you though.
There was a problem hiding this comment.
I don't think this even needs to be timed; it'll only run when the pipeline gets fired anyway.
There was a problem hiding this comment.
Well, it's nice to not necessarily save every frame all the time. For example, my team saves images twice a second during a match but switches to saving every image when actually auto-aiming.
|
This is very useful for testing and debugging at competition where you don't have realtime access because you can load up the saved images to play them back through the pipeline and adjust thresholds etc. I'll fix up based on the comments so far. |
|
I'm debating adding a directory chooser for the output directory instead of or in addition to the prefix. However, I'm not sure if adding those sorts of controls is frowned upon in operations. |
|
No, a directory chooser would be a good control to add. |
The period and path prefix and suffix can be set, and the operation enabled
and disabled at will (this is particularly useful in combination with PR #572).