00001 00002
00003 package require jmath
00004 package require image
00005 package require display
00006 package require sams
00007
00008 namespace eval sams {
00009 proc showFrame { fr } {
00010 ::display::show [$fr img]
00011 set size [::sams::Frame_size $fr]
00012 for { set i 0 } { $i < $size } { incr i } {
00013 set f [::sams::Frame_get $fr $i]
00014 set angle [::sams::Feature_o $f]
00015 ::display::drawCircle [$fr img] [::sams::Feature_x $f] [::sams::Feature_y $f]\
00016 [::sams::Feature_s $f]
00017
00018 set xR [expr [::sams::Feature_s $f] * cos($angle)]
00019 set yR [expr [::sams::Feature_s $f] * sin($angle)]
00020 ::display::drawLine [$fr img] [::sams::Feature_x $f] [::sams::Feature_y $f] \
00021 [expr [::sams::Feature_x $f]+$xR] [expr [::sams::Feature_y $f]+$yR]
00022 }
00023 }00024
00025 proc drawProjectedHypothesis { img hc } {
00026 set pm [$hc view2Frame]
00027 display::drawLine $img [jmath::vec_get $pm 0] [jmath::vec_get $pm 1] [jmath::vec_get $pm 2] [jmath::vec_get $pm 3] 2 "green"
00028 display::drawLine $img [jmath::vec_get $pm 0] [jmath::vec_get $pm 1] [jmath::vec_get $pm 4] [jmath::vec_get $pm 5] 2 "green"
00029 display::drawLine $img [jmath::vec_get $pm 6] [jmath::vec_get $pm 7] [jmath::vec_get $pm 2] [jmath::vec_get $pm 3] 2 "green"
00030 display::drawLine $img [jmath::vec_get $pm 6] [jmath::vec_get $pm 7] [jmath::vec_get $pm 4] [jmath::vec_get $pm 5] 2 "green"
00031 display::drawText $img [jmath::vec_get $pm 8] [jmath::vec_get $pm 9] [sams::Hypothesis_m_view_id_get $hc] "green"
00032 set mt [sams::Hypothesis_m_matches_get $hc]
00033 set size [::sams::MatchesVec_size $mt]
00034 for {set i 0} {$i < $size} {incr i} {
00035 set ff [::sams::Match_frameRef_get [sams::MatchesVec_get $mt $i]]
00036 ::display::drawCircle $img [::sams::Feature_x $ff] [::sams::Feature_y $ff] [::sams::Feature_s $ff]
00037 set f [$hc part2Frame $i]
00038 ::display::drawCircle $img [$f get 0] [$f get 1] [$f get 3] 1 "green"
00039 set xR [expr [$f get 3] * cos([$f get 2])]
00040 set yR [expr [$f get 3] * sin([$f get 2])]
00041 ::display::drawLine $img [$f get 0] [$f get 1] \
00042 [expr [$f get 0]+$xR] [expr [$f get 1]+$yR] 1 "green"
00043 ::display::drawLine $img [::sams::Feature_x $ff] [::sams::Feature_y $ff] [$f get 0] [$f get 1] 1 "green"
00044 }
00045 }00046
00047 proc drawProjectedMatches { img fr mt tr } {
00048 set size [::sams::MatchesVec_size $mt]
00049 for {set i 0} {$i < $size} {incr i} {
00050 set m [::sams::MatchesVec_get $mt $i]
00051 if { [sams::Match_valid_get $m] } {
00052 kernel::putsDbg "draw matched feature"
00053 set ff [::sams::Match_frameRef_get $m]
00054 ::display::drawCircle $img [::sams::Feature_x $ff] [::sams::Feature_y $ff] [::sams::Feature_s $ff] 2
00055 kernel::putsDbg "draw matched part"
00056 set vpi [::sams::Match_modelRef_get $m]
00057 set f [$vpi transform $tr]
00058 ::display::drawCircle $img [$f get 0] [$f get 1] [$f get 3] 1 "green"
00059 kernel::putsDbg "link match"
00060 ::display::drawLine $img [::sams::Feature_x $ff] [::sams::Feature_y $ff] [$f get 0] [$f get 1] 1 "green"
00061 }
00062 }
00063 }00064
00065 }00066
00067 package provide sams 1.0