00001 00002
00003 package require image
00004 package require gfm
00005
00006 namespace eval gfm {
00007 proc computeSimpleMatch {
00008 {fileName1}
00009 {fileName2}
00010 {reduction 2}
00011 {scale 1}
00012 {desiredNb 1000}
00013 {threshold 3.0}
00014 {doDisplay true}
00015 } {
00016 set ref [image::JfrImage_loadImage $fileName1]
00017 set match [image::JfrImage_loadImage $fileName2]
00018
00019 if {$reduction==1} {
00020 set ref_r $ref
00021 set match_r $match
00022 } else {
00023 # resize the ref image
00024 set ref_r [image::new_JfrImage \
00025 [expr round([$ref getWidth]/$reduction)] \
00026 [expr round([$ref getHeight]/$reduction)] \
00027 [$ref getDepth] [$ref getnChannels]]
00028 $ref resize $ref_r
00029
00030 # resize the match image
00031 set match_r [image::new_JfrImage \
00032 [expr round([$match getWidth]/$reduction)] \
00033 [expr round([$match getHeight]/$reduction)] \
00034 [$match getDepth] [$match getnChannels]]
00035 $match resize $match_r
00036 }
00037
00038 set harrisdetector [gfm::new_HarrisDetector $scale 1.0 2.0 1 $threshold "true" $desiredNb]
00039 00040 set simplematcher [gfm::new_SimpleMatcher 0.9 20 20 ]
00041 kernel::tic
00042 set engine [gfm::new_Engine $harrisdetector $simplematcher ]
00043 set result [gfm::Engine_computeMatch $engine $ref_r $match_r ]
00044 putsDbg "Time to match: [kernel::toc] ms"
00045 if {$doDisplay } {
00046 package require display
00047 display::show $ref_r
00048 displayHarrisPoints $ref_r [Result_points_ref_get $result ]
00049 display::show $match_r
00050 displayHarrisPoints $match_r [Result_points_match_get $result ]
00051 displayMatch $ref_r $match_r [Result_matches_get $result ]
00052 }
00053 }00054
00055 }00056
00057 package provide gfm 0.4