Skip to main content
. 2025 Sep 10;25(18):5648. doi: 10.3390/s25185648
Algorithm 1: GrassRemoval (P): Grass removal from point cloud P
  •   1:

    procedure GrassRemoval(P)

  •   2:

           Rotate P about Z and Y axes to align vertically.

  •   3:

           if |Pz,maxPz,min|>1.5 m then

  •   4:

                 Flag P as Potential_Grass

  •   5:

                 B{pPpy<Py,min+0.6m}

  •   6:

                 Planes

  •   7:

                 while |B|30 do

  •   8:

                      (π,Inliers) RANSAC_Plane_Segment(B)

  •   9:

                      if |π|<30 then

  • 10:

                           break

  • 11:

                      end if

  • 12:

                      θ angle between normal of π and Y-axis

  • 13:

                      if θ35 then

  • 14:

                           PlanesPlane{π}

  • 15:

                      end if

  • 16:

                      BBInliers

  • 17:

                 end while

  • 18:

                 if Planes then

  • 19:

                      πmain plane in Planes with maximum number of points

  • 20:

                      B{pPpy<Py,min+0.7m}

  • 21:

                      G

  • 22:

                      for all pB do

  • 23:

                           d distance from p to πmain

  • 24:

                           if d0.35 m then

  • 25:

                                GG{p}

  • 26:

                           end if

  • 27:

                      end for

  • 28:

                      PcleanPG

  • 29:

                      return Pclean

  • 30:

                 else

  • 31:

                      B{pPpy<Py,min+0.6m}

  • 32:

                      T{pPpy>Py,min+0.6m}

  • 33:

                      zminTmin{pzpT}

  • 34:

                      G{pBpz<zminT}

  • 35:

                      PcleanPG

  • 36:

                      return Pclean

  • 37:

                 end if

  • 38:

           else

  • 39:

                 return P               ▹ No preprocessing needed

  • 40:

           end if

  • 41:

    end procedure