Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@donmahallem
Last active March 23, 2024 11:27
Show Gist options
  • Star 24 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save donmahallem/22134574382b7bd8a67c1550734fcfc4 to your computer and use it in GitHub Desktop.
Save donmahallem/22134574382b7bd8a67c1550734fcfc4 to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@natowi
Copy link

natowi commented Jul 8, 2019

@donmahallem I get the following error importing the ipynb:

There was an error loading this notebook. Ensure that the file is accessible and try again.
JSON.parse: unexpected character at line 1 column 1 of the JSON data

Copy paste to new project works.

@donmahallem
Copy link
Author

Thanks for the headsup. Its fixed. Currently unsure what to add. As the workflows of providing the data can be quite different. Either mounting gdrive, upload zip or download from url.

@natowi
Copy link

natowi commented Jul 8, 2019

Maybe an exampe on how to enable AKAZE in DescriberTypes on FeatureExtraction, FeatureMatching and StructureFromMotion?
https://github.com/alicevision/meshroom/wiki/Reconstruction-parameters

@donmahallem
Copy link
Author

As I am fairly new to Meshroom there no direct CLI commands(atleast I couldnt find any), right? My currrent workflow would be creating a meshroom pipeline file on my current pc and upload it for processing to Colab.

@natowi
Copy link

natowi commented Jul 8, 2019

I am working on the CLI documentation.
Basically you can get the available parameters by running the nodes in the cli without parameters or with --help.

I was looking into https://github.com/mikedh/trimesh - maybe there is a way to preview the 3d mesh in the notebook...

@natowi
Copy link

natowi commented Jul 8, 2019

@donmahallem use "image dataset" instead of "meshfile"

@donmahallem
Copy link
Author

Will do once not on a phone.

Regarding the visualization I took a quick glance at importing html into a notebook. Maybe this way one can integrate an interactive preview. Depends on vertices size/performance tho. Otherwise there are wavefront renderes available that could produce stills for 3-4 directions and embed those as images. Will look into it

@natowi
Copy link

natowi commented Jul 8, 2019

@AbnormalMatrix
Copy link

Can someone please help?
Hi,
I get the exported .obj file as a point area cloud not as a mesh. I am opening it in blender. Thanks!

@natowi
Copy link

natowi commented Nov 26, 2019

@somedevelopment
Copy link

@kangnaclub9
Copy link

{
"nbformat": 4,
"nbformat_minor": 0,
"metadata": {
"colab": {
"name": "meshroom_test.ipynb",
"version": "0.3.2",
"provenance": []
},
"kernelspec": {
"name": "python3",
"display_name": "Python 3"
},
"accelerator": "GPU"
},
"cells": [
{
"cell_type": "markdown",
"metadata": {
"id": "RD3eZSm6d6NZ",
"colab_type": "text"
},
"source": [
"#Setup\n",
"Download Meshroom and Data\n"
]
},
{
"cell_type": "code",
"metadata": {
"id": "cQgXdvk-qUvi",
"colab_type": "code",
"colab": {}
},
"source": [
"!git clone https://github.com/alicevision/dataset_buddha\n",
"!wget -N https://github.com/alicevision/meshroom/releases/download/v2019.1.0/Meshroom-2019.1.0-linux.tar.gz\n",
"!mkdir meshroom\n",
"!tar xzf Meshroom-2019.1.0-linux.tar.gz -C ./meshroom"
],
"execution_count": 0,
"outputs": []
},
{
"cell_type": "markdown",
"metadata": {
"id": "zTI6AlUXd-_M",
"colab_type": "text"
},
"source": [
"#Upload data\n",
"Optional upload of pipline file and image source files\n"
]
},
{
"cell_type": "code",
"metadata": {
"id": "9_BfARNUdd_a",
"colab_type": "code",
"colab": {}
},
"source": [
"from google.colab import files\n",
"\n",
"# optional upload for the meshfile\n",
"\n",
"uploaded = files.upload()\n",
"\n",
"for fn in uploaded.keys():\n",
" print('User uploaded file "{name}" with length {length} bytes'.format( name=fn, length=len(uploaded[fn])))\n"
],
"execution_count": 0,
"outputs": []
},
{
"cell_type": "markdown",
"metadata": {
"id": "xA_XKpKqdoqb",
"colab_type": "text"
},
"source": [
"#Meshing\n",
"use the --pipeline argument to provide a path to the meshfile you created/uploaded"
]
},
{
"cell_type": "code",
"metadata": {
"id": "AZWyk461sxGI",
"colab_type": "code",
"colab": {}
},
"source": [
"!mkdir ./buddha_out\n",
"!./meshroom/Meshroom-2019.1.0/meshroom_photogrammetry --input ./dataset_buddha/buddha --output ./buddha_out\n"
],
"execution_count": 0,
"outputs": []
},
{
"cell_type": "markdown",
"metadata": {
"id": "7wwo3nPyd0-w",
"colab_type": "text"
},
"source": [
"#Download\n",
"Use the prefered download format\n"
]
},
{
"cell_type": "code",
"metadata": {
"id": "SPEdzNMo5fV6",
"colab_type": "code",
"colab": {}
},
"source": [
"!tar -czvf meshbuddha.tar.gz ./buddha_out\n",
"from google.colab import files\n",
"\n",
"\n",
"files.download('meshbuddha.tar.gz')"
],
"execution_count": 0,
"outputs": []
},
{
"cell_type": "code",
"metadata": {
"id": "rAXWX6SX8J_q",
"colab_type": "code",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 85
},
"outputId": "168b3acd-bd30-47c7-ca77-b6870306dd78"
},
"source": [
"!zip -r meshbuddha.zip ./buddha_out\n",
"files.download('meshbuddha.zip')"
],
"execution_count": 19,
"outputs": [
{
"output_type": "stream",
"text": [
" adding: buddha_out/ (stored 0%)\n",
" adding: buddha_out/texture_0.png (deflated 0%)\n",
" adding: buddha_out/texturedMesh.obj (deflated 72%)\n",
" adding: buddha_out/texturedMesh.mtl (deflated 28%)\n"
],
"name": "stdout"
}
]
}
]
}

