How to Make Laser Projection Virtual Keyboard

by 513696765 in Circuits > Electronics

65802 Views, 149 Favorites, 0 Comments

How to Make Laser Projection Virtual Keyboard

IMG_20140520_160414826.jpg
IMG_20140519_170456175.jpg
IMG_20140520_160400206.jpg
IMG_20140102_202930.jpg
IMG_20140520_160425654.jpg
IMG_20140102_203023.jpg

The laser projection virtual keyboard designed in this thesis is based on OpenCV combine with image camera, 980nm linear laser, 980nm infrared filter and Keyboard projection laser, the image camera detection used with 980nm infrared filter is caused by shielding finger to make 980nm linear laser diffuse reflection the light . By detecting and locating the center position of the light outline to discern and detect the position of finger and then map to keyboard position to achieve relative keyboard key events. With OpenCV vision library, it is fast to find the finger outline which is get by image camera, the position of finger location and revise the image surface distortion which is caused by image camera. By using OpenCV, the bottom hardware drive code written can be reduced, and invoke built-in function can directly face to hardware write code to fasten the difficult and speed of program development. By experiment and test, this virtual keyboard can correctly and accurately locate and detect the finger position, on the other hand, this keyboard also have fault-tolerant treatment, and finally realize the function of key input.

The Laser Projection Virtual Keyboard Designed

摄像头.jpg
Keyboard projection laser.jpg
980nm infrared linear laser.jpg
infrared filter.jpg

You need:

Image camera: $ 20 (USD)

Keyboard projection laser: $ 38(USD)

Infrared filter: $ 6.1 (USD)

linear laser: $ 54 (USD)

How to Work

how to work.bmp
HWO.gif

At the bottom of the infrared laser emission from a surface of a covering space in the infrared range, of course this plane to cover the entire keyboard, a keyboard in the center of the keyboard is the projection contour shape of the keyboard is mainly used for calibration, at the top of the real-time camera outside the graphics and pass data to the computer, because the laser light is a horizontal and parallel so no object occlusion camera is unable to detect the infrared signal, but if there are objects in the infrared laser region when the occluded objects' surface will be covered with the infrared camera will detect the infrared signal, computer access to the signal sent by the camera after after a certain the algorithm to obtain coordinates in the picture of infrared spot and then put the coordinate mapping to real keyboard position so as to realize its function.

Choose Camera Lens

camera lens.jpg
高度.bmp

The camera of detection of the same area, ‘Camera2’ is angle of view 150°need height is 'h2', and the ‘Camera1’is angle of view 90°need height is 'h1', in order to narrow the project size and choose the lens of angle of view 150°.

Calibration the Camera Lens

calibrate.bmp

The picture taken by use the angle of view 150 camera is a distortion, and in order to Calibration the distortion of the picture using Matlab camera Calibration tool ‘Calibration Toolbox Camera’.

The Camera Calibration Toolbox

标定界面.bmp
标定照片.bmp
单张标定照片.bmp
3d.bmp
误差.bmp
参数.bmp

Although "the camera calibration toolbox" as long as 3 different angles to shoot photos can be a good camera calibration, but in this design used 9 different angles to shoot photos of the camera calibration the calibration parameters, the parameters are applied to opencv correction algorithm in real-time operation can be real-time correction of distortion of the picture.

The following link is the algorithm paper and ‘camera calibration toolbox’ guide

http://www.vision.caltech.edu/bouguetj/calib_doc/
http://research.microsoft.com/en-us/um/people/zhang/Calib/

Lens Process

比较.bmp

The PC camera is visible and infrared detection are not allowed to enter because the infrared light in practice may cause the whole picture of the color fidelity, PC camera in the design of the product design manufacturers often use infrared filters in the infrared light environment, in this project need to detect the infrared signal is so PC camera behind add a layer of infrared filter, this filter can filter out visible light infrared light and visible light are only allowed to enter, because of the use of this system is the 980nm infrared laser, so the permeability of 980nm filter, this filter can filter the 980nm light for more than 980nm light has good permeability.

Why Choose Linear Laser

line.bmp
linear laser.bmp

Select the 980nm infrared linear laser as the source of the signal detection, the linear laser can cover all the keyboard range.

PC Software

soft PC.bmp
F54S7BXI0VOTUC4.MEDIUM.jpg

The development of software is Visual Studio 2010 and OpenCV library.

Programming and Algorithm

OpenCV.jpg
img4.bmp
imgwork.bmp

Use cvCaptureFromCAM () function and cvQueryFrame () function to get the camera image,Using the cvCvtColor () function binarization the image,Use findContours () function to find the object contour, drawContours () function to draw the object contour, boundingRect () function to draw the object contour of the rectangle

Test & Code

IMG_20140520_160410155.jpg
IMG_20140519_170456175.jpg
IMG_20140520_160400206.jpg
IMG_20140520_160425654.jpg
IMG_20140102_202930.jpg
IMG_20140102_203023.jpg

Press space key the PC will check the key

GitHub: https://github.com/hxy513696765/OpenCV-laser-projection-virtual-keyboard