My favorite IPython Magic commands

Jupyter Notebook is a great tool for data science prototyping, visualization and sharing. The first code cell of every notebook I work on contains the following commands: %matplotlib inline %load_ext autoreload %autoreload 2 These are some of the IPython Magic commands – handy enhancements added on top of the standard Python syntax to solve various tasks specific to interactive computing. The first line in the snippet above configures the notebook session to visualize and store all the Matplotlib figures inside the notebook.

Exposing C++ array data in Python with the Pybind11 buffer protocol

Python works great together with native code. The success of the Python data science stack is largely attributed to the capability of building native extensions. It is no secret, however, that the out-of-the-box C-based facilities are rather cumbersome to use. Luckily, there are a bunch of alternatives out there. The one I liked the most is Pybind11, a fork of Boost.Python with focus on the modern C++ standards. It is distributed as a lightweight header-only library that can be bundled with your project.

Buidling OpenCV with Conda on Linux

When it comes to building and installing OpenCV with Python support on *nix platforms, the collection of tutorials by Adrian Rosebrock is the best. He provides detailed description of the required steps, as well as motivation for better development practices. In particular, Adrian creates a dedicated virtualenv environment, installs NumPy in it, and builds the whole thing having this environment activated. Such a solution worked pretty well for me, both on Linux and macOS.

Configuring jumbo frames in Ubuntu

When working with GigE Vision cameras, it is important to be able to receive Ethernet frames of larger sizes than one gets in the default configuration. In particular, the default value of Maximum Transmission Unit (MTU) is 1500 bytes. By setting this parameter to the maximum (9000 bytes), a video streaming application handles smaller number of frames per second. This results in a decreased CPU load by cutting the number of operations for reconstructing image data from multiple small Ethernet frames.

Welcome

It’s been a long time since I planned to start a blog where I would publish various technical tricks which I have experienced in my work. I had greatly benefited from the others’ contributions – in blogs, Stack Overflow, and open-source software – and it’s definitely a good idea to share my own knowledge in an organized way. The goal is to make this blog a useful and interesting resource, perhaps with more than just nerdy stuff.