Object-based Image classification in QGIS || OBIA !! || A complete Tutorial

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Music] what's up guys hiding i hope you're good welcome to yet another amazing tutorial today we are going to cover object-based image analysis or obia in quantum gis so as you see here on my screen i have a very high resolution imagery here and then i have been able to use obia to classify this image just watch this tutorial to learn how you can do this too and don't forget to subscribe this channel and hit that like button let us dive into the tutorial [Music] [Applause] [Music] so the first thing is to create a new project my project here and then i'll save it as obr2gs so after creating the new project you open layer add layer address to layer so guys as you can see here i have added my raster file here as you can see it's a very high resolution image as you can see it so these are trees these are houses there are some roads and then you can see we have some grass here yeah so today i'm going to be able to carry out obia on these high resolution imagery so to proceed what you have to do is to first define the number of classes you're going to work with remember when we are going to do a classification the first thing we should always consider is the classification scheme how many classes are going to consider and then what are the components of each class and then for this tutorial i have been able to declare and decide the number of classes here let me show them to you my first class is called the buildings my second class is called the trees my third class is called grass my fourth class is called road and then my fifth class is called bare ground so after defining your classes the next thing you are supposed to do is to select training samples for your what for your algorithm so what you do you go to layer create layer new shape for your layer and then you select the name of this layer it will be sample and then the geometry type it is a point yeah i'll leave it in dallas 84 and then i'll add a new attribute which is called class id and then class id is a whole number and then after that i click ok so using this shape file i'm going to be able to sample in each of my classes here as you see i'm going to select points that represent buildings trees grass the roads the bare ground and then actually i'm going to be able to give each one of those points a distinguishing class id attribute as you see for the buildings it will be one the trees two the grass three the road four and then the background five and then depending on the number of classes you have considered you can choose the class id but however make sure that you select a minimum of 30 samples for each class so let me add features as you see so after some time as you see i've been able to add a number of features let me open the attribute table and then for each feature i have been able to give it a unique class id as you see one represents the buildings to the trees three the grass for the road and then five the bare ground let me scroll down so that you can see my samples are you seeing the three are the four using the four and then the fives yeah so at this stage i hope you've already installed the of your toolbox or the otp plugin if you have not yet installed that plugin kindly check my previous tutorial on how to install this plugin within quantum gis so after that you just go to processing toolbox and then you search for segmentation and then you click it here when you search for segmentation make sure it is selected from the options of the otb plugin you see this for me it will appear here because i have used it previously so if you have not already used it it will be here and then select it and then when you open it select the input image as this the segmentation algorithm i'll use mean shift yeah i will leave all the adoptions as default and i will just tick this and then i will go down here and then i will select where to save my file i will save it as let me save it as segmentation segmentation results and then it is a shape file segmentation results dot shp and then i click save after that i run this so as this algorithm is running depending on your competence and your experience or the type of image you have you can choose to customize and change these default values in the most appropriate way you want for your analysis but however if you are not a more advanced user i suggest that you leave these options as what as the default and then you can learn how to fine tune them as time moves on yeah after running this so add layer adjustable layer and then so navigate to the folder where you have saved your output here file as you can see my automation file is here segmentation results and then open it and then click add when you click add you can see that we have been able to do a segmentation on this image so what you do is you go to properties and then symbology and then i'll select this holo symbology and then let me try to [Music] to make this point three then i click apply when you zoom in you can be able to see the segments in your image yeah so let me zoom in and can you see the segments yeah so let me hope this is fine yeah after this step come to the processing toolbar and then search for zono statistics zone statistics click this zone statistics and then the input image should be this the image in which we are interested in and then the type of input for the zone definitions is vector and then the input vector data make sure that you fit in the output result that has been gotten from the segmentation algorithm and for me it is my segmentation right result shape file and then let me save this shapefile i'll save it as segmentation statistics segmentation statistics and then make sure that you run so after some time your algorithm will finish executing and then as you up open the attribute table here you will see that a number of features have been added like these mean value the standard deviation zero the mean zero the max zero the mean one and a number of parameters actually these are the parameters that we are going to use for our classification as you will see in the future so after this step proceed on to to join and then search join click the join attributes by location and then select the base layer as this segmentation statistics make sure that the base layer is the vector file that has been created from what from computing the statistics and then the gene layer should be this sample points and then make sure that the join type you select a one-to-one relationship and then save the joined layer save it to file as the joined layer i'll call it join what change layer then click save and then you take this one this card records which could not be changed make sure you tick it then after click run so after some time i've been able to select my parameters all the samples that i'm going to use for what for training my algorithm so the next thing is to search for the train vector classifier train vector classifier remember all these algorithms that have been incorporated within the otp plugin so you search for this strain vector classifier and then select it when you click that make sure the input vector data you select the joined layer and then click ok after selecting the joined layer you come here the field names for training features so when you open the attribute tab of the chain layer you will see a number of what attributes that have been created so me at least the mean zero the standard deviation zero the mean one the standard deviation one the mean two and the standard deviation two so i'll put mean zero and standard deviation zero and mean one standard deviation one mean two then standard deviation two after that step if you have a validation data you can click here and then add it but since i don't have validation data you proceed field containing the class integer label when you open this attribute table you'll see that my integer label i've named it as a class id so i'll put this as class class id then i'll leave the rest as what as default of course the classifier can be svm you can use decision trees attrition networks base random forest scale neighbor and then whatever you want then after you come and then select the output of the model and then you save this to file save it as obr model dot model yeah make sure you take note of this extension the dot model yeah you can save it as any name but use the dot model and after i run it so it may take some time and then it finishes executing and the next step is to come still here to the processing toolbox and then you search for vector for vector classifier you see i click here the vector classifier and then they'll tell me the name of the input vector data make sure that you input the segmentation statistics image then you open it and then the model you browse to the model my model is obvia model yeah it's another file the output field i leave it as option and then the field names to be calculated still you open this attribute table and then you you put to the main zero standard deviation zero the mid one standard deviation one the mean two and then the standard deviation one also then after you select we have to save your file so i'll save my file as classified output shp and then i run it so after some time your algorithm will run and let me bring my classified what my classified output then i browse to here and then select this classified output and i'll add it and then i click and further i click properties and then i come to labels to symbology actually and i select categorized and then i browse here name the value i select this predicted and then i classify remember i had chosen five classes as you see i've been able to do a classification but the symbology doesn't look good so i click on my symbol here simple fill and then i select this outline the wood if i make it point zero zero six and i click ok and then i click apply remember that the one was a building so usually the buildings will give them a red color is my red yes then the trees i'll give them a dark green color yes it's here and then my grass i'll give it a light green color this one right click okay and then the four are the therefore represents the road so the road i'll give it something like brown let me look for brown yes and then actually the bare ground i'll give it cyan let me look for cn okay let me just give it this color then apply so all other values i can untick this until i click ok and as i apply so as you see this is the output of my segmentation i've been able to classify and actually if you have to compare it with the results of the image array they actually correlate as you can see yeah so after this step you may want to compute areas so what you do is to come to vector geoprocessing tools and then you come to dissolve and then you select this the input layer should be this what this classified output file and then make sure you you select these dissolve fields and then the foods to dissolve i dissolve what the predicted field then i click ok then i'll save the dissolved layer as dissolved dissolved layer okay and then i run that of course it may take some time depending on how big your study area is and how fast your laptop is so after some time my argument was actually executed so i close yeah so after that you click properties then you open attribute table and then you come here to open field calculator but before you open the field calculator you make sure that you are working in what in a projected what coordinate system so if you're not working in a projected coordinate system you just have to reproject your layer and then make sure you're working in what in your projected connect system yeah so you come here to layer and then you click open through the calculator and then you create a new field and then you call it area this area is in red pair meters and then it should be a decimal number and i'll just use this dollar sign and then the area yeah and i just click ok actually after some time as you can see i have calculated the area of each glass in square meters so you can proceed to convert this to echoes hectares and whatever you need yeah so thank you for watching this tutorial see you then
Info
Channel: Jesse Buyungo
Views: 1,841
Rating: 4.8064518 out of 5
Keywords: Object based image classification QGIS, Object-based image analysis classification in QGIS ArcGIS, Image segmentation in QGIS, OBIA QGIS, Orfeo Toolbox tutorial, Object based classification QGIS, Orfeo toolbox QGIS, Orfeo toolbox segmentation
Id: fX2UpOwoYLk
Channel Id: undefined
Length: 17min 44sec (1064 seconds)
Published: Tue Jul 27 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.