avatarYağmur Çiğdem Aktaş

Free AI web copilot to create summaries, insights and extended knowledge, download it at here

3702

Abstract

any images are used for the calibration. For how many images, corner detection was successful. Because it can get a little confusing to see if the image were good or not trying to show the checker pattern to the camera. The further process is the same:</p><figure id="11fc"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*jSVPK-T9s8Z8ffT9rEl0gw.png"><figcaption>Image by Author</figcaption></figure><p id="77f8"><i>Measures Taken for This Section</i></p><ol><li>If the user forgets to determine the corner the calibration will fail. So instead of opening a file explorer, a warning message is sent.</li></ol><figure id="b742"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*yfuqhp-IUamqE4ZCa32kjg.png"><figcaption>Image by Author</figcaption></figure><p id="6fae">2. The calibration may not be successful every time. Two main reasons for that are not having enough successful images. Either the expected corner quantity is given wrong or there is a small number of images. For example, the user may press ‘q’ too early in the CAM case. In that case, to warn the user that the calibration is not performed, a message is sent.</p><figure id="c59e"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*8aeRKsii4gX0JYrtko1Itw.png"><figcaption>Image by Author</figcaption></figure><p id="6afd">3) These problems cause run time errors so they are cached in the background too.</p><p id="139c"><b>Feature Matching</b></p><figure id="cdf2"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*uG7FqC3ftC2HdCTvrE73xg.png"><figcaption>Image by Author</figcaption></figure><p id="cf51">If the Demo box is checked, the process will be done with default images. If not, to detect corners, extract circles and extract lines, 1 image will be required. For match features, 2 images will be required. In case any image didn’t select, a warning image is sent, in case only 1 image is selected for Match Features, the same image will be used as left and right images.</p><p id="3574">o Detect Corners</p><p id="36f9">Harris Corner or Morphological operators can be selected for that process. For Harris Corner, the user can define kernel size, neighborhood, and k. We see demo image results for both:</p><figure id="30a3"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*LHbkqagI1VzuKlxuxuY_Jg.png"><figcaption>Image by Author</figcaption></figure><p id="b14f">o Extract Circles</p><p id="7808">For extract circles, the user can define the minimum and the maximum radius of circles. Any circle being outside of this range won’t be extracted. We see demo image results.</p><figure id="d5ee"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*9kdV__h55SLnlriUFxvTPw.png"><figcaption>Image by Author</figcaption></figure><p id="45b2">o Extract Lines</p><p id="7108">The user can define a threshold, minimum line length, and maximum line gap.</p><figure id="403f"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*M1Dc3WxQ07RIH5mjYo34Aw.png"><figcaption>Image by Author</figcaption></figure><p id="feb8">o Match Features</p><p id="f08a">This is the part we need mostly for going further for Epipolar Geometry. As I mentioned in the previous post, we need to have 2D matched image points to obtain Essential Matrix, Fundamental Matrix, Triangulation, etc and in real-life examples, we usually don't have them in contrary that we used already matched points to be able to continue more easily during the tutorial. By clicking this button, you can obtain the matched points as Matched_Points1.txt and Matched_Points2.txt. The epipolar geometry part expects .txt files for 2D points, so you can directly use what you obt

Options

