Skip to content

Commit

Permalink
Merge pull request #78 from Smithsonian/dev-metashape
Browse files Browse the repository at this point in the history
Merging photogrammetry branch
  • Loading branch information
gjcope authored Feb 2, 2024
2 parents de0c7bb + 9544730 commit a83edef
Show file tree
Hide file tree
Showing 36 changed files with 2,002 additions and 118 deletions.
9 changes: 9 additions & 0 deletions docs/content/recipes/clean/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
title: "Recipe: clean"
summary: "Cleans a mesh of common issues"
weight: 110
---

The `clean` recipe fixes some common issues with unnecessary geometry in a mesh by removing unreferenced vertices, zero area faces, duplicate vertices, and duplicate faces.

It also has options for removing extraneous geometry components (often appearing as floating triangle clusters or unneeded reconstructions in photogrammetry results) by deleting everything but the largest component or, when doing turntable capture, deleting everything but the component central to the capture volume.
9 changes: 9 additions & 0 deletions docs/content/recipes/photogrammetry/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
title: "Recipe: photogrammetry"
summary: "Creates a mesh and texture from capture image set folders"
weight: 110
---

The `photogrammetry` recipe takes zip files of capture image sets (including alignment-only and masking images) and aligns the images, generates a mesh, cleans the mesh of unnecessary geometry, and finally generates a texture mapped to the cleaned mesh. This full photogrammetry pipeline currently works with Agisoft Metashape, with limited support for the RealityCapture and Meshroom applications.

Resulting meshes may require some manual cleanup or fixing dependent on the input and masking data available.
9 changes: 9 additions & 0 deletions docs/content/recipes/si-zip-photogrammetry/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
title: "Recipe: si-zip-photogrammetry"
summary: "Creates a mesh and texture from zipped capture image sets"
weight: 120
---

The `si-zip-photogrammetry` recipe is similar to the `photogrammetry` recipe but with some steps specific to the Smithsonian workflow. It takes folders of capture image sets (including alignment-only and masking images) as input and aligns the images, generates a mesh, cleans the mesh of unnecessary geometry, and finally generates a texture mapped to the cleaned mesh. This full photogrammetry pipeline currently works with Agisoft Metashape, with limited support for the RealityCapture and Meshroom applications.

Resulting meshes may require some manual cleanup or fixing dependent on the input and masking data available.
23 changes: 23 additions & 0 deletions docs/content/tasks/batch-convert-image/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
title: BatchConvertImage
summary: Converts folders of image files between different formats.
---


### Description

Converts image files between different formats.

Optionally clip the images to black or white.

Tool: [ImageMagick](../../tools/imageMagick)

### Options

| Option | Type | Required | Default | Description |
|-----------------|---------|----------|---------|---------------------------------------------------------------------------------------------------------------------|
| inputImageFolder| string | yes | | Input image folder name. |
| outputImageFolder | string | yes | | Output image folder name. |
| quality | number | no | 70 | Compression quality for JPEG images (0 - 100). |
| filetype | string | no | 'jpg' | File type to convert images to. |
| level | number | no | none | If provided, clips image to black (value < 128) or white (value > 128) |
20 changes: 20 additions & 0 deletions docs/content/tasks/combine-mesh/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
title: CombineMesh
summary: Combines two meshes into a single self contained .fbx
---

### Description

Combines two meshes into a single self contained .fbx.

Tool: [Blender](../../tools/blender)

### Options

| Option | Type | Required | Default | Description |
|---------------|----------|----------|--------------------|---------------------------------------------------------------|
| baseMeshFile | string | yes | | Base mesh file name. |
| inputMeshFile | string | yes | | Input mesh file name to combine with base. |
| inputMeshBasename | string | yes | | Name used for merged input mesh |
| outputMeshFile | string | yes | | Output mesh file name. |
| timeout | number | no | 0 | Maximum task execution time in seconds |
19 changes: 19 additions & 0 deletions docs/content/tasks/merge-mesh/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
title: MergeMesh
summary: Merges a multi-mesh model file into one .obj and texture
---

### Description

Merges a multi-mesh model file into one .obj and texture.

Tool: [Blender](../../tools/blender)

### Options

