Skip to content

Commit

Permalink
[MERGE] Merged master, fixed merge conflicts related to vpDisplayFact…
Browse files Browse the repository at this point in the history
…ory use
  • Loading branch information
rlagneau committed Jul 1, 2024
2 parents 70591bb + a19b3c5 commit 9057c9f
Show file tree
Hide file tree
Showing 58 changed files with 593 additions and 275 deletions.
2 changes: 1 addition & 1 deletion 3rdparty/simdlib/Simd/SimdAlignment.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ namespace Simd

SIMD_INLINE size_t Alignment()
{
#if defined(WIN32)
#if defined(_WIN32)
return GetAlignment();
#else
return ALIGNMENT;
Expand Down
2 changes: 1 addition & 1 deletion 3rdparty/simdlib/Simd/SimdAllocator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ namespace Simd
*/
static SIMD_INLINE size_t Alignment()
{
#if defined(__SimdAlignment_h__) && defined(WIN32)
#if defined(__SimdAlignment_h__) && defined(_WIN32)
return Simd::Alignment();
#else
return SimdAlignment();
Expand Down
6 changes: 3 additions & 3 deletions 3rdparty/simdlib/Simd/SimdBaseCpu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
#include <sstream>
#include <iostream>

#if defined(_MSC_VER)
#if defined(_WIN32)

#ifndef NOMINMAX
#define NOMINMAX
Expand Down Expand Up @@ -77,7 +77,7 @@ namespace Simd {
#if defined(SIMD_X86_ENABLE) || defined(SIMD_X64_ENABLE)
bool CheckBit(int eax, int ecx, Cpuid::Register index, Cpuid::Bit bit) {
unsigned int registers[4] = { 0, 0, 0, 0 };
#if defined(_MSC_VER)
#if defined(_WIN32)
__cpuidex((int*)registers, eax, ecx);
#elif (defined __GNUC__)
if (__get_cpuid_max(0, NULL) < eax)
Expand Down Expand Up @@ -124,7 +124,7 @@ namespace Simd {
}
#endif

#if defined(_MSC_VER)
#if defined(_WIN32)
typedef SYSTEM_LOGICAL_PROCESSOR_INFORMATION Info;

void GetLogicalProcessorInformation(std::vector<Info>& info) {
Expand Down
4 changes: 2 additions & 2 deletions 3rdparty/simdlib/Simd/SimdLib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
#define SIMD_LIB_CPP
#endif

#if defined(WIN32) && !defined(SIMD_STATIC)
#if defined(_WIN32) && !defined(SIMD_STATIC)

#define SIMD_EXPORTS
#ifndef NOMINMAX
Expand All @@ -50,7 +50,7 @@ BOOL APIENTRY DllMain(HMODULE hModule, DWORD dwReasonForCall, LPVOID lpReserved)
}
return TRUE;
}
#endif//WIN32
#endif//_WIN32

#include "Simd/SimdLib.h"

Expand Down
5 changes: 4 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1711,13 +1711,16 @@ status(" Build with moment combine:" ENABLE_MOMENTS_COMBINE_MATRICES THEN "y
# ===================== Optional 3rd parties =====================
status("")
status(" OpenCV: ")
status(" Version:" USE_OPENCV THEN "${OpenCV_VERSION}" ELSE "n/a")
status(" Version:" USE_OPENCV THEN "${OpenCV_VERSION}" ELSE "n/a")
if(USE_OPENCV)
vp_list_replace_string(OpenCV_LIB_COMPONENTS OpenCV_LIB_COMPONENTS_FILTERED "^opencv_+" "")
status(" Modules:" "${OpenCV_LIB_COMPONENTS_FILTERED}")
status(" OpenCV dir:" "${OpenCV_DIR}")
endif()
status("")
status(" YARP: ")
status(" Version:" USE_YARP THEN "${YARP_VERSION_SHORT}" ELSE "n/a")
status("")
status(" Mathematics: ")
status(" Blas/Lapack:" (USE_LAPACK OR WITH_LAPACK) THEN "yes" ELSE "no")
status(" \\- Use MKL:" USE_MKL THEN "yes" ELSE "no")
Expand Down
1 change: 1 addition & 0 deletions ChangeLog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ ViSP 3.x.x (Version in development)
. [#1337] The pose of the automatic datageneration pipeline from blenderproc seems wrong
. [#1341] SVD computation fails with Lapack when m < n
. [#1370] encountered compilation errors while building the ViSP library
. [#1424] Unable to detect Yarp 3.9.0
----------------------------------------------
ViSP 3.6.0 (released September 22, 2023)
- Contributors:
Expand Down
3 changes: 2 additions & 1 deletion example/device/framegrabber/grabV4l2MultiCpp11Thread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ bool getOptions(int argc, char **argv, unsigned int &deviceCount, bool &saveVide
return true;
}

#ifndef DOXYGEN_SHOULD_SKIP_THIS
// Code adapted from the original author Dan Mašek to be compatible with ViSP
// image
class vpFrameQueue
Expand Down Expand Up @@ -204,7 +205,6 @@ class vpFrameQueue

class vpStorageWorker
{

public:
vpStorageWorker(vpFrameQueue &queue, const std::string &filename, unsigned int width, unsigned int height)
: m_queue(queue), m_filename(filename), m_width(width), m_height(height)
Expand Down Expand Up @@ -430,6 +430,7 @@ void display(unsigned int width, unsigned int height, int win_x, int win_y, unsi
}

} // Namespace
#endif // DOXYGEN_SHOULD_SKIP_THIS

int main(int argc, char *argv[])
{
Expand Down
16 changes: 10 additions & 6 deletions example/device/framegrabber/saveRealSenseData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,8 @@ bool getOptions(int argc, const char *argv[], bool &save, std::string &pattern,
return true;
}

#ifndef DOXYGEN_SHOULD_SKIP_THIS

// Code adapted from: https://stackoverflow.com/a/37146523
class vpFrameQueue
{
Expand Down Expand Up @@ -575,7 +577,7 @@ class vpStorageWorker
}
else if (m_save_pcl_npz_format) {
#ifdef VISP_HAVE_MINIZ
// Write Npz headers
// Write Npz headers
std::vector<char> vec_filename(filename_point_cloud.begin(), filename_point_cloud.end());
// Null-terminated character is handled at reading
// For null-terminated character handling, see:
Expand Down Expand Up @@ -662,6 +664,8 @@ class vpStorageWorker
};
} // Namespace

#endif // DOXYGEN_SHOULD_SKIP_THIS

int main(int argc, const char *argv[])
{
bool save = false;
Expand Down Expand Up @@ -935,10 +939,10 @@ int main(int argc, const char *argv[])
#else
if (save_pointcloud) {
ptr_pointCloud = std::make_unique<std::vector<vpColVector>>(pointCloud);
}
}
save_queue.push(ptr_colorImg, ptr_depthImg, ptr_pointCloud, ptr_infraredImg);
#endif
}
}

double delta_time = vpTime::measureTimeMs() - start;
vec_delta_time.push_back(delta_time);
Expand Down Expand Up @@ -982,10 +986,10 @@ int main(int argc, const char *argv[])
#else
if (save_pointcloud) {
ptr_pointCloud = std::make_unique<std::vector<vpColVector>>(pointCloud);
}
}
save_queue.push(ptr_colorImg, ptr_depthImg, ptr_pointCloud, ptr_infraredImg);
#endif
}
}
break;

case vpMouseButton::button2:
Expand All @@ -995,9 +999,9 @@ int main(int argc, const char *argv[])
quit = true;
save_queue.cancel();
break;
}
}
}
}
}

