November 13, 2013

TDK - Gépi látás - képfeldolgozás és mélységi kép kettő webkamera segítségével

For the english version click here.
[Frissítés] Azóta lezajlott az eredményhirdetés is, ahol 2. díjat kaptam a biomechatronika szekcióban :P
----------------
A BME-n a 2013-as TDK konferencián ezzel a dolgozattal indultam. Dolgozatom a gépi látás megvalósításáról szól LabVIEW környezetben. Változatos képfeldolgozási technológiákat mutatok be folyamatosan szem előtt tartva, hogy a módszerek szűkebb költségvetésű egyetemi és hallgatói projektekben is használhatóak legyenek.
Először áttekintem a LabVIEW programozás alapjait, az adatfolyam programozás mibenlétét, előnyeit, hátrányait. Csak olyan mélységig, hogy a későbbi fejezetek azok számára is érhetőek legyenek, akik még nem programoztak LabVIEW környezetben.
Ezután rátérek az egyszerű képfeldolgozási módszerekre. Itt először a színalapú mintázatkeresést mutatom be. Ennek keretében a megadott színbeli mintázatot keresi a program a képen. Majd a fekete-fehér képen történő forma alapú mintázatkeresést írom le. Itt a különböző módszerekkel monokrómmá tett képen keresi az előre definiált alakzatot.
Majd folytatom a magasabb szintű képfeldolgozási technológiákkal. Ennek keretében a kétdimenziós vonalkód (QR kód és Data Matrix) olvasásáról írok, melyek egyre elterjedtebbek mind az iparban, mind a mindennapi életben.
Ezt követően bemutatom azt, hogy két egymás melletti, csupán horizontálisan eltolt webkamera képét felhasználva hogyan lehet - az emberi látáshoz hasonlóan - mélységi képet előállítani. Itt fontos a megfelelő beállítás, ami a kameráknak több szögből megmutatott fekete-fehér ráccsal végezhető. Ezután a beállítás természetesen elmenthető, így ezt elegendő kamera-beállításonként egyszer elvégezni. 
Ezt követően a program képes a webkamerák képét élőben (real time) mélységi képpé alakítani és azt egy színes grafikonon megjeleníteni. Az összes ponthoz rögtön rendel egy mélységi koordinátát is, amit egyrészt a színekkel érzékeltet, másrészt ha az egeret az adott pont fölé visszük, akkor külön is megjeleníti. 
Természetesen ennek a technológiának is megvannak a korlátai, nem várható el, hogy két középkategóriás webkamera képéből tökéletes háromdimenziós képet kapjunk, emellett a módszer mérési tartománya nagyban függ a kamerák elrendezésétől. Egymáshoz nagyon közel elhelyezett kamerák esetén elsősorban közelebbi célpontok esetén fog pontosabban működni, míg távolabb elhelyezettek elsősorban távolabbi célpontoknál adnak használhatóbb eredményt.
Az általam készített vi-ok letölthetők innen:  https://www.dropbox.com/sh/3k30qofbyssvj01/SzJ0mVAZZ- míg a dolgozatom itt érhető el: https://www.dropbox.com/s/26ui2qnpywgg3yh/TDK.pdf
Kiemelt köszönet illeti konzulensemet, Dr Aradi Petra tanárnőt (BME-MOGI) és Kl3m3n-t az ni.com oldalról.

Üdv:
Márk

Machine Vision - Image processing and depth image with two webcams

[update] yaaaay, I got 2nd place on the biomechatronics sections :P
----------
It was my university project, and now I share it with you. Unfortunately it's only in Hungarian language, but I hope, at least the vi-s can help also the non-hungarian readers.
My paper is about machine vision in LabVIEW environment. Various image processing methods are presented, considering that it must be able to used in non-industrial environment like low-budget university and student projects.
First I review the basics of programming in LabVIEW, the dataflow programming method. I write about it only so quick to make the following chapters clear for those people who have no previous experience with LabVIEW programming.
Then I start with the easier image processing methods. First the color matching: here the program looks for a predefined color pattern and gives back the coordinates of it. Then the pattern matching algorithm on a black-white image: first we make the picture monochrome with one of the various options and then the program searches for the predefined shape or geometry pattern.
Thereafter the more sophisticated image processing methods come. I write about the two dimensional bar code (QR Code and Data Matrix) scanning, which are more and more frequently used in the industry and all day life.

Next I present how to use two horizontally offset webcam to create a depth image, like human vision. The correct settings are very important. It can be done with a black-white grid showed in different angel to the camera. Of course the configuration can be saved so it has to be done only once per camera configuration. For more info, see this video:

After that the program is ready to process the images real time to a depth image. This depth image is presented on a colored graph, where each color represent a depth, and the actual depth value can be read by hover the mouse over the point. 

Of course this technology has its own limitations. It can’t be expected to get a perfect 3D image from the image of two midrange webcam, but it can help us to choose the closer so the more important part of the image, where the previous image processing technologies should be used. It saves us resources and combining with a moving robot, the robot will be able to turn its head towards the closest activity. The measurement range highly depend on the configurations of the cameras. Very close cameras give better results in case of closer targets and cameras with higher distance can be used in farer targets.

All of my vi-s and my paper are available here: https://1drv.ms/f/s!An5KBEiOStfLgvAf6yFFrktZR4LmqQ

Special thanks to:
Best regards:
Mark