| Option | Type | Required | Default | Description |
|---------------|----------|----------|--------------------|---------------------------------------------------------------|
| inputMeshFile | string | yes | | Input mesh file name to merge. |
| outputMeshFile | string | yes | | Output mesh file name. |
| outputTextureFile | string | yes | | Output texture file name. |
| timeout | number | no | 0 | Maximum task execution time in seconds |
23 changes: 23 additions & 0 deletions docs/content/tasks/photogrammetry-tex/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
title: PhotogrammetryTex
summary: Uses photogrammetry capture images to project a texture onto existing geometry.
---


### Description

Uses photogrammetry capture images to project a texture onto existing geometry using saved camera positions from a previous photogrammetry process.

Tools: [Metashape](../../tools/metashape) (** Planned implementations for RealityCapture and Meshroom **)

### Options

| Option | Type | Required | Default | Description |
|----------------------|---------|----------|-----------|----------------------------------------------------------------------------------------------|
| inputImageFolder | string | yes | | Input image folder zip file. |
| inputModelFile | string | yes | | Metashape only: Alignment image folder. |
| outputFile | string | yes | | Base name used for output files. |
| camerasFile | string | yes | | Name used for saved camera position file. |
| scalebarFile | string | no | | CSV file with scalebar markers and distances. ([Example scalebar file](./scalebar-defs.csv)) |
| timeout | number | no | 0 | Maximum task execution time in seconds (default: 0, uses timeout defined in tool setup). |
| tool | string | no | "Metashape" | Tool to use for decimation: "Metashape", "RealityCapture", or "Meshroom". |
36 changes: 36 additions & 0 deletions docs/content/tasks/photogrammetry/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
title: Photogrammetry
summary: Generates a mesh and texture from zipped image sets using photogrammetry techniques.
---


### Description

Generates a mesh and texture from zipped image sets using photogrammetry techniques. It includes options for masking image sets and alignment-only images.

Tools: [Metashape](../../tools/metashape),
With limited support by: [RealityCapture](../../tools/reality-capture), [Meshroom](../../tools/meshroom)

### Options

| Option | Type | Required | Default | Description |
|----------------------|---------|----------|-----------|----------------------------------------------------------------------------------------------|
| inputImageFolder | string | yes | | Input image folder zip file. |
| alignImageFolder | string | yes | | Metashape only: Alignment image folder. |
| maskImageFolder | string | no | | Metashape only: Mask image folder. |
| outputFile | string | no | | Base name used for output files. |
| camerasFile | string | no | | Metashape only: Name used for saved camera position file. |
| scalebarFile | string | no | | CSV file with scalebar markers and distances. ([Example scalebar file](./scalebar-defs.csv)) |
| optimizeMarkers | boolean | no | false | Metashape only: Flag to enable discarding high-error markers. |
| alignmentLimit | number | no | 50 | Metashape only: Percent success required to pass alignment stage. |
| tiepointLimit | integer | no | 25000 | Metashape only: Max number of tiepoints. |
| keypointLimit | integer | no | 75000 | Metashape only: Max number of keypoints. |
| turntableGroups | boolean | no | false | Metashape only: Flag to process images as SI-formatted turntable groups. |
| depthMaxNeighbors | integer | no | 16 | Metashape only: Max neighbors value to use for depth map generation. |
| genericPreselection | boolean | no | true | Metashape only: Flag = true to use generic preselection. |
| meshQuality | string | no | "High" | Metashape only: Preset for mesh quality ("Low", "Medium", "High", "Highest", "Custom"). |
| customFaceCount | integer | no | 3000000 | Metashape only: If meshQuality is custom, this defines the goal face count. |
| depthMapQuality | string | no | "Highest" | Metashape only: Preset for depth map quality ("Low", "Medium", "High", "Highest"). |
| maskMode | string | no | "File" | Metashape only: Desired masking operation. "File" assumes provided image is the mask, "Background" uses the background of the image as a basis for 'smart' masking. |
| timeout | number | no | 0 | Maximum task execution time in seconds (default: 0, uses timeout defined in tool setup). |
| tool | string | no | "Metashape" | Tool to use for decimation: "Metashape", "RealityCapture", or "Meshroom". |
33 changes: 33 additions & 0 deletions docs/content/tasks/photogrammetry/scalebar-defs.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
marker1,marker2,distance
4,5,0.2498
5,6,0.24987
7,8,0.24985
9,10,0.49965
10,11,0.49963
12,13,0.24976
13,14,0.24987
33,34,0.50016
34,35,0.50034
36,37,0.24997
37,38,0.2501
41,42,0.49999
42,43,0.50019
44,45,0.25008
45,46,0.24996
49,50,0.50009
50,51,0.50007
52,53,0.25
53,54,0.25004
55,56,0.2501
57,58,0.50016
58,59,0.50013
63,64,0.25008
65,66,0.50021
66,67,0.50029
68,69,0.25008
69,70,0.25006
73,74,0.50026
74,75,0.50035
76,77,0.25014
77,78,0.25011
79,80,0.25007
17 changes: 17 additions & 0 deletions docs/content/tasks/screenshot/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
title: Screenshot
summary: Generates a screenshot of the provided geometry
---

