00001 package require image
00002 package require datareader
00003 package require gfm
00004
00005
00006 set imaPath "/tmp/msanfour"
00007 set imaPrefix "scr_"
00008 set imaSuffix ".png"
00009 set nbDigits 3
00010 set firstnum 0
00011 set lastnum 20
00012 set pasIma 1
00013
00014 set tracksListFileName "/home/msanfour/pistesGFM_PNG2.feat"
00015 set minTrackLength 5
00016
00017 00018 00019 set seqReader [::datareader::new_ImageReader]
00020 ::datareader::ImageReader_setup $seqReader $imaPath $imaPrefix $imaSuffix $nbDigits
00021
00022 00023 00024 set scale 1
00025 set threshold 3.0
00026 set desiredNb 3000
00027 set harrisdetector [gfm::new_HarrisDetector $scale 1.0 2.0 1 $threshold "true" $desiredNb]
00028
00029 00030 00031 set groupsize 10
00032 set minimalgroupsize 2
00033 set distance 20.0
00034 set closeness 0.6
00035 set weakcloseness 0.6
00036 set distinguability 0.1
00037 set rotationTolerance 0.2
00038 set scaleTolerance 10000.0
00039 set distanceTolerance 10.0
00040 set rotationDifferenceWithMedian 0.4
00041 set thresholdofenoughtgroup 0.333
00042 set groupsmatcher [gfm::new_GroupsMatcher 100000 100000 $groupsize $minimalgroupsize $distance $closeness $weakcloseness $distinguability $rotationTolerance $scaleTolerance $distanceTolerance $rotationDifferenceWithMedian $thresholdofenoughtgroup ]
00043
00044 00045 00046
00047 set my_engine [::gfm::new_EngineOfflineTracking $harrisdetector $groupsmatcher]
00048
00049 00050 set cptima 0;
00051 set anImage [::datareader::ImageReader_loadImage $seqReader $firstnum]
00052 set cptima 1;
00053
00054 00055 ::gfm::EngineOfflineTracking_initTracking $my_engine $anImage
00056
00057 00058 set extractedPoints [::gfm::EngineOfflineTracking_currentPoints $my_engine]
00059
00060 00061 set list_of_tracks [::gfm::new_tracks $extractedPoints]
00062
00063 for {set cpt [expr $firstnum+$pasIma]} {$cpt<=$lastnum} {set cpt [expr $cpt+$pasIma]} {
00064
00065 # Load the next image in the sequence
00066 unset anImage;
00067 set anImage [::datareader::ImageReader_loadImage $seqReader $cpt]
00068
00069 # Extact Harris points and match
00070 ::gfm::EngineOfflineTracking_nextImage $my_engine $anImage $cptima
00071
00072 # Get extracted points and puts in tracks list
00073 unset extractedPoints
00074 set extractedPoints [::gfm::EngineOfflineTracking_currentPoints $my_engine]
00075 ::gfm::tracks_add $list_of_tracks $extractedPoints
00076
00077 set cptima [expr $cptima +1]
00078 }
00079
00080 00081 00082 00083
00084 gfm::tracks_makeStatistics $list_of_tracks
00085 gfm::tracks_exportBinaryFile $list_of_tracks $tracksListFileName $minTrackLength
00086 gfm::tracks_makeStatistics $list_of_tracks
00087
00088 unset list_of_tracks
00089 unset groupsmatcher
00090 unset harrisdetector
00091 unset seqReader