00001 00002
00003 00004 00005 00006
00007 package require kernel
00008 package require image
00009 package require display
00010 package require gfm
00011
00012 namespace eval gfm {
00013
00014 00015 00016 00017 00018 00019 00020 00021 proc displayTrackedHarrisPoints { image_r vecPoints {enableClick "false"} {color "red"} } {
00022
00023 if $enableClick {set indexMap ""}
00024
00025 set colorSquare "blue"
00026
00027 for {set i 0} {$i < [gfm::sizeInterestFeatureVec $vecPoints]} {incr i} {
00028
00029 set ip [gfm::getInterestFeatureVec $vecPoints $i]
00030 set ipu [gfm::getUFromIP $ip ]
00031 set ipv [gfm::getVFromIP $ip ]
00032 set id [gfm::InterestPoint_id $ip]
00033
00034 set tkIds [display::drawCross $image_r $ipu $ipv 3 1 $color {jafar gfm_point}]
00035
00036 display::drawSquare $image_r [expr round($ipu)] [expr round($ipv)] 5 1 $colorSquare {jafar hpm_match}
00037 display::drawText $image_r [expr round($ipu)] [expr round($ipv - 10 )] "$id" $colorSquare "c" {jafar hpm_match}
00038
00039 if $enableClick {
00040 foreach id $tkIds {
00041 lappend indexMap $id $i
00042 }
00043 }
00044 }
00045 if $enableClick {
00046 bind .$image_r <ButtonPress-1> "::gfm::printHarrisPointIndex $image_r $vecPoints \{$indexMap\}"
00047 }
00048
00049 }00050
00051
00052
00053 00054 00055 00056 00057 proc displayHarrisPoints { image_r vecPoints {enableClick "false"} {color "red"} } {
00058 if $enableClick {set indexMap ""}
00059 for {set i 0} {$i < [gfm::sizeInterestPointVec $vecPoints]} {incr i} {
00060 set ip [gfm::getInterestPointVec $vecPoints $i]
00061 set ipu [gfm::getUFromIP $ip ]
00062 set ipv [gfm::getVFromIP $ip ]
00063 set tkIds [display::drawCross $image_r $ipu $ipv 3 1 $color {jafar gfm_point}]
00064 if $enableClick {
00065 foreach id $tkIds {
00066 lappend indexMap $id $i
00067 }
00068 }
00069 }
00070 if $enableClick {
00071 bind .$image_r <ButtonPress-1> "::gfm::printHarrisPointIndex $image_r $vecPoints \{$indexMap\}"
00072 }
00073 }00074
00075
00076 proc printHarrisPointIndex {img vecPoints indexMap} {
00077 set tkId [.$img.$img find withtag current]
00078 array set indexMapArray $indexMap
00079 set index $indexMapArray($tkId)
00080 putsDbg "point index: $index"
00081 putsDbg [gfm::print [gfm::getInterestPointVec $vecPoints $index]]
00082 }00083
00084
00085 proc displayMatch {ref_r match_r vecMatches {doDisplayNum "true"} {color "green"}} {
00086 for {set i 0} {$i < [sizeMatchesVec $vecMatches]} {incr i} {
00087 set hp1 [getMatchFirst [ getMatchesVec $vecMatches $i]]
00088 set hp2 [getMatchSecond [ getMatchesVec $vecMatches $i]]
00089 display::drawSquare $ref_r [expr round([ InterestPoint_u $hp1 ])] [expr round([ InterestPoint_v $hp1 ])] 5 1 $color {jafar hpm_match}
00090 if $doDisplayNum {
00091 display::drawText $ref_r [expr round([ InterestPoint_u $hp1 ] )] [expr round([InterestPoint_v $hp1] - 10 )] "$i" $color "c" {jafar hpm_match}
00092 }
00093 display::drawSquare $match_r [expr round([ InterestPoint_u $hp2 ])] [expr round([InterestPoint_v $hp2 ])] 5 1 $color {jafar hpm_match}
00094 if $doDisplayNum {
00095 display::drawText $match_r [expr round([ InterestPoint_u $hp2 ] )] [expr round([InterestPoint_v $hp2 ] - 10 )] "$i" $color "c" {jafar hpm_match}
00096 }
00097 }
00098 }00099
00100
00101 proc displayTrack {match_image vecMatches {color "blue"}} {
00102 for {set i 0} {$i < [sizeMatchesVec $vecMatches]} {incr i} {
00103 set hp1 [getMatchFirst [getMatchesVec $vecMatches $i] ]
00104 set hp2 [getMatchSecond [getMatchesVec $vecMatches $i] ]
00105
00106 display::drawLine $match_image \
00107 [expr round([$hp1 u])] [expr round([$hp1 v])] \
00108 [expr round([$hp2 u])] [expr round([$hp2 v])] \
00109 1 $color {jafar gfm_track}
00110
00111 }
00112 }00113
00114 }00115
00116 package provide gfm 0.4