You are on page 1of 22

eCognitionTutorial:Classifyinga QuickBirdImage

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.

Thewindowthatpopsuphastwosidestoit;ontherightareallthevariousparametersyoucanusefor classifyingyourimage.Togglethroughsomeofthemtherearealot!eCognitionisuniqueinthatit classifiestheimagebasedonimageobjects;thereareveryfewclassificationinputsthatarepixelbased (e.g.nomaximumlikelihood,isodata,etc).Sinceweredoingaverybasicclassification,theresreallyno needtousemanyobjectfeaturesintheNNclassifier.TakealookattheimageobjectsovertheCharles Rivervs.thoseoverland.ObviouslythelandhashigherreflectanceandagenerallypositiveNDVI,while thewaterisdarkanduniformincolor.Alsotheimageobjectsoverthewateraremuchlarger.Letsadd afewobjectfeaturestotheclassifierandseewhatwegetforaclassification

Doubleclickingvariousfeaturespaceparametersonthelefthandsideofthenearestneighborwindow, addsthemtoyourNNclassifier.HereIveaddedmeanvaluesforbrightnessandNDVI,standard deviationforBandNDVI,andimageobjectarea.Thisshoulddoagoodjobofclassifyingwater,given 6

thatwaterobjectsarelowinbrightnessandNDVI,havelittlevariationinreflectanceorcolor,andare generallylargerinsizecomparedtolandobjects.Addtheseinputsandclickok. Letsnowaddtheseinputstoourtwoclasses

ClickClassification>NearestNeighbor>ApplyStandardNNtoClasses.Doubleclickorusetheall buttontobringthelandandwaterclassestotheselectedclassesbox. Nowweregoingtoaddanewprocess(theclassification).Intheprocesstreeclickonyourparent (coarsesegmentation),andinsertanewchild.

ThenintheAlgorithmdropdownbox,underBasicClassification,selectclassification.

Thisprocesswindowwillthenpopup.Makeyouractiveclasseslandandwater;keepeverythingelse thesame.Clickok. 8

Wewillnowselectsamplesforlandandwater.Ifyoudontalreadyhavethesamplestoolbarup,addit toyourtoolbar(View>Toolbars>Samples).

Youcanuseboththetoolwiththearrow(selectobjectsoneatatime),orthecrosssight(brushtool)to selectobjectsforclassification.ClickeitherbuttonandthenthelandclassundertheClassHierarchy window(upperrightwindow)tobegintoassignsamples.

HereIusedthebrushtooltogetsamplesofland.Itriedtogetawidevarietyofsamples(veg, impervious,shadow,etc). Dothesameforwater.

Letsnowexecutetheclassifier.Rightclicktheclassificationintheprocesstreeandhitexecute.

10

Looksprettygood!Ifyougetsomemisclassifiedobjects,youcangobackandaddmoresamplesforthe appropriateclass.Justusethesampletool,selectthemisclassifiedsamplesandthenhitexecuteagain. Wenowhaveaverybasicland/watermap.Atthispointyoumightwanttosaveyourproject.GotoFile >saveas,andfindanappropriatespottosave.Yourprojectwillbesavedasa.dprfile;asimilarsortof projectfileasanArcMap.mxdfile. Thenextstepinclassificationistobreakthelandclassintomoredetailedlandcoverclasses.Thiswill requireanothersegmentation

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

Youcantrydifferentscaleandsegmentationparameters,hittingexecutewilldeletethepreviouslayer. Ifoundtheparametersabovetoworkprettywellinsegmentingdifferentlandcoversandimage objects.Hitexecuteandseewhatyouget.

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:

Similartowhatwedidbefore,wearegoingtowanttoedittheNNfeaturespace;goto classification>nearestneighbor>editstandardnearestneighborfeaturespace.Giventhat wereclassifyingbothvegetation,aswellasurbansubstrate,Iaddedafewgeometricobject features,suchaslength/width,rectangularfit,andshapeindex.Hopefullythesewillhelpin classifyingsomeoftheroadandbuildingobjects.

13

Setyourfeaturespaceupsimilarly(ordifferent!)andclickok.Thenapplythefeaturespacetoyour classes:Classification>NearestNeighbor>ApplyStandardNNtoClasses(selectalltheclassesexcept landandwater). Nextwewillstartcollectingsamplesforeachclass.Usethesampletoolbarandfindgood representativesamplesforeachclass.Itcanbehelpfultousetheimageobjectinformationwindowto seethelayervalueswithineachobject;onceyoustartclassifying,youcanalsolookatmembership probabilitiesofeachobject).Mysampleslookedsomethinglikethis:

