comparison cv2_extract_frames.xml @ 0:d2919cd7e314 draft default tip

planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tools/cv2 commit 15c13526f0bf7274b785e4f03e7b6ad9049e5bae
author imgteam
date Wed, 18 Mar 2026 09:15:00 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:d2919cd7e314
1 <tool id="cv2_extract_frames" name="Extract video frames" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="21.05">
2 <description>with cv2</description>
3 <macros>
4 <token name="@TOOL_VERSION@">4.13.0</token>
5 <token name="@VERSION_SUFFIX@">0</token>
6 <token name="@HELP_SECONDS@">Use a negative value to specify the time from the end of the video (e.g., a value of -1 corresponds to "1 second before the end of the video").</token>
7 <import>tests.xml</import>
8 <import>creators.xml</import>
9 </macros>
10 <creator>
11 <expand macro="creators/rmassei"/>
12 </creator>
13 <edam_operations>
14 <edam_operation>operation_3443</edam_operation>
15 </edam_operations>
16 <xrefs>
17 <xref type="biii">opencv</xref>
18 </xrefs>
19 <requirements>
20 <requirement type="package" version="4.13.0">opencv</requirement>
21 </requirements>
22 <required_files>
23 <include type="literal" path="cv2_extract_frames.py"/>
24 </required_files>
25 <command detect_errors="aggressive">
26 <![CDATA[
27 mkdir ./output_frames &&
28
29 python '$__tool_directory__/cv2_extract_frames.py' output_frames
30 -v '$video_path'
31 -s '$start_time'
32 #if str($end_time) != ""
33 -e '$end_time'
34 #end if
35 -c '$convert_to_grey'
36
37 && ls -l ./output_frames
38 ]]>
39 </command>
40 <inputs>
41 <param name="video_path" type="data" optional="False" format="mp4,avi" label="Input video to convert"/>
42 <param name="start_time" type="float" value="0" optional="false" label="Start time"
43 help="Start time in seconds. @HELP_SECONDS@"/>
44 <param name="end_time" type="float" optional="true" label="End time"
45 help="End time in seconds (optional). Leave empty to extract the sequence until the end of the video. @HELP_SECONDS@"/>
46 <param name="convert_to_grey" type="boolean" label="Convert output to single-channel grayscale?"
47 help="Convert the file to grayscale (will be RGB otherwise)."/>
48 </inputs>
49 <outputs>
50 <collection name="frames" type="list" label="Output frames">
51 <discover_datasets directory="output_frames" format="tiff" pattern="__name__"/>
52 </collection>
53 </outputs>
54 <tests>
55 <test>
56 <!-- test MP4 w/o grayscale conversion -->
57 <param name="video_path" value="input1.mp4"/>
58 <param name="start_time" value="0"/>
59 <param name="end_time" value="0.1"/>
60 <param name="convert_to_grey" value="False"/>
61 <output_collection name="frames" type="list">
62 <expand macro="tests/intensity_image_diff/element" name="frame_0.tiff" value="frame_0.tiff" ftype="tiff"/>
63 <expand macro="tests/intensity_image_diff/element" name="frame_1.tiff" value="frame_1.tiff" ftype="tiff"/>
64 </output_collection>
65 </test>
66 <test>
67 <!-- test MP4 w grayscale conversion -->
68 <param name="video_path" value="input1.mp4"/>
69 <param name="start_time" value="0"/>
70 <param name="end_time" value="0.1"/>
71 <param name="convert_to_grey" value="True"/>
72 <output_collection name="frames" type="list">
73 <expand macro="tests/intensity_image_diff/element" name="frame_2.tiff" value="frame_2.tiff" ftype="tiff"/>
74 <expand macro="tests/intensity_image_diff/element" name="frame_3.tiff" value="frame_3.tiff" ftype="tiff"/>
75 </output_collection>
76 </test>
77 <test>
78 <!-- test AVI w/o grayscale conversion -->
79 <param name="video_path" value="input2.avi"/>
80 <param name="start_time" value="0"/>
81 <param name="end_time" value="1"/>
82 <param name="convert_to_grey" value="False"/>
83 <output_collection name="frames" type="list">
84 <expand macro="tests/intensity_image_diff/element" name="frame_4.tiff" value="frame_4.tiff" ftype="tiff"/>
85 <expand macro="tests/intensity_image_diff/element" name="frame_5.tiff" value="frame_5.tiff" ftype="tiff"/>
86 </output_collection>
87 </test>
88 <test>
89 <!-- test AVI w grayscale conversion -->
90 <param name="video_path" value="input2.avi"/>
91 <param name="start_time" value="0"/>
92 <param name="end_time" value="1"/>
93 <param name="convert_to_grey" value="True"/>
94 <output_collection name="frames" type="list">
95 <expand macro="tests/intensity_image_diff/element" name="frame_6.tiff" value="frame_6.tiff" ftype="tiff"/>
96 <expand macro="tests/intensity_image_diff/element" name="frame_7.tiff" value="frame_7.tiff" ftype="tiff"/>
97 </output_collection>
98 </test>
99 <test>
100 <!-- test AVI with endtime 0 -->
101 <param name="video_path" value="input2.avi"/>
102 <param name="start_time" value="0"/>
103 <param name="end_time" value="0"/>
104 <param name="convert_to_grey" value="True"/>
105 <output_collection name="frames" type="list" count="1"/>
106 </test>
107 <test>
108 <!-- test MP4 with endtime negative-->
109 <param name="video_path" value="input1.mp4"/>
110 <param name="start_time" value="0"/>
111 <param name="end_time" value="-1"/>
112 <param name="convert_to_grey" value="True"/>
113 <output_collection name="frames" type="list" count="238"/>
114 </test>
115 </tests>
116 <help>
117
118 **Extract a sequence of image frames as TIFFs from MP4 and AVI files.**
119
120 Frames captured within a specified time interval (in seconds) will be extracted from the video file as individual TIFF images.
121 Optionally, the extracted frames can be converted to grayscale.
122
123 **Codecs Support:**
124 The tool was tested with H.264 and H.265 (HEVC) video codecs.
125 The tool may support other codecs, though this has not been tested yet.
126 If you have successfully converted files using alternative video formats or codecs, we would be grateful for your feedback at https://github.com/BMCV/galaxy-image-analysis.
127
128 </help>
129 <citations>
130 <citation type="bibtex">@article{opencv_library,
131 author = {Bradski, G.},
132 citeulike-article-id = {2236121},
133 journal = {Dr. Dobb's Journal of Software Tools},
134 keywords = {bibtex-import},
135 posted-at = {2008-01-15 19:21:54},
136 priority = {4},
137 title = {{The OpenCV Library}},
138 year = {2000}
139 }</citation>
140 </citations>
141 </tool>
142