Landsat 8 Image Classification using QGIS

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello guys welcome to another tutorial in this tutorial i'm going to show you how to create your own land cover maps using qgis by making use of the freely available landsat 8 products now there are different ways of downloading landsat 8 satellite images there are certain plugins in qgis itself which would actually enable you to download landsat 8 images or there are other ways of actually just searching for the for the corresponding image which you would like to download now i'm going to go with the good old way of actually using this earthexplorer.usgs.gov web portal from which you can basically zoom into your area of interest and from there you can quite simply mark your area of interest simply by clicking over here just like this to highlight your corresponding area of interest and after that you can go to these data sets and from here you can go to landsat and you can go to landsat collection one and landsat collection one level one and from here you can specify landsat 8 or li product and you can actually specify additional criteria such as the scene cloud cover and the lan cloud cover so i'm going to specify both to be less than let's say 90 and after you're done with everything you can simply click on this result [Music] button which will basically load up the corresponding results for you once you find the the corresponding landsat image let's say this looks like it doesn't have much clouds you can use this footprint button to actually see where this style would get placed and once you're okay with the the coverage you can simply download that from here but as you can see over here you need to login using your own username and password and for my case i have already actually logged in and download download the corresponding uh landsat image so i'm going to use that image directly but in your case i hope you guys managed to first create an account with earthexplorer.usgsgov in case if you haven't and once you log in this button will be enabled for you guys to download the the corresponding landsat image directly without much of a hassle all right i'm going to now go ahead and open up qjs3 we are going to use the latest version of qgi s3 to carry out this classification i'm going to use one of the most well-known plugins which is called semi-automatic classification plugin in short sap so to download that plugin i'm going to go to plugins over here and go to manage and install plugins now as soon as you start searching semi-automatic you can see that that plug-in is right over here yeah you can see over here over 700 000 downloads as per now so what we're going to do is we're just going to go ahead and install this plugin first all right now what i can do is i can actually navigate to the place where i have kept my landsat images now you can see that after you install the plug-in you get a new dock called this scp dock now if you would like to get rid of this dock for the time being you can simply just go ahead and click over here but in case later if you need to have it actually we will need to have that dock later on in this tutorial you can simply go to weave and panels and from here you can see that we have the option to tick on this scp dock which will sort of enable this again so i'm going to close this out for the time being and after that i will navigate to the place where i have saved my landsat images as you can see over here when you download the landsat images it's not just one file it's actually coming up with different bands band number one band number ten eleven two three four and so on for the purposes of this tutorial i'm actually going to only use the bands starting from one all the way up to seven all right so i can simply just drag it and drop it over here in order to add this different bands into my working space all right after you have done that you can go to this scp and go to this band set option and now if you just refresh this band set by clicking on this button you can see that whatever you have on this layers panel which is which are actually the set of bands starting from band number one will be loaded into here and before i proceed on with the the the actual classification i would first like to do a couple of things now first of all uh i do not want to do the classification for this entire image so i would like to actually crop this image based on my area of interest so in order to do that first go over here and make sure that you have actually refreshed everything yeah after that make sure that you have actually selected everything like this and then you can go ahead and click on this ad band to ban set which will add this into this band set one as you can see over here and now you can go to this pre-processing and from here you can see that there's one option called clip multiple rasters so that's what we are going to do now you can see that select input band set has already been selected to be number one which was this in case if there was another band set called let's say band set number two and if that's the set which you would like to actually use to do the clipping then you would go over here and select band number two correspondingly but in this case we are going to go with band number one and now you can specify the the area of interest now i'm just going to go over here and click on the set area in the map after that i can actually zoom into my area of interest and you can left click in order to start the rectangle and right click let's say in order to conclude the rectangle like this in case if you would like to do some further adjustments you can do that as well in this manner just make sure that on the upper left corner you can change the upper left corner simply by using the left mouse button and the lower right corner can be changed by using the right mouse button i think i'm okay with this so i'm going to go over here to scp and open this band set dialog box again and now if i go to this pre-processing you can see that now the coordinates have already been selected for the upper left and the lower right corner which basically creates a rectangle if you wish to use a vector for the clipping an sd shape file or something like that for clipping you can use that as well through this option but for the time being i'm actually going to use this sort of selection and once you're done with that you can simply click on this run and from here select the location i'm going to create a new folder called let's say clip and after that i can select that folder and you can see that the algorithm runs and after that it'll clip the raster according to my clip the the different bands according to my selection and after that you can actually go ahead and get rid of this initially added set of bands you can you can bulk select and remove everything which you do not want and only retain the the ones which actually appear with this clip wood in the front so that you can distinguish between the clipped ones and the unclipped ones all right so the next thing that i'm going to do is i'm going to again go ahead and open up this band set and now you can see that in the single bands list you can see that actually the band set that we have over here is still the previous set of bands so what i'm going to do is i'm going to refresh this again and it'll detect that we have a different set of bands over here than what we had before and it'll accordingly update this and you would want to actually update this part as well so what you would normally do is you first clear this one out by resetting it and after that you can select everything and add it just like this and by the way you can select the corresponding settings as well from here the quick wavelength settings from here you can actually select your product which is landsat 8 oil i and also make sure that you have selected the correct wavelength unit which is in micrometers and the next thing that we have to do is actually we have to convert this into reflectance which we can simply do by going to preprocessing again and over here select landsat because this product is landsat and now we have to actually provide the path where we have saved those clipped landsat bands so i'm going to open up this and as you can remember i directed the clipped bands into this clip folder so i'm just going to go ahead and select this folder and we also have to select the mtl file and if you just open up your original downloaded landsat files you will actually notice that among the bands you will also find this kind of a file which ends with mtl and this is the file we actually have to provide so i'm going to select this one and open this we have given the path to the clipped landsat bands and also we have selected the corresponding mtl file i'm also going to go ahead and apply the dos one atmospheric correction and after that i can just go ahead and run this so that it will convert these existing landsat bands into reflectance maybe i will create a new fold reflectance and after that select the folder and it'll just take a couple of seconds for it to convert and now if you minimize this you will notice that we get a new set of bands which starts with rt which basically stands for reflectance bands and this is what we need so right now what i would do is i'll just go ahead and get rid of this clipped bands which we had before because we won't be needing them anymore all right now after you open up this window again you basically can just refresh this you know to make sure that you actually have this rt the reflectance bands over here and you need to transfer this into this band set as well so what you can do is just go ahead and maybe get rid of this these existing bands which are the clipped bands over here and after that you can select just make sure that you select everything from band number one up to band number seven and after that you can add it over here and one important thing just make sure that you have the corresponding number correctly when it comes to this sort of index and the corresponding band number because later on we are going to do some combinations of different uh bands so so for that we need to make sure that actually the number that we refer to is correctly referring to the corresponding landsat band so for that just to avoid the confusions make sure that if this is number seven then this is actually going to be the band number seven the reflectance band number seven so just like that just do a quick check to make sure that everything is in order after you find that everything is in order all you can do is just minimize this this and select one of these band combinations which are actually available by default let's say if i if i were to select 432 you can see that it actually creates the virtual band set number one which is equivalent to a natural color image the band combination 432 now in case if you're not really familiar with what i said pertaining to these different band combinations i'm actually just going to take a step back and i'll quickly try to give you a bit of an overview of what all of these different bands and band combinations actually mean now when landsat is acquiring the data it actually acquires the data for different wavelengths now as you can see from the diagram band number two three and four actually corresponding to blue green and red and as you can see the band number five is the near infrared band now what's cool about having these different bands which correspond to different wavelengths is that we can combine these bands to display different depictions of our area of interest just a minute ago i mentioned that this is a natural color image now the formation of the natural color image happens when we combine the red green and blue bands and as you can see over here band number four is the red band and band number three is the green band and band number two is the blue band so when you combine these red green and blue bands we get the final image in a way how we are usually used to seeing that so that's why we call that a natural color image now that's all good as long as you're trying to identify the features the different features or maybe the different land cover classes just based on what we can see from the image but just because these different land use classes happen to reflect different amounts of light it's actually much more convenient to use different combinations of bands to identify certain classes now if you talk about vegetation vegetation actually reflects a lot of light in the near infrared so it's actually much more efficient to look at a color infrared image rather than looking at a natural color image if you really want to identify what are the areas with the healthy vegetation so that's where we just come over here and change the band combinations from four three two to five four three and as you can remember five is the near infrared band so to make that change all you have to do is just go over here and and just enter 5-4-3 and as soon as you hit enter you will see that the whole thing actually changed its color now this is not a true color image this is a false color image which can very clearly show us the areas which consist of vegetation and it's highlighted in this very bright red color so rather than looking at a natural color image it's actually always very very efficient to look at the corresponding color composite image especially when you when you would like to highlight two different types of land cover let me just go back and switch revert this to 432 now let's say that if you're trying to identify the reverse you can see that this river has a certain color and this river actually has another color when we just look at this natural color image so to our naked eye sometimes we there's a there's a good chance that we might actually accidentally miss some of these water bodies just because of the way how it has been represented in this natural color image if you use a band combination like 564 let's use that and see 5-6-4 and now you can very clearly identify what are the water bodies and what are the land areas from here as you can see this dark blue and this bit of a light blue actually correspond to water bodies so now we don't have to have any sort of doubt especially when we are trying to sort of isolate a certain area because this false color image can sort of guide us to easily identify the type of land cover we are looking for given that we are actually aware of these different band combinations so that's basically the benefit of having these different bands and having the flexibility to sort of combine different bands in order to generate the same image but in different colors all right so i guess you got some sort of a basic idea about this different landsat bands and how we can utilize these different band combinations to our advantage all right so now let's go ahead and get started with the actual classification now for that you have to go to weave panels and make sure that you take this sap dock because we will be requiring that for classification all right guys after that just make sure that you open up this training input panel and from here you can click on this create a new training input so i will just go ahead and create a new folder and i will name it as training inputs and i will create also a file called training inputs now when we are using this scp plugin we have to make sure that we actually understand the two different types of classes that we're talking about now we have the macro classes and we have the classes now macro class is actually the name given for the overall class which can consist of different types of subclasses now for example water bodies can be a macro class legs rivers ponds can be different classes inside that macro class now agricultural areas can be another macro class inside which may be different crops can have each individual class if you wish to so i'll explain that a bit more in detail while i'm just carrying out the the exercise so to get started as you can see over here the macro class id and the class id is now set to one now my macro class i'm going to name this one as water bodies and i'm going to assign the class name to be let's say reverse after you have entered those two information you can simply go to this create r or i polygon now over here roi stands for region of interest so all you have to do is just click on that and provide different training samples for the program so that it can identify what exactly the water bodies are simply by just drawing a polygon like this and to complete the polygon you can just right click [Music] and if you would like to give more than one sample actually that's possible all you have to do is just hold down control just like this and i will take another sample from here and i will take a couple of samples from this river as well just make sure that you are holding down control if you are specifying more than one polygon maybe some parts from here as well all right i think for the purposes of this tutorial i'm just going to conclude it at that after you're done with that you can click on this button save temporary roi to training input and of course over here you can just go ahead and change the color maybe if it's water bodies and rivers i would like to put it in this kind of a blue color and let's say that if you would like to select still water bodies but a different class let's say ponds to me maybe this looks like some water storage area i'm just going to consider that to be a pond everything that's outside of of the rivers well it could be lakes as well but never mind i'm just going to name it as spawns so all you have to do is just come over here and only change the name of the class which is now going to be pons and now you can see that automatically this class id has changed to number two but we still retain the the macro class id to be number one and now you can actually provide the samples just like this by drawing inside by drawing the polygons inside like this maybe i will take a couple of samples from here as well maybe some from here all right after you're satisfied with the number of samples all you can do is just go ahead and click on this button again and now you can see that it creates a new entry with the macro class id 1 which is water bodies but the class id is 2 which is basically pawns i'm going to put this one in a light blue color all right so similarly now i would like to create maybe let's say agricultural areas and if you can recall the table we can use 652 band combination to identify the agricultural areas now even when you look at this image just like this you might not be able to directly distinguish what could be the the forested areas and what could be the agricultural areas so it's always actually good to have some sort of knowledge from the actual ground itself usually the healthy vegetation appear in a bit of a dark green and if the vegetation appears to be stressed then the shade of the green might not be as dark so let's say for this exercise i'm going to identify that these lighter color green areas are going to be agricultural areas we can actually do a secondary check by using the 5 4 3 band combination yeah as you can see over here this area areas most likely correspond to the forested areas while these areas can be regarded as agricultural areas so what i'm going to do is i'm going to again go over here and now change the macro class id to 2 and i'm going to specify this to be agricultural areas and the class id i'm also going to return it to be let's say agriculture and after that i'm i can again create the roi polygon from here simply by selecting my area just like this and maybe i will pick a couple of more samples from these areas as well and if i switch this back to 652 yeah i might as well get the samples from here as well now as you can see it can be a bit of a challenging task now to identify to distinguish between the forested areas and the and the agricultural areas in this this particular case but anyway just for the demonstration purposes i'm just going to stick with this and after that i can click on this button again and let me just go and change the color to be a bit of a light green and now i would like to create maybe another class which is forested areas that's also going to be a macro class so i'm going to put number three over here and i'm going to name this one as forest and i'm going to flip this back to [Music] 543 and after that i'm going to select this bit of dark red areas as you can see over here one sample from here and the second one let's say from here yeah just two samples like that and the first areas i'm going to specify maybe this bit of a dark green color and finally let's wrap up this tutorial by specifying some built up areas and some barren lens so our macro class id number four is going to be built up areas and i'm going to put the class to be let's say buildings so i will select this tool and mark the polygons to be like this of areas which i can highlight from this figure to be most likely the rooftops of the buildings i'm going to select these pixels as well to be the training samples well now as you might be guessing it's actually going to be a bit of a tedious task because it's not guaranteed that your selection is actually going to be accurate all the time so that's why finally once we have classified the image we can always just go back and revert the things if you find them to be not really accurate and it's it's a bit of a trial and error process which might require some additional time if you really want to perfect your land use or land cover map [Music] all right so i'm going to confirm this one by clicking on this button and after that let's wrap things up by creating another class called open land i'm going to specify the class to be let's say bare soil and those could be these areas that we see over here all right after you're done with that you can again run this by the way we can go ahead and change the colors i'm going to change the build up areas to be red and the bare soil to be orange like this and now let's flip this back to the natural color image all right so the next step would be to go over here to this classification option and now you can make sure that you either select your class id in case if you would like to have your classification in a very detailed manner including all of your classes or if you would like to have only your macro classes then you can actually select this one now for the time being let's go with the classes and after that you can select the corresponding algorithm i'm going to go with maximum likelihood and after that you can actually zoom into your corresponding area and click on this activate classification preview pointer and then when you click somewhere over here in the middle you can see that the classification actually appears just like this now if you would like to zoom in you can click on this and it will actually zoom into your entire screen and you can move the point from point from place to place as you can see over here so that before you wrap up your classification it actually gives you something like a unfinished product so that you can actually just go back and forth and see whether your classification is accurate enough or not now as you can see over here since we selected since we selected the pawns to be in this light blue color you can see that these areas outside of the river have been now specified as pawns but as you can see that certain areas inside the river are also now classified to be pawns which is actually incorrect so in cases like this you might actually have to go back to your training inputs and change it again correspondingly but for the time being i'm actually not going to do that by the way in case if you would like to display only the macro classes all you have to do is just go over here and click on this and again just make sure that you have assigned the corresponding colors to when you go over here into this macro class list right over here so i'm going to go with yeah you can pick the color directly from the screen for water bodies agricultural areas should be this and the forested area should be this color and the built-up areas i selected it to be red and the open lands to be this color and after that again you can go to classification make sure that you have selected the macro class id and after that you can now set the pre weave just like this so that so that now you can see that all the water bodies are now highlighted in blue color so sometimes if you try to go to these individual classes rather than selecting the macro classes then things might get a bit more challenging but as long as you keep it in this manner in the macro class mod you can sort of group you can sort of group those different classes into one big macro class and represent it like this well it all depends upon your preference so you can actually do further checks like this and as you can see yeah all of these areas are now highlighted to be built up areas with buildings which might not be the case necessarily as you can see over here there's definitely room for improvement as you can see from this image but for the time being i'm actually just going to wrap this tutorial up by showing you how to export this now in the form of raster all right so to generate the overall classification just make sure that you have selected the correct settings over here just like this and after that you can simply hit run and as you can see from here the file which is going to get generated is actually a dot tip file which means it's a raster i'm going to name this one as land cover types dot tiff and as you can see it's actually building the land cover raster now and now you can see that it actually created the land cover raster for us using the macro classes and if i go to layers you can see that the names of the different classes are specified over here so from here you can very clearly see that it actually manages to identify the water bodies quite accurately but not so much in certain places as you can see over here the river becomes discontinuous in certain places which is something to be corrected and over here as well you can see that the river is actually discontinuous over here which is not really the case in reality so those are the things actually to be corrected uh definitely before you conclude this conclude your classification to a final product and after you're done with everything you can actually export this entire thing into into a vector and if you would like to calculate the total areas you can very easily do once it's in the vector mod let's say you would like to calculate the total amount of forested areas or the total amount of agricultural areas you can quite simply do that once you have converted this raster into a vector only once you have actually finalized your your raster alright guys so that concludes the tutorial for today just make sure that you understood the steps and you got the concepts and and how this classification can be further improved and once you know that you can confidently apply these concepts to classify your own land cover raster without much of a hassle using qgis so thanks a lot for watching guys uh if you do have any questions or comments just put them down below and if you do like this tutorial you can always show your support by hitting that like button and don't forget to subscribe to this channel in case if you would like to see more interesting tutorials like this in the upcoming days so i'll see you guys in the next one
Info
Channel: GeoDelta Labs
Views: 53,051
Rating: 4.9556313 out of 5
Keywords: Landsat 8 Image Classification, Landsat 8 Image Classification using QGIS, SCP Plugin, Semi Automatic Classification Plugin, Semi-Automatic Classification Plugin, QGIS3, How to classify an image, ROI, Spectral band analysis, reflectance, Supervised classification, unsupervised classification, landcover classification, How to classify an image using QGIS, Landast, Landsat 8
Id: HKNS-wsc7lo
Channel Id: undefined
Length: 32min 1sec (1921 seconds)
Published: Tue Oct 06 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.