14

Makesureyoumakeuseoftheimageobjectinformationwindow,andobserveclassprobabilitiesof variousobjects(theclassificationtab),aswellmeanobjectspectralvalues(thefeaturestab).Thiscan helpyoumakecorrectsamples,andalsoseeifyourclassesaretoosimilar.Byclickinganunclassified imageobject,youcanseeclassprobabilitieswhicharebasedonyourclassifierandsamplesyouve chosen. Addanewchildunderyourfinesegmentationparent.FortheAlgorithmselectClassification.Inthis stepweareonlygoingtoclassifythefinesegmentationandthelandclass,soouractiveclasseswillbe everythingexceptlandandwater.Inputtheseparameters:

Hitexecute.Itmaytakeacoupleminutestoclassifydependingonhowmanyobjectfeaturesyouputin theNNclassifier.Myclassificationlookssomethinglikethis:

15

Takealookatyourclassification.Therewillsomeerrorinit,mostlikelybetweentheroadandbuilt classes.Itcanbehelpfultouseavarietyofvisualizationtoolssuchastransparencies(thesliderinlower leftofthescreen),splittingthewindow(underthewindowpulldown),aswellasthestandardlayer, object,andclassificationbuttonswithinthetoptoolbar.

16

Here,Isplitthescreenverticallyandusedasidebysideview(bothunderthewindowpulldown),and thenmadeatransparentclassificationoverlayontheleftandaclassifiedpolygonviewontheright. Thismakesiteasiertoseewherethereserrorintheclassification.

4. ManualEditing
Oneofthelaststepsincreatingaclassificationismanualeditingandcleanup.Thisisusuallythemost tediousandtimeconsumingstep.ThankfullyitsmucheasiertodocleanupineCognitioncomparedto theroundaboutENVI/ArcMapprocessthatstypicallyused.Whatwearegoingtodohereisaddanew parentintheprocesstreecalledcleanuprightclickintheprocesstree>appendnew>namethe parentcleanup>anddragittothebottomoftheruleset.

Rightclickoncleanup>insertanewchild>selectmanualclassificationtowardsthebottomofthe pulldown.

17

Thenselectoneofyourclassesontherightwindow.HereImusingabareclass.Ifyouwantyoucan useabrushtoolforediting.Iliketouseasmallweightof2,soIcanselectbothindividualobjectsand havethefunctionalityofusingthebrush.

AddaManualclassificationforeachclass.

18

Afteryouhaveaddedallthecleanupprocesses,startwithasectionofyourmap.Illstartatthelower rightbyFenwayPark. Oneofthemajormisclassificationscanbeseenbetweentheroadandbuiltclasses.Rightclickonthe roadmanualclassificationintheprocesstreeandhitexecute.Yourcursorshouldturntoabrushtool; youcanthenmanuallypaintandreassignimageobjects.Wellcleanupsomeoftheerrorsinthis portionoftheimage

19

HereIdidsomecleanupontheroadways,althoughitsnotperfect,itsbetterthanwhatwehadbefore. Atthispointyoucouldevenaddadditionalclasses(parkinglots,sidewalks,highway)andmanuallyedit themin.Wellkeepitsimplefornowthough.

Ispentacoupleminutescleaningupthissectionoftheimage.Overall,itlooksprettygood!Itsusually worthgivingtheimageasolidlookover,justrememberyoullnevergeta100%perfectproduct. 20

5. ExportResult
Onceyourehappywithyourclassificationyoucanexportittoavarietyofformats(tif,img,shp).This canbehelpfulifyouregoingtousetheclassificationinArcorENVI.

UndertheExportpulldown,selectexportresults.Forexporttypechooserasterfile,contenttype classification,andformaterdasimg.Imgfilesallowyoutokeepclassnamesandcolorschemesthis istypicallywhatIuse.

Hitexportandsaveitinaproperdirectory. 21

TheimagecannowbeviewedandanalyzedinArc.Togetridofthedifferentbrightnessclasses,Ioften groupclassesandusethereclassifytoolinArc.

TheresalottolearnineCognition,thistutorialjustscratchesthesurface.Youcanusethissoftwarefor anysortofremotelysenseddata.IveprocessedLiDARdata,forvegetationanalysis.Youmightevenbe abletoaddinLiDARdatatodifferentiatebetweenbuildingheightsanddifferenttypesofurban substrateuseyourimagination!UnfortunatelytherearentmanygoodDefinienstutorialsoutthereso thebestwaytolearnistosimplyplayaroundwiththesoftware.Goodluckandhavefun!

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

You might also like