double mean_vec_delta_time = vpMath::getMean(vec_delta_time);
Expand Down
32 changes: 18 additions & 14 deletions modules/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,24 @@ if(USE_OPENCV)
endif(USE_OPENCV)

if(USE_YARP)
list(APPEND opt_incs ${YARP_INCLUDE_DIRS})
foreach(lib_ ${YARP_LIBRARIES})
get_target_property(imported_libs_ ${lib_} INTERFACE_LINK_LIBRARIES)
if(imported_libs_)
list(APPEND YARP_LIBS ${lib_})
list(APPEND YARP_IMPORTED_LIBS ${imported_libs_})
else()
list(APPEND YARP_LIBS ${lib_})
endif()

get_target_property(imported_incs_ ${lib_} INTERFACE_INCLUDE_DIRECTORIES)
if(imported_incs_)
list(APPEND YARP_IMPORTED_INCLUDE_DIRS ${imported_incs_})
endif()
endforeach()
vp_list_unique(YARP_IMPORTED_LIBS)
vp_list_unique(YARP_IMPORTED_INCLUDE_DIRS)

list(APPEND opt_incs ${YARP_IMPORTED_INCLUDE_DIRS})

# Work around to add Yarp libraries and also third party libraries requested by Yarp
list(REVERSE YARP_LIBRARIES) # to start with YARP_init, that depends on YARP_dev, YARP_sig and YARP_OS
Expand All @@ -182,21 +199,8 @@ if(USE_YARP)
else()
list(APPEND opt_libs ${YARP_LIB}) # Append full absolute library path and name
endif()
# Get 3rd party libraries requested by Yarp
get_target_property(YARP_LINK_LIBS_ ${lib} "IMPORTED_LINK_INTERFACE_LIBRARIES_${CONFIGURATION}")
list(APPEND YARP_LINK_LIBS ${YARP_LINK_LIBS_})
endforeach()
endforeach()

