diff --git a/CMakeLists.txt b/CMakeLists.txt index f0221349f..a42acd8b5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -50,8 +50,8 @@ ENDIF() # ${OpenMVS_BINARY_DIR}. PROJECT(OpenMVS) -cmake_policy(SET CMP0127 NEW) -cmake_dependent_option(OpenMVS_USE_SSE "Enable SSE optimizations" ON "NOT CMAKE_SYSTEM_PROCESSOR MATCHES \"^(arm|ARM|aarch64|AARCH64).\"" OFF) +# cmake_policy(SET CMP0127 NEW) +# cmake_dependent_option(OpenMVS_USE_SSE "Enable SSE optimizations" ON "NOT CMAKE_SYSTEM_PROCESSOR MATCHES \"^(arm|ARM|aarch64|AARCH64).\"" OFF) SET(OpenMVS_MAJOR_VERSION 2) SET(OpenMVS_MINOR_VERSION 2) diff --git a/apps/CMakeLists.txt b/apps/CMakeLists.txt index 3bb00c6c6..e7c788f99 100644 --- a/apps/CMakeLists.txt +++ b/apps/CMakeLists.txt @@ -1,14 +1,14 @@ # Add applications -ADD_SUBDIRECTORY(InterfaceCOLMAP) -ADD_SUBDIRECTORY(InterfaceMetashape) -ADD_SUBDIRECTORY(InterfaceMVSNet) -ADD_SUBDIRECTORY(InterfacePolycam) +#ADD_SUBDIRECTORY(InterfaceCOLMAP) +#ADD_SUBDIRECTORY(InterfaceMetashape) +#ADD_SUBDIRECTORY(InterfaceMVSNet) +#ADD_SUBDIRECTORY(InterfacePolycam) ADD_SUBDIRECTORY(DensifyPointCloud) ADD_SUBDIRECTORY(ReconstructMesh) ADD_SUBDIRECTORY(RefineMesh) -ADD_SUBDIRECTORY(TextureMesh) -ADD_SUBDIRECTORY(TransformScene) -ADD_SUBDIRECTORY(Viewer) +#ADD_SUBDIRECTORY(TextureMesh) +#ADD_SUBDIRECTORY(TransformScene) +#ADD_SUBDIRECTORY(Viewer) if(OpenMVS_ENABLE_TESTS) ADD_SUBDIRECTORY(Tests) endif() diff --git a/apps/DensifyPointCloud/DensifyPointCloud.cpp b/apps/DensifyPointCloud/DensifyPointCloud.cpp index cde482a86..f8531d7e2 100644 --- a/apps/DensifyPointCloud/DensifyPointCloud.cpp +++ b/apps/DensifyPointCloud/DensifyPointCloud.cpp @@ -70,6 +70,7 @@ int nExportNumViews; int nArchiveType; int nProcessPriority; unsigned nMaxThreads; +int mockCudaDevice; String strConfigFileName; boost::program_options::variables_map vm; } // namespace OPT @@ -101,6 +102,8 @@ bool Initialize(size_t argc, LPCTSTR* argv) #endif #ifdef _USE_CUDA ("cuda-device", boost::program_options::value(&CUDA::desiredDeviceID)->default_value(-1), "CUDA device number to be used for depth-map estimation (-2 - CPU processing, -1 - best GPU, >=0 - device index)") + #else + ("cuda-device", boost::program_options::value(&OPT::mockCudaDevice)->default_value(-1), "Just a placeholder (not a CUDA build)") #endif ; @@ -196,7 +199,7 @@ bool Initialize(size_t argc, LPCTSTR* argv) } // initialize the log file - OPEN_LOGFILE(MAKE_PATH(APPNAME _T("-")+Util::getUniqueName(0)+_T(".log")).c_str()); + //OPEN_LOGFILE(MAKE_PATH(APPNAME _T("-")+Util::getUniqueName(0)+_T(".log")).c_str()); // print application details: version and command line Util::LogBuild(); diff --git a/apps/ReconstructMesh/ReconstructMesh.cpp b/apps/ReconstructMesh/ReconstructMesh.cpp index 24a74b945..c19ebeb62 100644 --- a/apps/ReconstructMesh/ReconstructMesh.cpp +++ b/apps/ReconstructMesh/ReconstructMesh.cpp @@ -177,7 +177,7 @@ bool Initialize(size_t argc, LPCTSTR* argv) } // initialize the log file - OPEN_LOGFILE(MAKE_PATH(APPNAME _T("-")+Util::getUniqueName(0)+_T(".log")).c_str()); + // OPEN_LOGFILE(MAKE_PATH(APPNAME _T("-")+Util::getUniqueName(0)+_T(".log")).c_str()); // print application details: version and command line Util::LogBuild(); diff --git a/apps/Viewer/CMakeLists.txt b/apps/Viewer/CMakeLists.txt index fe0920242..e9dab43ca 100644 --- a/apps/Viewer/CMakeLists.txt +++ b/apps/Viewer/CMakeLists.txt @@ -38,7 +38,9 @@ cxx_executable_with_flags(${VIEWER_NAME} "Apps" "${cxx_default}" "MVS;${OPENGL_L # Manually set Common.h as the precompiled header IF(CMAKE_VERSION VERSION_GREATER_EQUAL 3.16.0) - TARGET_PRECOMPILE_HEADERS(${VIEWER_NAME} PRIVATE "Common.h") + if(NOT WIN32) # Smaller but slower build on Windows + TARGET_PRECOMPILE_HEADERS(${VIEWER_NAME} PRIVATE "Common.h") + endif() endif() # Install diff --git a/build/Utils.cmake b/build/Utils.cmake index 9c2430faa..1854f92ee 100644 --- a/build/Utils.cmake +++ b/build/Utils.cmake @@ -17,6 +17,7 @@ OPTION(BUILD_RTTI_ENABLED "Enable support run-time type information" ON) OPTION(BUILD_STATIC_RUNTIME "Link staticaly the run-time library" OFF) OPTION(CMAKE_SUPPRESS_REGENERATION "This will cause CMake to not put in the rules that re-run CMake. This might be useful if you want to use the generated build files on another machine" OFF) OPTION(CMAKE_USE_RELATIVE_PATHS "Try to use relative paths in generated projects" OFF) +OPTION(INSTALL_USE_SUBDIR "Install into /OpenMVS subdirectories" ON) # Organize projects into folders SET_PROPERTY(GLOBAL PROPERTY USE_FOLDERS ON) @@ -817,7 +818,11 @@ macro(ConfigLibrary) else() set(${varp} "${CMAKE_INSTALL_PREFIX}/${${var}}") endif() - set(${var} "${${varp}}/${PROJECT_NAME}") + if(INSTALL_USE_SUBDIR) + set(${var} "${${varp}}/${PROJECT_NAME}") + else() + set(${var} "${${varp}}") + endif() endforeach() endmacro() diff --git a/libs/Common/CMakeLists.txt b/libs/Common/CMakeLists.txt index 18899afde..2008665ff 100644 --- a/libs/Common/CMakeLists.txt +++ b/libs/Common/CMakeLists.txt @@ -8,7 +8,9 @@ cxx_library_with_type(Common "Libs" "" "${cxx_default}" # Manually set Common.h as the precompiled header IF(CMAKE_VERSION VERSION_GREATER_EQUAL 3.16.0) - TARGET_PRECOMPILE_HEADERS(Common PRIVATE "Common.h") + if(NOT WIN32) # Smaller but slower build on Windows + TARGET_PRECOMPILE_HEADERS(Common PRIVATE "Common.h") + endif() endif() # Link its dependencies diff --git a/libs/Common/File.h b/libs/Common/File.h index 2e431bccd..166779c47 100644 --- a/libs/Common/File.h +++ b/libs/Common/File.h @@ -468,7 +468,7 @@ class GENERAL_API File : public IOStream { if (flags & NOBUFFER) m |= O_DIRECT; #endif - h = ::open(aFileName, m, S_IRUSR | S_IWUSR); + h = ::open(aFileName, m, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); } virtual void close() { diff --git a/libs/Common/Util.cpp b/libs/Common/Util.cpp index 1ae22cb66..523664914 100644 --- a/libs/Common/Util.cpp +++ b/libs/Common/Util.cpp @@ -434,16 +434,16 @@ String Util::GetOSInfo() String Util::GetDiskInfo(const String& path) { - #if defined(_SUPPORT_CPP17) && (!defined(__GNUC__) || (__GNUC__ > 7)) + // #if defined(_SUPPORT_CPP17) && (!defined(__GNUC__) || (__GNUC__ > 8)) - const std::filesystem::space_info si = std::filesystem::space(path.c_str()); - return String::FormatString("%s (%s) space", formatBytes(si.available).c_str(), formatBytes(si.capacity).c_str()); + // const std::filesystem::space_info si = std::filesystem::space(path.c_str()); + // return String::FormatString("%s (%s) space", formatBytes(si.available).c_str(), formatBytes(si.capacity).c_str()); - #else + // #else return String(); - #endif // _SUPPORT_CPP17 + // #endif // _SUPPORT_CPP17 } /*----------------------------------------------------------------*/ diff --git a/libs/Common/Util.h b/libs/Common/Util.h index 871f92835..db2976ac5 100644 --- a/libs/Common/Util.h +++ b/libs/Common/Util.h @@ -824,6 +824,49 @@ class GENERAL_API Util lastMsgLen = msgLen; } }; + + template + static std::pair ComputePercentileMinMax(const T *data, size_t size){ + if (size == 0) + return std::make_pair(0, 0); + + // Find min/max + T aMin = data[0]; + T aMax = data[0]; + + for (size_t i = 1; i < size; i++) { + if (data[i] > aMax) aMax = data[i]; + if (data[i] < aMin) aMin = data[i]; + } + + const float range = static_cast(aMax - aMin); + if (range == 0.0f) + return std::make_pair(aMin, aMax); + + float closestMinP = 9999.0f; + float closestMaxP = 9999.0f; + + T min = 0; + T max = 0; + + // Get min/max values at the 10th and 90th percentile + for (size_t i = 0; i < size; i++) { + const float percentile = (static_cast(data[i]) - static_cast(aMin)) / range; + const float minP = abs(percentile - 0.1f); + const float maxP = abs(percentile - 0.9f); + + if (minP < closestMinP) { + min = data[i]; + closestMinP = minP; + } + if (maxP < closestMaxP) { + max = data[i]; + closestMaxP = maxP; + } + } + + return std::make_pair(min, max); + } }; /*----------------------------------------------------------------*/ diff --git a/libs/IO/CMakeLists.txt b/libs/IO/CMakeLists.txt index 0f0595194..0c71cb97f 100644 --- a/libs/IO/CMakeLists.txt +++ b/libs/IO/CMakeLists.txt @@ -34,7 +34,9 @@ cxx_library_with_type(IO "Libs" "" "${cxx_default}" # Manually set Common.h as the precompiled header IF(CMAKE_VERSION VERSION_GREATER_EQUAL 3.16.0) - TARGET_PRECOMPILE_HEADERS(IO PRIVATE "Common.h") + if(NOT WIN32) # Smaller but slower build on Windows + TARGET_PRECOMPILE_HEADERS(IO PRIVATE "Common.h") + endif() endif() # Link its dependencies diff --git a/libs/IO/Image.cpp b/libs/IO/Image.cpp index 3d3e1cecb..b046f8bff 100644 --- a/libs/IO/Image.cpp +++ b/libs/IO/Image.cpp @@ -194,6 +194,8 @@ CImage::Size CImage::GetStride(PIXELFORMAT pixFormat) { case PF_A8: case PF_GRAY8: + case PF_GRAYU16: + case PF_GRAYF32: return 1; case PF_R5G6B5: return 2; @@ -237,6 +239,8 @@ bool CImage::FormatHasAlpha(PIXELFORMAT format) case PF_DXT5: return true; case PF_GRAY8: + case PF_GRAYU16: + case PF_GRAYF32: case PF_R5G6B5: case PF_B8G8R8: case PF_R8G8B8: @@ -409,6 +413,91 @@ bool CImage::FilterFormat(void* pDst, PIXELFORMAT formatDst, Size strideDst, con ((uint8_t*)pDst)[2] = ((uint8_t*)pSrc)[1]; } return true; + + case PF_GRAYU16:{ + // from PF_GRAYU16 to PF_R8G8B8 + + uint16_t *pData = (uint16_t*)pSrc; + std::pair mm = Util::ComputePercentileMinMax(pData, nSzize); + uint16_t min = mm.first; + uint16_t max = mm.second; + + for (Size i=0; i mm = Util::ComputePercentileMinMax(pData, nSzize); + float min = mm.first; + float max = mm.second; + + for (Size i=0; i mm = Util::ComputePercentileMinMax(pData, nSzize); + uint16_t min = mm.first; + uint16_t max = mm.second; + + for (Size i=0; i mm = Util::ComputePercentileMinMax(pData, nSzize); + float min = mm.first; + float max = mm.second; + + for (Size i=0; i IMAGEPTR; } // namespace SEACAVE + #endif // __SEACAVE_IMAGE_H__ diff --git a/libs/IO/ImageTIFF.cpp b/libs/IO/ImageTIFF.cpp index bfdd7e177..bb4ecd09b 100644 --- a/libs/IO/ImageTIFF.cpp +++ b/libs/IO/ImageTIFF.cpp @@ -29,44 +29,41 @@ using namespace SEACAVE; /* ISO C++ uses a 'std::streamsize' type to define counts. This makes it similar to, (but perhaps not the same as) size_t. - The std::ios::pos_type is used to represent stream positions as used by tellg(), tellp(), seekg(), and seekp(). This makes it similar to (but perhaps not the same as) 'off_t'. The std::ios::streampos type is used for character streams, but is documented to not be an integral type anymore, so it should *not* be assigned to an integral type. - The std::ios::off_type is used to specify relative offsets needed by the variants of seekg() and seekp() which accept a relative offset argument. - Useful prototype knowledge: - Obtain read position - ios::pos_type basic_istream::tellg() - + ios::pos_type basic_istream::tellg() Set read position - basic_istream& basic_istream::seekg(ios::pos_type) - basic_istream& basic_istream::seekg(ios::off_type, ios_base::seekdir) - + basic_istream& basic_istream::seekg(ios::pos_type) + basic_istream& basic_istream::seekg(ios::off_type, ios_base::seekdir) Read data - basic_istream& istream::read(char *str, streamsize count) - + basic_istream& istream::read(char *str, streamsize count) Number of characters read in last unformatted read - streamsize istream::gcount(); - + streamsize istream::gcount(); Obtain write position - ios::pos_type basic_ostream::tellp() - + ios::pos_type basic_ostream::tellp() Set write position - basic_ostream& basic_ostream::seekp(ios::pos_type) - basic_ostream& basic_ostream::seekp(ios::off_type, ios_base::seekdir) - + basic_ostream& basic_ostream::seekp(ios::pos_type) + basic_ostream& basic_ostream::seekp(ios::off_type, ios_base::seekdir) Write data - basic_ostream& ostream::write(const char *str, streamsize count) + basic_ostream& ostream::write(const char *str, streamsize count) */ +// https://www.awaresystems.be/imaging/tiff/tifftags/sampleformat.html +enum TIFF_SAMPLEFORMAT_TYPE { + TIFF_SAMPLEFORMAT_UINT = 1, + TIFF_SAMPLEFORMAT_INT = 2, + TIFF_SAMPLEFORMAT_IEEEFP = 3 +}; + struct tiffis_data; struct tiffos_data; @@ -393,42 +390,66 @@ HRESULT CImageTIFF::ReadHeader() TIFFGetField(tif, TIFFTAG_IMAGELENGTH, &m_height) && TIFFGetField(tif, TIFFTAG_PHOTOMETRIC, &photometric)) { - uint16 bpp=8, ncn = photometric > 1 ? 3 : 1; + uint16 bpp=8, ncn = photometric > 1 ? 3 : 1, sampleFormat = 1; TIFFGetField(tif, TIFFTAG_BITSPERSAMPLE, &bpp); TIFFGetField(tif, TIFFTAG_SAMPLESPERPIXEL, &ncn); + TIFFGetField(tif, TIFFTAG_SAMPLEFORMAT, &sampleFormat); m_dataWidth = m_width; m_dataHeight= m_height; m_numLevels = 0; m_level = 0; + m_stride = ncn; - if ((bpp == 32 && ncn == 3) || photometric == PHOTOMETRIC_LOGLUV) { - // this is HDR format with 3 floats per pixel - //TODO: implement - ASSERT("error: not implemented" == NULL); - Close(); - return _FAIL; - } if (bpp > 8 && ((photometric != 2 && photometric != 1) || (ncn != 1 && ncn != 3 && ncn != 4))) bpp = 8; - switch (bpp) { + + bool implemented = true; + + switch (bpp){ case 8: - m_stride = 4; - m_format = PF_B8G8R8A8; + if (ncn >= 3) { + m_format = PF_B8G8R8A8; + m_stride = 4; + } else if (ncn == 1) { + m_format = PF_GRAY8; + m_stride = 1; + } else { + implemented = false; + } + break; + case 16: + if (ncn == 1 && sampleFormat == TIFF_SAMPLEFORMAT_UINT){ + m_format = PF_GRAYU16; + m_stride = 2; + }else if (ncn == 3 && sampleFormat == TIFF_SAMPLEFORMAT_UINT){ + m_format = PF_R16G16B16; + m_stride = 6; + }else{ + implemented = false; + } + + break; + case 32: + if (ncn == 1 && sampleFormat == TIFF_SAMPLEFORMAT_IEEEFP){ + m_format = PF_GRAYF32; + m_stride = 4; + }else if (ncn == 3 && sampleFormat == TIFF_SAMPLEFORMAT_IEEEFP){ + m_stride = 12; + m_format = PF_R32G32B32; + }else{ + implemented = false; + } + break; - //case 16: - // m_type = CV_MAKETYPE(CV_16U, photometric > 1 ? 3 : 1); - // break; - //case 32: - // m_type = CV_MAKETYPE(CV_32F, photometric > 1 ? 3 : 1); - // break; - //case 64: - // m_type = CV_MAKETYPE(CV_64F, photometric > 1 ? 3 : 1); - // break; default: - //TODO: implement + // TODO: implement support for more + implemented = false; + } + + if (!implemented) { ASSERT("error: not implemented" == NULL); LOG(LT_IMAGE, "error: unsupported TIFF image"); Close(); @@ -448,101 +469,47 @@ HRESULT CImageTIFF::ReadData(void* pData, PIXELFORMAT dataFormat, Size nStride, { if (m_state && m_width && m_height) { TIFF* tif = (TIFF*)m_state; - uint32_t tile_width0 = m_width, tile_height0 = 0; - int is_tiled = TIFFIsTiled(tif); uint16 photometric; TIFFGetField(tif, TIFFTAG_PHOTOMETRIC, &photometric); uint16 bpp = 8, ncn = photometric > 1 ? 3 : 1; TIFFGetField(tif, TIFFTAG_BITSPERSAMPLE, &bpp); TIFFGetField(tif, TIFFTAG_SAMPLESPERPIXEL, &ncn); - const int bitsPerByte = 8; - int dst_bpp = (int)(1 * bitsPerByte); - if (dst_bpp == 8) { + + const size_t buffer_size = m_stride * m_width * m_height; + CLISTDEF0(uint8_t) _buffer(buffer_size); + uint8_t* buffer = _buffer.Begin(); + + if (m_format == PF_B8G8R8A8 || m_format == PF_GRAY8){ char errmsg[1024]; if (!TIFFRGBAImageOK(tif, errmsg)) { Close(); return _INVALIDFILE; } - } - if ((!is_tiled) || - (is_tiled && - TIFFGetField(tif, TIFFTAG_TILEWIDTH, &tile_width0) && - TIFFGetField(tif, TIFFTAG_TILELENGTH, &tile_height0))) - { - if (!is_tiled) - TIFFGetField(tif, TIFFTAG_ROWSPERSTRIP, &tile_height0); - - if (tile_width0 <= 0) - tile_width0 = m_width; - - if (tile_height0 <= 0 || - (!is_tiled && tile_height0 == std::numeric_limits::max())) - tile_height0 = m_height; - - uint8_t* data = (uint8_t*)pData; - if (!is_tiled && tile_height0 == 1 && dataFormat == m_format && nStride == m_stride) { - // read image directly to the data buffer - for (Size j=0; j m_height) - tile_height = m_height - y; - - for (uint32_t x = 0; x < m_width; x += tile_width0) { - uint32_t tile_width = tile_width0; - if (x + tile_width > m_width) - tile_width = m_width - x; - - int ok; - switch (dst_bpp) { - case 8: - { - uint8_t* bstart = buffer; - if (!is_tiled) - ok = TIFFReadRGBAStrip(tif, y, (uint32_t*)buffer); - else { - ok = TIFFReadRGBATile(tif, x, y, (uint32_t*)buffer); - //Tiles fill the buffer from the bottom up - bstart += (tile_height0 - tile_height) * tile_width0 * 4; - } - if (!ok) { - Close(); - return _INVALIDFILE; - } - - for (uint32_t i = 0; i < tile_height; ++i) { - uint8_t* dst = data + x*3 + lineWidth*(tile_height - i - 1); - uint8_t* src = bstart + i*tile_width0*4; - if (!FilterFormat(dst, dataFormat, nStride, src, m_format, m_stride, tile_width)) { - Close(); - return _FAIL; - } - } - break; - } - default: - { - Close(); - return _INVALIDFILE; - } - } - } + // Simplified + if (!TIFFReadRGBAImageOriented(tif, m_width, m_height, (uint32*)buffer, ORIENTATION_TOPLEFT, 0)){ + Close(); + return _INVALIDFILE; + } + }else if (m_format == PF_GRAYU16 || m_format == PF_GRAYF32 || m_format == PF_R32G32B32 || m_format == PF_R16G16B16){ + for (uint32 y = 0; y < m_height; y++, buffer += m_lineWidth){ + if (!TIFFReadScanline(tif, buffer, y, 0)){ + Close(); + return _INVALIDFILE; } } + buffer = _buffer.Begin(); + } - return _OK; + // Data not in the format we need? + if (dataFormat != m_format || nStride != m_stride){ + if (!FilterFormat(pData, dataFormat, nStride, buffer, m_format, m_stride, m_width * m_height)) { + Close(); + return _FAIL; + } } + + return _OK; } Close(); diff --git a/libs/MVS/CMakeLists.txt b/libs/MVS/CMakeLists.txt index 853386508..60dccaf6a 100644 --- a/libs/MVS/CMakeLists.txt +++ b/libs/MVS/CMakeLists.txt @@ -41,7 +41,9 @@ cxx_library_with_type(MVS "Libs" "" "${cxx_default}" # Manually set Common.h as the precompiled header IF(CMAKE_VERSION VERSION_GREATER_EQUAL 3.16.0) - TARGET_PRECOMPILE_HEADERS(MVS PRIVATE "Common.h") + if(NOT WIN32) + TARGET_PRECOMPILE_HEADERS(MVS PRIVATE "Common.h") + endif() endif() # Link its dependencies diff --git a/libs/MVS/PatchMatchCUDA.cpp b/libs/MVS/PatchMatchCUDA.cpp index 1a6c95f99..a0548f030 100644 --- a/libs/MVS/PatchMatchCUDA.cpp +++ b/libs/MVS/PatchMatchCUDA.cpp @@ -297,6 +297,7 @@ void PatchMatchCUDA::EstimateDepthMap(DepthData& depthData) cv::resize(depthMap, depthMap, image.size(), 0, 0, cv::INTER_LINEAR); CUDA::checkCudaCall(cudaMemcpy2DToArray(cudaDepthArrays[i-1], 0, 0, depthMap.ptr(), depthMap.step[0], sizeof(float) * depthMap.cols, depthMap.rows, cudaMemcpyHostToDevice)); } + images[i] = std::move(image); cameras[i] = std::move(camera); } @@ -398,6 +399,7 @@ void PatchMatchCUDA::EstimateDepthMap(DepthData& depthData) lowResNormalMap = depthData.normalMap; lowResViewsMap = depthData.viewsMap; } + } // apply ignore mask diff --git a/libs/MVS/PointCloud.cpp b/libs/MVS/PointCloud.cpp index c62920961..dd33bb291 100644 --- a/libs/MVS/PointCloud.cpp +++ b/libs/MVS/PointCloud.cpp @@ -270,20 +270,20 @@ namespace BasicPLY { ply.describe_property(elem_names[0], 3, props+3); if (bNormals) ply.describe_property(elem_names[0], 3, props+6); - if (bViews) + // if (bViews) // ODM: always output "views" in PLY ply.describe_property(elem_names[0], props[9]); - if (bWeights) - ply.describe_property(elem_names[0], props[10]); - if (bConfidence) - ply.describe_property(elem_names[0], props[11]); - if (bScale) - ply.describe_property(elem_names[0], props[12]); + // if (bWeights) + // ply.describe_property(elem_names[0], props[10]); + // if (bConfidence) + // ply.describe_property(elem_names[0], props[11]); + // if (bScale) + // ply.describe_property(elem_names[0], props[12]); if (elem_count) ply.element_count(elem_names[0], elem_count); } - static const PLY::PlyProperty props[16]; + static const PLY::PlyProperty props[10]; }; - const PLY::PlyProperty Vertex::props[16] = { + const PLY::PlyProperty Vertex::props[10] = { {"x", PLY::Float32, PLY::Float32, offsetof(Vertex,p.x), 0, 0, 0, 0}, {"y", PLY::Float32, PLY::Float32, offsetof(Vertex,p.y), 0, 0, 0, 0}, {"z", PLY::Float32, PLY::Float32, offsetof(Vertex,p.z), 0, 0, 0, 0}, @@ -293,14 +293,15 @@ namespace BasicPLY { {"nx", PLY::Float32, PLY::Float32, offsetof(Vertex,n.x), 0, 0, 0, 0}, {"ny", PLY::Float32, PLY::Float32, offsetof(Vertex,n.y), 0, 0, 0, 0}, {"nz", PLY::Float32, PLY::Float32, offsetof(Vertex,n.z), 0, 0, 0, 0}, - {"view_indices", PLY::Uint32, PLY::Uint32, offsetof(Vertex,views.pIndices), 1, PLY::Uint8, PLY::Uint8, offsetof(Vertex,views.num)}, - {"view_weights", PLY::Float32, PLY::Float32, offsetof(Vertex,views.pWeights), 1, PLY::Uint8, PLY::Uint8, offsetof(Vertex,views.num)}, - {"confidence", PLY::Float32, PLY::Float32, offsetof(Vertex,confidence), 0, 0, 0, 0}, - {"value", PLY::Float32, PLY::Float32, offsetof(Vertex,scale), 0, 0, 0, 0}, + {"views", PLY::Uint8, PLY::Uint8, offsetof(Vertex,views.num), 0, 0, 0, 0} + //{"view_indices", PLY::Uint32, PLY::Uint32, offsetof(Vertex,views.pIndices), 1, PLY::Uint8, PLY::Uint8, offsetof(Vertex,views.num)}, + //{"view_weights", PLY::Float32, PLY::Float32, offsetof(Vertex,views.pWeights), 1, PLY::Uint8, PLY::Uint8, offsetof(Vertex,views.num)}, + //{"confidence", PLY::Float32, PLY::Float32, offsetof(Vertex,confidence), 0, 0, 0, 0}, + //{"value", PLY::Float32, PLY::Float32, offsetof(Vertex,scale), 0, 0, 0, 0}, // duplicates - {"diffuse_red", PLY::Uint8, PLY::Uint8, offsetof(Vertex,c.r), 0, 0, 0, 0}, - {"diffuse_green", PLY::Uint8, PLY::Uint8, offsetof(Vertex,c.g), 0, 0, 0, 0}, - {"diffuse_blue", PLY::Uint8, PLY::Uint8, offsetof(Vertex,c.b), 0, 0, 0, 0} + //{"diffuse_red", PLY::Uint8, PLY::Uint8, offsetof(Vertex,c.r), 0, 0, 0, 0}, + //{"diffuse_green", PLY::Uint8, PLY::Uint8, offsetof(Vertex,c.g), 0, 0, 0, 0}, + //{"diffuse_blue", PLY::Uint8, PLY::Uint8, offsetof(Vertex,c.b), 0, 0, 0, 0} }; } // namespace BasicPLY } // namespace PointCloudInternal @@ -438,7 +439,7 @@ bool PointCloud::SaveNViews(const String& fileName, uint32_t minViews, bool bLeg } } else { // describe what properties go into the vertex elements - ply.describe_property(BasicPLY::elem_names[0], 9, BasicPLY::Vertex::props); + ply.describe_property(BasicPLY::elem_names[0], 10, BasicPLY::Vertex::props); // export the array of 3D points FOREACH(i, points) { @@ -448,6 +449,7 @@ bool PointCloud::SaveNViews(const String& fileName, uint32_t minViews, bool bLeg vertex.p = points[i]; vertex.n = normals[i]; vertex.c = colors.empty() ? Pixel8U::WHITE : colors[i]; + vertex.views.num = pointViews[i].size(); ply.put_element(&vertex); } } diff --git a/libs/Math/CMakeLists.txt b/libs/Math/CMakeLists.txt index 407e2e403..89f2a9801 100644 --- a/libs/Math/CMakeLists.txt +++ b/libs/Math/CMakeLists.txt @@ -25,7 +25,9 @@ cxx_library_with_type(Math "Libs" "" "${cxx_default}" # Manually set Common.h as the precompiled header IF(CMAKE_VERSION VERSION_GREATER_EQUAL 3.16.0) - TARGET_PRECOMPILE_HEADERS(Math PRIVATE "Common.h") + if(NOT WIN32) + TARGET_PRECOMPILE_HEADERS(Math PRIVATE "Common.h") + endif() endif() # Link its dependencies diff --git a/vcpkg.json b/vcpkg.json deleted file mode 100644 index 0c1542b1a..000000000 --- a/vcpkg.json +++ /dev/null @@ -1,50 +0,0 @@ -{ - "name": "openmvs", - "version": "2.2.0", - "description": "OpenMVS: open Multi-View Stereo reconstruction library", - "homepage": "https://cdcseacave.github.io/openMVS", - "dependencies": [ - "boost-iostreams", - "boost-program-options", - "boost-serialization", - "boost-system", - "boost-throw-exception", - { - "name": "cgal", - "default-features": false - }, - "eigen3", - "glew", - "glfw3", - "libpng", - { - "name": "opencv", - "features": [ - "eigen", - "openexr" - ] - }, - "opencv", - "opengl", - "tiff", - "vcglib", - "zlib" - ], - "features": { - "python": { - "description": "Python bindings for OpenMVS", - "dependencies": [ - "boost-python" - ] - }, - "cuda": { - "description": "CUDA support for OpenMVS", - "dependencies": [ - "cuda" - ] - }, - "openmp": { - "description": "OpenMP support for OpenMVS" - } - } -}