Piero V.

PyElas

Recently, I started experimenting with stereo vision.

It is a technique to produce depth maps using images captured by close positions. Then, with these maps, it is possible to create 3D representations.

The core of this workflow is the matching algorithm, which takes pairs of post-processed images and creates a “disparity” map. The disparity is the distance between a point in the two images. Depth and disparity are inverses, so it is easy to switch from one to the other.

OpenCV contains some stereo matching algorithms, but they produced a lot of noise. So I looked for another library, and I found libelas.

It is a GPLv3 C++/MATLAB library with many parameters to tune, but I could not find a Python version. My options were to switch to C++ or to port it by myself. I chose the latter, hoping that also others can benefit from it 🙂️.

Long story short, I published my first package on PyPI: PyElas.

How to use it

You can install it using pip. Then you just have to do this: … [Leggi il resto]

On acquiring 3D models of people

For my Master’s degree thesis, I dove into acquiring static objects with a RGBD sensor. Eventually, I decided to use the Kinect Fusion algorithm, which produced decent results.

I found this topic fascinating, so I continued on my own, but in another direction: acquiring people. So, in the last few months, I have been experimenting with scanning myself and my friends with a Microsoft Kinect One.

Conditioned by my previous results, initially, I tried with point clouds.

Deformation graph approach

One approach I found in several papers consists in:

  1. acquiring only a few scans (from 6-8 points of view), with the person as still as they can;
  2. performing a rough global alignment;
  3. running ICP to improve the rigid alignment locally;
  4. downsampling the point cloud to build a deformation graph;
  5. resolving an optimization problem;
  6. deforming the denser point clouds.

Reaching point 3 is not trivial because people move. ICP can be very unforgiving, and in some cases, you also need some luck to obtain good results at this stage.

For downsampling (Point 4), I used Open3D’s voxelization followed by averaging point coordinates. I do not know how this can influence the final results compared to something like a clustering algorithm. … [Leggi il resto]

Una Fenice che torna al passato

Questione di desideri…

15 anni fa, desideravo diventare uno sviluppatore web: ero affascinato da questo mondo e avrei voluto farne parte anche io. Un po’ alla volta ho imparato a usare gli strumenti necessari e creai il mio primo sito.

12 anni fa, ho realizzato che non bastava fare delle pagine web e basta, ma dovevano avere uno scopo. Ho anche realizzato che fare sia il contenuto, che tutto il sistema per gestirlo era un lavoro enorme e le mie competenze non ne erano all’altezza. Sono quindi passato a dei CMS: Flatpress, DokuWiki e altri.

Dopo 6 mesi, poi ho deciso di tenere solo il blog, ma a parte qualche cambiamento di grafica, è rimasto così per 10 anni.

Poi, 2 anni fa, cercavo un tirocinio per l’Università e volevo che il sito potesse dare una panoramica nonché reseoconto cronografico dei miei progetti. Ne ho aprofittato per dare una rinnovata: già da diverso tempo non mi trovavo più con PHP, avevo deciso di abbandonare Flatpress e volevo che il risultato fosse più professionale. Sono passato così a Python, in particolare Django, per il backend, più un Bootstrap leggermente personalizzato per il frontend. … [Leggi il resto]

NetStylus

Preamble

Recently I started digital sculpting, and I immediately realized that the mouse is not the best tool for this scope. As any tutorial will tell you, a drawing tablet will make you much faster and much more precise.

I do not have one, but I have a Microsoft Surface Pro and a Surface Pen. However, it is the base, not-so-powerful model: it has just a Core M3 and 4GB of RAM. It was enough to study at University, but, sadly, I cannot even think of running a 3D editor in it.

Initially, I tried Weylus, a program that allows you to control a machine (my Linux desktop, in my case) through a web browser from any device with a stylus. Being web-based, it works on any device, including iPads, and it even mirrors the screen.

However, it did not play well with the barrel button of my pen. And that button is critical for a lot of workflows.

Therefore, I decided to write my own software to do so: NetStylus.

The Win32 API for tablets

I discovered that Microsoft has liked pen input methods for years: they started the Tablet PC thing with Windows XP, before 2005!

They have several APIs and functionality, but we are interested in the one that sits at the beginning of the chain: the Real-Time Stylus interface.[Leggi il resto]

Picking voxels on the Open3D visualizer

While working on my M.S. thesis, I got to know Open3D. To me, it is basically the Swiss army knife for 3D data acquired from reality.

It offers implementations of performant algorithms, Python support to quickly change your scripts or adjust parameters to improve your results, and a visualizer to see them.

Unfortunately, this very visualizer is not very interactive. Often, I would like to pick objects in the scene and drag them or modify them. Sadly, in Python, it is not possible. But it is in C++, and I will comment on how you can implement that.

But first, I suggest you download my code, as I will refer to it. It combines the routines of the following sections to allow picking and deleting voxels.

Interact with the Mouse

Usually, when I want to do something with Open3D, I look at the examples on their Read the Docs documentation. However, they also offer a Doxygen-based one for the C++ part of the library. … [Leggi il resto]