CloudCompare Tutorial 03 - Point Cloud Segmentation and Clipping

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
welcome back to another cloud compare tutorial today we're gonna be talking about point cloud extraction so this is how we kind of take one point cloud and break it up into component pieces or smaller pieces and so there's a couple of different ways we can do this one is with what's called the segment tool so this is literally kind of chopping up the point cloud into different bits the second way we can do this is kind of a little bit more non-destructively with what cloud compare calls the cross-section tool and then the last method that we'll go over today is filtering by a scalar field or an attribute so this is where we can take kind of a range of elevations and extract out just that specific range of elevations or with lidar data different classifications so the first thing we're gonna want to do is get some data loaded I'm gonna go ahead and use the Sandy River lidar data set that we used in the last tutorial so again except kind of the defaults on opening last file and then again we'll just accept the defaults on the global shift and scale here so now that we've got that loaded up we can go ahead and close out our console window here down at the bottom to give us a little bit more space and the lidar data set comes in again with kind of the default first scalar field that it has in its data set which is point source ID that's not again very useful for us so I'm gonna go ahead and add in a Z values as color so again that's tools projection export coordinates to scalar field the Z values okay and then I'm gonna change my color ramp down here to a custom color ramp that I've got a temperature color ramp just to give us a little bit more definition in all of those elevations so before you get started on any kind of point cloud extraction it's usually a good idea to make a clone of your point cloud within cloud compare now the good thing about a lot of the editing that we can do in the extraction that we can do in compares that it's not destructive to the original file which is good unless you kind of save over it which takes an effort but the the base kind of operations that you can do in cloud compare are non-destructive so you can edit and change and if it doesn't work you can just remove it from your DB tree and reload the data and it'll be just fine but to save yourself some some headache and wait time on reloading the data oftentimes all clone and data set first before I start editing it just so that I don't have to waste time reloading the data so in order to clone a data set so you click on the point cloud that you want to clone and we'll go up to the little double sheep icon up here so clone the selected entities and so that will make a second copy and since this is a big point cloud that takes a minute but in the DB tree here now you can see that this has a suffix on it that says dot clone so that's the cloned data set so you can actually edit either one of these I usually go ahead and edit the clone so that the originals left intact for now so we're going to go ahead and select that cloned data set as our target for our editing and the first way that we're going to try to break up this point cloud is with the segmentation tool so the segmentation tool is the little pair of scissors up on your toolbar so if you click on that that will open up kind of the sub toolbar up here in the upper right and you can see that the text on the screen says segmentation on polygon political selection left click to add contour points right click to close so this is kind of giving you some prompts as to how this Tool Works so I'm going to show you two different modes of operation one is just a single cut and then the second is doing what's called a multiple cut or multiple selections to extract out so in order to just do a single cut on this what you're going to want to do is select the the polygon selection tool up here okay which is usually selected by default but I usually like to just double check that and then what you want to do is left click on kind of points to describe a polygon that you're going to want to cut out or cut in and we'll talk about the difference between those in just a second so in clicking on the scene here and usually I do this from the top down perspective you'll start to see the first left click you'll get this green line that starts to be pulled out from your cursor and as you click around you'll see that that starts to form a kind of polygon that kind of self closes so in this case I'm just going to go ahead and do a quick digitize of the river bottom here so that we can extract out just the river bottom I'm not being too careful you can be as careful or as kind of generous as you like with your digitizing and so we're going to click around till we get back to the beginning and you can see since this auto closes we don't have to find the original start point but if we right click you can see that that green line snaps away from our cursor and so we have this polygon now the there's two different ways to segment the point cloud so one is what's called segments in and one the other is segment out and we'll play with both of these so first we'll do segment in and so this segments out everything that's inside the polygon so if you click on that and then we'll hit the confirm segmentation button over here what you'll see is that we end up with kind of two separate new point clouds over here one is called remaining and the other is called segmented and so if we click these on and off I have my original point cloud still on so the segmented point cloud is what you had inside the polygon and the remaining point cloud is everything outside of that polygon so that's what the segments in does the segment out tool would just do the reverse so you'd actually the the segmented would be the outside and the remaining would be the inside either way it works just about the same I usually go for inside since that's kind of the way I'm familiar with digitizing is I want to kind of select everything inside the polygon but you can do it either way so I'm going to go ahead and delete those real quick and we'll start over with a new clone and I'll show you how we can actually do multiple cuts in one segmentation session so that if you do want to actually do multiple kind of cutouts you can actually do this in one go you don't have to do segments on top of segments on top of segments so we're going to select that clone click our scissor segment tool again and so in this case we're actually instead of using segments and we're gonna actually use segments out in order to do this selection properly so we're gonna I'm just going to pick a couple of spots along the river to show you how this works but you can do this again and as many or as few as you want so what I'm going to do is just select the upper left portion of the river here right click to close that and then I'm going to say so I'm gonna click on the segment out tool here and that'll pull out that data set and you can see that this segmentation paused I move the point cloud down you can see the rest of the text says unpause to segment again so what you can do in the sub toolbar here is is unclick the pause button to allow you to make another selection and so right now we'll just click down and digitize another set of points down here right click to close will say segment out again and now you can see we've got those both of those cut out and we'll do one more so unpause left click left click left click left click and then right click to close segments out and once we're done with all of our selections here again we'll just hit the green confirm selection there's a confirmed segmentation tool option here and that will go through and pull out those parts that we cut out and leave behind the parts that we wanted to leave in so in this case again it'll it'll keep both of the point clouds active and so if you click the segmented that'll be everything that's left since we did the out segment out option and then the remaining is the inside portions so this is just one way to kind of segment out multiple select multiple sections of a point cloud in one kind of session rather than having to do multiple selections as you go now one thing I will kind of warn you about is that if you try to do too many of these often times you will get some hiccups and I've had Clark compare kind of freeze up not too often but again if you start selecting lots and lots of points with lots of multiple selections you can run into some problems so I would do a few segmentations and then do a few more if you're doing a lot of kind of small segmentations another interesting thing that you can do with the segmentation tool is that you can actually load in predefined polygons as well and I'm not I don't have one for this site specifically set up but I will show you how you would do that is that you would load in a shapefile or some other pre-existing kind of polygon feature and in the segmentation tool you can use the there's the little line icon here which is use existing polyline had a polyline in your database tree you could actually use that to make your selection as well so if you have a shapefile for a study area or a pre-existing kind of polyline in cloud compare you can go ahead and reuse that again and again which is pretty slick so the next thing that we're gonna look at is the cross section tool and so this is pretty handy for a number of different kind of applications and the kind of the obvious one is to make a cross section properly so in a lot of kind of digital terrain analysis looking at a cross section of a landscape is a good way to kind of get a feel for how the landscape is is structured and so the way that we do that is with the what's called the cross section tool up here in your tool bar so about two to the right from your scissor tool so if you click on that that'll bring up a number of different handles on your point cloud and if we rotate around here you can see that we have kind of different handles in all three of the major axes to have red as the x-axis green as the y-axis and blue as the z-axis and so these handles are ways that we can kind of manipulate the kind of the yellow box here the field of view or the the area of interest and kind of clip out a very specific section so you can make this very thin you can make it big and blocky and so if you do this in a big blocky section you can extract out just that that section but if you actually want to do a proper cross section so let's say we wanted to do a cross section for this low section of the river here what we can do is get a real narrow slice up here and I'll show you how to do this kind of a little bit more quantitatively in a minute but you can get a really narrow slice here and then over in the options box over here you can actually say export selection to new cloud so if we click on that over in our database tree you can see that we have a new cloud entity over there so if I close this out the original cloud pops back to normal and so I can turn that off and what we're left with is just that small little selection that we made down here so I'm going to actually reset our rotation Center to the river there and if we rotate this down to a front view now you can see that that is a proper cross-section of the river so from the hilltop over here down into the valley down to the river bottom and then up onto kind of the floodplain here on the left or the right hand side scuse me and then back up starting to go up a hill here on the right side so that's one way to get a kind of proper cross-section analysis and so this is its own independent point cloud down so you could do analysis on that or you can edit that as you see fit I'm going to go ahead and delete that for now so that we can look at another a couple of different options in that cross-section tool again so again I'm going to select that clone hit the cross-section tool and so the other thing that you can do with these handles is rotate them as well so you can go in and out but then the little circular toroidal kind of handles here so around around the the arrows themselves are kind of the push and pull handles but then the little round Donuts here allow you to rotate that area of interest as well so you can rotate that in all the different axes and that'll give you some interesting things interesting results in most landscape data you're not going to want to rotate X&Y the red and green you may want to rotate the z axis but you may have need for rotation on the X&Y as well so I've kind of screwed this one up so I'm actually going to hit the X out of that close that out and start a new cross-section go back to my top-down view and so one way that you can do a little bit more kind of quantitative cross sectioning is if you click over here in the Advanced tab or the Advanced Options you can see that you can actually define this area of interest box by its center so you can actually type in coordinates for the center and then the important thing here is the widths so in the x-direction we have almost a thousand meters in the y-direction we have 70 meters right now in the z direction were encompassing about 208 meters but let's say we wanted to actually get a very specific cross section width or height extracted and so you can actually type in a number there so in this case I'm going to type in 10 and you'll see that if I hit OK that that narrows the y-direction down to a very narrow 10 meter strip a very precise 10 meter strip so that's one way to get a little bit more precise if you need a very specific dimension on this cross section tool you can use the Advanced tab there now another interesting thing if let's go ahead and extract that out real quick and close this out and let's say you had another point cloud that you wanted to extract the same cross-section from so I'm just going to reuse that same point cloud but you can click on your second point cloud that you want to extract that same cross-section and if we go into cross-section and then click on advanced again then you'll see that there's a new button in here I know you were all paying attention before but this last button is new after we did that last advanced selection so if I click last what that will do is actually match the center coordinates and the widths to the last selection that we did so hit OK and that puts it in the exact same spot as we had before and we can extract out that point cloud from our second data set and then if we wanted to compare those two we could do so in the the same space so those two cross sections here so section and section are the exact same size so that's pretty handy for comparing two different data sets from different timestamp time stamps or two different temporal events so pretty handy with the cross section tool there like I said you can do as big or as small of a cross section as you need so the last thing that we're going to do is to extract by or filter by scalar values and so this is a pretty straightforward process the only kind of prerequisite is that you have to kind of define what you want beforehand and know what you want beforehand and so in this case I'm going to do a couple of different extractions to show you a couple of different methods here and so in the last video we looked at the classifications on this point cloud so again this one has a classification of one being unclassified and two being classified as the ground and so in this case if we wanted to extract out just the ground points from the rest of the data set we can do that with a filter by actor or filter by scalar value selection so in this case I'm going to select this data set I've switched it over to the classification scalar field so that we can get a view of it and then up here in your toolbar there's by the histogram tools that we looked at in the last video there's this little toolbar right here that looks like a the color ramp with a min/max on it so I've got it highlighted there so if you click on that tool this brings up a filter by value dialog and what we can do here is put in the values that we want to extract or the range of values that we want to extract so in this case our classification just goes from 1 to 2 and so what we want is a range of 2 to 2 for the ground points and then the the remaining points the unclassified points won't be included in that selection so there's a couple of different options here that you can do to extract one is to export just the points inside that range so in this case it would just export the ground points or there is an option to split the point cloud into two different clouds so that it would create basically all the one all the points with the classification of one and all the other points with the classification of two as two different point clouds most times I just use the export tool just to get the ones that I want since those are the ones I'm after but the split can be useful in certain situations so go ahead and hit export and now you can see that we have a new entity here in our DB tree that says has a new suffix on it so this is clone which is it came from the clone dataset but then you can see that it's extract and so that tells you that it's been extracted from the clone data set so one thing that you'll learn about cloud compare is that it likes to put on these suffixes as you do different elements and do different analysis tasks and so it's a good way to keep track of kind of the custody chain or the processing chain that you've done on these sometimes these do get a little bit long and unruly and you can kind of trim them back if you need to but usually I just leave them as they are so you can see here that we're left with just the blue points which are our ground points and so if I switch back to our Z values and we rotate down you can see that we're just left with the ground points here in this case so this isn't like we did in the last video this isn't just kind of hiding all of the other points this is literally just the ground points and so you can see that here with our our point count over in our properties window this is only five hundred and twenty-five thousand points versus our full point cloud is just over twelve million points so about a third of the points are classified as ground in this case so that's one option to do this is to do extracting by a scalar field I'm going to show you another example of that by just extracting a certain elevation value and so in order to do that one of the things I want to do is go ahead and do a little bit of an advanced analysis step here but I actually need to do in this case is let's say I want to actually filter by height above the ground now in this case we don't actually know what the height above the ground surface really is we just have absolute elevations in our point cloud but what we can do since we extracted out the ground points here is that we can actually create a surface from these ground points and then measure the distance to that surface in the original point cloud so I've got a tutorial on my my website on how to do this and a little bit more depth but I'll go through this pretty quickly so in this case we're going to want to create a mesh surface from our ground points here so in this case we'll do edit mesh and then we're just going to do a de l'année mesh in the XY plane max edge length I usually leave it zero for most analysis tests like this so that will triangulate a a mesh surface that kind of covers all of those ground points so this creates a solid kind of surface that we can measure to with our kind of full point cloud so in this case we're going to use a tool up on the top here called cloud to mesh distance so I'm going to select my point cloud hold down control and then select my mesh surface and then the tool up here becomes active okay so there's this tool up here that is points to a mesh okay so a pretty intuitive icon there so if we click that you can see that it automatically populates here to say the point cloud is our compared value and then our reference surface is the mesh and then most of the time you can just leave the defaults here there are some advanced options if you're interested in those but the defaults work for most cases so all you have to do is hit the compute button down here and if you have a large data set this can take a while since it's actually measuring distances from each point to that surface all right so that took about eight minutes to calculate all of those point distances so once the progress bar goes away on the screen don't hit compute again because that will recompute the values so you can go ahead and say okay and so in this case if we turn off our mesh and just look at our point cloud you can see down in our active scalar fields we have a new scalar field here called c2m the signed distances so this is cloud to mesh to sign distances and if you go down to the bottom here you can see that we have kind of a little bit of a weird histogram we have a lot of data that's at zero and then a few points probably one or two or just a handful of points that are lower than the mesh and so in this case this is a good point where we can actually pull this up to the display value up to zero basically so that we're not showing those values and then we can also change our saturation here from the lowest value -39 in this case up to zero so that gives us our zero value right at the the ground surface and then we can also pull down our top saturation values so that we can actually see some of the upper values here so this is in meters and so we're basically going from the ground surface at zero up to in this case these tall trees here down right by the river are upwards of 50 or 60 meters tall that sounds right and so if we zoom in on that okay and we rotate around a little bit and Pam okay what you can see is that we indeed are getting some really really tall pine trees up there and so in this case if we're interested in kind of the canopy height this is one good way to do this just as an advanced analysis technique but if we're interested in just the points that are right above the ground which is kind of a common analysis task what we can actually do with this is go ahead and extract a range of values here directly from kind of that height above ground so that cloud to mesh distance so in this case we want to go from zero right at the ground to let's just say we want everything below 5 meters and so 0 to 5 meters is our range we'll say export and that'll take a second and you can see what we're left with here is just those values that are between zero in blue and 5 meters in red so this is kind of just the really low vegetation and the the ground surface essentially and so this is just one more way that we can extract out if we wanted to look at say just the under canopy vegetation and strip off the canopy this would be one way you can do that this is actually a good way to look at features in the river channel as well so things like large woody debris or red herring vegetation is to clip out the overhanging vegetation and just get these kind of low elevation values right above the ground surface
Info
Channel: James Dietrich
Views: 10,797
Rating: undefined out of 5
Keywords:
Id: ea1KbvXnTNw
Channel Id: undefined
Length: 30min 5sec (1805 seconds)
Published: Fri Apr 10 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.