CN101581989B - Image Capture Positioning System - Google Patents
Image Capture Positioning System Download PDFInfo
- Publication number
- CN101581989B CN101581989B CN2009100121170A CN200910012117A CN101581989B CN 101581989 B CN101581989 B CN 101581989B CN 2009100121170 A CN2009100121170 A CN 2009100121170A CN 200910012117 A CN200910012117 A CN 200910012117A CN 101581989 B CN101581989 B CN 101581989B
- Authority
- CN
- China
- Prior art keywords
- infrared
- coordinates
- curbound
- array
- pixel
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Images
Landscapes
- Studio Devices (AREA)
- Image Analysis (AREA)
Abstract
Description
技术领域technical field
本发明涉及一种图像捕捉定位系统,尤其涉及到一种使用固定摄像头来拍摄移动的红外定位点来进行定位的图像捕捉定位系统。The invention relates to an image capturing and positioning system, in particular to an image capturing and positioning system which uses a fixed camera to photograph moving infrared positioning points for positioning.
背景技术Background technique
随着电子设备的发展,图像捕捉定位系统被应用越来越广泛。例如光电鼠标技术,在光电鼠标内部有一个发光二极管,通过该发光二极管发出的光线,照亮光电鼠标底部表面。然后将光电鼠标底部表面反射回的一部分光线,经过一组光学透镜,传输到一个光感应器件(微成像器)内成像。这样,当光电鼠标移动时,其移动轨迹便会被记录为一组高速拍摄的连贯图像。最后利用光电鼠标内部的一块专用图像分析芯片(DSP,即数字微处理器)对移动轨迹上摄取的一系列图像进行分析处理,通过对这些图像上特征点位置的变化进行分析,来判断鼠标的移动方向和移动距离,从而完成光标的定位。但是,光电鼠标的技术局限性是必须借助于一个可以反射红外光的不平整平面,所以在对其进行拓展功能进而广泛应用受到了阻碍。With the development of electronic equipment, image capture and positioning systems are used more and more widely. For example, the photoelectric mouse technology has a light-emitting diode inside the photoelectric mouse, and the light emitted by the light-emitting diode illuminates the bottom surface of the photoelectric mouse. Then part of the light reflected back from the bottom surface of the photoelectric mouse is transmitted to an optical sensing device (micro imager) for imaging through a set of optical lenses. In this way, when the photoelectric mouse moves, its moving track will be recorded as a set of coherent images shot at high speed. Finally, a dedicated image analysis chip (DSP, digital microprocessor) inside the photoelectric mouse is used to analyze and process a series of images captured on the moving track, and to judge the position of the mouse by analyzing the changes in the position of the feature points on these images. Move the direction and distance to complete the positioning of the cursor. However, the technical limitation of the photoelectric mouse is that it must rely on an uneven plane that can reflect infrared light, so it is hindered in expanding its functions and then widely applying it.
后来任天堂设计出Wii定位技术:Wii游戏机包括一个主机,一个游戏手柄,一个红外发光条。红外发光条上安装有数个红外发光管,无线游戏手柄上安装红外滤光片、摄像头。红外发光条发出两束红外光,经手柄上的红外滤光片过滤,使红外光通过,摄像头拍摄外部的红外信息,再由游戏手柄上的MCU计算,取两个红外光点距离的中间值,完成定位。但是使摄像头移动,即把摄像头绑定在被定位对象上,来进行定位,这种定位方法的缺陷是对外界环境要求比较高,由于摄像头移动,如果外界存在任何红外干扰(太阳光或物体反射太阳光),都会给内部运算带来难度,从而导致定位的不准确。所以一种更有效的图像捕捉定位系统急需被研制。Later, Nintendo designed the Wii positioning technology: the Wii game console includes a console, a gamepad, and an infrared light strip. Several infrared light-emitting tubes are installed on the infrared light-emitting strip, and an infrared filter and a camera are installed on the wireless game handle. The infrared light strip emits two beams of infrared light, which are filtered by the infrared filter on the handle to allow the infrared light to pass through, and the camera captures the external infrared information, which is then calculated by the MCU on the game handle to take the middle value of the distance between the two infrared light points , to complete the positioning. But make the camera move, that is, bind the camera to the object to be positioned for positioning. The defect of this positioning method is that it has relatively high requirements for the external environment. Due to the movement of the camera, if there is any infrared interference (sunlight or object reflection) Sunlight), will bring difficulty to the internal calculation, resulting in inaccurate positioning. So a more effective image capture positioning system needs to be developed urgently.
发明内容Contents of the invention
本发明针对以上问题的提出,而研制一种使用固定摄像头来拍摄移动的红外定位点来进行定位的新型图像捕捉定位系统。本发明采用的具体技术手段如下:In view of the above problems, the present invention develops a novel image capturing and positioning system that uses a fixed camera to photograph moving infrared positioning points for positioning. The concrete technical means that the present invention adopts is as follows:
一种红外定位的图像捕捉装置,其特征在于包括红外定位点、上位机、摄像头和红外滤光灯罩;An infrared positioning image capture device is characterized in that it includes an infrared positioning point, a host computer, a camera and an infrared filter lampshade;
所述红外定位点同被捕捉对象进行绑定,作为红外光源;The infrared positioning point is bound to the captured object as an infrared light source;
所述红外滤光灯罩置于摄像头前端,用于滤除红外光谱以外的光线,仅使红外光透过红外滤光灯罩;The infrared filter lampshade is placed at the front end of the camera to filter out light rays other than the infrared spectrum, so that only infrared light passes through the infrared filter lampshade;
所述上位机通过摄像头实时采集红外定位点的运动轨迹信息,后将该信息传送到上位机的MCU或CPU中进行分析,得出被捕捉对象的当前位置。The host computer collects the motion trajectory information of the infrared positioning point in real time through the camera, and then transmits the information to the MCU or CPU of the host computer for analysis, and obtains the current position of the captured object.
一种利用红外定位进行图像捕捉的方法,其特征在于包括如下步骤:A method for image capture utilizing infrared positioning, characterized in that it comprises the following steps:
(1)、上位机先通过摄像头获取一张图片作为基准图片;(1), the upper computer first obtains a picture through the camera as a reference picture;
(2)、读取上一步骤中所拍摄的图片数据,把非黑像素的坐标保存到数组Pixel1里,获得外界环境的红外信息;(2), read the picture data taken in the previous step, save the coordinates of non-black pixels in the array Pixel1, and obtain the infrared information of the external environment;
(3)、在设定的间隔较短时间内通过摄像头继续获取图片,读取此次获取图片的颜色数据,并此次获取图片中非黑像素的坐标同上一步骤中所保存的坐标数组Pixel1进行对比,相同的坐标保存到数组Pixel中,为外界环境的红外干扰信息,并将其x坐标和y坐标分别求和,并且同时记录此数组Pixel中坐标的数量,以此判定是否存在外部环境的红外干扰;(3), continue to acquire pictures through the camera within a relatively short interval of time, read the color data of the acquired pictures this time, and obtain the coordinates of the non-black pixels in the picture this time with the coordinate array Pixel1 saved in the previous step For comparison, the same coordinates are saved in the array Pixel, which is the infrared interference information of the external environment, and the x and y coordinates are summed separately, and the number of coordinates in the array Pixel is recorded at the same time, so as to determine whether there is an external environment Infrared interference;
(4)、摄像头持续拍照,对每次拍照进行以下运算;(4) The camera continues to take photos, and performs the following calculations for each photo;
(5)、如果数组Pixel中坐标的数量是零,则不存在外部环境的红外干扰,在没有外部红外干扰的情况下,对步骤(4)获得的图像的逐个像素点进行色彩检测,如果检测到非黑像素点,就将其坐标信息存到数组stickPixel中,通过运算得到红外定位点的平均坐标StickX=pStickX/pStickCount,StickY=pStickY/pStickCount,其中pStickX是数组stickPixel中所有x坐标的和,pStickY是数组stickPixel中所有y坐标的和,pStickCount为步骤(4)获得图像中非黑像素点的数量;(5), if the number of coordinates in the array Pixel is zero, then there is no infrared interference from the external environment, in the absence of external infrared interference, color detection is carried out pixel by pixel to the image obtained in step (4), if detected To a non-black pixel point, its coordinate information is stored in the array stickPixel, and the average coordinate StickX=pStickX/pStickCount, StickY=pStickY/pStickCount of the infrared positioning point is obtained by calculation, wherein pStickX is the sum of all x coordinates in the array stickPixel, pStickY is the sum of all y coordinates in the array stickPixel, and pStickCount obtains the number of non-black pixels in the image for step (4);
(6)、如果数组Pixel中坐标的数量不为零,则外界环境存在红外干扰,对步骤(4)获得的图像的逐个像素点进行色彩检测,如果检测到非黑像素点,将其坐标信息存到数组stickPixel中,通过运算得到红外定位点的平均坐标StickX=(pStickX-pixelX)/(pStickCount-pCount),StickY=(pStickY-pixelY)/(pStickCount-pCount),其中pStickX是数组stickPixel中所有x坐标的和,pStickY是数组stickPixel中所有y坐标的和,pixelX和pixelY步骤(3)中所获得外部环境的红外信息的坐标X和坐标Y的和,pStickCount为步骤(4)获得图像中非黑像素点的数量,pCount为步骤(3)中外部红外信息中的非黑像素点的数量;(6), if the number of coordinates in the array Pixel is not zero, there is infrared interference in the external environment, and the color detection is performed pixel by pixel of the image obtained in step (4), if a non-black pixel is detected, its coordinate information Stored in the array stickPixel, the average coordinates of the infrared positioning point StickX=(pStickX-pixelX)/(pStickCount-pCount), StickY=(pStickY-pixelY)/(pStickCount-pCount), where pStickX is all in the array stickPixel The sum of x coordinates, pStickY is the sum of all y coordinates in the array stickPixel, the sum of the coordinates X and coordinates Y of the infrared information of the external environment obtained in pixelX and pixelY step (3), pStickCount is the non- The quantity of black pixel point, pCount is the quantity of the non-black pixel point in the external infrared information in the step (3);
(7)、根据不同的上位机,采用一定的换算方法将步骤(5)或步骤(6)中得到的平均坐标值换算成所需的定位数据,此换算过程由用户的不同要求决定。(7), according to different upper computers, adopt a certain conversion method to convert the average coordinate value obtained in step (5) or step (6) into required positioning data, and this conversion process is determined by different requirements of users.
3、根据权利要求2所述的一种利用红外定位进行图像捕捉的方法,其特征在于最后还包括判断距上次拍摄环境图像是否大于规定时间,如果大于返回步骤(1),如果不大于则返回步骤(3)的步骤。3. A method for image capture using infrared positioning according to claim 2, characterized in that it also includes judging whether the environmental image taken last time is greater than the specified time, if greater than the return step (1), if not greater than then Return to the procedure of step (3).
4、根据权利要求2所述的一种利用红外定位进行图像捕捉的方法,其特征在于所述步骤(5)中还包括预测红外定位点的下一个运动范围,再通过运算得到红外定位点的平均坐标的方法,具体步骤如下:4. A method for image capture using infrared positioning according to claim 2, characterized in that said step (5) also includes predicting the next range of movement of the infrared positioning point, and then obtaining the infrared positioning point by calculation The method of average coordinates, the specific steps are as follows:
1)首先判断是否是在步骤(3)后的第一次拍摄:是,则像素点的搜索范围设定为全屏;否,则像素点的搜索在结构体SearchBound区域内进行搜索,其中结构体SearchBound由结构体PreBound和结构体CurBound计算得到,SearchBound具体运算方法如下:SearchBound.maxX=CurBound.maxX+(CurBound.maxX-PreBound.maxX)*2;SearchBound.minX=CurBound.minX+(CurBound.minX-PreBound.minX)*2;SearchBound.maxY=CurBound.maxY+(CurBound.maxY-PreBound.maxY)*2;SearchBound.minY=CurBound.minY+(CurBound.minY-PreBound.minY)*2;结构体PreBound是一个用来存储前一帧中红外像素点范围的结构体,由前一次拍摄的图片中所有非黑色像素点的坐标的x最大值PreBound.maxX、最小值PreBound.minX以及y最大值PreBound.maxY、最小值PreBound.minY组成,即前一次拍摄的图片中所有非黑色像素点的所在的范围,结构体CurBound是一个用来存储当前帧中红外像素点范围的结构体,由本次拍摄的图片中所有非黑色像素点的坐标的x最大值CurBound.maxX、最小值CurBound.minX以及y最大值CurBound.maxY、最小值CurBound.minY组成,即本次拍摄的图片中所有非黑色像素点的所在的范围;1) First judge whether it is the first shooting after step (3): if yes, the search range of pixels is set to full screen; SearchBound is calculated by the structure PreBound and the structure CurBound. The specific calculation method of SearchBound is as follows: SearchBound.maxX=CurBound.maxX+(CurBound.maxX-PreBound.maxX)*2; SearchBound.minX=CurBound.minX+(CurBound.minX-PreBound .minX)*2; SearchBound.maxY=CurBound.maxY+(CurBound.maxY-PreBound.maxY)*2; SearchBound.minY=CurBound.minY+(CurBound.minY-PreBound.minY)*2; The structure PreBound is a To store the structure of the range of infrared pixels in the previous frame, the x maximum value PreBound.maxX, minimum value PreBound.minX and y maximum value PreBound.maxY, minimum value of the coordinates of all non-black pixel points in the previous frame value PreBound.minY, that is, the range of all non-black pixels in the picture taken last time. The structure CurBound is a structure used to store the range of infrared pixels in the current frame. It is composed of all the pixels in the picture taken this time. The coordinates of non-black pixels consist of the maximum value of x CurBound.maxX, the minimum value of CurBound.minX, the maximum value of y CurBound.maxY, and the minimum value of CurBound.minY, that is, the range of all non-black pixels in the picture taken this time ;
2)把CurBound赋给PreBound;2) Assign CurBound to PreBound;
3)在搜索范围内,对逐个像素点进行色彩检测,如果检测到非黑像素点,就将其坐标信息存到数组stickPixel中,pStickX是数组stickPixel中所有x坐标的和,pStickY是数组stickPixel中所有y坐标的和,使用变量pStickCount来记录步骤(4)获得图像中非黑像素点的数量,使用CurBound记录所有非黑像素的坐标区域;3) Within the search range, perform color detection on a pixel-by-pixel basis. If a non-black pixel is detected, its coordinate information is stored in the array stickPixel. pStickX is the sum of all x coordinates in the array stickPixel, and pStickY is in the array stickPixel The sum of all y coordinates, use the variable pStickCount to record the number of non-black pixel points in the image obtained in step (4), and use CurBound to record the coordinate area of all non-black pixels;
4)运算得到红外定位点的平均坐标StickX=pStickX/pStickCount,StickY=pStickY/pStickCount;4) calculate and obtain the average coordinate StickX=pStickX/pStickCount of the infrared positioning point, StickY=pStickY/pStickCount;
5)通过上面得到的PreBound、CurBound可以基本上判断出屏幕上非黑像素将要移动的范围,可以根据程序员自己需要使用最合适的参数获得下一帧的搜索范围SearchBound。5) Based on the PreBound and CurBound obtained above, the moving range of the non-black pixels on the screen can be basically judged, and the search range SearchBound of the next frame can be obtained by using the most suitable parameters according to the programmer's own needs.
本发明的发明点是使用固定摄像头来拍摄移动的红外定位点来进行定位,可省去一个单独用来定位的红外发光条,节约成本,节省空间,并且由于摄像头是固定的,外界环境的红外干扰一般变化不会太大,降低了对摄像头图片信号解析的难度,定位更准确,工作效率更高。另外,本发明的算法中,分为外界存在干扰和不存在干扰两部分,这样运行过程中会提高系统工作效率,并且有效地清除了外界环境中的红外光源(主要是太阳光,以及物体反射的阳光)所带来的干扰,定位更精准。The invention point of the present invention is to use a fixed camera to shoot a moving infrared positioning point for positioning, which can save a separate infrared light-emitting strip for positioning, saving cost and space, and because the camera is fixed, the infrared light of the external environment Interference generally does not change too much, which reduces the difficulty of analyzing the camera image signal, more accurate positioning, and higher work efficiency. In addition, the algorithm of the present invention is divided into two parts: external interference and non-interference. In this way, the operating efficiency of the system will be improved, and the infrared light source (mainly sunlight, and object reflection) in the external environment will be effectively removed. The interference caused by sunlight) makes the positioning more accurate.
附图说明Description of drawings
图1为本发明的硬件结构框图;Fig. 1 is a block diagram of hardware structure of the present invention;
图2为本发明的主流程图;Fig. 2 is the main flowchart of the present invention;
图3为本发明的具体实施例的工作流程图。Fig. 3 is a working flow diagram of a specific embodiment of the present invention.
具体实施方式Detailed ways
如图1所示,整个系统由红外定位点(红外发光设备),上位机,摄像头,红外滤光灯罩组成。红外定位点即红外发光源,可以是任何发出足够强度红外光的设备;上位机是控制监控设备,可以是电脑、游戏机等设备;摄像头可以是内置摄像头,也可以是外置可插拔的摄像头;红外光灯罩就是由红外滤光片制成的,可以固定在上位机上,或者固定在摄像头上。用红外滤光罩盖住摄像头,将摄像头连接到上位机,并将红外发光源跟被捕捉对象绑定。As shown in Figure 1, the whole system is composed of infrared positioning point (infrared light-emitting device), host computer, camera, and infrared filter lampshade. The infrared positioning point is the infrared light source, which can be any device that emits enough infrared light; the host computer is the control and monitoring device, which can be a computer, game console and other equipment; the camera can be a built-in camera or an external pluggable Camera; the infrared lampshade is made of an infrared filter, which can be fixed on the host computer or on the camera. Cover the camera with an infrared filter cover, connect the camera to the host computer, and bind the infrared light source to the captured object.
以下以游戏机为实例对本发明进行说明,首先将游戏机(上位机)连接到电视或显示器,将摄像头连接到游戏机(上位机),可以是通过外部接口插入,或者将摄像头直接内部连接并固定到游戏机上;用红外滤光罩盖住摄像头;将红外定位点(红外发光源)安装到无线游戏手柄内部。由无线游戏手柄上的红外定位点(红外发光源)发射出一定强度的红外光;红外光通过红外滤光罩,进入摄像头,由摄像头拍摄成图片,摄像头再将图片数据发送给游戏机内部的MCU(CPU),游戏机内部的MCU(CPU)对摄像头发来的图片数据按照以下算法进行解析处理,得到红外定位点(红外发光源)的平均坐标,再将红外定位点(红外发光源)的平均坐标换算成光标在显示屏上的坐标,就可以控制光标在显示屏上的运动。The present invention is described below with the game machine as an example. First, the game machine (host computer) is connected to a TV or a display, and the camera is connected to the game machine (host computer), which can be inserted through an external interface, or the camera is directly connected internally and Fix it on the game console; cover the camera with an infrared filter cover; install the infrared positioning point (infrared light source) inside the wireless game controller. The infrared positioning point (infrared light source) on the wireless game controller emits a certain intensity of infrared light; the infrared light passes through the infrared filter cover and enters the camera, which is captured by the camera to form a picture, and the camera sends the picture data to the inside of the game machine. MCU (CPU), the MCU (CPU) inside the game machine analyzes and processes the image data sent by the camera according to the following algorithm to obtain the average coordinates of the infrared positioning point (infrared light source), and then converts the infrared positioning point (infrared light source) Convert the average coordinates of the cursor to the coordinates of the cursor on the display screen to control the movement of the cursor on the screen.
实施例1:如图2所示,该图像捕捉定位系统的具体实现方法如下步骤:Embodiment 1: as shown in Figure 2, the specific implementation method of this image capture positioning system is as follows:
(1)、上位机先通过摄像头获取一张图片作为基准图片;用红外光照遮盖摄像头,摄像头拍摄外部环境的红外信息,并将红外的图片信息数据发送给游戏机(上位机)内部的MCU(CPU),由MCU(CPU)进行运算。(1), the host computer first obtains a picture through the camera as a reference picture; cover the camera with infrared light, the camera captures the infrared information of the external environment, and sends the infrared picture information data to the MCU inside the game machine (host computer) ( CPU), and the calculation is performed by the MCU (CPU).
(2)、读取上一步骤中所拍摄的图片数据,把非黑像素的坐标保存到数组Pixel1里,获得外界环境的红外信息,如果像素点的颜色是黑色(这个颜色判断根据不同上位设备,通过不同的色彩检测方法来判断,一般可用像素点的RGB值来判断),就不记录这个像素点的坐标值,如果这个像素点的颜色不是黑色就记录这个像素点的坐标值;(2), read the picture data taken in the previous step, save the coordinates of the non-black pixels in the array Pixel1, and obtain the infrared information of the external environment, if the color of the pixel is black (this color is judged according to different host devices , judged by different color detection methods, generally can be judged by the RGB value of the pixel), the coordinate value of this pixel point will not be recorded, if the color of this pixel point is not black, the coordinate value of this pixel point will be recorded;
(3)、在设定的间隔较短时间内通过摄像头继续获取二张图片图片(具体时间可根据摄像头或计算机性能决定,通常是3秒以下,因为外部环境可能存在某些变化的红外干扰源,如果存在变化的红外干扰源,不及时排除,会造成红外定位不准确),读取此次获取图片的颜色数据,并此次获取图片中非黑像素的坐标同上一步骤中所保存的坐标数组Pixel1进行对比,相同的坐标保存到数组Pixel中,为外界环境的红外干扰信息,因为红外定位点是移动设备,因此较短时间内的位置是有变化的,而外部环境的红外信息,通常来自于阳光或者是镜面所反射的阳光等固定设备,因此其他没有变化位置的非黑像素点就是外部环境所存在的红外信息,即外部存在的红外干扰。使用整型变量pCount来记录数组Pixel中的非黑色像素点的数量,即pCount所记录的是外部环境存在的红外信息的像素点的数量,整型变量pixelX是数组Pixel中所有x坐标和,整形变量pixelY是数组Pixel中所有y坐标和。(3) Continue to obtain two pictures through the camera within a short interval of time (the specific time can be determined according to the performance of the camera or computer, usually less than 3 seconds, because there may be some infrared interference sources in the external environment , if there is a changing infrared interference source, if it is not eliminated in time, the infrared positioning will be inaccurate), read the color data of the image obtained this time, and the coordinates of the non-black pixels in the image obtained this time are the same as those saved in the previous step The array Pixel1 is compared, and the same coordinates are saved in the array Pixel, which is the infrared interference information of the external environment, because the infrared positioning point is a mobile device, so the position changes in a short period of time, and the infrared information of the external environment, usually It comes from fixed equipment such as sunlight or sunlight reflected by mirrors, so other non-black pixels that do not change their positions are infrared information that exists in the external environment, that is, infrared interference that exists outside. Use the integer variable pCount to record the number of non-black pixels in the array Pixel, that is, pCount records the number of pixels of infrared information existing in the external environment, the integer variable pixelX is the sum of all x coordinates in the array Pixel, integer The variable pixelY is the sum of all y coordinates in the array Pixel.
(4)、摄像头持续拍照,对每次拍照进行以下运算(进入程序的主循环部分);(4), the camera continues to take pictures, and performs the following calculations for each photo (entering the main loop part of the program);
(5)、如果pCount为0,即步骤3中所获得的环境的红外信息像素点的数量是0,也就是拍摄到的图片是黑色的,外部没有任何红外干扰;没有外部红外干扰的情况下,MCU(CPU)对摄像头所发送的红外图片信息进行如下处理:(5), if pCount is 0, that is, the number of infrared information pixels of the environment obtained in step 3 is 0, that is, the picture taken is black, and there is no external infrared interference; in the case of no external infrared interference , the MCU (CPU) processes the infrared image information sent by the camera as follows:
对步骤(4)获得的图像的逐个像素点进行色彩检测,如果检测到非黑像素点,就将其坐标信息存到数组stickPixel中,通过运算得到红外定位点的平均坐标StickX=pStickX/pStickCount,StickY=pStickY/pStickCount,其中pStickX是数组stickPixel中所有x坐标的和,pStickY是数组stickPixel中所有y坐标的和,pStickCount为步骤(4)所拍摄图像中非黑像素点的数量。Carry out color detection pixel by pixel to the image that step (4) obtains, if detect non-black pixel point, just its coordinate information is stored in the array stickPixel, obtain the average coordinate StickX=pStickX/pStickCount of infrared anchor point by computing, StickY=pStickY/pStickCount, wherein pStickX is the sum of all x coordinates in the array stickPixel, pStickY is the sum of all y coordinates in the array stickPixel, and pStickCount is the quantity of non-black pixel points in the captured image of step (4).
(6)、pCount不为0,即是在第一帧和第二帧中有相同的坐标点是非黑色像素,因为红外定位点本身是移动的,因此如果不存在外部环境干扰的情况下,在较短时间内所拍摄的两张图片中,非黑像素应该有移动,表现为其坐标发生变化。就是存在外部环境的红外干扰,MCU(CPU)对摄像头所发送的红外图片信息进行如下处理:(6), pCount is not 0, that is, the same coordinate point in the first frame and the second frame is a non-black pixel, because the infrared positioning point itself is moving, so if there is no external environmental interference, in the In the two pictures taken within a relatively short period of time, the non-black pixels should have moved, which is represented by a change in their coordinates. That is, there is infrared interference from the external environment, and the MCU (CPU) processes the infrared image information sent by the camera as follows:
对步骤(4)获得的图像的逐个像素点进行色彩检测,如果检测到非黑像素点,将其坐标信息存到数组stickPixel中,通过运算得到红外定位点的平均坐标StickX=(pStickX-pixelX)/(pStickCount-pCount),StickY=(pStickY-pixelY)/(pStickCount-pCount),其中pStickX是数组stickPixel中所有x坐标的和,pStickY是数组stickPixel中所有y坐标的和,pixelX和pixelY步骤(3)中所获得外部环境的红外信息的坐标X和坐标Y的和,pStickCount为步骤(4)获得图像中非黑像素点的数量,pCount为步骤(3)中外部红外信息中的非黑像素点的数量。Carry out color detection pixel by pixel to the image that step (4) obtains, if detect non-black pixel point, its coordinate information is stored in the array stickPixel, obtains the average coordinate StickX=(pStickX-pixelX) of infrared positioning point by operation /(pStickCount-pCount), StickY=(pStickY-pixelY)/(pStickCount-pCount), wherein pStickX is the sum of all x coordinates in the array stickPixel, pStickY is the sum of all y coordinates in the array stickPixel, pixelX and pixelY step (3 ), pStickCount is the number of non-black pixels in the image obtained in step (4), pCount is the non-black pixels in the external infrared information in step (3) quantity.
(7)、根据不同的上位机,采用一定的换算方法将步骤(5)或步骤(6)中得到的平均坐标值换算成所需的定位数据,此换算过程由用户的不同要求决定。根据上位机所连接显示屏的分辨率不同,将上面定位点的平均坐标StickX、StickY映射成屏幕上光标的坐标值输出。由于所连接显示器分辨率及性能不同,映射方法不同,也有些不需要进行映射,有些只要直接按照StickX、StickY输出即可。例如,在计算机上,将所得到的平均坐标赋值给鼠标光标,并将一个小的红外发光源绑定到手上,那么就可以直接依靠手的变化来操纵鼠标光标的移动。(7), according to different upper computers, adopt a certain conversion method to convert the average coordinate value obtained in step (5) or step (6) into required positioning data, and this conversion process is determined by different requirements of users. According to the resolution of the display screen connected to the host computer, the average coordinates StickX and StickY of the above positioning points are mapped to the coordinate values of the cursor on the screen for output. Due to the different resolutions and performances of the connected monitors, the mapping methods are different, and some do not need to be mapped, and some can be directly output according to StickX and StickY. For example, on a computer, assign the obtained average coordinates to the mouse cursor, and bind a small infrared light source to the hand, so that the movement of the mouse cursor can be manipulated directly by hand changes.
(8)、判断距离上一次获得外界环境信息的时间是否大于2s,如果大于2s就循环到最开始<拍摄环境图像>即步骤(1)中,如果不到2s就循环到<摄像头拍照>即步骤(4)。(8). Determine whether the time since the last time the external environment information was obtained is greater than 2s. If it is greater than 2s, it will loop to the very beginning <shooting the environment image>, that is, step (1). If it is less than 2s, it will loop to <camera photoshoot>. Step (4).
实施例2:如图3所示,其它步骤同实施例这里不再一一说明,本实施例仅对处理步骤有所差别的步骤(5)进行进一步说明:Embodiment 2: as shown in Figure 3, other steps are no longer explained one by one here with the embodiment, and the present embodiment only further explains to the step (5) that processing step differs to some extent:
(5)、如果pCount为0,即步骤3中所获得的环境的红外信息像素点的数量是0,也就是拍摄到的图片是黑色的,外部没有任何红外干扰;没有外部红外干扰的情况下,MCU(CPU)对摄像头所发送的红外图片信息进行处理。(5), if pCount is 0, that is, the number of infrared information pixels of the environment obtained in step 3 is 0, that is, the picture taken is black, and there is no external infrared interference; in the case of no external infrared interference , the MCU (CPU) processes the infrared picture information sent by the camera.
1)判断preflag是否为0。定义一个整形变量preflag,preflag是用来标志是否是进入主循环后第一次拍摄,如果是第一次拍摄preflag就为0,如果不是第一次拍摄,preflag就为1。如果preflag为0,说明是第一次拍摄,则像素点的搜索范围设定为全屏;如果preflag为1,则说明不是进入主循环的第一次拍摄,如果不是第一次拍摄,说明存在PreBound。结构体PreBound是一个用来存储前一帧中红外像素点范围的结构体,由前一次拍摄的图片中所有非黑色像素点的坐标的x最大值PreBound.maxX、最小值PreBound.minX以及y最大值PreBound.maxY、最小值PreBound.minY组成,即前一次拍摄的图片中所有非黑色像素点的所在的范围,结构体CurBound是一个用来存储当前帧中红外像素点范围的结构体,由本次拍摄的图片中所有非黑色像素点的坐标的x最大值CurBound.maxX、最小值CurBound.minX以及y最大值CurBound.maxY、最小值CurBound.minY组成,即本次拍摄的图片中所有非黑色像素点的所在的范围。最后,则由PreBound和CurBound计算得到SearchBound;SearchBound具体运算方法如下:SearchBound.maxX=CurBound.maxX+(CurBound.maxX-PreBound.maxX)*2;SearchBound.minX=CurBound.minX+(CurBound.minX-PreBound.minX)*2;SearchBound.maxY=CurBound.maxY+(CurBound.maxY-PreBound.maxY)*2;SearchBound.minY=CurBound.minY+(CurBound.minY-PreBound.minY)*2。结构体SearchBound是用来存储搜索范围的结构体,就是所预测的红外像素点的搜索范围。计算出这个搜索范围的目的是在搜索红外像素点的时候在SearchBound这个区域内搜索,而不是在全屏搜索,可以提高搜索效率。1) Determine whether the preflag is 0. Define an integer variable preflag. Preflag is used to mark whether it is the first shooting after entering the main loop. If it is the first shooting, preflag is 0. If it is not the first shooting, preflag is 1. If preflag is 0, it means that it is the first shot, and the search range of pixels is set to full screen; if preflag is 1, it means that it is not the first shot to enter the main loop, if it is not the first shot, it means that there is PreBound . The structure PreBound is a structure used to store the range of infrared pixels in the previous frame. The x maximum value PreBound.maxX, the minimum value PreBound.minX and the y maximum value of the coordinates of all non-black pixel points in the picture taken last time The value PreBound.maxY and the minimum value PreBound.minY are composed of the range of all non-black pixels in the picture taken last time. The structure CurBound is a structure used to store the range of infrared pixels in the current frame. The x maximum value CurBound.maxX, the minimum value CurBound.minX, the y maximum value CurBound.maxY, and the minimum value CurBound.minY of the coordinates of all non-black pixels in the picture taken this time, that is, all non-black pixels in the picture taken this time The range of pixels. Finally, SearchBound is calculated by PreBound and CurBound; the specific calculation method of SearchBound is as follows: SearchBound.maxX=CurBound.maxX+(CurBound.maxX-PreBound.maxX)*2; SearchBound.minX=CurBound.minX+(CurBound.minX-PreBound. minX)*2; SearchBound.maxY=CurBound.maxY+(CurBound.maxY-PreBound.maxY)*2; SearchBound.minY=CurBound.minY+(CurBound.minY-PreBound.minY)*2. The structure SearchBound is a structure used to store the search range, which is the search range of the predicted infrared pixels. The purpose of calculating this search range is to search within the SearchBound area when searching for infrared pixels, instead of searching in full screen, which can improve search efficiency.
2)把CurBound赋给PreBound是为了通过这两个数值的运算来预测定位点下一帧的运动。2) The purpose of assigning CurBound to PreBound is to predict the motion of the anchor point in the next frame through the operation of these two values.
3)在搜索范围内,对逐个像素点进行色彩检测,如果检测到非黑像素点,就将其坐标信息存到数组stickPixel中,pStickX是数组stickPixel中所有x坐标的和,pStickY是数组stickPixel中所有y坐标的和,使用变量pStickCount来记录非黑像素点的数量,使用CurBound记录所有非黑像素的坐标区域。3) Within the search range, perform color detection on a pixel-by-pixel basis. If a non-black pixel is detected, its coordinate information is stored in the array stickPixel. pStickX is the sum of all x coordinates in the array stickPixel, and pStickY is in the array stickPixel The sum of all y coordinates, use the variable pStickCount to record the number of non-black pixels, and use CurBound to record the coordinate area of all non-black pixels.
4)运算得到红外定位点的平均坐标StickX=pStickX/pStickCount,StickY=pStickY/pStickCount。4) Calculate and obtain the average coordinates StickX=pStickX/pStickCount, StickY=pStickY/pStickCount of the infrared positioning point.
5)通过上面得到的PreBound、CurBound可以基本上判断出屏幕上非黑像素将要移动的范围,可以根据程序员自己需要使用最合适的参数获得下一帧的搜索范围SearchBound。5) Based on the PreBound and CurBound obtained above, the moving range of the non-black pixels on the screen can be basically judged, and the search range SearchBound of the next frame can be obtained by using the most suitable parameters according to the programmer's own needs.
以上所述,仅为本发明较佳的具体实施方式,但本发明的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本发明揭露的技术范围内,根据本发明的技术方案及其发明构思加以等同替换或改变,都应涵盖在本发明的保护范围之内。The above is only a preferred embodiment of the present invention, but the scope of protection of the present invention is not limited thereto, any person familiar with the technical field within the technical scope disclosed in the present invention, according to the technical solution of the present invention Any equivalent replacement or change of the inventive concepts thereof shall fall within the protection scope of the present invention.
Claims (3)
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN2009100121170A CN101581989B (en) | 2009-06-17 | 2009-06-17 | Image Capture Positioning System |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN2009100121170A CN101581989B (en) | 2009-06-17 | 2009-06-17 | Image Capture Positioning System |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| CN101581989A CN101581989A (en) | 2009-11-18 |
| CN101581989B true CN101581989B (en) | 2011-03-16 |
Family
ID=41364157
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN2009100121170A Active CN101581989B (en) | 2009-06-17 | 2009-06-17 | Image Capture Positioning System |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN101581989B (en) |
Families Citing this family (6)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN101887329B (en) * | 2010-07-13 | 2012-01-25 | 世大光电(深圳)有限公司 | Electronic equipment and optical positioning device thereof |
| CN102445913A (en) * | 2010-10-08 | 2012-05-09 | 鸿富锦精密工业(深圳)有限公司 | Temperature monitoring system and method |
| CN104660971A (en) * | 2013-11-25 | 2015-05-27 | 上海捷视科技有限公司 | Handheld radio microphone video acquisition and positioning system |
| CN107390953A (en) * | 2017-07-04 | 2017-11-24 | 深圳市虚拟现实科技有限公司 | Virtual reality handle space localization method |
| CN110560827B (en) * | 2019-08-28 | 2022-05-17 | 深圳泰德激光技术股份有限公司 | Material welding method, welding equipment and storage medium |
| CN114268553B (en) * | 2021-09-28 | 2025-08-08 | 上海市建筑通信网络有限公司 | AR positioning guidance system and method for shared communication facilities in residential areas |
-
2009
- 2009-06-17 CN CN2009100121170A patent/CN101581989B/en active Active
Also Published As
| Publication number | Publication date |
|---|---|
| CN101581989A (en) | 2009-11-18 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| US10531069B2 (en) | Three-dimensional image sensors | |
| JP6302414B2 (en) | Motion sensor device having a plurality of light sources | |
| CN104380729B (en) | Context-driven adjustment of camera parameters | |
| TWI585436B (en) | Method and apparatus for measuring depth information | |
| US8619122B2 (en) | Depth camera compatibility | |
| CN101581989B (en) | Image Capture Positioning System | |
| TWI442328B (en) | Shadow and reflection identification in image capturing devices | |
| JP5680976B2 (en) | Electronic blackboard system and program | |
| JP6299983B2 (en) | Motion sensor device having a plurality of light sources | |
| CA2786436C (en) | Depth camera compatibility | |
| CN104603574B (en) | Motion sensor device with multiple light sources | |
| JP5740822B2 (en) | Information processing apparatus, information processing method, and program | |
| CN109903324B (en) | Depth image acquisition method and device | |
| KR101883291B1 (en) | Device and method for controlling gesture | |
| CN201413506Y (en) | Image capturing and positioning device | |
| KR101503017B1 (en) | Motion detection method and apparatus | |
| CN101452349B (en) | Cursor control device, method and image system on image display device | |
| US9342164B2 (en) | Motion detecting device and the method for dynamically adjusting image sensing area thereof | |
| JP2011188023A (en) | Information processing unit, method of processing information, and program | |
| JP3954436B2 (en) | Image input device | |
| CN116916164A (en) | Image stroboscopic processing method, device, electronic equipment and storage medium | |
| Liao et al. | Robust technique of analyzing and locating laser speckle patterns for optical computer mice | |
| US20250218574A1 (en) | Systems and methods for image sequence registration | |
| JP2011186537A (en) | Apparatus and method for processing information, and program | |
| CN102609120A (en) | Cursor control device, method and image system on image display device |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| C06 | Publication | ||
| PB01 | Publication | ||
| C10 | Entry into substantive examination | ||
| SE01 | Entry into force of request for substantive examination | ||
| C14 | Grant of patent or utility model | ||
| GR01 | Patent grant |