Skip to main content

A toolkit for crop sensing using the ZED camera

Project description

About The Project

unimi_crop_sensing nasce con l’obiettivo di offrire un insieme di operazioni semplici e intuitive per interagire con la camera ZED. Consiste in un toolkit per l'elaborazione e segmentazione di immagini e point cloud acquisiti tramite la camera stereo ZED. Il progetto è pensato per applicazioni di agricoltura di precisione, consentendo di identificare piante in 2D e 3D, generare bounding box e comunicare con un cobot attraverso WebSocket in ambiente ROS.

https://github.com/Hoppip48/unimi_crop_sensing/

Funzionalità principali

  • Segmentazione del verde con Excess Green Index
  • Clustering delle piante tramite KMeans
  • Calcolo bounding box 2D e 3D su point cloud
  • Salvataggio .ply, immagini, normal map
  • Integrazione WebSocket ROS (rosbridge) per invio/lettura pose

Built With

Getting Started

Prerequisites

Assicurati di avere:

  • Python 3.9
  • ZED SDK installato correttamente e funzionante
  • ROS + rosbridge in esecuzione se si usa WebSocket
  • Le librerie listate in requirements.txt

Installation

Puoi usare unimi_crop_sensing come pacchetto Python installabile via PyPI. Installa tutto con:

pip install unimi_crop_sensing

⚠️ Pyzed 5.0 richiede numpy 2.x, ciò va in conflitto con altre funzioni del progetto, perciò se riscontri errori relativi a numpy, assicurati di installare una versione compatibile:

pip install "numpy<2"

Usage

Questo è un esempio di main che sfrutta ogni funzione per ottenere coordinate spaziali e point cloud di ogni piantina nel proprio raggio d'azione

# This function is used to test the functionalities of the crop sensing module
def main():
    
    # Get the current pose of the cobot
    pose = cobot_manager.get_cobot_pose(linux_ip)

    # Initialize the ZED camera
    zed = zed_manager.zed_init(pose)
    
    # Capture the environment with the ZED camera
    image, depth_map, normal_map, point_cloud = zed_manager.get_zed_image(zed, save=True)

    # Filter the plants from the background
    mask = find_plant.filter_plants(image, save_mask=True)
    
    # Divide the plants into clusters
    masks, bounding_boxes = find_plant.segment_plants(mask, plants_number)
    find_plant.save_clustered_image(image, bounding_boxes)

    # Extract the 3D points from the clusters
    for m in masks:
        bbxpts = find_plant.plot_3d_bbox(m, point_cloud)
        
    # Communicate the bounding boxes to the cobot (only if the cobot is operated in another machine)
    cobot_manager.send_cobot_map(linux_ip, bbxpts)

    # Create point cloud (this will create a .ply file by taking a video of the environment)
    create_plc.record_and_save(plant_name='piantina1', frames=300)

    zed.close()

Contact

francescobassam.morgigno@studenti.unimi.it

Acknowledgments

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

unimi_crop_sensing-0.5.tar.gz (8.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

unimi_crop_sensing-0.5-py3-none-any.whl (9.3 kB view details)

Uploaded Python 3

File details

Details for the file unimi_crop_sensing-0.5.tar.gz.

File metadata

  • Download URL: unimi_crop_sensing-0.5.tar.gz
  • Upload date:
  • Size: 8.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for unimi_crop_sensing-0.5.tar.gz
Algorithm Hash digest
SHA256 5d105d3ac9447925561716a72de04df085884c1c2bfd7b669d5c0a2db9d76d96
MD5 689d0f5f95113f20d0ea1c73d44e0667
BLAKE2b-256 e5891f9209f5de3c2c56bfe1439943be8ff9cf401c366f79090e9e9c5f817c86

See more details on using hashes here.

Provenance

The following attestation bundles were made for unimi_crop_sensing-0.5.tar.gz:

Publisher: release.yml on Hoppip48/unimi_crop_sensing

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file unimi_crop_sensing-0.5-py3-none-any.whl.

File metadata

File hashes

Hashes for unimi_crop_sensing-0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 e1957d1fd8ef32060444c7c09cefa494c798dd81a54eaeac2f10187e2deebd93
MD5 8dd96653cdf2be343e7ca0e1f15e4a10
BLAKE2b-256 f6815b025ff599ed9a40458e674a0136ba76bbaa679cf5e768e65f7d884e50d8

See more details on using hashes here.

Provenance

The following attestation bundles were made for unimi_crop_sensing-0.5-py3-none-any.whl:

Publisher: release.yml on Hoppip48/unimi_crop_sensing

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page