00001 package require premodeler
00002
00003 namespace eval premodeler {
00004
00005 00006 00007 00008 proc testEngine { type sensorName seriesName serieNumber dataPath {begin -1} {end -1} {step -1} } {
00009 set engine [::premodeler::new_Engine $type $sensorName $seriesName $serieNumber $dataPath]
00010 ::premodeler::Engine_process $engine $begin $end $step
00011 return $engine
00012 }00013
00014 00015 00016 00017 proc testIFManager { engine {threshold 3} } {
00018 set result [::premodeler::Engine_getProcessResult $engine]
00019 set manager [::premodeler::new_IFManager]
00020 ::premodeler::IFManager_setSMResult $manager $result
00021 ::premodeler::IFManager_loadSequenceIFs $manager
00022 ::premodeler::IFManager_printSequenceIFs $manager
00023 ::premodeler::IFManager_cleanSequenceIFs $manager $threshold
00024 ::premodeler::IFManager_printSequenceIFs $manager
00025 return $manager
00026 }00027
00028 00029 00030 00031 proc testMatching { imgFile1 imgFile2 {color "green"} } {
00032 set profiler [premodeler::new_Profiler]
00033 puts "profiler set"
00034 set ref_img [image::Image_loadImage $imgFile1]
00035 puts "ref_img set"
00036 set match_img [image::Image_loadImage $imgFile2]
00037 puts "match_img set"
00038 premodeler::Profiler_setRequestImage1 $profiler $imgFile1
00039 premodeler::Profiler_setRequestImage2 $profiler $imgFile2
00040 puts "set request images"
00041 premodeler::Profiler_process $profiler
00042 puts "processed"
00043 set matches [premodeler::Profiler_getMatchesVector $profiler]
00044 puts "set matches"
00045 set result_img [premodeler::mergeImages $ref_img $match_img]
00046 puts "result image built"
00047 display::show $result_img
00048 for {set i 0} {$i < [gfm::sizeMatchesVec $matches]} {incr i} {
00049 set hp1 [gfm::getMatchFirst [ gfm::getMatchesVec $matches $i]]
00050 set hp2 [gfm::getMatchSecond [ gfm::getMatchesVec $matches $i]]
00051 set u1 [expr round([ gfm::InterestPoint_u $hp1 ])]
00052 set v1 [expr round([ gfm::InterestPoint_v $hp1 ])]
00053 display::drawSquare $result_img $u1 $v1 5 1 $color {jafar hpm_match}
00054 display::drawText $result_img $u1 [expr $v1 - 10] "$i" $color "c" {jafar hpm_match}
00055 set u2 [expr round([ gfm::InterestPoint_u $hp2 ])]
00056 set offset [::image::CvImage_width $ref_img]
00057 set u2 [expr $u2 + $offset]
00058 set v2 [expr round([ gfm::InterestPoint_v $hp2 ])]
00059 display::drawSquare $result_img $u2 $v2 5 1 $color {jafar hpm_match}
00060 display::drawText $result_img $u2 [expr $v2 - 10] "$i" $color "c" {jafar hpm_match}
00061 display::drawLine $result_img $u1 $v1 $u2 $v2 1 "blue"
00062 }
00063 }00064 }00065 package provide premodeler 0.9
00066