Metadata-Version: 2.4
Name: easyams
Version: 0.1.2
Summary: Easy Agisoft MetaShape (EasyAMS) Plugin with extended functions for smart agriculture.
Project-URL: Homepage, https://github.com/UTokyo-FieldPhenomics-Lab/EasyAMS
Project-URL: Issues, https://github.com/UTokyo-FieldPhenomics-Lab/EasyAMS/issues
Author-email: Haozhou Wang <howcanoewang@gmail.com>
License: MIT
License-File: LICENSE
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Science/Research
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Topic :: Scientific/Engineering :: GIS
Classifier: Topic :: Scientific/Engineering :: Image Processing
Requires-Python: >=3.9.13
Requires-Dist: numpy==1.26.4
Requires-Dist: onnx==1.17.0
Requires-Dist: onnxruntime==1.19.2
Requires-Dist: opencv-python==4.10.0.84
Requires-Dist: pillow>=8.2.0
Requires-Dist: pybboxes>=0.1.6
Requires-Dist: requests>=2.32.3
Requires-Dist: shapely>=2.0.0
Requires-Dist: stag-python>=1.1.0
Requires-Dist: tqdm>=4.67.1
Description-Content-Type: text/markdown

# EasyAMS

Easy Agisoft MetaShape (EasyAMS) Plugin with extended functions for smart agriculture.

![img](docs/_static/gui.jpg)

# How to use

> Please ensure you have the `Metashape Professional License` to have access to [automation option/Built-in python scripting](https://www.agisoft.com/features/compare/) function

Download the `tools/installer.py` in this project to your computer, and launch the `installer.py` script in the metashape to open the GUI.

![img](docs/_static/launch.png)

# Developer

## 1) Source code install

Please clone this repo to your local path.

Then Install this plugin by chosing the installer located at `/Your/Local/Path/to/EasyAMS/tools/installer.py` with argument `--dev`. 

![img](docs/_static/dev_setting.jpg)

It will use folder at `/Your/Local/Path/to/EasyAMS/src/easyams/` as `easyams` source code package, after any modification, restart Metashape to make effects.

If you have any modification for `installer.py`, rerun the `Run Python Script` with `--dev` arguement to refresh the cached installer file at `User\AppData\Local\Agisoft\Metashape Pro\scripts\easyams_launcher.py`. Please refer 
[How to run Python script automatically on Metashape Professional start : Helpdesk Portal](https://agisoft.freshdesk.com/support/solutions/articles/31000133123-how-to-run-python-script-automatically-on-metashape-professional-start) for more details.

## 2) Environment setup

Recommend using [uv](https://docs.astral.sh/uv/getting-started/installation/) as virtual enviroment manager.

```
> uv --version
uv 0.6.14
```

For example, the git repo folder is located at: `C:\path\to\source\code\EasyAMS` with the following folder structure:

```
C:\path\to\source\code\EasyAMS
├─ docs/
├─ src/
├─ tests/
readme.md
pyproject.toml
...
```

Using the following command to setup development enviroment:

```
> cd C:\path\to\source\code\EasyAMS
...EasyAMS > uv sync --all-groups
```

It will create a `.venv` at current project folder and install the `tests` dependency group and `train` dependency group inside `pyproject.toml`.

> PS: The default easyams plugin dependency is free of `pytorch` and `ultralytics`, only using the `onnx(cpu)` to inferencing and ensure the ease of installation.    
> For model training and exporting, `labelme` is used for data annotation and the `pytorch` package is required.


# Error Fixs

## Plugin installation

### 1. Python venv creation failed on Arch-Linux with `libcrypt` errors


```
[EasyAMS] [CMD] /home/crest/.local/share/Agisoft/Metashape Pro/easyams-packages-py39/bin/uv venv /home/crest/.local/share/Agisoft/Metashape Pro/easyams-packages-py39/venv --python 3.9.13
[EasyAMS] [Error]:
[EasyAMS]     × Querying Python at
[EasyAMS]     │ `/home/crest/.local/share/uv/python/cpython-3.9.13-linux-x86_64-gnu/bin/python3.9`
[EasyAMS]     │ failed with exit status exit status: 127
[EasyAMS]   
[EasyAMS]     │ [stderr]
[EasyAMS]     │ /home/crest/.local/share/uv/python/cpython-3.9.13-linux-x86_64-gnu/bin/python3.9:
[EasyAMS]     │ error while loading shared libraries: libcrypt.so.1: cannot open shared
[EasyAMS]     │ object file: No such file or directory
[EasyAMS]   
[EasyAMS] [EasyAMS] virtual isolated python venv creation failed
```

[Solution](https://github.com/electron-userland/electron-builder-binaries/issues/47): `sudo pacman -S --needed libxcrypt libxcrypt-compat` 