This is the repository of my project for the CMU course 16-823 Physics-Based Methods in Vision. The collected data and generated figures are available at this link.
Some scripts included in this repo:
capture_frames.pyprovides the live feed of the camera. Collect the current frame by pressingc.plot_histograms.pycontains all the code we used to generate figures in the report.
Some guides on compiling the Royale SDK (downloadable from the official website of PMD):
The binary files in roypy/ are for Python 3.10 on Windows. If you want to build on your version of Python:
First, install Visual Studio, CMake, and swig. Make sure they are in your PATH or install them with scoop / winget:
winget install cmake
scoop install swigThen, activate your virtual environment, in which you should install numpy, matplotlib, and pywin32. To make sure it compiles windows, define ssize_t in swig/roypy.h by
#if defined(_MSC_VER)
#include <BaseTsd.h>
typedef SSIZE_T ssize_t;
#endifor if that doesn't work, try:
#if !defined(ssize_t) && !defined(__MINGW32__)
#if defined(_WIN64)
typedef __int64 ssize_t;
#else
typedef long ssize_t;
#endif
#endifWith the correct python path set, run
cmake -S .\swig -B .\_build -G "Visual Studio 16 2019" -Droyale_USE_NUMPY_IN_ROYPY=onYou may also include -T ClangCL if you prefer. You mays also see if other versions of Visual Studio work, and as far as I tested, VS2019 should work well with Python 3.10 and Python 3.11.
Build and copy the built files to your project path, amke sure there is a file called _roypy.pyd:
cmake --build .\_build\ --config Release
cp .\_build\bin\* .\you might be seeing some warnings, but it's OK to ignore them. Now you may try if everything works by
python .\sample_opencv.py-
The binary file you need now is
_roypy.so, and it may not be found in_build/bin; check if it is in_build/. -
If you see some weird "QObject" and "QThread" errors, install
opencvfrom source:sudo apt install libgtk2.0-dev pkg-config # this is necessary for imshow() pip install --no-binary opencv-python opencv-pythonRun
pip cache purgeif necessary.