LasBuildSeg


NameLasBuildSeg JSON
Version 0.1.27 PyPI version JSON
download
home_page
SummaryBuilding Footrprint Extraction from Aerial LiDAR data
upload_time2024-03-14 13:38:54
maintainer
docs_urlNone
authorMertcanErdem
requires_python
licenseGNU General Public License v2.0
keywords building lidar
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            This Python package is BUilding Footprint Extractor Test

This of example of an how you can run your code

```python
import LasBuildSeg as lasb
import numpy as np

# Define input parameters
input_laz = '<input>.laz'  # Path to the input laz/las data file
epsg_code = <epsg_code>  # EPSG code of the input laz data
multy = <DTM non-ground multipalction number>  # Multiplication factor for DSM height enhancement
intermethod = '<interpolation method>'  # Interpolation method ('cubic', 'nearest', or 'linear')

# Define default parameter values
constant = 3.6  # Adaptive threshold constant
block_size = 51  # Adaptive threshold block size
kernel_size = 3  # Morphological open kernel size
tri_threshold = 3  # Terrain Ruggedness Index threshold

# Define contour filtering parameters
min_size = 35
max_size = 5000
squareness_threshold = 0.3
width_threshold = 3
height_threshold = 3
CloseKernel_size = 15

# Generate DSM and DTM
lasb.generate_dsm(input_laz, epsg_code, intermethod)
lasb.generate_dtm(input_laz, epsg_code, intermethod, multy)

# Generate NDHM
lasb.generate_ndhm('dtm.tif', 'dsm.tif')

# Read NDHM image and profile
img, profile = lasb.read_geotiff('ndhm.tif')

# Transform DSM
lasb.DSM_transform('dsm.tif')

# Read transformed DSM and profile
dem, _ = lasb.read_geotiff('dsm3857.tif')

# Convert image to 8-bit
img_8bit = lasb.to_8bit(img)

# Apply adaptive thresholding
img_thresh = lasb.threshold(img_8bit, block_size, constant)

# Apply morphological opening
img_open = lasb.morph_open(img_thresh, kernel_size)

# Filter contours without TRI
building_mask=lasb.filter_contours(img_open, dem, profile, min_size, max_size, squareness_threshold, width_threshold, height_threshold, tri_threshold)

# Apply morphological closing
building_mask_closed = lasb.close(building_mask, CloseKernel_size)

# Write building mask to GeoTIFF
lasb.write_geotiff('buildings.tif', building_mask_closed, profile)

# Convert building mask to GeoJSON
lasb.building_footprints_to_geojson('buildings.tif', 'building.geojson')

# Print completion message
print('All steps are complete.')

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "LasBuildSeg",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "Building,Lidar",
    "author": "MertcanErdem",
    "author_email": "merak908@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/cb/9e/ad7b33789009d5b80fedfd62a320255eb8c788e7ee68bdce1366ae3ff697/LasBuildSeg-0.1.27.tar.gz",
    "platform": null,
    "description": "This Python package is BUilding Footprint Extractor Test\r\n\r\nThis of example of an how you can run your code\r\n\r\n```python\r\nimport LasBuildSeg as lasb\r\nimport numpy as np\r\n\r\n# Define input parameters\r\ninput_laz = '<input>.laz'  # Path to the input laz/las data file\r\nepsg_code = <epsg_code>  # EPSG code of the input laz data\r\nmulty = <DTM non-ground multipalction number>  # Multiplication factor for DSM height enhancement\r\nintermethod = '<interpolation method>'  # Interpolation method ('cubic', 'nearest', or 'linear')\r\n\r\n# Define default parameter values\r\nconstant = 3.6  # Adaptive threshold constant\r\nblock_size = 51  # Adaptive threshold block size\r\nkernel_size = 3  # Morphological open kernel size\r\ntri_threshold = 3  # Terrain Ruggedness Index threshold\r\n\r\n# Define contour filtering parameters\r\nmin_size = 35\r\nmax_size = 5000\r\nsquareness_threshold = 0.3\r\nwidth_threshold = 3\r\nheight_threshold = 3\r\nCloseKernel_size = 15\r\n\r\n# Generate DSM and DTM\r\nlasb.generate_dsm(input_laz, epsg_code, intermethod)\r\nlasb.generate_dtm(input_laz, epsg_code, intermethod, multy)\r\n\r\n# Generate NDHM\r\nlasb.generate_ndhm('dtm.tif', 'dsm.tif')\r\n\r\n# Read NDHM image and profile\r\nimg, profile = lasb.read_geotiff('ndhm.tif')\r\n\r\n# Transform DSM\r\nlasb.DSM_transform('dsm.tif')\r\n\r\n# Read transformed DSM and profile\r\ndem, _ = lasb.read_geotiff('dsm3857.tif')\r\n\r\n# Convert image to 8-bit\r\nimg_8bit = lasb.to_8bit(img)\r\n\r\n# Apply adaptive thresholding\r\nimg_thresh = lasb.threshold(img_8bit, block_size, constant)\r\n\r\n# Apply morphological opening\r\nimg_open = lasb.morph_open(img_thresh, kernel_size)\r\n\r\n# Filter contours without TRI\r\nbuilding_mask=lasb.filter_contours(img_open, dem, profile, min_size, max_size, squareness_threshold, width_threshold, height_threshold, tri_threshold)\r\n\r\n# Apply morphological closing\r\nbuilding_mask_closed = lasb.close(building_mask, CloseKernel_size)\r\n\r\n# Write building mask to GeoTIFF\r\nlasb.write_geotiff('buildings.tif', building_mask_closed, profile)\r\n\r\n# Convert building mask to GeoJSON\r\nlasb.building_footprints_to_geojson('buildings.tif', 'building.geojson')\r\n\r\n# Print completion message\r\nprint('All steps are complete.')\r\n",
    "bugtrack_url": null,
    "license": "GNU General Public License v2.0",
    "summary": "Building Footrprint Extraction from Aerial LiDAR data",
    "version": "0.1.27",
    "project_urls": null,
    "split_keywords": [
        "building",
        "lidar"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "cb9ead7b33789009d5b80fedfd62a320255eb8c788e7ee68bdce1366ae3ff697",
                "md5": "d84dceeaa553d619b5d36546aa5b94ec",
                "sha256": "50d6de59b6056b57d57612731ce4dcef4bb63fae999d3e57d50dce20d82e3da6"
            },
            "downloads": -1,
            "filename": "LasBuildSeg-0.1.27.tar.gz",
            "has_sig": false,
            "md5_digest": "d84dceeaa553d619b5d36546aa5b94ec",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 15862,
            "upload_time": "2024-03-14T13:38:54",
            "upload_time_iso_8601": "2024-03-14T13:38:54.233287Z",
            "url": "https://files.pythonhosted.org/packages/cb/9e/ad7b33789009d5b80fedfd62a320255eb8c788e7ee68bdce1366ae3ff697/LasBuildSeg-0.1.27.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-03-14 13:38:54",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "lasbuildseg"
}
        
Elapsed time: 0.21129s