diff --git a/LICENSES_EXTERNAL_SOFTWARE b/LICENSES_EXTERNAL_SOFTWARE index 4311b7c..e1d4052 100644 --- a/LICENSES_EXTERNAL_SOFTWARE +++ b/LICENSES_EXTERNAL_SOFTWARE @@ -699,3 +699,40 @@ OpenMVS: if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU AGPL, see . + + +mvs-texturing: + + All source files are distributed under the BSD 3-Clause License unless + otherwise noted in the source file. + + Software License Agreement (BSD 3-Clause License) + --------------------------------------------------------------------------- + + Copyright (c) 2015, Nils Moehrle and others + TU Darmstadt - Graphics, Capture and Massively Parallel Computing + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + 3. Neither the name of the copyright holder nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + + This software is provided by the copyright holders and contributors "as is" + and any express or implied warranties, including, but not limited to, the + implied warranties of merchantability and fitness for a particular purpose + are disclaimed. In no event shall the copyright holder or contributors be + liable for any direct, indirect, incidental, special, exemplary, or + consequential damages (including, but not limited to, procurement of + substitute goods or services; loss of use, data, or profits; or business + interruption) however caused and on any theory of liability, whether in + contract, strict liability, or tort (including negligence or otherwise) + arising in any way out of the use of this software, even if advised of the + possibility of such damage. \ No newline at end of file diff --git a/lib/runCommand.dart b/lib/runCommand.dart index f2bc597..7a0d283 100644 --- a/lib/runCommand.dart +++ b/lib/runCommand.dart @@ -8,6 +8,6 @@ runCommand(String command, List attr) async { err = "permission_denied"; } print('command_out: ${results.stdout}'); - return err; + return err == "" ? results.stdout : err; }); } diff --git a/lib/scanningScreen/scanningScreenModel.dart b/lib/scanningScreen/scanningScreenModel.dart index 5ad940d..c2c05a4 100644 --- a/lib/scanningScreen/scanningScreenModel.dart +++ b/lib/scanningScreen/scanningScreenModel.dart @@ -1,7 +1,10 @@ import 'dart:async'; import 'dart:io'; +import 'package:path_provider/path_provider.dart'; +import 'package:process_run/shell.dart'; import 'package:flutter/material.dart'; +import 'package:isolate_current_directory/isolate_current_directory.dart'; import 'package:simple_photogrammetry_gui/runCommand.dart'; import 'package:system_info2/system_info2.dart'; @@ -41,16 +44,16 @@ class ScanningScreenModel { startScanningProcess(var view, String imagesPath, String outputPath) async { if ((await checkDependencies(view))) { - // "C:${slash}Program Files${slash}simple_photogrammetry_gui${slash}colmap${slash}colmap${slash}COLMAP.bat" String colmapPath = Platform.isWindows ? 'C:${slash}Program Files${slash}simple_photogrammetry_gui${slash}colmap${slash}colmap${slash}COLMAP.bat' : 'colmap'; - String openMvsPath = Platform.isWindows ? 'C:${slash}Program Files${slash}simple_photogrammetry_gui${slash}openMVS${slash}' : ''; - String outlierRemovalPath = Platform.isWindows ? 'C:${slash}Program Files${slash}simple_photogrammetry_gui${slash}' : ''; + String openMvsPath = Platform.isWindows ? 'C:${slash}Program Files${slash}simple_photogrammetry_gui${slash}openMVS${slash}' : './openMVS/'; + String texReconPath = Platform.isWindows ? 'C:${slash}Program Files${slash}simple_photogrammetry_gui${slash}' : './'; + String decimateMeshPath = Platform.isWindows ? 'C:${slash}Program Files${slash}simple_photogrammetry_gui${slash}' : './'; + String databasePath = "$outputPath${slash}temp${slash}database.db"; - int totalStepNumber = 11; - if(!view.reconstructAndTextureMesh) { - totalStepNumber=8; - } + int totalStepNumber = 10; + + var shell = Shell(); if(Platform.isWindows) { @@ -62,11 +65,47 @@ class ScanningScreenModel { }else{ - await runCommand("mkdir $outputPath/temp", []); - await runCommand("mkdir $outputPath/temp/sparse", []); - await runCommand("mkdir $outputPath/temp/dense", []); - await runCommand("mkdir $outputPath/temp/dense/sparse", []); - await runCommand("touch $outputPath/temp/database.db", []); + + + try{ + + await shell.run(''' + mkdir $outputPath/temp + '''); + + }catch(e) {} + + try{ + + await shell.run(''' + mkdir $outputPath/temp/sparse + '''); + + }catch(e) {} + + try{ + + await shell.run(''' + mkdir $outputPath/temp/dense + '''); + + }catch(e) {} + + try{ + + await shell.run(''' + mkdir $outputPath/temp/dense/sparse + '''); + + }catch(e) {} + + try{ + + await shell.run(''' + touch $outputPath/temp/database.db + '''); + + }catch(e) {} } @@ -120,10 +159,9 @@ class ScanningScreenModel { return; } - view.status = "5.2/$totalStepNumber Converting Project"; - view.setState(() {}); - print("\"$colmapPath\" model_converter --input_path \"$outputPath${slash}temp${slash}dense${slash}sparse\" --output_path \"$imagesPath\" --output_type Bundler"); - await runCommand("\"$colmapPath\" model_converter --input_path \"$outputPath${slash}temp${slash}dense${slash}sparse\" --output_path \"$imagesPath\" --output_type Bundler", []); + view.status = "5.2/$totalStepNumber Converting Project"; + view.setState(() {}); + await runCommand("\"$colmapPath\" model_converter --input_path \"$outputPath${slash}temp${slash}dense${slash}sparse\" --output_path \"$imagesPath\" --output_type CAM", []); if (view.stop) { stop(view); @@ -139,8 +177,8 @@ class ScanningScreenModel { return; } - int max_img_resolution = 2560; - int dense_retrys = 1; + int maxImgResolution = 2560; + int denseRetrys = 1; await runCommand('powershell -c "del \'$outputPath${slash}temp${slash}model_dense.mvs\'"', []); @@ -150,13 +188,13 @@ class ScanningScreenModel { return; } - print("max_img_resolution: ${max_img_resolution}"); + print("max_img_resolution: ${maxImgResolution}"); - if (dense_retrys == 1) { + if (denseRetrys == 1) { view.status = "7/$totalStepNumber Densifying Point Cloud"; view.setState(() {}); } else { - view.status = "7/$totalStepNumber Densifying Point Cloud failed, retrying with a max image resolution of $max_img_resolution"; + view.status = "7/$totalStepNumber Densifying Point Cloud failed, retrying with a max image resolution of $maxImgResolution"; } view.setState(() {}); @@ -166,16 +204,14 @@ class ScanningScreenModel { } - // print("\"${openMvsPath}DensifyPointCloud\" --input-file \"$outputPath${slash}temp${slash}model_colmap.mvs\" --working-folder \"$outputPath${slash}temp\" --output-file \"$outputPath${slash}temp${slash}model_dense.mvs\""); - - await runCommand("\"${openMvsPath}DensifyPointCloud\" --input-file \"$outputPath${slash}temp${slash}model_colmap.mvs\" --working-folder \"$outputPath${slash}temp\" --output-file \"$outputPath${slash}temp${slash}model_dense.mvs\" --max-resolution $max_img_resolution", []); - if(dense_retrys == 5) { + await runCommand("\"${openMvsPath}DensifyPointCloud\" --input-file \"$outputPath${slash}temp${slash}model_colmap.mvs\" --working-folder \"$outputPath${slash}temp\" --output-file \"$outputPath${slash}temp${slash}model_dense.mvs\" --max-resolution $maxImgResolution", []); + if(denseRetrys == 5) { view.status = "Failed, went wrong at DensifyPointCloud"; view.setState(() {}); return; } - dense_retrys++; - max_img_resolution = (max_img_resolution*0.7).floor(); + denseRetrys++; + maxImgResolution = (maxImgResolution*0.7).floor(); } if (view.stop) { @@ -183,19 +219,7 @@ class ScanningScreenModel { return; } - view.status = "8/$totalStepNumber Removing Outliers"; - view.setState(() {}); - - await runCommand("\"${outlierRemovalPath}removeOutliers\" -i \"$outputPath${slash}temp${slash}model_dense.ply\" -o \"$outputPath\"", []); - - if(view.reconstructAndTextureMesh) { - - if (view.stop) { - stop(view); - return; - } - - double decimationFactorMeshRecon = 1; + double decimationFactorMeshRecon = 1; int meshReconRetrys = 1; while (!File("$outputPath${slash}temp${slash}model_surface.mvs").existsSync()) { @@ -210,7 +234,7 @@ class ScanningScreenModel { view.setState(() {}); } - await runCommand("\"${openMvsPath}ReconstructMesh\" --input-file \"$outputPath${slash}temp${slash}model_dense.mvs\" --working-folder \"$outputPath${slash}temp\" --output-file \"$outputPath${slash}temp${slash}model_surface.mvs\" -d $meshReconRetrys", []); + await runCommand("\"${openMvsPath}ReconstructMesh\" --input-file \"$outputPath${slash}temp${slash}model_dense.mvs\" --working-folder \"$outputPath${slash}temp\" --output-file \"$outputPath${slash}temp${slash}model_surface.mvs\" -d ${(2.5+(double.parse(meshReconRetrys.toString())/2)).toString()} --integrate-only-roi 1 --smooth 1", []); decimationFactorMeshRecon=decimationFactorMeshRecon*0.7; if(meshReconRetrys == 10) { @@ -221,67 +245,50 @@ class ScanningScreenModel { meshReconRetrys++; } + + if (view.stop) { + stop(view); + return; + } - if (view.stop) { - stop(view); - return; - } - - double decimationFactor = 0; - int imgScaleDownFactor = 0; - bool useDecimationFactor = false; - - while (!File("$outputPath${slash}temp${slash}model_surface_refined.mvs").existsSync()) { - if (view.stop) { - stop(view); - return; - } - - if (decimationFactor == 0) { - view.status = "10/$totalStepNumber Refining Mesh"; - view.setState(() {}); - } else { - view.status = "10/$totalStepNumber Refining Mesh failed, retrying with image scale-down factor $imgScaleDownFactor, and decimation factor $decimationFactor"; - view.setState(() {}); - } + view.status = "10/$totalStepNumber Texturing Mesh"; + view.setState(() {}); - await runCommand("\"${openMvsPath}RefineMesh\" --input-file \"$outputPath${slash}temp${slash}model_surface.mvs\" --working-folder \"$outputPath${slash}temp\" --output-file \"$outputPath${slash}temp${slash}model_surface_refined.mvs\" --reduce-memory 1 --decimate $decimationFactor --resolution-level $imgScaleDownFactor", []); + int texreconRetrys = 1; - imgScaleDownFactor++; + while(!File("$outputPath${slash}textured.obj").existsSync()) { - if (useDecimationFactor) { - decimationFactor-=0.1; - } + if(texreconRetrys > 1) { + view.status = "10/$totalStepNumber Texturing Mesh, failed retrying with decimation-factor: ${1+((texreconRetrys-1)/2)}"; + view.setState(() {}); + // await runCommand("\"${resizeImagesPath}resizeImages\" -i \"${imagesPath}\" -r ${texrecon_retrys*0.7}", []); + await runCommand("\"${decimateMeshPath}decimateMesh\" -m \"$outputPath${slash}temp${slash}model_surface.ply\" -o \"$outputPath${slash}temp\" -t ${1+((texreconRetrys-1)/2)}", []); + } - if (imgScaleDownFactor == 5 && useDecimationFactor == false) { - imgScaleDownFactor = 0; - decimationFactor = 0.9; - useDecimationFactor = true; - continue; - } + print('working folder: $imagesPath'); - if (imgScaleDownFactor == 5 && useDecimationFactor) { - view.status = "Failed, went wrong at RefineMesh"; - view.setState(() {}); - return; + await Process.run('"${texReconPath}texrecon" .${slash} "$outputPath${slash}temp${slash}model_surface${texreconRetrys > 1 ? "_decimated" : ""}.ply" "${outputPath}${slash}textured"',[],workingDirectory: texreconRetrys > 1 && false ? "${imagesPath}${slash}downres" : imagesPath).then((ProcessResult results) { + String err = results.stderr.toString(); + print('err: $err'); + if (err.contains('Permission denied') || err.contains("PermissionDenied")) { + err = "permission_denied"; } - } + print('command_out: ${results.stdout}'); + return err; + }); - if (view.stop) { - stop(view); + if(texreconRetrys == 6){ + view.status = "Failed, went wrong at texturing mesh"; + view.setState(() {}); return; } - view.status = "11/$totalStepNumber Texturing Mesh"; - view.setState(() {}); - await runCommand("\"${openMvsPath}TextureMesh\" --input-file \"$outputPath${slash}temp${slash}model_surface_refined.mvs\" --working-folder \"$outputPath${slash}temp\" --output-file \"$outputPath${slash}textured.mvs\" --export-type obj", []); + texreconRetrys++; } view.status = "Done"; view.setState(() {}); - // await runCommand("\"$colmapPath\" feature_extractor exhaustive_matcher --SiftMatching.use_gpu 0 --database_path \"$outputPath${slash}temp${slash}database.db\"", []); - //colmap mapper --database_path $outputPath${slash}temp${slash}database.db --image_path $imagesPath --output_path $PROJECT/sparse } } @@ -299,6 +306,8 @@ class ScanningScreenModel { runCommand('taskkill /IM "ReconstructMesh.exe" /F', []); runCommand('taskkill /IM "DensifyPointCloud.exe" /F', []); runCommand('taskkill /IM "COLMAP.bat" /F', []); + runCommand('taskkill /IM "reconstructMesh.exe" /F', []); + runCommand('taskkill /IM "texrecon.exe" /F', []); }else{ runCommand('killall RefineMesh', []); runCommand('killall TextureMesh', []); @@ -320,15 +329,26 @@ class ScanningScreenModel { if (Platform.isWindows) { bool hasColmap = await Directory("C:${slash}Program Files${slash}simple_photogrammetry_gui${slash}colmap").exists(); bool hasOpenMVS = await Directory("C:${slash}Program Files${slash}simple_photogrammetry_gui${slash}openMVS").exists(); - bool hasRemoveOutliers = await File("C:${slash}Program Files${slash}simple_photogrammetry_gui${slash}removeOutliers.exe").exists(); + // bool hasRemoveOutliers = await File("C:${slash}Program Files${slash}simple_photogrammetry_gui${slash}removeOutliers.exe").exists(); + // bool hasReconstructMesh = await File("C:${slash}Program Files${slash}simple_photogrammetry_gui${slash}reconstructMesh.exe").exists(); + bool hasTexRecon = await File("C:${slash}Program Files${slash}simple_photogrammetry_gui${slash}texrecon.exe").exists(); + bool hasResizeImages = await File("C:${slash}Program Files${slash}simple_photogrammetry_gui${slash}resizeImages.exe").exists(); + bool hasDecimateMesh = await File("C:${slash}Program Files${slash}simple_photogrammetry_gui${slash}decimateMesh.exe").exists(); - hasAllDependencies = hasColmap && hasOpenMVS && hasRemoveOutliers; + hasAllDependencies = hasColmap && hasOpenMVS && hasTexRecon && hasResizeImages && hasDecimateMesh; } else if (Platform.isLinux) { - bool hasColmap = (await runCommand('colmap',[])).toString().trim() != ""; - bool hasOpenMVS = (await runCommand('DensifyPointCloud',[])).toString().trim() != "";//ile("C:${slash}Program Files${slash}simple_photogrammetry_gui${slash}openMVS").existsSync(); - hasAllDependencies = hasColmap && hasOpenMVS; + + + bool hasColmap = (await runCommand('colmap',[])).toString().trim().contains("COLMAP"); + + // bool hasOpenMVS = await Directory("~/.simple_photogrammetry_gui_dependencies/openMVS").exists(); + // bool hasRemoveOutliers = await File("~/.simple_photogrammetry_gui_dependencies/removeOutliers").exists(); + // bool hasReconstructMesh = await File("~/.simple_photogrammetry_gui_dependencies/reconstructMesh").exists(); + // bool hasTexRecon = await File("~/.simple_photogrammetry_gui_dependencies/texrecon").exists(); + + hasAllDependencies = hasColmap;// && hasOpenMVS && hasRemoveOutliers && hasReconstructMesh && hasTexRecon; } if (!hasAllDependencies) { @@ -337,7 +357,7 @@ class ScanningScreenModel { view.context, "Some dependencies are missing, download them now?", [ - TextButton( + Platform.isLinux ? Container() : TextButton( onPressed: () async { Navigator.pop(view.context); @@ -366,7 +386,7 @@ class ScanningScreenModel { view.setState(() {}); }, child: Text( - "Yes (No CUDA)", + "Yes${Platform.isLinux ? "" : " (No CUDA)"}", style: TextStyle(color: view.colorScheme.onBackground, fontSize: 18), )), TextButton( @@ -400,7 +420,11 @@ class ScanningScreenModel { return; } - await runCommand('powershell -c "Expand-Archive -Path ./removeOutliers.zip -DestinationPath \'C:${slash}Program Files${slash}simple_photogrammetry_gui\'"', []); + await runCommand('powershell -c "Expand-Archive -Path ./decimateMesh.zip -DestinationPath \'C:${slash}Program Files${slash}simple_photogrammetry_gui\'"', []); + + await runCommand('powershell -c "Expand-Archive -Path ./resizeImages.zip -DestinationPath \'C:${slash}Program Files${slash}simple_photogrammetry_gui\'"', []); + + await runCommand('powershell -c "Expand-Archive -Path ./texrecon.zip -DestinationPath \'C:${slash}Program Files${slash}simple_photogrammetry_gui\'"', []); await runCommand('powershell -c "Rename-Item -Path \'C:${slash}Program Files${slash}simple_photogrammetry_gui${slash}colmap${slash}${cuda ? 'COLMAP-3.7-windows-cuda' : 'COLMAP-3.7-windows-no-cuda'}\' -NewName \'C:${slash}Program Files${slash}simple_photogrammetry_gui${slash}colmap${slash}colmap\'"', []); @@ -411,6 +435,12 @@ class ScanningScreenModel { permissionErrorAlert(view); return; } + // ~/.simple_photogrammetry_gui_dependencies/ + // await runCommand('mkdir ~/.simple_photogrammetry_gui_dependencies', []); + // await runCommand('cp ./removeOutliers ~/.simple_photogrammetry_gui_dependencies/', []); + // await runCommand('cp ./reconstructMesh ~/.simple_photogrammetry_gui_dependencies/', []); + // await runCommand('cp ./texrecon ~/.simple_photogrammetry_gui_dependencies/', []); + // await runCommand('cp ./openMVS ~/.simple_photogrammetry_gui_dependencies/', []); } } diff --git a/lib/scanningScreen/scanningScreenView.dart b/lib/scanningScreen/scanningScreenView.dart index 303f003..b969264 100644 --- a/lib/scanningScreen/scanningScreenView.dart +++ b/lib/scanningScreen/scanningScreenView.dart @@ -99,7 +99,7 @@ class _ScanningScreenViewState extends State { ) ], ), - const Padding(padding: EdgeInsets.all(8)), + /*const Padding(padding: EdgeInsets.all(8)), Row( mainAxisAlignment: MainAxisAlignment.center, children: [ @@ -114,7 +114,7 @@ class _ScanningScreenViewState extends State { color: colorScheme.onPrimary, ), onTap: (selected) { - reconstructAndTextureMesh = selected ?? false; + reconstructAndTextureMesh = (selected ?? false); setState(() {}); }, ), @@ -124,7 +124,7 @@ class _ScanningScreenViewState extends State { style: TextStyle(color: colorScheme.onBackground, fontWeight: FontWeight.normal), ) ], - ), + ),*/ const Padding(padding: EdgeInsets.all(10.0)), Row( mainAxisAlignment: MainAxisAlignment.center, @@ -294,7 +294,8 @@ class _ScanningScreenViewState extends State { children: [ linkWidget("1. Colmap", "https://colmap.github.io/"), linkWidget("2. OpenMVS", "https://github.com/cdcseacave/openMVS"), - linkWidget("3. pointcloudToMesh", "https://github.com/danielTobon43/pointcloudToMesh"), + linkWidget("3. mvs-texturing", "https://github.com/nmoehrle/mvs-texturing"), + linkWidget("4. pymeshlab", "https://github.com/cnr-isti-vclab/PyMeshLab"), ], ), ); diff --git a/mvs-texturing/texrecon.exe b/mvs-texturing/texrecon.exe new file mode 100644 index 0000000..ad484b1 Binary files /dev/null and b/mvs-texturing/texrecon.exe differ diff --git a/openmvs/DensifyPointCloud.exe b/openmvs/DensifyPointCloud.exe new file mode 100644 index 0000000..1dcff5e Binary files /dev/null and b/openmvs/DensifyPointCloud.exe differ diff --git a/openmvs/InterfaceCOLMAP.exe b/openmvs/InterfaceCOLMAP.exe new file mode 100644 index 0000000..0ea1dc2 Binary files /dev/null and b/openmvs/InterfaceCOLMAP.exe differ diff --git a/openmvs/InterfaceMVSNet.exe b/openmvs/InterfaceMVSNet.exe new file mode 100644 index 0000000..eabc194 Binary files /dev/null and b/openmvs/InterfaceMVSNet.exe differ diff --git a/openmvs/InterfaceMetashape.exe b/openmvs/InterfaceMetashape.exe new file mode 100644 index 0000000..02fb3b0 Binary files /dev/null and b/openmvs/InterfaceMetashape.exe differ diff --git a/openmvs/ReconstructMesh.exe b/openmvs/ReconstructMesh.exe new file mode 100644 index 0000000..1df5b8d Binary files /dev/null and b/openmvs/ReconstructMesh.exe differ diff --git a/openmvs/RefineMesh.exe b/openmvs/RefineMesh.exe new file mode 100644 index 0000000..7563feb Binary files /dev/null and b/openmvs/RefineMesh.exe differ diff --git a/openmvs/Tests.exe b/openmvs/Tests.exe new file mode 100644 index 0000000..34314e8 Binary files /dev/null and b/openmvs/Tests.exe differ diff --git a/openmvs/TextureMesh.exe b/openmvs/TextureMesh.exe new file mode 100644 index 0000000..7707fb8 Binary files /dev/null and b/openmvs/TextureMesh.exe differ diff --git a/openmvs/TransformScene.exe b/openmvs/TransformScene.exe new file mode 100644 index 0000000..f1f9e92 Binary files /dev/null and b/openmvs/TransformScene.exe differ diff --git a/openmvs/Viewer.exe b/openmvs/Viewer.exe new file mode 100644 index 0000000..9ba9b0a Binary files /dev/null and b/openmvs/Viewer.exe differ diff --git a/openmvs/boost_iostreams-vc143-mt-x64-1_80.dll b/openmvs/boost_iostreams-vc143-mt-x64-1_80.dll new file mode 100644 index 0000000..9c6081f Binary files /dev/null and b/openmvs/boost_iostreams-vc143-mt-x64-1_80.dll differ diff --git a/openmvs/boost_program_options-vc143-mt-x64-1_80.dll b/openmvs/boost_program_options-vc143-mt-x64-1_80.dll new file mode 100644 index 0000000..702bf78 Binary files /dev/null and b/openmvs/boost_program_options-vc143-mt-x64-1_80.dll differ diff --git a/openmvs/boost_serialization-vc143-mt-x64-1_80.dll b/openmvs/boost_serialization-vc143-mt-x64-1_80.dll new file mode 100644 index 0000000..71d2131 Binary files /dev/null and b/openmvs/boost_serialization-vc143-mt-x64-1_80.dll differ diff --git a/openmvs/bz2.dll b/openmvs/bz2.dll new file mode 100644 index 0000000..a9f6829 Binary files /dev/null and b/openmvs/bz2.dll differ diff --git a/openmvs/glew32.dll b/openmvs/glew32.dll new file mode 100644 index 0000000..5c81a13 Binary files /dev/null and b/openmvs/glew32.dll differ diff --git a/openmvs/glfw3.dll b/openmvs/glfw3.dll new file mode 100644 index 0000000..55e7fb8 Binary files /dev/null and b/openmvs/glfw3.dll differ diff --git a/openmvs/gmp-10.dll b/openmvs/gmp-10.dll new file mode 100644 index 0000000..221f310 Binary files /dev/null and b/openmvs/gmp-10.dll differ diff --git a/openmvs/jpeg62.dll b/openmvs/jpeg62.dll new file mode 100644 index 0000000..d2385bb Binary files /dev/null and b/openmvs/jpeg62.dll differ diff --git a/openmvs/liblzma.dll b/openmvs/liblzma.dll new file mode 100644 index 0000000..26093e9 Binary files /dev/null and b/openmvs/liblzma.dll differ diff --git a/openmvs/libpng16.dll b/openmvs/libpng16.dll new file mode 100644 index 0000000..f92f8ae Binary files /dev/null and b/openmvs/libpng16.dll differ diff --git a/openmvs/opencv_calib3d4.dll b/openmvs/opencv_calib3d4.dll new file mode 100644 index 0000000..3e2fe92 Binary files /dev/null and b/openmvs/opencv_calib3d4.dll differ diff --git a/openmvs/opencv_core4.dll b/openmvs/opencv_core4.dll new file mode 100644 index 0000000..39d28db Binary files /dev/null and b/openmvs/opencv_core4.dll differ diff --git a/openmvs/opencv_features2d4.dll b/openmvs/opencv_features2d4.dll new file mode 100644 index 0000000..da4811d Binary files /dev/null and b/openmvs/opencv_features2d4.dll differ diff --git a/openmvs/opencv_flann4.dll b/openmvs/opencv_flann4.dll new file mode 100644 index 0000000..3420896 Binary files /dev/null and b/openmvs/opencv_flann4.dll differ diff --git a/openmvs/opencv_highgui4.dll b/openmvs/opencv_highgui4.dll new file mode 100644 index 0000000..862dd47 Binary files /dev/null and b/openmvs/opencv_highgui4.dll differ diff --git a/openmvs/opencv_imgcodecs4.dll b/openmvs/opencv_imgcodecs4.dll new file mode 100644 index 0000000..e153ed5 Binary files /dev/null and b/openmvs/opencv_imgcodecs4.dll differ diff --git a/openmvs/opencv_imgproc4.dll b/openmvs/opencv_imgproc4.dll new file mode 100644 index 0000000..ad8c57a Binary files /dev/null and b/openmvs/opencv_imgproc4.dll differ diff --git a/openmvs/opencv_videoio4.dll b/openmvs/opencv_videoio4.dll new file mode 100644 index 0000000..82be27e Binary files /dev/null and b/openmvs/opencv_videoio4.dll differ diff --git a/openmvs/tiff.dll b/openmvs/tiff.dll new file mode 100644 index 0000000..4cfb6e8 Binary files /dev/null and b/openmvs/tiff.dll differ diff --git a/openmvs/webp.dll b/openmvs/webp.dll new file mode 100644 index 0000000..be34e08 Binary files /dev/null and b/openmvs/webp.dll differ diff --git a/openmvs/webpdecoder.dll b/openmvs/webpdecoder.dll new file mode 100644 index 0000000..34d2f21 Binary files /dev/null and b/openmvs/webpdecoder.dll differ diff --git a/openmvs/zlib1.dll b/openmvs/zlib1.dll new file mode 100644 index 0000000..a4c8b6c Binary files /dev/null and b/openmvs/zlib1.dll differ diff --git a/openmvs/zstd.dll b/openmvs/zstd.dll new file mode 100644 index 0000000..5af2d35 Binary files /dev/null and b/openmvs/zstd.dll differ diff --git a/pubspec.lock b/pubspec.lock index 823d6b3..fb4065c 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -1,6 +1,14 @@ # Generated by pub # See https://dart.dev/tools/pub/glossary#lockfile packages: + args: + dependency: transitive + description: + name: args + sha256: "4cab82a83ffef80b262ddedf47a0a8e56ee6fbf7fe21e6e768b02792034dd440" + url: "https://pub.dev" + source: hosted + version: "2.4.0" async: dependency: transitive description: @@ -25,6 +33,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.2.1" + charcode: + dependency: transitive + description: + name: charcode + sha256: fb98c0f6d12c920a02ee2d998da788bca066ca5f148492b7085ee23372b12306 + url: "https://pub.dev" + source: hosted + version: "1.3.1" clock: dependency: transitive description: @@ -152,6 +168,14 @@ packages: url: "https://pub.dev" source: hosted version: "4.0.2" + isolate_current_directory: + dependency: "direct main" + description: + name: isolate_current_directory + sha256: "522dfcf5ef765b1e60c8d20398cdc1d2c3189f5430dcbe78979094b88f2fcc74" + url: "https://pub.dev" + source: hosted + version: "1.2.0" js: dependency: transitive description: @@ -280,6 +304,14 @@ packages: url: "https://pub.dev" source: hosted version: "4.2.4" + process_run: + dependency: "direct dev" + description: + name: process_run + sha256: "1142d7f4f0c3f36393a1319406efcf481def2b6d862b2bf600c8ae8fa74d5bd8" + url: "https://pub.dev" + source: hosted + version: "0.12.5+2" provider: dependency: "direct main" description: @@ -288,6 +320,14 @@ packages: url: "https://pub.dev" source: hosted version: "6.0.5" + pub_semver: + dependency: transitive + description: + name: pub_semver + sha256: "307de764d305289ff24ad257ad5c5793ce56d04947599ad68b3baa124105fc17" + url: "https://pub.dev" + source: hosted + version: "2.1.3" roundcheckbox: dependency: "direct main" description: @@ -333,6 +373,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.2.0" + synchronized: + dependency: transitive + description: + name: synchronized + sha256: "33b31b6beb98100bf9add464a36a8dd03eb10c7a8cf15aeec535e9b054aaf04b" + url: "https://pub.dev" + source: hosted + version: "3.0.1" system_info2: dependency: "direct main" description: @@ -469,6 +517,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.0.0" + yaml: + dependency: transitive + description: + name: yaml + sha256: "23812a9b125b48d4007117254bca50abb6c712352927eece9e155207b1db2370" + url: "https://pub.dev" + source: hosted + version: "3.1.1" sdks: dart: ">=2.19.2 <3.0.0" flutter: ">=3.4.0-17.0.pre" diff --git a/pubspec.yaml b/pubspec.yaml index 9549368..addf1b0 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -42,6 +42,7 @@ dependencies: roundcheckbox: ^2.0.5 system_info2: ^3.0.1 url_launcher: ^6.1.10 + isolate_current_directory: ^1.2.0 dev_dependencies: flutter_test: @@ -55,6 +56,7 @@ dev_dependencies: flutter_lints: ^2.0.0 dynamic_color: ^1.6.2 file_picker: ^5.2.5 + process_run: ^0.12.5+2 # For information on the generic Dart part of this file, see the # following page: https://dart.dev/tools/pub/pubspec diff --git a/python/decimateMesh.py b/python/decimateMesh.py new file mode 100644 index 0000000..6cd3973 --- /dev/null +++ b/python/decimateMesh.py @@ -0,0 +1,19 @@ +import os +import pymeshlab +import optparse + +parser = optparse.OptionParser() +parser.add_option("-m","--mesh",action="store",help="To be textured mesh") +parser.add_option("-o","--output_folder",action="store",help="Folder where Results are stored") +parser.add_option("-t","--face_reduction_factor",action="store",help="face reduction factor (0 = disabled)") +options, args = parser.parse_args() +output_folder = options.output_folder +mesh = options.mesh +face_reduction_factor = float(options.face_reduction_factor) + +ms = pymeshlab.MeshSet() +print('reading...') +ms.load_new_mesh(mesh) +ms.meshing_decimation_quadric_edge_collapse(targetfacenum=int(ms.current_mesh().face_number()/face_reduction_factor)) +print('saving') +ms.save_current_mesh(os.path.join(output_folder,"model_surface_decimated.ply")) \ No newline at end of file diff --git a/python/reconstructMesh/reconstructMesh.py b/python/reconstructMesh/reconstructMesh.py new file mode 100644 index 0000000..01faa19 --- /dev/null +++ b/python/reconstructMesh/reconstructMesh.py @@ -0,0 +1,139 @@ +import optparse +import open3d as o3d +import numpy as np +import pymeshlab + +parser = optparse.OptionParser() +parser.add_option("-i","--input_pointcloud",action="store",help="Input Pointcloud") +parser.add_option("-o","--output_folder",action="store",help="Folder where Results are stored") +parser.add_option("-d","--recon_depth",action="store",help="Reconstruction Depth") +options, args = parser.parse_args() +input_pointcloud_path = options.input_pointcloud +output_folder = options.output_folder +recon_depth = options.recon_depth + + + + + + + +#pcd.normals = o3d.utility.Vector3dVector(np.zeros( +# (1, 3))) # invalidate existing normals + +#pcd.estimate_normals() + +#print("Meshing") +#radii = [0.005, 0.01, 0.02, 0.04] +#rec_mesh = o3d.geometry.TriangleMesh.create_from_point_cloud_ball_pivoting(inlier_cloud, /#o3d.utility.DoubleVector(radii)) + +input_pointcloud = o3d.io.read_point_cloud(input_pointcloud_path) + +#input_pointcloud.normals = o3d.utility.Vector3dVector(np.zeros( +# (1, 3))) # invalidate existing normals + +#input_pointcloud.estimate_normals() +#print("filtering...") +#cl, ind = input_pointcloud.remove_statistical_outlier(nb_neighbors=50, std_ratio=0.1) +#cl, ind = pcd.remove_radius_outlier(nb_points=16, radius=0.05) + + + +#inlier_cloud = input_pointcloud.select_by_index(ind) + +#scale = 0.1 +#generate_sampling_voronoi +pcd = input_pointcloud.voxel_down_sample(voxel_size=0.005) +pcd.estimate_normals() +# o3d.geometry.estimate_normals(pcd,search_param=o3d.geometry.KDTreeSearchParamHybrid(radius=0.1,max_nn=30)) +# print(f"saving...") +o3d.io.write_point_cloud(output_folder + f"/downsampled.ply", pcd, write_ascii=False) +print('recon') + +#Alpha shapes +# mesh = o3d.geometry.TriangleMesh.create_from_point_cloud_alpha_shape(pcd, 0.01) +# mesh.compute_vertex_normals() + +# #BPA: + +# radii = [0.009] +# mesh = o3d.geometry.TriangleMesh.create_from_point_cloud_ball_pivoting( +# pcd, o3d.utility.DoubleVector(radii)) + +# print('saving') +# o3d.io.write_triangle_mesh(output_folder + f"/bpa_recon.ply", mesh, write_ascii=False) + +#while(scale < 2.0): + +# print("meshing...") +# print('run Poisson surface reconstruction') +# with o3d.utility.VerbosityContextManager( +# o3d.utility.VerbosityLevel.Debug) as cm: +# mesh, densities = o3d.geometry.TriangleMesh.create_from_point_cloud_poisson( +# input_pointcloud, depth=int(recon_depth), scale=0.9) + +# with o3d.utility.VerbosityContextManager( +# o3d.utility.VerbosityLevel.Debug) as cm: +# triangle_clusters, cluster_n_triangles, cluster_area = ( +# mesh.cluster_connected_triangles()) +# triangle_clusters = np.asarray(triangle_clusters) +# cluster_n_triangles = np.asarray(cluster_n_triangles) +# cluster_area = np.asarray(cluster_area) + +# triangles_to_remove = cluster_n_triangles[triangle_clusters] < 100 +# mesh.remove_triangles_by_mask(triangles_to_remove) + +# print(f"saving...") +# o3d.io.write_triangle_mesh(output_folder + f"/meshed_poisson_cleanup.ply", mesh, write_ascii=False) + + +# scale+=0.1 + + + + + +print("cleaning & reconstructing") + +ms = pymeshlab.MeshSet() + +print('reading...') +ms.load_new_mesh(output_folder + "/downsampled.ply") +# texturesize +#ms. +# ms.generate_surface_reconstruction_ball_pivoting() + +# ms.generate_marching_cubes_apss(filterscale=5) +# print('estimating_normals...') +# ms.compute_normal_for_point_clouds() +# print('remove outliers') +# ms.compute_selection_point_cloud_outliers() +# ms.meshing_remove_selected_vertices() +# print('reconstructing...') +# ms.generate_surface_reconstruction_screened_poisson(depth=int(recon_depth)) +# print('remove_connected_componet_by_diameter...') +# ms.meshing_remove_connected_component_by_diameter() +# ms.meshing_remove_connected_component_by_face_number(mincomponentsize=100) +# print('compute_selection_by_edge_length...') +# # ms.meshing_remove_connected_component_by_diameter() +# ms.compute_selection_by_edge_length(threshold=0.1) +# print('meshing_remove_selected_faces...') +# ms.meshing_remove_selected_faces() +# print('dilate...') +# ms.apply_selection_dilatation() +# ms.apply_selection_dilatation() +# ms.apply_selection_dilatation() +# ms.apply_selection_dilatation() +# ms.apply_selection_dilatation() +# print('select_small_disconnected_components...') +# ms.compute_selection_by_small_disconnected_components_per_face() +# print('remove_selected_faces...') +# ms.meshing_remove_selected_faces() +# print('repair_non_manifold_edges...') +# ms.meshing_repair_non_manifold_edges() +# print('close_holes...') +# ms.meshing_close_holes() +# print('repair non manifold...') +# ms.meshing_repair_non_manifold_edges() +# print('saving...') +ms.save_current_mesh(output_folder + "/cleaned_up.ply") diff --git a/python/reconstructMesh/reconstructMesh_experimental.py b/python/reconstructMesh/reconstructMesh_experimental.py new file mode 100644 index 0000000..e54b333 --- /dev/null +++ b/python/reconstructMesh/reconstructMesh_experimental.py @@ -0,0 +1,80 @@ + +generate_surface_reconstruction_vcg +# import optparse +# import open3d as o3d +# import numpy as np +# import pyvista as pv + +# parser = optparse.OptionParser() +# parser.add_option("-i","--input_pointcloud",action="store",help="Input Pointcloud") +# parser.add_option("-o","--output_folder",action="store",help="Folder where Results are stored") +# parser.add_option("-d","--recon_depth",action="store",help="Reconstruction Depth") +# options, args = parser.parse_args() +# input_pointcloud_path = options.input_pointcloud +# output_folder = options.output_folder +# recon_depth = options.recon_depth + + +# #pcd.normals = o3d.utility.Vector3dVector(np.zeros( +# # (1, 3))) # invalidate existing normals + +# #pcd.estimate_normals() + +# #print("Meshing") +# #radii = [0.005, 0.01, 0.02, 0.04] +# #rec_mesh = o3d.geometry.TriangleMesh.create_from_point_cloud_ball_pivoting(inlier_cloud, /#o3d.utility.DoubleVector(radii)) + +# print('reading...') +# input_pointcloud = pv.read(input_pointcloud_path) +# #o3d.io.read_point_cloud(input_pointcloud_path) + +# # points is a 3D numpy array (n_points, 3) coordinates of a sphere +# cloud = pv.PolyData(input_pointcloud) + +# print('meshing...') +# surf = cloud.reconstruct_surface() +# surf.save(output_folder + 'py_vista_test.ply') + +# # volume = cloud.delaunay_3d(alpha=2.) +# # shell = volume.extract_geometry() +# # shell.save(output_folder + 'py_vista_test.ply') + +# #input_pointcloud.normals = o3d.utility.Vector3dVector(np.zeros( +# # (1, 3))) # invalidate existing normals + +# #input_pointcloud.estimate_normals() +# #print("filtering...") +# #cl, ind = input_pointcloud.remove_statistical_outlier(nb_neighbors=50, std_ratio=0.1) +# #cl, ind = pcd.remove_radius_outlier(nb_points=16, radius=0.05) + + + +# #inlier_cloud = input_pointcloud.select_by_index(ind) + +# #scale = 0.1 + +# #while(scale < 2.0): + +# # print("meshing...") +# # print('run Poisson surface reconstruction') + +# # with o3d.utility.VerbosityContextManager( +# # o3d.utility.VerbosityLevel.Debug) as cm: +# # mesh, densities = o3d.geometry.TriangleMesh.create_from_point_cloud_poisson( +# # input_pointcloud, depth=int(recon_depth), scale=0.9) + +# # with o3d.utility.VerbosityContextManager( +# # o3d.utility.VerbosityLevel.Debug) as cm: +# # triangle_clusters, cluster_n_triangles, cluster_area = ( +# # mesh.cluster_connected_triangles()) +# # triangle_clusters = np.asarray(triangle_clusters) +# # cluster_n_triangles = np.asarray(cluster_n_triangles) +# # cluster_area = np.asarray(cluster_area) + +# # triangles_to_remove = cluster_n_triangles[triangle_clusters] < 100 +# # mesh.remove_triangles_by_mask(triangles_to_remove) + +# # print(f"saving (scale: 0.9)...") +# # o3d.io.write_triangle_mesh(output_folder + f"/meshed_poisson_cleanup.ply", mesh, write_ascii=False) +# # scale+=0.1 + diff --git a/python/removeOutliers/removeOutliers.py b/python/removeOutliers/removeOutliers.py new file mode 100644 index 0000000..68dd669 --- /dev/null +++ b/python/removeOutliers/removeOutliers.py @@ -0,0 +1,32 @@ +import optparse +import open3d as o3d + +parser = optparse.OptionParser() +parser.add_option("-i","--input_pointcloud",action="store",help="Input Pointcloud") +parser.add_option("-o","--output_folder",action="store",help="Folder where Results are stored") +options, args = parser.parse_args() +input_pointcloud = options.input_pointcloud +output_folder = options.output_folder + + +pcd = o3d.io.read_point_cloud(input_pointcloud) + +cl, ind = pcd.remove_statistical_outlier(nb_neighbors=20, std_ratio=0.5) +#cl, ind = pcd.remove_radius_outlier(nb_points=16, radius=0.05) + +print("filtering...") + +inlier_cloud = pcd.select_by_index(ind) + + +#pcd.normals = o3d.utility.Vector3dVector(np.zeros( +# (1, 3))) # invalidate existing normals + +#pcd.estimate_normals() + +#print("Meshing") +#radii = [0.005, 0.01, 0.02, 0.04] +#rec_mesh = o3d.geometry.TriangleMesh.create_from_point_cloud_ball_pivoting(inlier_cloud, /#o3d.utility.DoubleVector(radii)) + +print("saving...") +o3d.io.write_point_cloud(output_folder + "/outliers_removed.ply", inlier_cloud, write_ascii=False) diff --git a/python/resizeImages/resizeImages.py b/python/resizeImages/resizeImages.py new file mode 100644 index 0000000..f848b6a --- /dev/null +++ b/python/resizeImages/resizeImages.py @@ -0,0 +1,51 @@ + +from PIL import Image +import os, os.path +import optparse +import shutil + +parser = optparse.OptionParser() +parser.add_option("-i","--image_folder",action="store",help="Imager folder") +parser.add_option("-r","--resolution_decrease",action="store",help="resolution decrease") +# parser.add_option("-o","--output_folder",action="store",help="Folder where Results are stored") +options, args = parser.parse_args() +image_folder = options.image_folder +resolution_decrease = options.resolution_decrease + +# output_folder = options.output_folder + +# image_list = [Image.open(item) for i in [glob.glob(f'{image_folder}/*.%s' % ext) for ext in ["jpg","tif","png","tiff", "jpeg"]] for item in i] +try: + os.chdir(image_folder) + os.mkdir("downres") +except: + print("Folder exists") + +imgs = [] +valid_images = [".jpg",".tif",".png",".tiff", ".jpeg", ".tga"] +for f in os.listdir(image_folder): + ext = os.path.splitext(f)[1] + if ext.lower() not in valid_images: + continue + imgs.append(f) + +for image_filename in imgs: + print(image_filename) + image = Image.open(os.path.join(image_folder,image_filename)) + + image_resized = image.resize((int(image.size[0]/float(resolution_decrease)), int(image.size[1]/float(resolution_decrease)))) + image_resized.save(os.path.join(os.path.join(image_folder,"downres"),image_filename)) + +cam_files = [] +valid_cam_files = [".cam"] +for f in os.listdir(image_folder): + ext = os.path.splitext(f)[1] + if ext.lower() not in valid_cam_files: + continue + # cam_files.append(f) + print(f) + shutil.copy(os.path.join(image_folder,f), os.path.join(os.path.join(image_folder,"downres"),f)) + +# src_path = r"E:\demos\files\report\profit.txt" +# dst_path = r"E:\demos\files\account\profit.txt" + diff --git a/python/textureMesh.py b/python/textureMesh.py new file mode 100644 index 0000000..1219e3a --- /dev/null +++ b/python/textureMesh.py @@ -0,0 +1,32 @@ +import os +import pymeshlab +import optparse + +parser = optparse.OptionParser() +parser.add_option("-p","--project",action="store",help="Input Project") +parser.add_option("-m","--mesh",action="store",help="To be textured mesh") +parser.add_option("-o","--output_folder",action="store",help="Folder where Results are stored") +parser.add_option("-t","--face_reduction_factor",action="store",help="face reduction factor (0 = disabled)") +options, args = parser.parse_args() +project = options.project +output_folder = options.output_folder +mesh = options.mesh +face_reduction_factor = float(options.face_reduction_factor) + +ms = pymeshlab.MeshSet() +print("loading project...") +ms.load_project(project) +# ms.load_project(['bundle.rd.out', 'cams.txt']) +# print(ms.number_rasters()) +ms.delete_current_mesh() +print('reading...') +ms.load_new_mesh(mesh) +if(face_reduction_factor != 0): + ms.meshing_decimation_quadric_edge_collapse(targetfacenum=int(ms.current_mesh().face_number()/face_reduction_factor)) +# ms.set_current_mesh(new_curr_id=1) +print('texturing') +ms.meshing_repair_non_manifold_edges() +ms.compute_texcoord_parametrization_and_texture_from_registered_rasters(texturesize=8192,texturename="texture.jpg") +print('saving') +ms.save_current_mesh(os.path.join(output_folder,"textured.obj")) +# mesh(self: pmeshlab.MeshSet, id: int) → pmeshlab.Mesh \ No newline at end of file