Ecognition Tutorial - Classifying A Quickbird Image
Ecognition Tutorial - Classifying A Quickbird Image
JaredNewellandPontusOlofsson Dept.ofGeographyandEnvironment,BostonUniversity
1. SettingupaneCognitionproject
AQuickbirdImageoftheBUareacanbefoundon/data/bs16/Bostonpan/.Downloadthecontentsof thisfolderandputitinalocalfolderonyourcomputer.(Thereshouldbetwotiffimages;afourband QuickbirdimageandanNDVIimage). OpeneCognitionDeveloperfromyourstartmenu.ChoosetheRuleSetModefromtheprompt. ClickFile>NewProject.Ascreenwillappearaskingyoutoimportimagelayers.Navigatetothe BostonQB.tifandNDVI.tifimagesandopenthem. Herewecanspecifyaprojectname,thematicdata,andwhichbandstouse.Mostimportantlywecan selectasubsetfromtheimage(SubsetSelectionbutton);subsetsareparticularlyusefulifyouwantto tryoutvariousrulesetsonalargeimage.Forthistutorialwellusethewhole2,300x2,300pixelimage. Clicktheeditbuttonforeachlayerandrenamethelayerssoyoucandifferentiatebetweenthem. Quickbirdlayers1,2,3,4areB,G,R,NIR;renametheNDVIlayeraccordingly.ClickOKtoloadthedata. ThemainDeveloperscreenwillopenupandyoushouldseeyourimage.Tochangethelayer compositionofthebands,click onthetoptoolbar.WhatsneatabouteCognitionisthatyoucan mixmorethanthreebands.ForexampleyoucandisplayanimageintruecolorRGB,andthenfor addedvegetationenhancementaddintheNIRorNDVIinthegreenband.Youcanalsodolayer weighting,andgiveweightsforeachband(usetherightclicktoincrease,andthelefttodecrease).Play aroundwiththelayermixingandweighting.Ilikethismix:
2. Segmentation
eCognitionisauniqueimageprocessingsoftware,asitusesanobjectbasedprocessingand classificationschemeratherthantraditionalpixelbasedmethods.Whatthismeansisthesoftwareruns segmentationalgorithmstogroupsimilarandadjacentpixelstogetherintopolygonsorimageobjects. IneCognition,thesegmentationalgorithmusesabottomup,lowtohighvalueregiongrowingmethod coinedtheFractalNetEvolutionApproach(BaatzandSchape1999).First,aseedpixelisselectedfrom withintheimage,andthenneighboringpixelswithsimilarvaluesareconsolidatedintoobjectsbasedon thesmallestgrowthofheterogeneity,anddefinedbyspectralvarianceandgeometryoftheobject (Benzetal.2004).Thisregiongrowingprocessstopswhentheobjectgrowthexceedsauserdefined scaleparameter.Thesegments(imageobjects)arethenclassifiedthroughfuzzylogicbasedobject metricsandstatisticssuchaspixelvalues,texture,shape,andsize. Letslearnabitaboutthiswholesegmentationthing Firstmakesureyouhavetheproperwindowsopen.Wellbeplayingaroundwithsomeprocessesand algorithms,soletsloaduptheprocessestreewindow.GotoView>DevelopRulesetView.Some windowsshouldshowupontherighthandsideofyourscreen. eCognitionusesahierarchicalprocesstreewhenclassifyingormanipulatinganyimagedata.The processesaredefinedbyaParentChildconcept;parentsbeingtherootandchildrenbeingthe 2
branches.FirstletsstartbyaddinganewParent.RightclickintheprocesstreeandAppendNew. Giveitthenamecoarsesegmentation. RightclickonthecoarsesegmentationintheprocesstreeandInsertChild.Herewearegoingtostart withtheusualfirststepinobjectbasedimageclassificationImagesegmentation.IntheEditProcess windowthatpopsup,selectMultiresolutionSegmentationfromtheAlgorithmdropdown. MultiresolutionsegmentationisprobablythemostwidelyusedalgorithmineCognition.Ithasthree mainsettingsorcriterionthatdefinehowtheimagewillbesegmented:scaleparameter,Shape,and Compactness.Scaleparameterwilldeterminethesizeofthesegments;itsanarbitrarynumbernot relatedtoscaleorpixelsize.TheShapeparameterrangesfrom01.0.Avalueof0.1willcreate segmentsheavilyweightedoncolor(e.g.differentiatingbetweentreespecies,rocktype,urban substrate),whileavalueof0.9willsegmentbasedonshape(e.g.buildings,roads,standsoftrees).The compactnessparameterdefineshowcondensedandcompactimageobjectswillbe;avalueof0.1will giveyousquigglyandirregularsegments(maybeusefulifyourelookingatextractinghydrologicdataor roadways),whileavalueof0.9willyieldblockyandcompactsegments(goodforextractingbuildings andpatchworktypelandcover).Additionallyyoucangiveweightstoyourimagelayers(rangingfrom0 1.0).Thinkaboutwhatyouwanttoclassify(veg,buildings,landcover),andadjustaccordingly. Givethesegmentationlevelanamecoarseseg.Youcantryafewdifferentsegmentations;the settingsbelowwillyieldverysmallsegmentsheavilyweightedoncolor.
Playaroundwiththedifferentparametersandseewhatyouget.Aftereachsegmentationyoullhave todeletethelayer .
3. Classification
Letstryandmakealandcoverclassificationfromtheimage.Inmanyimagescenestherearedifferent scalesusedforanalysis(thinkforest>stand>individualtree).Insomecasesthereareareasinimages thatyoumightwanttoprocesswithgreaterdetail.Converselythereareareasinascenethatmaynot needmuchanalysisatall(fields,water).
3.1CoarseScaleSegmentation
TakealookattheBostonimage;whatbroadlandcovercategoriesdoyousee?Therearetrees, buildings,roads,water,etc,overallaprettycomplexanddetailedlandscape.Ataverygenerallevel thereswaterandland.WhatIvefoundhelpfulistopreclassifylargehomogenouslandcoversbefore concentratingonthefinescalestuff.Inthiscaseitsbesttoclassifythewaterfirstandremoveitfrom furtheranalysis.Weallknowthatshadowandwatercaneasilybeconfusedatafinescale,sothiswill letusdealwiththosepeskyshadowsatalatertime.Letsrunacoarseresolutionsegmentationonthe image,andtrytoextracttheCharlesRiverthebestwecan.TheBUbridgeandRRtracksontheleftside oftheimagedividetheriver,sowecantgettoocoarsewithoursegmentation Ifoundthattheseparametersworkthebestfordelineatingwaterandland.Deleteyourprevious segmentationandusethesesettings:
Hitexecute.Itwilltakeafewsecondsoruptoaminute.Youshouldgetanimageandsegmentation thatlookssomethinglikethis:
Youcanchangevariousvisualizationsbyselectingthebuttonstotherightoftheeyeonthetoolbar. Moveyourmouseoverthevariousbuttonstolearnwhattheydo.Youcanturnimageobjectsonand off,viewclassifications,seeclassificationsamples,etcwiththesebuttons.Thetwobuttonstotheright oftheeyearetheonesIusethemost.Theytogglebetweenimageviewandclassificationview. Nowthattheimagehasbeensegmentedletsstartwithaverybasicclassification,separatingtheland andwater.Firstletscreatetwoclasseslandandwater.Tosodosimplyrightclick>insertclassinthe classhierarchywindow(topright)andaddthetwoclasses.Givethemappropriatecolorsandlabels. WearenowgoingtousethestandardNearestNeighborclassifiertocreatethisfirstclassification. Fromthetoptoolbarclickclassification>nearestneighbor>editstandardnearestneighborfeature space.
ThenintheAlgorithmdropdownbox,underBasicClassification,selectclassification.
Thisprocesswindowwillthenpopup.Makeyouractiveclasseslandandwater;keepeverythingelse thesame.Clickok. 8
Wewillnowselectsamplesforlandandwater.Ifyoudontalreadyhavethesamplestoolbarup,addit toyourtoolbar(View>Toolbars>Samples).
Letsnowexecutetheclassifier.Rightclicktheclassificationintheprocesstreeandhitexecute.
10
3.2FineScaleSegmentation
Weregoingtowanttoresegmentthelandareaintosmallersegments.Wellshootforaminimum mappingunitofaround25m(tryingtocapture,buildings,roads,trees). AddanewparenttotheProcesstree;rightclickonthecoarsesegmentation>Appendnew.Callthis processfinesegmentationclickok.Thenaddachildtotheprocess.Inthiscasewearegoingto wanttoaddanothermultiresolutionsegmentation,andresegmentonlythelandobjects.Intheedit processwindowselectmultiresolutionsegmentationfromthealgorithmdropdown,applyittothelevel coarseseg,andselectaclassfilterforjustlandkeepalltheotherparametersontheleftthesame. Ontheright,weregoingtospecifythelevelusageasusecurrentandinputlayerweightsand parametersasso:
11
Nextwellstartclassifyingthefinescalesegments.Toclassifythesemuchsmallerimageobjects,we needtofirstaskourselves:Whatdowewanttoclassify?Wellsticktoafairlybasicclassificationsystem (Tree,Grass,BareGround,Building/Impervious,Road,andShadow).Althoughweonlyhavesixclasses, thereareverydifferenttypesofeachclass(e.g.brightandshadowedsidesofatree,whiteandblack buildings,greenanddrygrass).Wellwanttotryandcapturethisvariabilityinourclassification. Ivefoundthatthebestwaytoclassifyaheterogeneousandspectrallydiversehiressceneistostart withmanyclasses,andthenmergethemtogetherwhenyourereadytodeliverafinalproduct. Giveaverythoroughlookoveryourimage,andthinkaboutwhatclassesyoumightwanttoinclude. Alsothinkabouthowtheclassifiermightseetheimageobjectsyoucantexpecttheclassifierto differentiatebetweenroadandbuilding,withoutgivingitsomemeasureofshapeandcompactness. StartbuildingdifferentclassesbyrightclickingintheClassHierarchywindow.Wellstartwithvarious treeclassesIaddedfiveclassesbasedonthegeneralbrightnessandmixingseenwithdifferent imageobjects.Ialsotriedtokeeptheclasscolorsrepresentativeoftruecolor.
12
Iputtogetheraclassificationthatlookssomethinglikethis:
13
14
Hitexecute.Itmaytakeacoupleminutestoclassifydependingonhowmanyobjectfeaturesyouputin theNNclassifier.Myclassificationlookssomethinglikethis:
15
16
4. ManualEditing
Oneofthelaststepsincreatingaclassificationismanualeditingandcleanup.Thisisusuallythemost tediousandtimeconsumingstep.ThankfullyitsmucheasiertodocleanupineCognitioncomparedto theroundaboutENVI/ArcMapprocessthatstypicallyused.Whatwearegoingtodohereisaddanew parentintheprocesstreecalledcleanuprightclickintheprocesstree>appendnew>namethe parentcleanup>anddragittothebottomoftheruleset.
Rightclickoncleanup>insertanewchild>selectmanualclassificationtowardsthebottomofthe pulldown.
17
AddaManualclassificationforeachclass.
18
19
Ispentacoupleminutescleaningupthissectionoftheimage.Overall,itlooksprettygood!Itsusually worthgivingtheimageasolidlookover,justrememberyoullnevergeta100%perfectproduct. 20
5. ExportResult
Onceyourehappywithyourclassificationyoucanexportittoavarietyofformats(tif,img,shp).This canbehelpfulifyouregoingtousetheclassificationinArcorENVI.
Hitexportandsaveitinaproperdirectory. 21
TheimagecannowbeviewedandanalyzedinArc.Togetridofthedifferentbrightnessclasses,Ioften groupclassesandusethereclassifytoolinArc.
Learnmore
M.BaatzandA.Schpe,Objectorientedandmultiscaleimageanalysisinsemanticnetworks, Proceedingsofthe2ndinternationalsymposiumonoperationalizationofremotesensing,ITC, Enschede(1999),pp.1620.http://www.definiens.com/ U.C.Benz,P.Hofmann,G.Willhauck,I.LingenfelderandM.Heynen,Multiresolution,objectoriented fuzzyanalysisofremotesensingdataforGISreadyinformation,ISPRSJournalofPhotogrammetry andRemoteSensing58(34)pp.239258 http://www.ecognition.com/andhttp://www.definiens.com/ 22