# Remove Yarp libraries since they were added previously with full absolute library path and name
if(YARP_LINK_LIBS)
foreach(lib ${YARP_LIBRARIES})
list(REMOVE_ITEM YARP_LINK_LIBS ${lib})
endforeach()
endif()
# Add 3rd party libraries requested by Yarp
list(APPEND opt_libs ${YARP_LINK_LIBS})
add_definitions(${YARP_DEFINES})
endif(USE_YARP)

# Math: eigen3, gsl, mkl, openblas, atlas, netlib, OpenCV
Expand Down
70 changes: 31 additions & 39 deletions modules/core/include/visp3/core/vpGaussRand.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,51 +49,43 @@ BEGIN_VISP_NAMESPACE
their mean equal to 10 with a standard deviation equal to 0.5.
\code
#include <iostream>
#include <visp3/core/vpGaussRand.h>
#ifdef ENABLE_VISP_NAMESPACE
using namespace VISP_NAMESPACE_NAME;
#endif
#include <iostream>
#include <visp3/core/vpGaussRand.h>
int main()
{
vpGaussRand noise(0.5, 10);
for(int i=0; i< 10; i++) {
std::cout << "noise " << i << ": " << noise() << std::endl;
int main()
{
vpGaussRand noise(0.5, 10);
for(int i=0; i< 10; i++) {
std::cout << "noise " << i << ": " << noise() << std::endl;
}
return 0;
}
return 0;
}
\endcode
The previous example produces the following printings:
\verbatim
noise 0: 10.645
noise 1: 9.67129
noise 2: 10.1208
noise 3: 10.1039
noise 4: 10.8667
noise 5: 9.89823
noise 6: 9.81414
noise 7: 9.96076
noise 8: 11.0795
noise 9: 9.79229
noise 0: 10.645
noise 1: 9.67129
noise 2: 10.1208
noise 3: 10.1039
noise 4: 10.8667
noise 5: 9.89823
noise 6: 9.81414
noise 7: 9.96076
noise 8: 11.0795
noise 9: 9.79229
\endverbatim
Note that the previous example produces always the same "random" results. To
produce real random values, you need to initialize the random generator with
different values using seed(). For example, this could be done using the
current time. The code becomes:
produce real random values, you need to initialize the random generator with
different values using seed(). For example, this could be done using the
current time. The code becomes:
\verbatim
#include <iostream>
#include <visp3/core/vpGaussRand.h>
#include <visp3/core/vpTime.h>
#ifdef ENABLE_VISP_NAMESPACE
using namespace VISP_NAMESPACE_NAME;
#endif
int main()
{
vpGaussRand noise(0.5, 10);
Expand Down Expand Up @@ -123,15 +115,6 @@ current time. The code becomes:
*/
class VISP_EXPORT vpGaussRand
{
private:
double gaussianDraw();

vpUniRand m_rng;
double m_mean;
double m_sigma;
bool m_AlreadyDone;
double m_x2;

public:
/*!
Default noise generator constructor.
Expand Down Expand Up @@ -172,6 +155,15 @@ class VISP_EXPORT vpGaussRand
Return a random value from the Gaussian noise generator.
*/
double operator()() { return m_sigma * gaussianDraw() + m_mean; }

private:
double gaussianDraw();

vpUniRand m_rng;
double m_mean;
double m_sigma;
bool m_AlreadyDone;
double m_x2;
};
END_VISP_NAMESPACE
#endif
8 changes: 4 additions & 4 deletions modules/core/include/visp3/core/vpImageTools_warp.h
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ void vpImageTools::warpLinear(const vpImage<Type> &src, const vpMatrix &T, vpIma
const Type val11 = src[y_ + 1][x_ + 1];
const int64_t interp_i64 =
static_cast<int64_t>(((s_1 * t_1) * val00) + ((s * t_1) * val01) + ((s_1 * t) * val10) + ((s * t) * val11));
const float interp = (interp_i64 >> (nbits * 2)) + ((interp_i64 & 0xFFFFFFFF) * precision_2);
const float interp = (interp_i64 >> (nbits * 2)) + ((interp_i64 & 0xFFFFFFFFU) * precision_2);
dst[i][j] = vpMath::saturate<Type>(interp);
}
else if (y_ < (static_cast<int>(src.getHeight()) - 1)) {
Expand Down Expand Up @@ -498,15 +498,15 @@ inline void vpImageTools::warpLinearFixedPointNotCenter(const vpImage<vpRGBa> &s
const vpRGBa val11 = src[y_ + 1][x_ + 1];
const int64_t interpR_i64 =
static_cast<int64_t>((s_1 * t_1 * val00.R) + (s * t_1 * val01.R) + (s_1 * t * val10.R) + (s * t * val11.R));
const float interpR = (interpR_i64 >> (nbits * 2)) + ((interpR_i64 & 0xFFFFFFFF) * precision_2);
const float interpR = (interpR_i64 >> (nbits * 2)) + ((interpR_i64 & 0xFFFFFFFFU) * precision_2);

const int64_t interpG_i64 =
static_cast<int64_t>((s_1 * t_1 * val00.G) + (s * t_1 * val01.G) + (s_1 * t * val10.G) + (s * t * val11.G));
const float interpG = (interpG_i64 >> (nbits * 2)) + ((interpG_i64 & 0xFFFFFFFF) * precision_2);
const float interpG = (interpG_i64 >> (nbits * 2)) + ((interpG_i64 & 0xFFFFFFFFU) * precision_2);

const int64_t interpB_i64 =
static_cast<int64_t>((s_1 * t_1 * val00.B) + (s * t_1 * val01.B) + (s_1 * t * val10.B) + (s * t * val11.B));
const float interpB = (interpB_i64 >> (nbits * 2)) + ((interpB_i64 & 0xFFFFFFFF) * precision_2);
const float interpB = (interpB_i64 >> (nbits * 2)) + ((interpB_i64 & 0xFFFFFFFFU) * precision_2);

dst[i][j] = vpRGBa(vpMath::saturate<unsigned char>(interpR), vpMath::saturate<unsigned char>(interpG),
vpMath::saturate<unsigned char>(interpB), 255);
Expand Down
5 changes: 3 additions & 2 deletions modules/core/include/visp3/core/vpIoTools.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,10 @@
#include <complex>

#if VISP_CXX_STANDARD > VISP_CXX_STANDARD_98

namespace visp
{
#ifndef DOXYGEN_SHOULD_SKIP_THIS
// https://github.com/BinomialLLC/basis_universal/blob/ad9386a4a1cf2a248f7bbd45f543a7448db15267/encoder/basisu_miniz.h#L665
static inline unsigned long vp_mz_crc32(unsigned long crc, const unsigned char *ptr, size_t buf_len)
{
Expand All @@ -73,6 +75,7 @@ static inline unsigned long vp_mz_crc32(unsigned long crc, const unsigned char *
}
return ~crcu32;
}
#endif // DOXYGEN_SHOULD_SKIP_THIS

#ifdef VISP_HAVE_MINIZ
namespace cnpy
Expand Down Expand Up @@ -126,8 +129,6 @@ struct NpyArray

using npz_t = std::map<std::string, NpyArray>;
VISP_EXPORT npz_t npz_load(std::string fname);


VISP_EXPORT char BigEndianTest();
VISP_EXPORT char map_type(const std::type_info &t);
template<typename T> std::vector<char> create_npy_header(const std::vector<size_t> &shape);
Expand Down
1 change: 1 addition & 0 deletions modules/core/include/visp3/core/vpRGBf.h
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ class VISP_EXPORT vpRGBf
float B; //!< Blue component.

friend VISP_EXPORT vpRGBf operator*(double x, const vpRGBf &rgb);
friend VISP_EXPORT vpRGBf operator*(float x, const vpRGBf &rgb);
};
END_VISP_NAMESPACE
#endif
Loading

0 comments on commit 9057c9f

Please sign in to comment.