Category Archives: C++

Decomposing Projection Using OpenCV and C++

 

 

And the output is:


 

Camera Projection Matrix with Eigen

 

Create OpenCV Matrix (cv::Mat, cv::Mat_ ) From Various Data Types

1) cv:: Mat_

You can create a matrix with cv:: Mat_

2) cv::Mat

or like this with cv::Mat

if you forgot the list of data types you use

 

more data types here

Computing Fundamental Matrix and Drawing Epipolar Lines for Stereo Vision Cameras in OpenCV

Following my other post, you can extract the equation for epipolar lines. Basically choosing one point in one image and using fundamental matrix, we will get a line in the other image:

 

Creating a Simulated Stereo Vision Cameras With OpenCV and C++

n this tutorial, I created an ellipsoid in 3D space and create two cameras in right and left and captured the image:​

Point cloud of 3D Ellipsoid

Image from right camera.

Image from left camera.

 


 

How to use image_geometry and camera_info_manager in ROS

camera_info_publisher.cpp:

image_geometry_demo.cpp:

 

CMakeLists.txt

 

 

Simulating A Virtual Camera With OpenCV and Reverse Projection From 2D to 3D

Projection of Points from 3D in the camera plane:

Computed rays from the camera origin in the direction of points:

 

points are stored in CSV file like this:


The content of “reverse_projection.hpp”

The content of “transformation.hpp

 

How to develop GUI Application with PyQt (python Qt)

There are two main methods for developing GUI application with qt:
1) Adding all widgets in your code (your cpp or python code)
2) Creating qt UI files, adding widgets there and load everything into your application.

1)Adding all widgets in your code

Here is the snippet for adding all widgets and their slots in code:

2) Creating qt UI files, adding widgets there and load everything into your application

Now let’s do what we have done in the first method in a UI file and load it. First, create a text file and put the followings in it and save it as “mainwindow.ui”


Now call it in your python file like this:

The results should be the same as what you got in the first method.

Adding Qt UI files to your CMake

Qt uses qmake  to generate classes from UI files and compile everything in the project, luckily there are some macros in CMake that allows you to bring everything into your CMake and build everything there, here is what you need to do:

you can find the full project at my Github