### Description

Generates a screenshot of the provided geometry

Tool: [Blender](../../tools/blender)

### Options

| Option | Type | Required | Default | Description |
|---------------|----------|----------|--------------------|---------------------------------------------------------------|
| inputMeshFile | string | yes | | Input mesh file name to combine with base. |
| timeout | number | no | 0 | Maximum task execution time in seconds |
27 changes: 27 additions & 0 deletions docs/content/tools/meshroom/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
title: Meshroom
summary: Photogrammetry tool
---

### Information

- Developer: AliceVision
- Website: https://alicevision.org/#meshroom
- License: https://github.com/alicevision/meshroom?tab=License-1-ov-file

### Installation

- Windows installer: https://www.fosshub.com/Meshroom.html?dwl=Meshroom-2023.3.0-win64.zip

### Configuration

Example configuration for Meshroom in the `tools.json` configuration file:

```json
"RealityCapture": {
"executable": "C:\\Program Files\\Meshroom\\Meshroom-2021.1.0\\meshroom_batch.exe",
"version": "2021.1.0",
"maxInstances": 1,
"timeout": 0 // never
}
```
27 changes: 27 additions & 0 deletions docs/content/tools/metashape/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
title: Agisoft Metashape
summary: Photogrammetry tool
---

### Information

- Developer: Agisoft LLC
- Website: https://www.agisoft.com/
- License: Commercial/Proprietary

### Installation

- Windows installer: https://www.agisoft.com/downloads/installer/

### Configuration

Example configuration for Agisoft Metashape in the `tools.json` configuration file:

```json
"RealityCapture": {
"executable": "C:\\Program Files\\Agisoft\\Metashape Pro\\metashape.exe",
"version": "v1.8.3, build 14331",
"maxInstances": 1,
"timeout": 7200
}
```
6 changes: 1 addition & 5 deletions docs/content/tools/reality-capture/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@ title: Reality Capture
summary: Photogrammetry tool
---

### Note

_Reality Capture support is planned for a future release of Cook._

### Information

- Developer: Capturing Reality s.r.o.
Expand All @@ -24,7 +20,7 @@ Example configuration for Reality Capture in the `tools.json` configuration file
```json
"RealityCapture": {
"executable": "C:\\Program Files\\Capturing Reality\\RealityCapture\\RealityCapture.exe",
"version": "1.0.3.4658",
"version": "1.2.0.17385",
"maxInstances": 1,
"timeout": 0
}
Expand Down
25 changes: 25 additions & 0 deletions server/recipes/clean.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@
"keepLargestComponent": {
"type": "boolean",
"default": true
},
"isTurntable": {
"type": "boolean",
"default": false
}
},
"required": [
Expand Down Expand Up @@ -68,6 +72,25 @@
"highPolyMeshFile": "sourceMeshFile"
}
},
"success": "'inspect'",
"failure": "$failure"
},
"inspect": {
"task": "InspectMesh",
"description": "Validate mesh and inspect topology",
"pre": {
"deliverables": {
"inspectionReport": "outputFileBaseName & '-inspection.json'"
}
},
"parameters": {
"meshFile": "sourceMeshFile",
"reportFile": "deliverables.inspectionReport",
"tool": "'Blender'"
},
"post": {
"sceneSize": "$result.inspection.scene.geometry.size"
},
"success": "'clean-mesh'",
"failure": "$failure"
},
Expand All @@ -83,6 +106,8 @@
"inputMeshFile": "sourceMeshFile",
"outputMeshFile": "deliverables.cleanedMeshFile",
"keepLargestComponent": "keepLargestComponent",
"isTurntable": "isTurntable",
"sceneSize": "sceneSize",
"timeout": 1200
},
"success": "'delivery'",
Expand Down
Loading

0 comments on commit a83edef

Please sign in to comment.