@shanji97
Copy link

Hi!
Due to 2021.1.0 not being available I modified the file, to be more "actually", although there is still something to be done about few things. Some things could be resolved to give Meshroom some new features like file/folder remapings for different environments.
{"nbformat":4,"nbformat_minor":0,"metadata":{"colab":{"name":"Kopija beležnice RunMeshroom.ipynb","provenance":[{"file_id":"1qiHD3s4l_WCao0yIL6TIjvntY-Bgt32W","timestamp":1622313897316}],"collapsed_sections":[],"toc_visible":true},"kernelspec":{"name":"python3","display_name":"Python 3"},"accelerator":"GPU"},"cells":[{"cell_type":"markdown","metadata":{"id":"tJUlZN4TRnCH"},"source":["This notebook is based off of donmahallem's MeshroomColab notebook modified by shanji97.\n","\n","If you need help, check out his YouTube and his GitHub."]},{"cell_type":"markdown","metadata":{"id":"RD3eZSm6d6NZ"},"source":["#Setup (2021.1.0 version)\n","Download the meshroom tar file from Fosshub and upload it to a download service of you choice. Download the file and copy the direct download link (not the link the site is hosted on - It is usually formated as download.website.domain/someRandomIdString, here's an example: https://download.wetransfer.com//eugv/427e33c9565913f74fb2012ba98c895020210518183951/e837b9ffcec53fe59d42ac89c665f0134e3784bd/Meshroom-2021.1.0-linux-cuda10.tar.gz?cf.....). \n","\n","1) Set the download to the first input field. (TODO: Let the user choose between custom link and drive link.\n","\n","2) Set the path of your meshroom file\n","\n","3) Set the path of the (most recent) camera sensors database file (TODO: git clone and git pull the camerasensors.db file to Google Drive folder, manipulate the camera sensor location in the .mg file.\n","\n","4)(TODO): Remap the locations of the images using sed\n","\n"]},{"cell_type":"markdown","metadata":{"id":"PvIwyegUobtF"},"source":[""]},{"cell_type":"code","metadata":{"id":"Ol5uQcZkLvA3"},"source":["link_to_direct_download = 'https://download.wetransfer.com//eugv/427e33c9565913f74fb2012ba98c895020210518183951/e837b9ffcec53fe59d42ac89c665f0134e3784bd/Meshroom-2021.1.0-linux-cuda10.tar.gz?cf=y&token=eyJhbGciOiJIUzI1NiJ9.eyJleHAiOjE2MjE0MTg1OTAsInVuaXF1ZSI6IjQyN2UzM2M5NTY1OTEzZjc0ZmIyMDEyYmE5OGM4OTUwMjAyMTA1MTgxODM5NTEiLCJmaWxlbmFtZSI6Ik1lc2hyb29tLTIwMjEuMS4wLWxpbnV4LWN1ZGExMC50YXIuZ3oiLCJ3YXliaWxsX3VybCI6Imh0dHA6Ly9wcm9kdWN0aW9uLmJhY2tlbmQuc2VydmljZS5ldS13ZXN0LTEud3Q6OTI5Mi93YXliaWxsL3YxL3Nhcmthci84MGUzMGVlMjZiNGEzNmE0MTlmZmJmMTg3ZWM5YjE3MmRmOWRlODQ3MWRjN2NhNGIwMmM3NTM3NDJjMjEyYTNmYWVhMzU2YzMzYWM2NjdmODI2ZjU3NiIsImZpbmdlcnByaW50IjoiZTgzN2I5ZmZjZWM1M2ZlNTlkNDJhYzg5YzY2NWYwMTM0ZTM3ODRiZCIsImNhbGxiYWNrIjoie1wiZm9ybWRhdGFcIjp7XCJhY3Rpb25cIjpcImh0dHA6Ly9wcm9kdWN0aW9uLmZyb250ZW5kLnNlcnZpY2UuZXUtd2VzdC0xLnd0OjMwMDAvd2ViaG9va3MvYmFja2VuZFwifSxcImZvcm1cIjp7XCJ0cmFuc2Zlcl9pZFwiOlwiNDI3ZTMzYzk1NjU5MTNmNzRmYjIwMTJiYTk4Yzg5NTAyMDIxMDUxODE4Mzk1MVwiLFwiZG93bmxvYWRfaWRcIjoxMjE0MDc4MTA0OX19In0.6iHqkKICcqXxZpMcWL_aHQ7BT6WfxJ_r9zVEjqvmHzo'#@param {type:"string"}\n","\n","meshroom_file_path = "/content/drive/MyDrive/Osnove_oblikovanja_2021/Projekt_1/MeshroomCaches/shanji/D2/BB.mg" #@param {type:"string"}\n","\n","sensorDB="/content/drive/MyDrive/Osnove_oblikovanja_2021/Projekt_1/MeshroomCaches/shanji/D2/cameraSensors.db" #@param {type:"string"}\n","\n","output_path="/content/drive/MyDrive/Osnove_oblikovanja_2021/Projekt_1/MeshroomCaches/shanji/D2/Cache" #@param {type:"string"}\n"],"execution_count":null,"outputs":[]},{"cell_type":"code","metadata":{"id":"kKyatDmQQsWA"},"source":[""],"execution_count":null,"outputs":[]},{"cell_type":"markdown","metadata":{"id":"RsxzdzwtPVCA"},"source":["Create a directory to store the meshroom bins in and extract the meshroom bins there."]},{"cell_type":"code","metadata":{"id":"cQgXdvk-qUvi"},"source":["\n","\n","!mkdir ~/meshroom\n","!wget -N --user-agent Mozilla/4.0 -O ~/meshroom/MRoom.tar.gz '{link_to_direct_download}'\n","!tar -xvf ~/meshroom/MRoom.tar.gz\n"],"execution_count":null,"outputs":[]},{"cell_type":"markdown","metadata":{"id":"zTI6AlUXd-_M"},"source":["#Google Drive\n","Connect to Google Drive, so that you can import and export files from there.\n"]},{"cell_type":"code","metadata":{"id":"2wodsIcpYbDR","colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"status":"ok","timestamp":1621417172047,"user_tz":-120,"elapsed":9195,"user":{"displayName":"ALEKSANDER KOVA","photoUrl":"","userId":"13312320104478609314"}},"outputId":"6542250a-97ea-4b16-e024-51dc4981b05c"},"source":["from google.colab import drive\n","drive.mount('/content/drive')"],"execution_count":null,"outputs":[{"output_type":"stream","text":["Drive already mounted at /content/drive; to attempt to forcibly remount, call drive.mount("/content/drive", force_remount=True).\n"],"name":"stdout"}]},{"cell_type":"markdown","metadata":{"id":"xA_XKpKqdoqb"},"source":["#Meshing\n","Use the form in setup to specify an input and output path, or check sample data to try it out."]},{"cell_type":"code","metadata":{"id":"AZWyk461sxGI"},"source":["!cd ~/meshroom\n","!Meshroom-2021.1.0-av2.4.0-centos7-cuda10.2/meshroom_compute --forceCompute '{meshroom_file_path}'"],"execution_count":null,"outputs":[]}]}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment