Skip to main content

About The Project

unimi_crop_sensing was created with the aim of offering a set of simple and intuitive operations to interact with the ZED camera. It consists of a toolkit for processing and segmenting images and point clouds acquired via the ZED stereo camera. The project is designed for precision agriculture applications, allowing you to identify plants in 2D and 3D, generate bounding boxes and communicate with a cobot through WebSocket in a ROS environment.

Main features

  • Green segmentation with Excess Green Index
  • Plant clustering via KMeans
  • 2D and 3D bounding box calculation on point cloud
  • Save .ply, images, normal map
  • WebSocket ROS (rosbridge) integration for communication on separate systems

Built With

Getting Started

Prerequisites

Make sure you have:

  • Python 3.9
  • ZED SDK properly installed and working and a connected ZED camera
  • ROS + rosbridge running if you use WebSocket
  • The libraries listed in requirements.txt

Installation

You can use unimi_crop_sensing as a Python package installable via PyPI. Install everything with:

pip install unimi_crop_sensing

⚠️ Pyzed 5.0 requires numpy 2.x, this conflicts with other project features, so if you encounter errors related to numpy, make sure you install a compatible version:

pip install "numpy<2"

Usage

This is an example of a script that uses every function to obtain spatial coordinates and point clouds of each plant within its range

# 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.get_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)
    zed.close()
    create_plc.record_and_save(plant_name='piantina1', frames=300)

Note: The pipeline.py file contains a ready-to-run example with all the necessary components to extract bounding boxes and send them to the Dobot cobot.

Contact

francescobassam.morgigno@studenti.unimi.it

Acknowledgments

Metadata

Release files for unimi-crop-sensing 1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for unimi-crop-sensing 1.2
File Size Uploaded
unimi_crop_sensing-1.2.tar.gz 11.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for unimi-crop-sensing 1.2
File Interpreter ABI Platform
unimi_crop_sensing-1.2-py3-none-any.whl Python 3 none any Details

Total release size: 23.6 kB

Release files / unimi_crop_sensing-1.2.tar.gz

Download URL unimi_crop_sensing-1.2.tar.gz
Size 11.2 kB
Tags Source
SHA-256 checksum
How to use checksums
a464cfa88e8eed34936e9ae4ea2022e3812766bfb11b9cea6409200c117fe781
BLAKE2b-256 checksum
How to use checksums
e4a428628c233bba76958877caea7153703ee4159c3cacae35f6e0a7598e0a30
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 29, 2025.

Transparency log

Release files / unimi_crop_sensing-1.2-py3-none-any.whl

Download URL unimi_crop_sensing-1.2-py3-none-any.whl
Size 12.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7c8349560a50a56262773a4d48ee63c45de0f751b9d2fc54471357bdd170a1ab
BLAKE2b-256 checksum
How to use checksums
3cc41f0582fa42abae2727094671099fb94fbde6498fbe2c21ecf1fec12825d6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 29, 2025.

Transparency log

Release history Release notifications | RSS feed

This release

1.2 This release

2 release files

1.1

2 release files

1.0

2 release files

0.10

2 release files

0.9

2 release files

0.8

2 release files

0.6

2 release files

0.5

2 release files

0.4

2 release files

0.3

2 release files

0.2

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page