Download presentation
Presentation is loading. Please wait.
1
GUI Final Project: MPEG Maker
Computing for Imaging Science (SIMG-726) Andrew Adams 02 Mar 2006
2
Overview Objectives Widget Definitions Input Files
MPEG Formats and Frame Rates Output File Status Windows Widget Event Handler Get & Display Image Format and Frame Rates Research Specific Requirements MPEG Generating Function MPEG Object Error Handling Conclusion / Future Work
3
Objectives Something useful for my research (video processing)
Simple interface to convert 100s of images into MPEGs “Non-standard” frame rates (i.e. 1 to 2 frames per second) Complex enough to demonstrate an understanding of the IDL widget environment File input/output Select various settings Text and Image Status “Make MPG” function call (IDLgrMPEG object)
4
Widget Definitions - Functionality
Input filename format: prefix + NNN + suffix Example: Frame011-RGB.pnm (digits = 3) Frame indexing (start and stop frames) Reduced frame rate (option) Output filename and location Text status window Image status window Clear and Quit
5
Widget Definitions – Blank GUI
Input Specs – widget_label Select image – widget_button cw_field (widget data entry field) Prefix & Suffix Number of Digits Start & Stop Index Output Specs - widget_label MPEG Format & Frame Rate cw_pdmenu (pull down menu) cw_bgroup (button group) Repeated Frames – cw_field Reduced FR – widget_text Clear/Make/Select – widget_button Output file – cw_field Display – widget_draw Status – widget_text Quit – widget_button
6
Widget Definitions – Pull Down Menus
7
Widget Definitions – Global Data
global_data = { draw_id: window1, $ ;Image status window window_id: window_id, $ ;Image status window prefix_id: prefix, $ ;Input filename suffix_id: suffix, $ ;Input filename istart_id: istart, $ ;Frame index (start) istop_id: istop, $ ;Frame index (stop) idigits_id: idigits, $ ;Index format (# of digits) format_id: format, $ ;MPEG format frame_rate_id: frame_rate, $ ;MPEG frame rate rep_frames_id: rep_frames, $ ; No. of repeated frame rfr_text_id: rfr_text, $ ; Reduced frame rate outfile_id: outfile, $ ; Output filename text_id: textbox } ; Text status window
8
Widget Definitions – Default Values
No. of digits = 3 (001 to 999) Format = 0 (MPEG1) Frame rate = 5 (30 fps) Repeated frames = 1 (no effect) Output file = ‘MPGOUT.mpg’ (Note: Output file directory defaults to “my documents” in windows)
9
Widget Event Handler Get Image Format and Frame Rate
Query_image to check format Open & Display (.png OK as is, .pnm had to be reversed) Put filename in Prefix and Suffix fields Update text status window Format and Frame Rate Button groups (global_data get value) Update text status window (string array index) formats = ['MPEG1', 'MPEG2'] rates = ['23.976', '24', '25', '29.97', '30', '50', '59.94', '60']
10
Widget Event Handler – Get Image
Representative filename is put in both Prefix and Suffix fields…
11
Widget Event Handler – Get Image
…which can be edited by the user as necessary. Start and Stop indices are also filled in.
12
Widget Event Handler – Research Requirement
Need MPEGs with frame rates of 1-10 fps Example: Frame rate = 24fps Repeated frames = 6 RFR = 24 / 6 = 4 fps Repeated frames value (1 – 30) is input manually… …reduced frame rate (RFR) is calculated and text status window updated.
13
Widget Event Handler – Status Window
Text Status Window (Log) Update text window whenever settings change Keeps the user aware of current settings before MPEG Serves as a log of activity Clear button Restores default values Does NOT clear the log window Quit button
14
MPEG Generating Function - IDLgrMPEG
Query_image to check image format Open and Display images Grayscale (.png) OK, Color (.pnm) needed to be reversed* GUI display is updated for each image in sequence Does not affect the runtime significantly (& keeps user entertained!) Build IDLgrMPEG object IDLgrMPEG::Put adds image to object IDLgrMPEG::Save writes object to .mpg file Obj_destroy before returning * Note: Color images had to be reversed about the rows using REVERSE(image,3) for display and about the columns using REVERSE(image,2) before adding to the MPEG object! (Trial & Error…)
15
MPEG Generating Function – Error Handling
Final task in GUI development In most cases, return -1 with error message Defaults set for: Digits, format, frame rate, and repeated frames Then proceed with make MPEG and return 0)
16
DEMONSTRATION…
17
…in case of technical difficulties (it really does make MPEG files!)
18
Conclusion Objectives were met Future work Useful research tool
Better understanding of widgets in IDL Future work IDL crashes when query_image function gets a bad filename Scroll window String array rewritten…display bottom Save to text file?)
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.