Skip to content

Instantly share code, notes, and snippets.

@paramphy
Forked from natowi/MeshroomColab.ipynb
Created November 15, 2019 05:42
Show Gist options
  • Save paramphy/82402d254aae271b014eaa95004d396d to your computer and use it in GitHub Desktop.
Save paramphy/82402d254aae271b014eaa95004d396d to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
{
"nbformat": 4,
"nbformat_minor": 0,
"metadata": {
"colab": {
"name": "MR2.ipynb",
"provenance": [],
"collapsed_sections": []
},
"kernelspec": {
"name": "python3",
"display_name": "Python 3"
},
"accelerator": "GPU"
},
"cells": [
{
"cell_type": "markdown",
"metadata": {
"id": "TZh8CZsjwfD1",
"colab_type": "text"
},
"source": [
"\n",
"Setup\n",
"\n",
"Download Meshroom\n"
]
},
{
"cell_type": "code",
"metadata": {
"id": "b4HH_r8CwZXa",
"colab_type": "code",
"colab": {}
},
"source": [
"!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": "mmSZ5le1wl1r",
"colab_type": "text"
},
"source": [
"\n",
"Upload data\n",
"\n",
"Optional upload of pipline file and image source files\n"
]
},
{
"cell_type": "code",
"metadata": {
"id": "BP3p_lGEq69X",
"colab_type": "code",
"colab": {}
},
"source": [
"!mkdir input"
],
"execution_count": 0,
"outputs": []
},
{
"cell_type": "markdown",
"metadata": {
"id": "bnYMYBQlrL0u",
"colab_type": "text"
},
"source": [
"Change dir before upload"
]
},
{
"cell_type": "code",
"metadata": {
"id": "d9NW_koxq-wj",
"colab_type": "code",
"colab": {}
},
"source": [
"%cd input"
],
"execution_count": 0,
"outputs": []
},
{
"cell_type": "markdown",
"metadata": {
"id": "GqxXyUJYrdV5",
"colab_type": "text"
},
"source": [
"Test directory"
]
},
{
"cell_type": "code",
"metadata": {
"id": "KI9G_jvtrgOm",
"colab_type": "code",
"colab": {}
},
"source": [
"!ls"
],
"execution_count": 0,
"outputs": []
},
{
"cell_type": "code",
"metadata": {
"id": "MpXT0L6ywoSa",
"colab_type": "code",
"colab": {}
},
"source": [
"from google.colab import files\n",
"\n",
"# optional upload for the images\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])))"
],
"execution_count": 0,
"outputs": []
},
{
"cell_type": "markdown",
"metadata": {
"id": "Pc_52Wh9ruQF",
"colab_type": "text"
},
"source": [
"List Input contents"
]
},
{
"cell_type": "code",
"metadata": {
"id": "RcIHvaherrAb",
"colab_type": "code",
"colab": {}
},
"source": [
"!ls"
],
"execution_count": 0,
"outputs": []
},
{
"cell_type": "markdown",
"metadata": {
"id": "QMspCFLAs_K7",
"colab_type": "text"
},
"source": [
"Navigate back to content folder"
]
},
{
"cell_type": "code",
"metadata": {
"id": "2TywJh4lsNDK",
"colab_type": "code",
"colab": {}
},
"source": [
"%cd ../\n",
"!ls"
],
"execution_count": 0,
"outputs": []
},
{
"cell_type": "markdown",
"metadata": {
"id": "4E_kAx-2wq3O",
"colab_type": "text"
},
"source": [
"\n",
"Meshing\n",
"\n",
"use the --pipeline argument to provide a path to the meshfile you created/uploaded\n",
"Note: the node temp files are stored in the temp folder out is only for the final result"
]
},
{
"cell_type": "code",
"metadata": {
"id": "3GimHqrGwsmu",
"colab_type": "code",
"colab": {}
},
"source": [
"!mkdir ./out\n",
"!./meshroom/Meshroom-2019.1.0/meshroom_photogrammetry --input ./input --output ./out\n"
],
"execution_count": 0,
"outputs": []
},
{
"cell_type": "markdown",
"metadata": {
"id": "_EZJtblswuZy",
"colab_type": "text"
},
"source": [
"\n",
"Download\n",
"\n",
"Use the prefered download format\n"
]
},
{
"cell_type": "code",
"metadata": {
"id": "IirusdKJwz-6",
"colab_type": "code",
"colab": {}
},
"source": [
"!tar -czvf out.tar.gz ./out\n",
"from google.colab import files\n",
"\n",
"\n",
"files.download('out.tar.gz')"
],
"execution_count": 0,
"outputs": []
},
{
"cell_type": "code",
"metadata": {
"id": "VQ8F_rxPw4dK",
"colab_type": "code",
"colab": {}
},
"source": [
"!zip -r out.zip ./out\n",
"files.download('out.zip')"
],
"execution_count": 0,
"outputs": []
},
{
"cell_type": "markdown",
"metadata": {
"id": "NNzXTKPYwwl3",
"colab_type": "text"
},
"source": [
""
]
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment