New Tool: Extract frames with CV2#207
Conversation
|
Very cool, thanks @rmassei! I will try to look into it ASAP. |
kostrykin
left a comment
There was a problem hiding this comment.
Again, thanks @rmassei!
A few comments inside.
If you have the time and patience, I'd appreciate if you could make this a tool suite for cv2 instead (with only a single tool included for now, but the possibility to extend in the future). I think this would make sense, given how large cv2 is. But again, I'm also find with merging this as a standalone tool (as is).
Co-authored-by: Leonid Kostrykin <void@evoid.de>
Updated codec support information and added feedback request.
|
@kostrykin what do you think about:
for the help codec section? |
Co-authored-by: Leonid Kostrykin <void@evoid.de>
kostrykin
left a comment
There was a problem hiding this comment.
A few more comments :)
could you maybe add a small test for end_frame<0?
Co-authored-by: Leonid Kostrykin <void@evoid.de>
kostrykin
left a comment
There was a problem hiding this comment.
Sorry I think I had messed up a bit with my previous suggestions, this should hopefully fix it. Also, it would be very nice to have a test for end_time<0 and end_time=0 since these are different code branches.
Make `end_time` optional
|
Yes, I just need to add tests for the different |
| <param name="start_time" value="0"/> | ||
| <param name="end_time" value="0"/> | ||
| <param name="convert_to_grey" value="True"/> | ||
| <output_collection name="frames" type="list" count="1"/> |
There was a problem hiding this comment.
Yep that's pretty neat!
It can make sense. The thing is, as you can see from the definition of the macro, galaxy-image-analysis/macros/tests.xml Line 87 in 5ca3026 the attributes name and value are propagated to <element> which is basically documented here, although it is not explicitly mentioned in the docs: https://docs.galaxyproject.org/en/latest/dev/schema.html#id122
and:
What is not really clear from the docs is what the Here is an example that might disambiguate this a bit:
I suppose this is because:
https://docs.galaxyproject.org/en/latest/dev/schema.html#tool-tests-test-output-collection |
| <![CDATA[ | ||
| mkdir ./output_frames && | ||
|
|
||
| python "$__tool_directory__/cv2_extract_frames.py" output_frames |
There was a problem hiding this comment.
please use single-quotes
| mkdir ./output_frames && | ||
|
|
||
| python "$__tool_directory__/cv2_extract_frames.py" output_frames | ||
| -v $video_path |
There was a problem hiding this comment.
| -v $video_path | |
| -v '$video_path' |
|
ready to merge? @rmassei |
|
Looks fine to me! |
|
Thanks! |
|
Thanks to you for all the help and, as usual, patience @kostrykin @bgruening |
|
@rmassei Can you please also make a PR for https://github.com/usegalaxy-eu/usegalaxy-eu-tools to add the tool to Galaxy EU? |
This PR introduce a new imaging tool to extract frames from video files. At the present, it was tested with MP4 and AVI but it might work with any other video formats supported by OpenCV.
How does it works:
The tool accepts a video file as input source. Users can specify a time range (in seconds); every frame that falls within this interval is extracted and saved as an individual TIFF image.The tool also offers an optional grayscale conversion.
Maybe to check:
I am not 100% sure if the test was set up correctly (although it passes)
https://github.com/rmassei/galaxy-image-analysis/blob/adf8b716e3d00cdc0b6572bd9ddf84fdb339559e/tools/extract_frames/cv2_extract_frames.xml#L47
Does it make sense that the
nameandvaluefields have the same value?Check-list for the contributor
Please make sure you have read the CONTRIBUTING.md document (last updated: 2025/12/22).
Mandatory checks:
If this PR adds or updates a tool or tool collection:
Guidelines for the contributor
This section is cited from the Naming and Annotation Conventions for Tools in the Image Community in Galaxy.
Naming
Generally, the name of Galaxy tools in our community should be expressive and concise, while stating the purpose of the tool as precisely as possible. Consistency of the namings of Galaxy tools is important to ensure they can be found easily. To maintain consistency, we consider phrasing names as imperatives a good practice, such as "Analyze particles" or "Perform segmentation using watershed transformation". An acknowledged exception from this rule is the names of tool wrappers of major tool suites, where the name of a tool wrapper should be chosen identically to the module or function of the tool which is wrapped (e.g., "MaskImage" in CellProfiler).
Tool description
If a Galaxy tool is a thin tool wrapper (e.g, part of a major tool suite), then the name of the wrapped tool (and only the name of the wrapped tool, subsequent to the term "with" as in "with Bioformats") should be used as the description of the tool (further examples include "with CellProfiler", "with ImageJ2", "with ImageMagick", "with SpyBOAT", "with SuperDSM"). This ensures that the tool is found by typing the name of the wrapped tool into the "Search" field on the Galaxy interface. The tool description should be empty if a tool is either not part of a major tool suite, or the main functionality of the tool is implemented in the wrapper.
Annotations
We point out that there is a global list of precedential annotations with Bio.tools identifiers (Ison et al., 2019) in Galaxy (see mappings), which may outweigh the annotations made in the XML specification of a Galaxy tool (and thus the annotations of a tool reported within the web interface of Galaxy might be divergent). However, since the precedential annotations are subject to possible changes and to avoid redundant work, we do not aim to reflect those in our specifications (those which we make in the XML specifications of Galaxy tools).