ained from that section.</p><figure id="a24b"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*8736O7MRsmIEql-nBw54ag.png"><figcaption>Image by Author</figcaption></figure><p id="cce5"><b>Epipolar Geometry</b></p><p id="95f7">In this part, you will be able to work with everything we learned in Epipolar Geometry post.</p><figure id="9b30"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*ozbD5_jNXTXV88rQyeRRqw.png"><figcaption>Image by Author</figcaption></figure><p id="2a8d">By clicking the Demo button, the 2D matched points coming from Match Features Demo images are used and you will see that various tasks are realized step by step. At the end of each step, a message is sent to the user to inform where the output matrix or vector was saved.</p><figure id="2a77"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*GvgTNKb9IqdpQ2j8AjnQDg.png"><figcaption>Image by Author</figcaption></figure><p id="8833">To work with your own matched points, you should select 2 different files, 1 for the 2D points that comes from the first image, 1 for the 2D points comes from the second image as a txt file. If you obtained your points using this GUI, you already have them as .txt files and you can keep working with them without the need for any conversion operation.</p><p id="1c33">After choosing your files, you will see this information message “Point matches are loaded successfully!”, but if you select less or more than 2 files, you will get a warning message and you need to click again to Select 2D Match Points.</p><figure id="7f0e"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*T9nHHfiVmj8vIlLEQZPsqw.png"><figcaption>Image by Author</figcaption></figure><p id="2619">Then you can try Essential Matrix, Fundamental Matrix, Epipolar Lines and Triangulation buttons! For each step, you will get a message if you need to select anything and a message to inform you where your results are saved if everything went fine.</p><p id="058a">Don’t forget that for example, Essential Matrix requires Camera Matrix, and if you don’t have it yet, you can go to the Calibration section and obtain your Camera Matrix before estimating Essential Matrix!</p><p id="1a86">You can find the source code via this <a href="https://github.com/YCAyca/Visual_Perception_GUI">Github </a>link.</p><figure id="e7a2"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*CQUhBXHJkCms-KSO-aNclw.png"><figcaption>Image by Author</figcaption></figure><p id="d981">Please don’t forget to change these dependencies according to your path in GUI_VisualPerception.pro file.</p><figure id="fce6"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*_voJhQYKbn1Mq-qhfHbt8w.png"><figcaption>Image by Author</figcaption></figure><p id="7b30">and these absolute paths in the Input_Output.hpp file!</p><p id="4a0a">Thank you for your interest and have fun with GUI!</p><p id="4e93">[1] <a href="https://ros-developer.com/2018/12/19/creating-a-simulated-stereo-vision-cameras-with-opencv-and-c/">https://ros-developer.com/2018/12/19/creating-a-simulated-stereo-vision-cameras-with-opencv-and-c/</a></p><p id="4f02">[2] <a href="https://docs.opencv.org/3.4.15/d9/d0c/group__calib3d.html#ga19e3401c94c44b47c229be6e51d158b7">https://docs.opencv.org/3.4.15/d9/d0c/group__calib3d.html#ga19e3401c94c44b47c229be6e51d158b7</a></p><p id="a3a1">[3] <a href="https://stackoverflow.com/questions/44056880/how-to-read-write-a-matrix-from-a-persistent-xml-yaml-file-in-opencv-3-with-pyth/44056881">https://stackoverflow.com/questions/44056880/how-to-read-write-a-matrix-from-a-persistent-xml-yaml-file-in-opencv-3-with-pyth/44056881</a></p></article></body>

Visual Perception GUI

A user interface implemented with QT Creator, Opencv, and C++ to make the user able for realizing what they learned during this tutorial like Camera Calibration, Fundamental-Essential Matrix Estimation, Triangulation

The GUI consists of 3 parts as Calibration, Feature Matching, and Epipolar Geometry.

Image by Author

Let’s examine it part by part

Calibration

In this part, you can calibrate your camera either using your already taken images or using your camera connected to your PC. Additionally, there is a Demo section for you to start trying more easily.

Image by Author

o Demo

By clicking the Demo button, the user can use default checkerboard pattern images to see how it is working. Each image with corner detections drawn on them is showing. If the expected number of corners can be detected, it is a successful detection. These type of images are shown with the message “Successful corner detection, this image will be used in calibration” and if less than expected corners are detected, the image is shown with a message “Corner detection < expected number of corners”.

Image by Author

Afterward, only the successful images are used for calibration and we get another message if calibration is done without any problem. The message shows the directory where the calibration results are saved in a file. By looking at the mentioned file, we see the following result:

Image by Author

o Calibration Images

By clicking this button, the user can select the folder where his own calibration images are. Before selecting this folder, the user should correctly determine the number of corners to detect in the x and y axes. After that, the calibration process will start automatically.

I determine the number of corners then select the folder where my calibration images are and we see the same process works.

Image by Author

o CAM

