Changeset 2023 for trunk/examples/video


Ignore:
Timestamp:
Jan 9, 2011 9:30:53 PM (10 years ago)
Author:
dkearney
Message:

updates for video widgets
two new video dials
video chooser widget for selecting movies
video preview widget is a no frills movie player.
updated c code to more correctly report the last frame of the movie.
new video speed widget which allows for fractional values between 0x and 1.0x
updated piv/pve example application
fixed "release" function in tcl bindings for RpVideo?

Location:
trunk/examples/video
Files:
12 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/examples/video/dial/dialdemo.tcl

    r1979 r2023  
    4545after 200 {
    4646    update idletasks
    47     .f.d3 mark add loopstart 5
    48     .f.d3 mark add loopend 10
     47#    .f.d3 mark add loopstart 5
     48#    .f.d3 mark add loopend 10
    4949    .f.d3 mark add particle0 17
    5050    .f.d3 mark add particle1 10
  • trunk/examples/video/piv/intro.html

    r1928 r2023  
    11<html>
    22    <body>
    3         <h1>PIV tool</h1>
    4         <p>add info about how piv tool works</p>
     3        <center>
     4            <h1>ParticleVE</h1>
     5            <h2>a particle tracking velocimetry tool</h2>
     6        </center>
     7        <p>
     8            Track particles in videos to calculate an estimate of
     9            their velocity.
     10        </p>
     11
     12        <h3>What is Particle Velocity Estimation</h3>
     13        <p>
     14        <!-- text from wikipedia -->
     15Particle tracking velocimetry (PTV) is a velocimetry method, i.e a technique to measure velocity of particles. The name suggests that the particles are tracked, and not only recorded as an image as it is suggested in another form, particle image velocimetry. There are two very different experimental methods:
     16
     17    * the two dimensional (2D) modification of Particle Image Velocimetry (PIV), in which the flow field is measured in the two-dimensional slice of the flow, illuminated by a laser sheet (a thin plane) and low density of seeded particles allow for the tracking each of them individually for several frames.
     18    * the Three-Dimensional Particle tracking velocimetry (3D-PTV) is a distinctive experimental technique, based on multiple camera-system, three-dimensional volume illumination and tracking of flow tracers (i.e. particles) in three-dimensional space by using photogrammetric principles.
     19        </p>
     20        <h3>Get Started:</h3>
     21        <ol>
     22            <li>Choose a video to track particles in.</li>
     23            <li>Preview the video, searching for interesting frames.</li>
     24            <li>Mark particle locations and analyze the frames.</li>
     25        </ol>
     26        <center>
     27            <img src="images/pve_demo_small.png"/>
     28        </center>
     29
     30        <h3>Practical Applications:</h3>
     31        <p></p>
     32
     33        <h3>Learn More:</h3>
     34        <ol>
     35            <li><a href="http://wikipedia.org/wiki/Particle_tracking_velocimetry">Particle Tracking Velocimetry (PTV)</a></li>
     36            <li><a href="http://wikipedia.org/wiki/Particle_image_velocimetry">Particle Image Velocimetry (PIV)</a></li>
     37        </ol>
    538    </body>
    639</html>
  • trunk/examples/video/piv/piv.tcl

    r1979 r2023  
    77package require RapptureGUI
    88package require BLT
     9package require Img
    910
    1011
     
    3637wm title . "particle velocity estimate"
    3738wm withdraw .
     39set width 960
     40set height 625
     41
     42set installdir [file dirname [ \
     43                Rappture::utils::expandPath [ \
     44                file normalize [info script]]]]
     45
    3846
    3947
     
    5361set f [$nb insert end about]
    5462
    55 # loader for videos
    5663
    57 set loader [frame $f.loader]
    5864
    59 label $loader.icon -image [Rappture::icon folder]
    60 pack $loader.icon -side left
    61 label $loader.name -borderwidth 1 -relief solid -background white -anchor w
    62 pack $loader.name -side left -expand yes -fill x -padx 2
    63 button $loader.go -text "Upload..."
    64 pack $loader.go -side right
     65# html intro page
    6566
    66 # create an html intro page
    67 
    68 set intro [frame $f.intro -borderwidth 1 -width 300 -height 300]
     67set intro [frame $f.intro]
    6968
    7069Rappture::Scroller $intro.scroller -xscrollmode auto -yscrollmode auto
     
    7978$intro.scroller.html load $html
    8079
    81 set demo [frame $f.demo]
    8280
     81# verticle divider
     82set div [frame $f.div -width 1 -background black]
     83
     84
     85set previewVar ""
     86
     87# movie chooser
     88
     89set chooser [frame $f.chooser_f]
     90
     91set fid [open [file join $installdir images step1.png] r]
     92fconfigure $fid -translation binary -encoding binary
     93set data [read $fid]
     94close $fid
     95set imh [image create photo]
     96$imh put $data
     97label $chooser.step1 -image $imh
     98
     99set vc [Rappture::VideoChooser $chooser.vc -variable ::previewVar]
     100$vc load [glob "/home/derrick/projects/piv/video/*.mp4"]
     101# $vc load [glob "/apps/piv/video/*.mp4"]
     102
     103pack $chooser.step1 -side top -anchor w -pady 8
     104pack $vc -side bottom -anchor center
     105
     106
     107
     108# movie previewer
     109
     110set preview [frame $f.preview_f]
     111
     112set fid [open [file join $installdir images step2.png] r]
     113fconfigure $fid -translation binary -encoding binary
     114set data [read $fid]
     115close $fid
     116set imh [image create photo]
     117$imh put $data
     118label $preview.step2 -image $imh
     119
     120set vp [Rappture::VideoPreview $preview.preview -variable ::previewVar]
     121
     122pack $preview.step2 -side top -anchor w -pady 8
     123pack $vp -side bottom -anchor center
     124
     125
     126
     127# analyze button gets us to the analyze page
     128
     129set analyze [frame $f.analyze_f]
     130
     131set fid [open [file join $installdir images step3.png] r]
     132fconfigure $fid -translation binary -encoding binary
     133set data [read $fid]
     134close $fid
     135set imh [image create photo]
     136$imh put $data
     137label $analyze.step3 -image $imh
     138
     139button $analyze.go \
     140    -text "Analyze" \
     141    -command {
     142        $vp video stop
     143        $vs load file $previewVar
     144        $vs video seek [$vp query framenum]
     145        $nb current next>
     146        # FIXME: video loaded into memory twice
     147    }
     148pack $analyze.step3 -side left -anchor w
     149pack $analyze.go -anchor center
     150
     151
     152set reqwidth [expr round($width/2.0)]
    83153blt::table $f \
    84     0,0 $intro -rowspan 3 -fill both \
    85     0,1 $demo -fill x \
    86     1,1 $loader -fill x
     154    0,0 $intro -rowspan 3 -fill both -reqwidth $reqwidth\
     155    0,1 $div -rowspan 3 -fill y -pady 8 -padx 8\
     156    0,2 $chooser -fill x -padx {0 8}\
     157    1,2 $preview -fill x \
     158    2,2 $analyze -fill x
    87159
    88 blt::table configure $f c* -resize both
     160blt::table configure $f c0 -resize none
     161blt::table configure $f c1 -resize none
     162blt::table configure $f c2 -resize none
    89163# blt::table configure $f r0 -pady 1
    90164
     
    94168
    95169set f [$nb insert end video]
    96 set movieViewer [Rappture::VideoScreen $f.viewer]
    97 $loader.go configure -command {$nb current next>; $movieViewer loadcb}
     170set vs [Rappture::VideoScreen $f.viewer -fileopen {$nb current about}]
     171pack $vs -expand yes -fill both
    98172
    99 pack $movieViewer -expand yes -fill both
    100173
    101174# ------------------------------------------------------------------
     
    103176# ------------------------------------------------------------------
    104177
     178
    105179$nb current about
    106 wm geometry . 900x600
     180wm geometry . ${width}x${height}
    107181wm deiconify .
    108 update idletasks
    109182
    110 # for testing we automatically load a video
    111 array set videoFiles [list \
    112     1 "/home/derrick/projects/piv/video/TOPHAT_06-03-10_16-05-55.mp4" \
    113     2 "/home/derrick/projects/piv/video/TOPHAT_06-03-10_16-09-56.mp4" \
    114     3 "/home/derrick/projects/piv/video/TOPHAT_06-03-10_16-13-56.mp4" \
    115     4 "/home/derrick/junk/coa360download56Kbps240x160.mpg" \
    116 ]
    117 $nb current video
    118 update idletasks
    119 $movieViewer load file $videoFiles(1)
     183#update idletasks
     184#image delete $imh
Note: See TracChangeset for help on using the changeset viewer.