00001 00002
00003 00004 00005 00006
00007 package require kernel
00008 package require image
00009 package require gfm
00010
00011 namespace eval gfm {
00012 proc computeHarrisPoints {
00013 {fileName}
00014 {reduction 2}
00015 {scale 1}
00016 {desiredNb 1000}
00017 {threshold 3.0}
00018 {doDisplay true}
00019 {doReturnVecPoints false}
00020 {doReturnSaveResult false}
00021 } {
00022
00023 set image [image::JfrImage_loadImage $fileName]
00024 if {$reduction==1} {
00025 set image_r $image
00026 } else {
00027 # resize the image
00028 set image_r [image::new_JfrImage [expr round([$image getWidth]/$reduction)] [expr round([$image getHeight]/$reduction)] [$image getDepth] [$image getnChannels]]
00029 $image resize $image_r
00030 }
00031
00032 00033 kernel::tic;
00034 set harrisdetector [gfm::new_HarrisDetector $scale 1.0 2.0 1 $threshold "true" $desiredNb]
00035 set harrispoints [gfm::HarrisDetector_detectIn $harrisdetector $image_r]
00036
00037 putsDbg "Time to detect the harris points: [kernel::toc] ms"
00038
00039 if $doDisplay {
00040 package require display
00041 display::show $image_r
00042 gfm::displayHarrisPoints $image_r $harrispoints
00043 display::dumpEps $image_r "image.eps"
00044 }
00045 }00046 proc computeHarrisLaplacePoints {
00047 {fileName}
00048 {reduction 2}
00049 {threshold 3.0}
00050 {doDisplay true}
00051 {doReturnVecPoints false}
00052 {doReturnSaveResult false}
00053 } {
00054
00055 set image [image::JfrImage_loadImage $fileName]
00056 if {$reduction==1} {
00057 set image_r $image
00058 } else {
00059 # resize the image
00060 set image_r [image::new_JfrImage [expr round([$image getWidth]/$reduction)] [expr round([$image getHeight]/$reduction)] [$image getDepth] [$image getnChannels]]
00061 $image resize $image_r
00062 }
00063
00064 00065 kernel::tic;
00066 set harrislaplacedetector [gfm::new_HarrisLaplaceDetector 2.0 1 $threshold ]
00067 set harrislaplacepoints [gfm::HarrisLaplaceDetector_detectIn $harrislaplacedetector $image_r]
00068
00069 putsDbg "Time to detect the harris-laplace points: [kernel::toc] ms"
00070
00071 if $doDisplay {
00072 package require display
00073 display::show $image_r
00074 gfm::displayHarrisPoints $image_r $harrislaplacepoints
00075 }
00076 }00077
00078 }00079
00080 package provide gfm 0.4