It is also possible to calibrate cameras via webcam. The user can click on CAM button right after determining expected corner counts and show the checkerboard images to the camera. The same process will work. To quit, the user should press ‘q’. For the CAM option, there is only an additional message is sent to the interface to declare how many images are used for the calibration. For how many images, corner detection was successful. Because it can get a little confusing to see if the image were good or not trying to show the checker pattern to thE camera. The further process is the same:

Image by Author

For the CAM option, there is only an additional message is sent to the interface to declare how many images are used for the calibration. For how many images, corner detection was successful. Because it can get a little confusing to see if the image were good or not trying to show the checker pattern to the camera. The further process is the same:

Image by Author

Measures Taken for This Section

  1. If the user forgets to determine the corner the calibration will fail. So instead of opening a file explorer, a warning message is sent.
Image by Author

2. The calibration may not be successful every time. Two main reasons for that are not having enough successful images. Either the expected corner quantity is given wrong or there is a small number of images. For example, the user may press ‘q’ too early in the CAM case. In that case, to warn the user that the calibration is not performed, a message is sent.

Image by Author

3) These problems cause run time errors so they are cached in the background too.

Feature Matching

Image by Author

If the Demo box is checked, the process will be done with default images. If not, to detect corners, extract circles and extract lines, 1 image will be required. For match features, 2 images will be required. In case any image didn’t select, a warning image is sent, in case only 1 image is selected for Match Features, the same image will be used as left and right images.

o Detect Corners

Harris Corner or Morphological operators can be selected for that process. For Harris Corner, the user can define kernel size, neighborhood, and k. We see demo image results for both:

Image by Author

o Extract Circles

For extract circles, the user can define the minimum and the maximum radius of circles. Any circle being outside of this range won’t be extracted. We see demo image results.

Image by Author

o Extract Lines

The user can define a threshold, minimum line length, and maximum line gap.

Image by Author

o Match Features

This is the part we need mostly for going further for Epipolar Geometry. As I mentioned in the previous post, we need to have 2D matched image points to obtain Essential Matrix, Fundamental Matrix, Triangulation, etc and in real-life examples, we usually don't have them in contrary that we used already matched points to be able to continue more easily during the tutorial. By clicking this button, you can obtain the matched points as Matched_Points1.txt and Matched_Points2.txt. The epipolar geometry part expects .txt files for 2D points, so you can directly use what you obtained from that section.

Image by Author

Epipolar Geometry

In this part, you will be able to work with everything we learned in Epipolar Geometry post.

Image by Author

By clicking the Demo button, the 2D matched points coming from Match Features Demo images are used and you will see that various tasks are realized step by step. At the end of each step, a message is sent to the user to inform where the output matrix or vector was saved.

Image by Author

To work with your own matched points, you should select 2 different files, 1 for the 2D points that comes from the first image, 1 for the 2D points comes from the second image as a txt file. If you obtained your points using this GUI, you already have them as .txt files and you can keep working with them without the need for any conversion operation.

After choosing your files, you will see this information message “Point matches are loaded successfully!”, but if you select less or more than 2 files, you will get a warning message and you need to click again to Select 2D Match Points.

Image by Author

Then you can try Essential Matrix, Fundamental Matrix, Epipolar Lines and Triangulation buttons! For each step, you will get a message if you need to select anything and a message to inform you where your results are saved if everything went fine.

Don’t forget that for example, Essential Matrix requires Camera Matrix, and if you don’t have it yet, you can go to the Calibration section and obtain your Camera Matrix before estimating Essential Matrix!

You can find the source code via this Github link.

Image by Author

Please don’t forget to change these dependencies according to your path in GUI_VisualPerception.pro file.

Image by Author

and these absolute paths in the Input_Output.hpp file!

Thank you for your interest and have fun with GUI!

[1] https://ros-developer.com/2018/12/19/creating-a-simulated-stereo-vision-cameras-with-opencv-and-c/

[2] https://docs.opencv.org/3.4.15/d9/d0c/group__calib3d.html#ga19e3401c94c44b47c229be6e51d158b7

[3] https://stackoverflow.com/questions/44056880/how-to-read-write-a-matrix-from-a-persistent-xml-yaml-file-in-opencv-3-with-pyth/44056881

Visual Perception
Opencv
Cpp
Calibration
Epipolar Geometry
Recommended from ReadMedium