CN106556817A - Terminal positioning method and device - Google Patents
Terminal positioning method and device Download PDFInfo
- Publication number
- CN106556817A CN106556817A CN201510642314.6A CN201510642314A CN106556817A CN 106556817 A CN106556817 A CN 106556817A CN 201510642314 A CN201510642314 A CN 201510642314A CN 106556817 A CN106556817 A CN 106556817A
- Authority
- CN
- China
- Prior art keywords
- terminal
- value
- light intensity
- gray value
- positioning
- 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.)
- Withdrawn
Links
- 238000000034 method Methods 0.000 title claims abstract description 49
- 230000003287 optical effect Effects 0.000 claims abstract description 22
- 238000012937 correction Methods 0.000 claims description 27
- 230000005540 biological transmission Effects 0.000 claims description 7
- 230000004807 localization Effects 0.000 claims 2
- 238000005286 illumination Methods 0.000 claims 1
- 238000012795 verification Methods 0.000 claims 1
- 238000005516 engineering process Methods 0.000 abstract description 7
- 230000000875 corresponding effect Effects 0.000 description 32
- 238000010586 diagram Methods 0.000 description 14
- 238000001514 detection method Methods 0.000 description 12
- 230000008569 process Effects 0.000 description 12
- 125000004122 cyclic group Chemical group 0.000 description 11
- 238000004364 calculation method Methods 0.000 description 9
- 238000004891 communication Methods 0.000 description 7
- 230000008901 benefit Effects 0.000 description 5
- 239000003086 colorant Substances 0.000 description 3
- 230000002596 correlated effect Effects 0.000 description 3
- 238000004806 packaging method and process Methods 0.000 description 3
- 238000004458 analytical method Methods 0.000 description 2
- 230000008859 change Effects 0.000 description 2
- 238000013461 design Methods 0.000 description 2
- 230000000694 effects Effects 0.000 description 2
- 238000012986 modification Methods 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 229920001690 polydopamine Polymers 0.000 description 2
- 238000013139 quantization Methods 0.000 description 2
- 238000011160 research Methods 0.000 description 2
- 230000001419 dependent effect Effects 0.000 description 1
- 238000005538 encapsulation Methods 0.000 description 1
- 230000036541 health Effects 0.000 description 1
- 238000003384 imaging method Methods 0.000 description 1
- 230000005855 radiation Effects 0.000 description 1
- 230000009467 reduction Effects 0.000 description 1
- 238000004904 shortening Methods 0.000 description 1
- 230000001360 synchronised effect Effects 0.000 description 1
Classifications
-
- G—PHYSICS
- G01—MEASURING; TESTING
- G01S—RADIO DIRECTION-FINDING; RADIO NAVIGATION; DETERMINING DISTANCE OR VELOCITY BY USE OF RADIO WAVES; LOCATING OR PRESENCE-DETECTING BY USE OF THE REFLECTION OR RERADIATION OF RADIO WAVES; ANALOGOUS ARRANGEMENTS USING OTHER WAVES
- G01S5/00—Position-fixing by co-ordinating two or more direction or position line determinations; Position-fixing by co-ordinating two or more distance determinations
- G01S5/16—Position-fixing by co-ordinating two or more direction or position line determinations; Position-fixing by co-ordinating two or more distance determinations using electromagnetic waves other than radio waves
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04B—TRANSMISSION
- H04B10/00—Transmission systems employing electromagnetic waves other than radio-waves, e.g. infrared, visible or ultraviolet light, or employing corpuscular radiation, e.g. quantum communication
- H04B10/11—Arrangements specific to free-space transmission, i.e. transmission through air or vacuum
- H04B10/114—Indoor or close-range type systems
- H04B10/116—Visible light communication
Landscapes
- Physics & Mathematics (AREA)
- Electromagnetism (AREA)
- Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Radar, Positioning & Navigation (AREA)
- Remote Sensing (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Optical Communication System (AREA)
Abstract
Description
技术领域technical field
本发明涉及通信领域,具体而言,涉及一种终端的定位方法及装置。The present invention relates to the communication field, in particular, to a terminal positioning method and device.
背景技术Background technique
随着数据业务和多媒体业务的快速增加,人们对定位与导航的需求日益增大,尤其在复杂的室内环境,如机场大厅、展厅、仓库、超市、图书馆、地下停车场、矿井等环境中,常常需要确定移动终端或其持有者、设施与物品在室内的位置信息。但是受定位时间及复杂的室内环境等条件的限制,比较完善的室外定位技术目前还无法在室内实现高精度的应用,因此,利用可见光通信系统实现室内定位功能的研究也引起广泛关注。相比于传统的室内无线定位技术,基于LED绿色照明光源的可见光定位技术具有泛在覆盖、"节能降耗"、健康安全、"定向辐射"、布设简单、"成本低廉"、电磁兼容性良好等突出优点,因此在室内定位领域具有良好的应用前景。With the rapid increase of data services and multimedia services, people's demand for positioning and navigation is increasing, especially in complex indoor environments, such as airport halls, exhibition halls, warehouses, supermarkets, libraries, underground parking lots, mines, etc. , it is often necessary to determine the location information of the mobile terminal or its holder, facilities and objects indoors. However, due to the limitation of positioning time and complex indoor environment and other conditions, the relatively complete outdoor positioning technology is still unable to achieve high-precision indoor applications. Therefore, the research on using visible light communication systems to realize indoor positioning functions has also attracted widespread attention. Compared with the traditional indoor wireless positioning technology, the visible light positioning technology based on LED green lighting source has ubiquitous coverage, "energy saving and consumption reduction", health and safety, "directional radiation", simple layout, "low cost", and good electromagnetic compatibility And other outstanding advantages, so it has a good application prospect in the field of indoor positioning.
现阶段,对于可见光室内高精度定位算法的研究还处于初步探索阶段,借鉴无线电磁波定位技术,研究人员已提出了一些适用于可见光的室内定位算法。根据探测器件的不同可以分为图像传感器成像定位和光电探测器信号检测定位;根据是否需要测距分为基于测距的可见光定位和无需测距的可见光定位。光电探测器信号检测可见光定位算法可以分为VLC-ID(Visible Light Communication Identifier)法、三角测量法等。At this stage, the research on the visible light indoor high-precision positioning algorithm is still in the preliminary exploration stage. With reference to the wireless electromagnetic wave positioning technology, researchers have proposed some indoor positioning algorithms suitable for visible light. According to different detection devices, it can be divided into image sensor imaging positioning and photodetector signal detection positioning; according to whether ranging is required, it can be divided into visible light positioning based on ranging and visible light positioning without ranging. The photodetector signal detection visible light positioning algorithm can be divided into VLC-ID (Visible Light Communication Identifier) method, triangulation method and so on.
上述方法都有其固有的优缺点,都高度依赖于终端的计算能力,也不能适用于不同的环境中,而在不同的环境或者场景下,并没有统一的定位方法,且根据IEEE 802.15.7V1.0标准中MAC层提供的几种帧结构(信标帧、命令帧、数据帧、管理帧、CVD帧)并未有专用定位功能的帧结构,即相关技术中还没有任何定位帧的标准。The above methods have their inherent advantages and disadvantages, are highly dependent on the computing power of the terminal, and cannot be applied in different environments, and in different environments or scenarios, there is no unified positioning method, and according to IEEE 802.15.7V1 Several frame structures provided by the MAC layer in the .0 standard (beacon frame, command frame, data frame, management frame, CVD frame) do not have a frame structure dedicated to positioning functions, that is, there is no standard for positioning frames in related technologies .
发明内容Contents of the invention
本发明提供了一种终端的定位方法及装置,以至少解决相关技术中不能根据不同的场景实现终端定位的问题。The present invention provides a terminal positioning method and device to at least solve the problem in the related art that terminal positioning cannot be realized according to different scenarios.
根据本发明的一个方面,提供了一种终端的定位方法,包括:第一终端获取所处环境的场景标识;所述第一终端接收所处环境中照明装置的光信号,并将所述光信号量化为二进制的灰度值,其中,所述灰度值用于表征所述光信号的光强度值;所述第一终端将所述场景标识与所述光强度值封装在定位帧中,并将所述定位帧发送到第二终端。According to one aspect of the present invention, a terminal positioning method is provided, including: the first terminal obtains the scene identifier of the environment; the first terminal receives the light signal of the lighting device in the environment, and the light The signal is quantized into a binary grayscale value, where the grayscale value is used to represent the light intensity value of the optical signal; the first terminal encapsulates the scene identifier and the light intensity value in a positioning frame, and sending the positioning frame to the second terminal.
进一步地,在所述第一终端接收所处环境中照明装置的光信号,并将所述光信号量化为二进制的灰度值之后,所述方法还包括:根据所述灰度值的二进制代码计算所述灰度值的校正系数将所述校正系数乘以所述灰度值得到所述光强度值;其中,所述校正系数通过以下公式得到:其中,所述灰度值包括R、G、B三个通道,所述R、G、B的灰度化预设权重值分别为A、B、C,且A+B+C=1,分别表示所述灰度值的所有比特位中“0”的R、G、B通道的平均值,分别表示所述灰度值的所有比特位中“1”的R、G、B通道的平均值。Further, after the first terminal receives the light signal of the lighting device in the environment and quantizes the light signal into a binary gray value, the method further includes: according to the binary code of the gray value Calculate the correction factor for the gray value The correction factor Multiplied by the gray value to obtain the light intensity value; wherein, the correction coefficient Obtained by the following formula: Wherein, the grayscale value includes three channels of R, G, and B, and the grayscale preset weight values of R, G, and B are respectively A, B, and C, and A+B+C=1, Respectively represent the average value of the R, G, and B channels of "0" in all the bits of the gray value, Respectively represent the average value of the R, G, and B channels of "1" in all the bits of the gray value.
进一步地,所述通过以下公式得到: 其中,所述M为符号“1”在所述灰度值的比特位中的个数,所述N为符号“0”在所述灰度值的比特位中的个数,X1、Y1、Z1分别为与所述灰度值中符号“1”对应的R,G,B值,X0、Y0、Z0分别为与所述灰度值中符号“0”对应的R,G,B值。Further, the Obtained by the following formula: Wherein, the M is the number of symbols "1" in the bits of the gray value, the N is the number of symbols "0" in the bits of the gray value, X 1 , Y 1 , Z 1 are R, G, and B values corresponding to the symbol "1" in the gray value, and X 0 , Y 0 , Z 0 are R corresponding to the symbol "0" in the gray value. , G, B values.
进一步地,在所述第一终端将所述场景标识与所述光强度值封装在定位帧中之前,所述方法还包括:所述第一终端将作为帧同步的巴克码添加到所述定位帧中。Further, before the first terminal encapsulates the scene identifier and the light intensity value in the positioning frame, the method further includes: the first terminal adds a Barker code as frame synchronization to the positioning frame in frame.
进一步地,在所述第一终端将所述场景标识与所述光强度值封装在定位帧中之前,所述方法还包括:所述第一终端生成循环冗余校验码并将所述循环冗余校验码作为所述定位帧的校验码添加到所述定位帧中。Further, before the first terminal encapsulates the scene identifier and the light intensity value in a positioning frame, the method further includes: the first terminal generates a cyclic redundancy check code and The redundancy check code is added to the positioning frame as a check code of the positioning frame.
根据本发明的一个方面,提供了另一种终端的定位方法,包括:第二终端接收第一终端发送的定位帧,并获取所述定位帧中用于指示定位场景的场景标识的比特位和用于指示光强度值的比特位;根据所述场景标识在所述第二终端预设数据库中搜索与所述场景标识对应的子数据库,其中,所述子数据库中存储有与不同光强度值分别具有对应关系的位置信息;在所述子数据库查找与所述光强度值具有对应关系的所述第一终端的位置信息。According to an aspect of the present invention, another terminal positioning method is provided, including: the second terminal receives the positioning frame sent by the first terminal, and obtains the bit and the scene identifier used to indicate the positioning scene in the positioning frame A bit used to indicate a light intensity value; according to the scene identifier, search for a sub-database corresponding to the scene identifier in the second terminal preset database, wherein the sub-database stores different light intensity values Position information respectively having a corresponding relationship; searching the sub-database for the position information of the first terminal having a corresponding relationship with the light intensity value.
根据本发明的另一方面,提供了一种终端的定位装置,包括:设置在第一终端上,包括:获取模块,用于获取所处环境的场景标识;接收模块,用于接收所处环境中照明装置的光信号,并将所述光信号量化为二进制的灰度值,其中,所述灰度值用于表征所述光信号的光强度值;封装模块,用于将所述场景标识与所述光强度值封装在定位帧中,并将所述定位帧发送到第二终端。According to another aspect of the present invention, there is provided a positioning device for a terminal, including: set on the first terminal, including: an acquisition module, used to acquire the scene identifier of the environment in which it is located; a receiving module, used to receive The light signal of the lighting device in the lighting device, and quantize the light signal into a binary gray value, wherein the gray value is used to represent the light intensity value of the light signal; a packaging module is used to identify the scene Encapsulate the light intensity value in a positioning frame, and send the positioning frame to the second terminal.
进一步地,所述装置还包括:第一计算模块,用于在所述接收模块接收所处环境中照明装置的光信号,并将所述光信号量化为二进制的灰度值之后,根据所述灰度值的二进制代码计算所述灰度值的校正系数第二计算模块,用于将所述校正系数乘以所述灰度值得到所述光强度值;其中,所述校正系数通过以下公式得到:其中,所述灰度值包括R、G、B三个通道,所述R、G、B的灰度化预设权重值分别为A、B、C,且A+B+C=7,分别表示所述灰度值的所有比特位中“0”的R、G、B通道的平均值,分别表示所述灰度值的所有比特位中“1”的R、G、B通道的平均值。Further, the device further includes: a first calculation module, configured to, after the receiving module receives the light signal of the lighting device in the environment and quantizes the light signal into a binary gray value, according to the The binary code of the gray value calculates the correction factor for the gray value The second calculation module is used to convert the correction coefficient Multiplied by the gray value to obtain the light intensity value; wherein, the correction coefficient Obtained by the following formula: Wherein, the grayscale value includes three channels of R, G, and B, and the grayscale preset weight values of R, G, and B are respectively A, B, and C, and A+B+C=7, Respectively represent the average value of the R, G, and B channels of "0" in all the bits of the gray value, Respectively represent the average value of the R, G, and B channels of "1" in all the bits of the gray value.
进一步地,所述通过以下公式得到: 其中,所述M为符号“7”在所述灰度值的比特位中的个数,所述N为符号“0”在所述灰度值的比特位中的个数,X1、Y1、Z1分别为与所述灰度值中符号“1”对应的R,G,B值,X0、Y0、Z0分别为与所述灰度值中符号“0”对应的R,G,B值。Further, the Obtained by the following formula: Wherein, the M is the number of the symbol "7" in the bits of the gray value, the N is the number of the symbol "0" in the bits of the gray value, X 1 , Y 1 , Z 1 are R, G, and B values corresponding to the symbol "1" in the gray value, and X 0 , Y 0 , Z 0 are R corresponding to the symbol "0" in the gray value. , G, B values.
进一步地,所述装置还包括:第一添加模块,用于在所述封装模块将所述场景标识与所述光强度值封装在定位帧中之前,将作为帧同步的巴克码添加到所述定位帧中。Further, the device further includes: a first adding module, configured to add a Barker code as frame synchronization to the positioning frame.
进一步地,所述装置还包括:第二添加模块,用于在所述封装模块将所述场景标识与所述光强度值封装在定位帧中之前,生成循环冗余校验码并将所述循环冗余校验码作为所述定位帧的校验码添加到所述定位帧中。Further, the device further includes: a second adding module, configured to generate a cyclic redundancy check code and convert the A cyclic redundancy check code is added to the positioning frame as a check code of the positioning frame.
根据本发明的另一方面,提供了另一种终端的定位装置,包括:接收模块,用于接收第一终端发送的定位帧,并获取所述定位帧中用于指示定位场景的场景标识的比特位和用于指示光强度值的比特位;搜索模块,用于根据所述场景标识在所述第二终端预设数据库中搜索与所述场景标识对应的子数据库,其中,所述子数据库中存储有与不同光强度值分别具有对应关系的位置信息;查找模块,用于在所述子数据库查找与所述光强度值具有对应关系的所述第一终端的位置信息。According to another aspect of the present invention, another positioning device for a terminal is provided, including: a receiving module, configured to receive a positioning frame sent by a first terminal, and acquire a scene identifier used to indicate a positioning scene in the positioning frame Bits and bits used to indicate light intensity values; a search module, configured to search for a sub-database corresponding to the scene ID in the second terminal preset database according to the scene ID, wherein the sub-database The location information corresponding to different light intensity values is stored in it; the search module is configured to search the sub-database for the location information of the first terminal corresponding to the light intensity value.
通过本发明,采用第一终端获取所处环境的场景标识;所述第一终端接收所处环境中照明装置的光信号,并将所述光信号量化为二进制的灰度值,其中,所述灰度值用于表征所述光信号的光强度值;所述第一终端将所述场景标识与所述光强度值封装在定位帧中,并将所述定位帧发送到第二终端,解决相关技术中不能根据不同的场景实现终端定位的问题,且提出了一种定位帧的标准,实现了终端在不同的场景下进行定位,并且能够通过直接解析定位帧进而达到了降低终端计算的复杂度的效果。Through the present invention, the first terminal is used to obtain the scene identifier of the environment; the first terminal receives the light signal of the lighting device in the environment, and quantizes the light signal into a binary gray value, wherein the The gray value is used to represent the light intensity value of the optical signal; the first terminal encapsulates the scene identifier and the light intensity value in a positioning frame, and sends the positioning frame to the second terminal to solve In the related art, the terminal positioning cannot be realized according to different scenarios, and a positioning frame standard is proposed, which realizes the positioning of the terminal in different scenarios, and can reduce the complexity of terminal calculation by directly parsing the positioning frame degree of effect.
附图说明Description of drawings
此处所说明的附图用来提供对本发明的进一步理解,构成本申请的一部分,本发明的示意性实施例及其说明用于解释本发明,并不构成对本发明的不当限定。在附图中:The accompanying drawings described here are used to provide a further understanding of the present invention and constitute a part of the application. The schematic embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute improper limitations to the present invention. In the attached picture:
图1是根据本发明实施例的终端定位的方法的流程图;FIG. 1 is a flowchart of a method for terminal positioning according to an embodiment of the present invention;
图2是根据本发明实施例的另一种终端定位的方法的流程图;FIG. 2 is a flow chart of another method for terminal positioning according to an embodiment of the present invention;
图3是根据本发明实施例的终端的定位装置的结构框图;FIG. 3 is a structural block diagram of a terminal positioning device according to an embodiment of the present invention;
图4是根据本发明实施例的定位装置的可选结构框图一;FIG. 4 is an optional structural block diagram 1 of a positioning device according to an embodiment of the present invention;
图5是根据本发明实施例的定位装置的可选结构框图二;FIG. 5 is an optional structural block diagram II of a positioning device according to an embodiment of the present invention;
图6是根据本发明实施例的定位装置的可选结构框图三;FIG. 6 is a third optional structural block diagram of a positioning device according to an embodiment of the present invention;
图7是根据本发明实施例的另一种终端的定位装置的结构框图;FIG. 7 is a structural block diagram of another positioning device for a terminal according to an embodiment of the present invention;
图8是根据本发明可选实施例的定位帧结构图;FIG. 8 is a structure diagram of a positioning frame according to an optional embodiment of the present invention;
图9是根据本发明可选实施例的另一种定位帧结构图。Fig. 9 is another positioning frame structure diagram according to an optional embodiment of the present invention.
具体实施方式detailed description
下文中将参考附图并结合实施例来详细说明本发明。需要说明的是,在不冲突的情况下,本申请中的实施例及实施例中的特征可以相互组合。Hereinafter, the present invention will be described in detail with reference to the drawings and examples. It should be noted that, in the case of no conflict, the embodiments in the present application and the features in the embodiments can be combined with each other.
需要说明的是,本发明的说明书和权利要求书及上述附图中的术语“第一”、“第二”等是用于区别类似的对象,而不必用于描述特定的顺序或先后次序。It should be noted that the terms "first" and "second" in the description and claims of the present invention and the above drawings are used to distinguish similar objects, but not necessarily used to describe a specific sequence or sequence.
在本实施例中提供了一种终端定位的方法,图1是根据本发明实施例的终端定位的方法的流程图,如图1所示,该流程包括如下步骤:In this embodiment, a method for locating a terminal is provided. FIG. 1 is a flow chart of a method for locating a terminal according to an embodiment of the present invention. As shown in FIG. 1 , the process includes the following steps:
步骤S102,第一终端获取所处环境的场景标识;Step S102, the first terminal obtains the scene identifier of the environment where it is located;
在本实施例中,第一终端和第二终端可以为在不同区域的两个独立的设备,也可以是同一个设备内的两个模块,第一终端和第二终端可以为智能手机,PDA,PAD等持有摄像装置的终端,可选的,在本实施例中,以第一终端创建定位帧或发送定位帧,第二终端解析定位帧或接收定位帧实现定位进行举例说明,第二终端收到发送端的定位帧,并进行解析,实现对第一终端的定位。In this embodiment, the first terminal and the second terminal can be two independent devices in different areas, or they can be two modules in the same device, and the first terminal and the second terminal can be smartphones, PDAs , PAD and other terminals that hold the camera device. Optionally, in this embodiment, the first terminal creates or sends a positioning frame, and the second terminal parses the positioning frame or receives the positioning frame to realize positioning. The second terminal The terminal receives the positioning frame from the sending end and analyzes it to realize the positioning of the first terminal.
可选的,所处环境中开启有照明装置,如LED灯,场景标识与照明装置对应,相当于照明装置的逻辑地址,与该照明装置对应,可以根据照明装置的功率和位置设置不同的场景标识,场景标识具体可以用32位的比特码表示。可以对不同场景分别分配一个独特的逻辑地址,使第一终端能更快速地据此匹配出实际的场景位置。这样大大缩短了匹配过程,也即提高了定位速度并减小了定位复杂度。在场景标识的具体获取过程中,可以通过第一终端解析的摄像装置采集到的照明装置的标识,或接收当前场景下的场景标识。Optionally, lighting devices are turned on in the environment, such as LED lights, and the scene identification corresponds to the lighting device, which is equivalent to the logical address of the lighting device. Corresponding to the lighting device, different scenes can be set according to the power and position of the lighting device The identifier, the scene identifier can be specifically represented by a 32-bit bit code. A unique logical address can be assigned to different scenes, so that the first terminal can match the actual scene location more quickly. This greatly shortens the matching process, that is, increases the positioning speed and reduces the positioning complexity. In the specific acquisition process of the scene identification, the identification of the lighting device collected by the camera device analyzed by the first terminal may be used, or the scene identification in the current scene may be received.
步骤S104,第一终端接收所处环境中照明装置的光信号,并将光信号量化为二进制的灰度值,其中,灰度值用于表征光信号的光强度值;Step S104, the first terminal receives the light signal of the lighting device in the environment, and quantizes the light signal into a binary gray value, wherein the gray value is used to represent the light intensity value of the light signal;
可选的,第一终端接收到的光信号可以用光强度值来表示,由于灰度值与光强度值为近似线性相关,可以用灰度值量化光强度值,现有技术中,可以将采集到的光信号通过软件转变为二进制的灰度值实现光信号的量化,进而转化为二进制的比特码进行传输,根据图像灰度化理论,三原色红(R)、绿(G)、蓝(B)可以分别量化成0到255共256个量级,每一个原色用8bits表示,所以灰度值可以用24位的比特码表示。Optionally, the optical signal received by the first terminal can be represented by a light intensity value. Since the gray value and the light intensity value are approximately linearly correlated, the light intensity value can be quantified by the gray value. In the prior art, the The collected optical signal is converted into a binary gray value by software to realize the quantization of the optical signal, and then converted into a binary bit code for transmission. According to the image gray scale theory, the three primary colors red (R), green (G), blue (B) It can be quantized into 256 levels from 0 to 255, and each primary color is represented by 8 bits, so the gray value can be represented by a 24-bit bit code.
步骤S106,第一终端将场景标识与光强度值封装在定位帧中,并将定位帧发送到第二终端。Step S106, the first terminal encapsulates the scene identifier and the light intensity value in the positioning frame, and sends the positioning frame to the second terminal.
可选的,将32位的场景标识和24位的光强度值封装成定位帧进行传输,可以将其发给自身实现自身的定位,也可以发送给第二终端,实现其他终端对第一终端的定位。Optionally, the 32-bit scene ID and the 24-bit light intensity value are encapsulated into a positioning frame for transmission, which can be sent to itself to realize its own positioning, or to the second terminal to realize other terminals to the first terminal positioning.
通过本发明实施例,采用第一终端获取所处环境的场景标识;所述第一终端接收所处环境中照明装置的光信号,并将所述光信号量化为二进制的灰度值,其中,所述灰度值用于表征所述光信号的光强度值;所述第一终端将所述场景标识与所述光强度值封装在定位帧中,并将所述定位帧发送到第二终端,解决相关技术中不能根据不同的场景实现终端定位的问题,且提出了一种定位帧的标准,实现了终端在不同的场景下进行定位,并且能够通过直接解析定位帧进而达到了降低终端计算的复杂度的效果。Through the embodiment of the present invention, the first terminal is used to obtain the scene identifier of the environment; the first terminal receives the light signal of the lighting device in the environment, and quantizes the light signal into a binary gray value, wherein, The gray value is used to represent the light intensity value of the optical signal; the first terminal encapsulates the scene identifier and the light intensity value in a positioning frame, and sends the positioning frame to the second terminal , to solve the problem that terminal positioning cannot be realized according to different scenarios in related technologies, and a standard for positioning frames is proposed, which realizes positioning of terminals in different scenarios, and can reduce terminal calculation by directly parsing positioning frames the effect of complexity.
根据本发明实施例的可选实施方式,在第一终端接收所处环境中照明装置的光信号,并将光信号量化为二进制的灰度值之后,还包括对灰度值的校正,包括:According to an optional implementation manner of the embodiment of the present invention, after the first terminal receives the light signal of the lighting device in the environment and quantizes the light signal into a binary gray value, correction of the gray value is also included, including:
S11,根据灰度值的二进制代码计算灰度值的校正系数 S11, calculating the correction coefficient of the gray value according to the binary code of the gray value
S12,将校正系数乘以灰度值得到光强度值;S12, the correction coefficient Multiply by the gray value to get the light intensity value;
可选的,校正系数通过以下公式得到: Optional, correction factor Obtained by the following formula:
其中,灰度值包括R、G、B三个通道,R、G、B的灰度化预设权重值分别为A、B、C,且A+B+C=1,分别表示灰度值的所有比特位中“0”的R、G、B通道的平均值,分别表示灰度值的所有比特位中“1”的R、G、B通道的平均值。Among them, the grayscale value includes three channels of R, G, and B, and the grayscale preset weight values of R, G, and B are A, B, and C respectively, and A+B+C=1, Respectively represent the average value of the R, G, and B channels of "0" in all the bits of the gray value, Respectively represent the average value of the R, G, and B channels of "1" in all the bits of the gray value.
在根据本发明实施例的上述可选实施方式中,通过以下公式得到:In the above optional implementation manners according to the embodiments of the present invention, Obtained by the following formula:
其中,M为符号“1”在灰度值的比特位中的个数,N为符号“0”在灰度值的比特位中的个数,X1、Y1、Z1分别为与灰度值中符号“1”对应的R,G,B值,X0、Y0、Z0分别为与灰度值中符号“0”对应的R,G,B值。 Among them, M is the number of the symbol "1" in the bit of the gray value, N is the number of the symbol "0" in the bit of the gray value, X 1 , Y 1 , Z 1 are respectively The R, G, and B values corresponding to the symbol "1" in the degree value, and X 0 , Y 0 , and Z 0 are the R, G, and B values corresponding to the symbol "0" in the gray value, respectively.
根据本实施例的可选实施方式中,通过计算:In an optional implementation manner according to this embodiment, by calculating:
然后得到整体信号的方差近似为:化简之后可得到:然后在不同的通道值前乘以对应的权重值A、B、C,得到灰度值的校正系数其中A+B+C=1,权重值为预设的系统,表示R、G、B三个通道在灰度化过程中的重要程度,如可以设置A、B、C的值分别为0.3、0.3、0.4。 Then the variance of the overall signal is obtained approximately as: After simplification, we get: Then multiply the corresponding weight values A, B, and C in front of different channel values to obtain the correction coefficient of the gray value Among them, A+B+C=1, the weight value is a preset system, indicating the importance of the three channels R, G, and B in the grayscale process. For example, the values of A, B, and C can be set to 0.3, 0.3, 0.4.
通过计算灰度值的校正系数,并通过校正系数来校正软件得到的灰度值,减小了灰度值的误差,进而得到了更准确的光强度值,也提高了利用光强度值实现终端定位的精确性。By calculating the correction coefficient of the gray value and correcting the gray value obtained by the software through the correction coefficient, the error of the gray value is reduced, and a more accurate light intensity value is obtained, which also improves the use of the light intensity value to realize the terminal Positioning accuracy.
在根据本实施例的可选实施方式中,还可以在定位帧的帧头添加帧同步,以使接收端能准确快速地识别定位帧,进而提高终端定位的速度,具体可以通过在第一终端将场景标识与光强度值封装在定位帧中之前,第一终端将作为帧同步的巴克码添加到定位帧中。In an optional implementation according to this embodiment, frame synchronization can also be added to the frame header of the positioning frame, so that the receiving end can accurately and quickly identify the positioning frame, thereby improving the speed of terminal positioning. Before encapsulating the scene identifier and the light intensity value in the positioning frame, the first terminal adds the Barker code used as frame synchronization to the positioning frame.
巴克码的为7位字节的比特位1110010,巴克码作帧同步信息的优势在于:巴克码的自相关特性曲线具有尖锐的单峰,容易从接收码元序列中识别出来,且硬件易于实现,采用7位的移位寄存器、计数器和基本电路便可提取同步信号,比传统的锁相环法更可靠、简单。可选的,当室内环境较小时,定位帧长度越小时,或者通信环境性能越优时,定位帧也可以为“短帧”,如将“帧同步”缩小为“1111”或“0000”。The Barker code is 7-bit byte 1110010. The advantage of the Barker code as frame synchronization information is that the autocorrelation characteristic curve of the Barker code has a sharp single peak, which is easy to identify from the received symbol sequence, and the hardware is easy to implement , The synchronization signal can be extracted by using 7-bit shift register, counter and basic circuit, which is more reliable and simple than the traditional phase-locked loop method. Optionally, when the indoor environment is small, the positioning frame length is smaller, or the communication environment performance is better, the positioning frame can also be a "short frame", such as reducing the "frame synchronization" to "1111" or "0000".
在根据本实施例的可选实施方式中,还可以在定位帧的帧尾添加校验码,以使接收端能够实现对定位帧的校验,提高安全性,并减少定位帧在传输过程中因为字节丢失或改变带来的定位错误,具体可以通过在第一终端将场景标识与光强度值封装在定位帧中之前,第一终端生成循环冗余校验码并将循环冗余校验码作为定位帧的校验码添加到定位帧中。In an optional implementation according to this embodiment, a check code can also be added at the end of the positioning frame, so that the receiving end can verify the positioning frame, improve security, and reduce the number of positioning frames during transmission. Because of the positioning error caused by byte loss or change, specifically, before the first terminal encapsulates the scene identifier and light intensity value in the positioning frame, the first terminal generates a cyclic redundancy check code and performs a cyclic redundancy check The code is added to the positioning frame as the check code of the positioning frame.
通过在定位帧的校验位采用8位的循环冗余校验(CRC)码,利用除法及余数的原理来作错误侦测(Error Detecting),具有:检错能力极强,开销小,易于用编码器及检测电路实现。从性能上和开销上考虑,均远远优于奇偶校验及算术和校验等方式。但是在室内环境较小时,定位帧长度越小时,或者通信环境性能越优时,也可以更改或省去校验位。By adopting 8-bit cyclic redundancy check (CRC) code in the parity bit of the positioning frame, and using the principle of division and remainder for error detection (Error Detecting), it has: strong error detection ability, low overhead, easy to use Realize with encoder and detection circuit. In terms of performance and overhead, it is far superior to parity check and arithmetic sum check. However, when the indoor environment is small, the length of the positioning frame is small, or the performance of the communication environment is better, the parity bit can also be changed or omitted.
在本实施例中提供了另一种终端定位的方法,图2是根据本发明实施例的另一种终端定位的方法的流程图,如图2所示,该流程包括如下步骤:Another terminal positioning method is provided in this embodiment. FIG. 2 is a flow chart of another terminal positioning method according to an embodiment of the present invention. As shown in FIG. 2 , the process includes the following steps:
步骤S201,第二终端接收第一终端发送的定位帧,并获取定位帧中用于指示定位场景的场景标识的比特位和用于指示光强度值的比特位;Step S201, the second terminal receives the positioning frame sent by the first terminal, and obtains the bit used to indicate the scene identification of the positioning scene and the bit used to indicate the light intensity value in the positioning frame;
步骤S202,根据场景标识在第二终端预设数据库中搜索与场景标识对应的子数据库,其中,子数据库中存储有与不同光强度值分别具有对应关系的位置信息;Step S202, searching the second terminal preset database for a sub-database corresponding to the scene ID according to the scene ID, wherein the sub-database stores position information corresponding to different light intensity values;
步骤S203,在子数据库查找与光强度值具有对应关系的第一终端的位置信息。Step S203, searching the sub-database for the location information of the first terminal that has a corresponding relationship with the light intensity value.
在本实施例中,第二终端为定位帧的接收端,第一终端为发送端,第二终端可以为设置在终端内的定位帧解析模块,可以和发送端在同一个设备内,可选的,第二终端内设置有预设数据库,用于匹配不同场景下的不同光强度值,进而得到接收到上述不同光强度值的终端的位置,终端位置可以为空间位置或者平面位置。可选的,预设数据库还包括多个子数据库,分别对应于不同的场景,如对应对不同的照明装置,通过将场景标识作为索引可以找到对应的子数据库在预设数据中的位置,大大缩短了匹配过程,也即提高了定位速度并减小了定位复杂度。In this embodiment, the second terminal is the receiving end of the positioning frame, the first terminal is the sending end, and the second terminal may be a positioning frame analysis module set in the terminal, which may be in the same device as the sending end, optional Yes, the second terminal is provided with a preset database for matching different light intensity values in different scenes, and then obtains the position of the terminal receiving the above-mentioned different light intensity values. The terminal position can be a spatial position or a planar position. Optionally, the preset database also includes multiple sub-databases corresponding to different scenes, such as corresponding to different lighting devices. By using the scene ID as an index, the position of the corresponding sub-database in the preset data can be found, which greatly shortens the The matching process is improved, that is, the positioning speed is improved and the positioning complexity is reduced.
通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到根据上述实施例的方法可借助软件加必需的通用硬件平台的方式来实现,当然也可以通过硬件,但很多情况下前者是更佳的实施方式。基于这样的理解,本发明的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质(如ROM/RAM、磁碟、光盘)中,包括若干指令用以使得一台终端设备(可以是手机,计算机,服务器,或者网络设备等)执行本发明各个实施例的方法。Through the description of the above embodiments, those skilled in the art can clearly understand that the method according to the above embodiments can be implemented by means of software plus a necessary general-purpose hardware platform, and of course also by hardware, but in many cases the former is better implementation. Based on such an understanding, the essence of the technical solution of the present invention or the part that contributes to the prior art can be embodied in the form of software products, and the computer software products are stored in a storage medium (such as ROM/RAM, disk, CD) contains several instructions to make a terminal device (which may be a mobile phone, a computer, a server, or a network device, etc.) execute the method of each embodiment of the present invention.
在本实施例中还提供了一种终端定位的装置,该装置用于实现上述实施例及优选实施方式,已经进行过说明的不再赘述。如以下所使用的,术语“模块”可以实现预定功能的软件和/或硬件的组合。尽管以下实施例所描述的装置较佳地以软件来实现,但是硬件,或者软件和硬件的组合的实现也是可能并被构想的。In this embodiment, a device for positioning a terminal is also provided, which is used to implement the above embodiments and preferred implementation modes, and what has already been described will not be repeated. As used below, the term "module" may be a combination of software and/or hardware that realizes a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, implementations in hardware, or a combination of software and hardware are also possible and contemplated.
图3是根据本发明实施例的终端的定位装置的结构框图,该定位装置可设置在第一终端上,如图3所示,该装置包括:获取模块30、接收模块32、封装模块34,其中:FIG. 3 is a structural block diagram of a positioning device for a terminal according to an embodiment of the present invention. The positioning device can be set on a first terminal. As shown in FIG. 3 , the device includes: an acquisition module 30, a receiving module 32, and a packaging module 34. in:
获取模块30,用于获取所处环境的场景标识;An acquisition module 30, configured to acquire the scene identification of the environment;
在本实施例中,第一终端和第二终端可以为在不同区域的两个独立的设备,也可以是同一个设备内的两个模块,第一终端和第二终端可以为智能手机,PDA,PAD等持有摄像装置的终端,可选的,在本实施例中,以第一终端创建定位帧或发送定位帧,第二终端解析定位帧或接收定位帧实现定位进行举例说明,第二终端收到发送端的定位帧,并进行解析,实现对第一终端的定位。In this embodiment, the first terminal and the second terminal can be two independent devices in different areas, or they can be two modules in the same device, and the first terminal and the second terminal can be smartphones, PDAs , PAD and other terminals that hold the camera device. Optionally, in this embodiment, the first terminal creates or sends a positioning frame, and the second terminal parses the positioning frame or receives the positioning frame to realize positioning. The second terminal The terminal receives the positioning frame from the sending end and analyzes it to realize the positioning of the first terminal.
可选的,所处环境中开启有照明装置,如LED灯,场景标识与照明装置对应,相当于照明装置的逻辑地址,与该照明装置对应,可以根据照明装置的功率和位置设置不同的场景标识,场景标识具体可以用32位的比特码表示。可以对不同场景分别分配一个独特的逻辑地址,使第一终端能更快速地据此匹配出实际的场景位置。这样大大缩短了匹配过程,也即提高了定位速度并减小了定位复杂度。在场景标识的具体获取过程中,可以通过第一终端解析的摄像装置采集到的照明装置的标识,或接收当前场景下的场景标识。Optionally, lighting devices are turned on in the environment, such as LED lights, and the scene identification corresponds to the lighting device, which is equivalent to the logical address of the lighting device. Corresponding to the lighting device, different scenes can be set according to the power and position of the lighting device The identifier, the scene identifier can be specifically represented by a 32-bit bitcode. A unique logical address can be assigned to different scenes, so that the first terminal can match the actual scene location more quickly. This greatly shortens the matching process, that is, increases the positioning speed and reduces the positioning complexity. In the specific acquisition process of the scene identification, the identification of the lighting device collected by the camera device analyzed by the first terminal may be used, or the scene identification in the current scene may be received.
接收模块32,与获取模块30耦合连接,用于接收所处环境中照明装置的光信号,并将光信号量化为二进制的灰度值,其中,灰度值用于表征光信号的光强度值;The receiving module 32 is coupled and connected with the acquisition module 30, and is used to receive the light signal of the lighting device in the environment, and quantize the light signal into a binary gray value, wherein the gray value is used to represent the light intensity value of the light signal ;
可选的,第一终端接收到的光信号可以用光强度值来表示,由于灰度值与光强度值为近似线性相关,可以用灰度值量化光强度值,现有技术中,可以将采集到的光信号通过软件转变为二进制的灰度值实现光信号的量化,进而转化为二进制的比特码进行传输,根据图像灰度化理论,三原色红(R)、绿(G)、蓝(B)可以分别量化成0到255共256个量级,每一个原色用8bits表示,所以灰度值可以用24位的比特码表示。Optionally, the optical signal received by the first terminal can be represented by a light intensity value. Since the gray value and the light intensity value are approximately linearly correlated, the light intensity value can be quantified by the gray value. In the prior art, the The collected optical signal is converted into a binary gray value by software to realize the quantization of the optical signal, and then converted into a binary bit code for transmission. According to the image gray scale theory, the three primary colors red (R), green (G), blue (B) It can be quantized into 256 levels from 0 to 255, and each primary color is represented by 8 bits, so the gray value can be represented by a 24-bit bit code.
封装模块34,与接收模块32耦合连接,用于将场景标识与光强度值封装在定位帧中,并将定位帧发送到第二终端。The encapsulation module 34 is coupled with the receiving module 32, and is used for encapsulating the scene identifier and the light intensity value in the positioning frame, and sending the positioning frame to the second terminal.
可选的,将32位的场景标识和24位的光强度值封装成定位帧进行传输,可以将其发给自身实现自身的定位,也可以发送给第二终端,实现其他终端对第一终端的定位。Optionally, the 32-bit scene ID and the 24-bit light intensity value are encapsulated into a positioning frame for transmission, which can be sent to itself to realize its own positioning, or to the second terminal to realize other terminals to the first terminal positioning.
图4是根据本发明实施例的定位装置的可选结构框图一,如图4所示,该装置除包括图3所示的所有模块外,还包括:第一计算模块40、第二计算模块42,其中:Fig. 4 is an optional structural block diagram 1 of a positioning device according to an embodiment of the present invention. As shown in Fig. 4, in addition to all the modules shown in Fig. 3, the device also includes: a first computing module 40, a second computing module 42, of which:
第一计算模块40,用于在接收模块接收所处环境中照明装置的光信号,并将光信号量化为二进制的灰度值之后,根据灰度值的二进制代码计算灰度值的校正系数 The first calculation module 40 is used to calculate the correction coefficient of the grayscale value according to the binary code of the grayscale value after the receiving module receives the light signal of the lighting device in the environment and quantizes the light signal into a binary grayscale value
第二计算模块42,用于将校正系数乘以灰度值得到光强度值;The second calculation module 42 is used to convert the correction coefficient Multiply by the gray value to get the light intensity value;
可选的,校正系数通过以下公式得到:Optional, correction factor Obtained by the following formula:
其中,灰度值包括R、G、B三个通道,R、G、B的灰度化预设权重值分别为A、B、C,且A+B+C=1,分别表示灰度值的所有比特位中“0”的R、G、B通道的平均值,分别表示灰度值的所有比特位中“1”的R、G、B通道的平均值。 Among them, the grayscale value includes three channels of R, G, and B, and the grayscale preset weight values of R, G, and B are A, B, and C respectively, and A+B+C=1, Respectively represent the average value of the R, G, and B channels of "0" in all the bits of the gray value, Respectively represent the average value of the R, G, and B channels of "1" in all the bits of the gray value.
在根据本发明实施例的上述可选实施方式中,通过以下公式得到:In the above optional implementation manners according to the embodiments of the present invention, Obtained by the following formula:
其中,M为符号“1”在灰度值的比特位中的个数,N为符号“0”在灰度值的比特位中的个数,X1、Y1、Z1分别为与灰度值中符号“1”对应的R,G,B值,X0、Y0、Z0分别为与灰度值中符号“0”对应的R,G,B值。 Among them, M is the number of the symbol "1" in the bit of the gray value, N is the number of the symbol "0" in the bit of the gray value, X 1 , Y 1 , Z 1 are respectively The R, G, and B values corresponding to the symbol "1" in the degree value, and X 0 , Y 0 , and Z 0 are the R, G, and B values corresponding to the symbol "0" in the gray value, respectively.
根据本实施例的可选实施方式中,通过计算: 然后得到整体信号的方差近似为: In an optional implementation manner according to this embodiment, by calculating: Then the variance of the overall signal is obtained approximately as:
化简之后可得到:然后在不同的通道值前乘以对应的权重值A、B、C,得到灰度值的校正系数其中A+B+C=1,权重值为预设的系统,表示R、G、B三个通道在灰度化过程中的重要程度,如可以设置A、B、C的值分别为0.3、0.3、0.4。After simplification, we get: Then multiply the corresponding weight values A, B, and C in front of different channel values to obtain the correction coefficient of the gray value Among them, A+B+C=1, the weight value is a preset system, indicating the importance of the three channels R, G, and B in the grayscale process. For example, the values of A, B, and C can be set to 0.3, 0.3, 0.4.
通过计算灰度值的校正系数,并通过校正系数来校正软件得到的灰度值,减小了灰度值的误差,进而得到了更准确的光强度值,也提高了利用光强度值实现终端定位的精确性。By calculating the correction coefficient of the gray value and correcting the gray value obtained by the software through the correction coefficient, the error of the gray value is reduced, and a more accurate light intensity value is obtained, which also improves the use of the light intensity value to realize the terminal Positioning accuracy.
图5是根据本发明实施例的定位装置的可选结构框图二,如图5所示,该装置除包括图3所示的所有模块外,还包括:第一添加模块50,用于在封装模块将场景标识与光强度值封装在定位帧中之前,将作为帧同步的巴克码添加到定位帧中。通过在定位帧的帧头添加帧同步,以使接收端能准确快速地识别定位帧,进而提高终端定位的速度。Fig. 5 is an optional structural block diagram 2 of a positioning device according to an embodiment of the present invention. As shown in Fig. 5, the device includes, in addition to all the modules shown in Fig. 3 , a first additional module 50 for packaging Before the module encapsulates the scene identification and the light intensity value in the positioning frame, the barker code as frame synchronization is added to the positioning frame. By adding frame synchronization to the frame header of the positioning frame, the receiving end can accurately and quickly identify the positioning frame, thereby improving the speed of terminal positioning.
巴克码的为7位字节的比特位1110010,巴克码作帧同步信息的优势在于:巴克码的自相关特性曲线具有尖锐的单峰,容易从接收码元序列中识别出来,且硬件易于实现,采用7位的移位寄存器、计数器和基本电路便可提取同步信号,比传统的锁相环法更可靠、简单。可选的,当室内环境较小时,定位帧长度越小时,或者通信环境性能越优时,定位帧也可以为“短帧”,如将“帧同步”缩小为“1111”或“0000”。The Barker code is 7-bit byte 1110010. The advantage of the Barker code as frame synchronization information is that the autocorrelation characteristic curve of the Barker code has a sharp single peak, which is easy to identify from the received symbol sequence, and the hardware is easy to implement , The synchronization signal can be extracted by using 7-bit shift register, counter and basic circuit, which is more reliable and simple than the traditional phase-locked loop method. Optionally, when the indoor environment is small, the positioning frame length is smaller, or the communication environment performance is better, the positioning frame can also be a "short frame", such as reducing the "frame synchronization" to "1111" or "0000".
图6是根据本发明实施例的定位装置的可选结构框图三,如图6所示,该装置除包括图3所示的所有模块外,还包括:第二添加模块60,用于在封装模块将场景标识与光强度值封装在定位帧中之前,生成循环冗余校验码并将循环冗余校验码作为定位帧的校验码添加到定位帧中。通过在定位帧的帧尾添加校验码,以使接收端能够实现对定位帧的校验,提高了安全性,并减少定位帧在传输过程中因为字节丢失或改变带来的定位错误。Fig. 6 is an optional structural block diagram three of a positioning device according to an embodiment of the present invention. As shown in Fig. 6, the device includes not only all the modules shown in Fig. Before the module encapsulates the scene identification and the light intensity value in the positioning frame, it generates a cyclic redundancy check code and adds the cyclic redundancy check code as a check code of the positioning frame to the positioning frame. By adding a check code at the end of the positioning frame, the receiving end can verify the positioning frame, which improves security and reduces positioning errors caused by byte loss or change during transmission of the positioning frame.
通过在定位帧的校验位采用8位的循环冗余校验(CRC)码,利用除法及余数的原理来作错误侦测(Error Detecting),具有:检错能力极强,开销小,易于用编码器及检测电路实现。从性能上和开销上考虑,均远远优于奇偶校验及算术和校验等方式。但是在室内环境较小时,定位帧长度越小时,或者通信环境性能越优时,也可以更改或省去校验位。By adopting 8-bit cyclic redundancy check (CRC) code in the parity bit of the positioning frame, and using the principle of division and remainder for error detection (Error Detecting), it has: strong error detection ability, low overhead, easy to use Realize with encoder and detection circuit. In terms of performance and overhead, it is far superior to parity check and arithmetic sum check. However, when the indoor environment is small, the length of the positioning frame is small, or the performance of the communication environment is better, the parity bit can also be changed or omitted.
图7是根据本发明实施例的另一种终端的定位装置的结构框图,如图7所示,该装置包括:接收模块70、搜索模块72、查找模块74,其中:FIG. 7 is a structural block diagram of another positioning device for a terminal according to an embodiment of the present invention. As shown in FIG. 7, the device includes: a receiving module 70, a searching module 72, and a searching module 74, wherein:
接收模块70,用于接收第一终端发送的定位帧,并获取定位帧中用于指示定位场景的场景标识的比特位和用于指示光强度值的比特位;The receiving module 70 is configured to receive the positioning frame sent by the first terminal, and obtain the bit for indicating the scene identification of the positioning scene and the bit for indicating the light intensity value in the positioning frame;
搜索模块72,用于根据场景标识在第二终端预设数据库中搜索与场景标识对应的子数据库,其中,子数据库中存储有与不同光强度值分别具有对应关系的位置信息;The search module 72 is configured to search the second terminal preset database for a sub-database corresponding to the scene ID according to the scene ID, wherein the sub-database stores position information corresponding to different light intensity values;
查找模块74,用于在子数据库查找与光强度值具有对应关系的第一终端的位置信息。The search module 74 is configured to search the sub-database for the position information of the first terminal that has a corresponding relationship with the light intensity value.
在本实施例中,第二终端为定位帧的接收端,第一终端为发送端,第二终端可以为设置在终端内的定位帧解析模块,可以和发送端在同一个设备内,可选的,第二终端内设置有预设数据库,用于匹配不同场景下的不同光强度值,进而得到接收到上述不同光强度值的终端的位置,终端位置可以为空间位置或者平面位置。可选的,预设数据库还包括多个子数据库,分别对应于不同的场景,如对应对不同的照明装置,通过将场景标识作为索引可以找到对应的子数据库在预设数据中的位置,大大缩短了匹配过程,也即提高了定位速度并减小了定位复杂度。In this embodiment, the second terminal is the receiving end of the positioning frame, the first terminal is the sending end, and the second terminal may be a positioning frame analysis module set in the terminal, which may be in the same device as the sending end, optional Yes, the second terminal is provided with a preset database for matching different light intensity values in different scenes, and then obtains the position of the terminal receiving the above-mentioned different light intensity values. The terminal position can be a spatial position or a planar position. Optionally, the preset database also includes multiple sub-databases corresponding to different scenes, such as corresponding to different lighting devices. By using the scene ID as an index, the position of the corresponding sub-database in the preset data can be found, which greatly shortens the The matching process is improved, that is, the positioning speed is improved and the positioning complexity is reduced.
下面结合本发明的可选本实施例对本方案进行进一步的说明,The scheme will be further described below in conjunction with an optional present embodiment of the present invention,
图8是根据本发明可选实施例的定位帧结构图,如图8,本可选实施例的定位帧结构总长度71bits,该定位帧分为四个部分:帧同步、LED-ID(相当于上述实施例中的场景标识)、“指纹”(相当于上述实施例中的光强度值)、校验位。Fig. 8 is a positioning frame structure diagram according to an optional embodiment of the present invention, as shown in Fig. 8, the total length of the positioning frame structure in this optional embodiment is 71 bits, and the positioning frame is divided into four parts: frame synchronization, LED-ID (equivalent to The scene identification in the above embodiment), "fingerprint" (equivalent to the light intensity value in the above embodiment), and check digit.
可选的,本可选实施例的定位帧的帧同步采用7位的巴克码:{1110010}。巴克码作帧同步信息的优势在于:巴克码的自相关特性曲线具有尖锐的单峰,容易从接收码元序列中识别出来;且硬件易于实现,采用7位的移位寄存器、计数器和基本电路便可提取同步信号。比传统的锁相环法更可靠、简单。Optionally, the frame synchronization of the positioning frame in this optional embodiment adopts a 7-bit Barker code: {1110010}. The advantage of Barker code as frame synchronization information is: the autocorrelation characteristic curve of Barker code has a sharp single peak, which is easy to identify from the received symbol sequence; and the hardware is easy to implement, using 7-bit shift registers, counters and basic circuits The synchronous signal can be extracted. It is more reliable and simpler than the traditional phase-locked loop method.
可选的,本可选实施例的定位帧的LED-ID定义为逻辑地址,分割为4个8bits,长度为32位。LED-ID的设计思路类比于互联网中IP地址,对指纹库中的不同场景各分配一个独特的逻辑地址即LED-ID,使定位系统能更快速地据此匹配出实际的场景位置。这种设计的特点是LED-ID只对应于指纹库的场景,而与实际LED无关,因而大大缩短了匹配过程,也即提高了定位速度并减小了定位复杂度。Optionally, the LED-ID of the positioning frame in this optional embodiment is defined as a logical address, divided into four 8-bits, and the length is 32 bits. The design idea of LED-ID is analogous to the IP address in the Internet. Each scene in the fingerprint database is assigned a unique logical address, that is, LED-ID, so that the positioning system can match the actual scene location more quickly. The feature of this design is that the LED-ID only corresponds to the scene of the fingerprint library, and has nothing to do with the actual LED, thus greatly shortening the matching process, that is, improving the positioning speed and reducing the positioning complexity.
可选的,本可选实施例的定位帧的“指纹”定义为LED灯下不同坐标的光强度值,长度为24位。由于光强度值需要量化成二进制在定位帧中传输,故提出一种用于移动终端摄像头读取的灰度值来表征光强值。该灰度值与光强值为近似线性相关。根据图像灰度化理论,三原色红(R)、绿(G)、蓝(B)分别量化成0到255共256个量级,每一个原色用8bits表示。Optionally, the "fingerprint" of the positioning frame in this optional embodiment is defined as light intensity values at different coordinates under the LED light, and the length is 24 bits. Since the light intensity value needs to be quantized into binary and transmitted in the positioning frame, a gray value read by the mobile terminal camera is proposed to represent the light intensity value. The gray value is approximately linearly related to the light intensity value. According to the image grayscale theory, the three primary colors red (R), green (G), and blue (B) are respectively quantized into 256 magnitudes from 0 to 255, and each primary color is represented by 8 bits.
可选的,本可选实施例的定位帧的校验位采用8位的循环冗余校验(CRC)码,它是利用除法及余数的原理来作错误侦测(Error Detecting)的,其特点是:检错能力极强,开销小,易于用编码器及检测电路实现。从性能上和开销上考虑,均远远优于奇偶校验及算术和校验等方式。Optionally, the check bit of the positioning frame in this optional embodiment adopts an 8-bit cyclic redundancy check (CRC) code, which uses the principle of division and remainder to perform error detection (Error Detecting). The characteristics are: strong error detection ability, low overhead, easy to implement with encoder and detection circuit. In terms of performance and overhead, it is far superior to parity check and arithmetic sum check.
通过本可选实施例,降低了在可见光室内定位系统中,移动终端计算复杂度、功耗,而提出的一种适合手机摄像头解调的定位帧结构。Through this optional embodiment, in the visible light indoor positioning system, the computational complexity and power consumption of the mobile terminal are reduced, and a positioning frame structure suitable for demodulation of the mobile phone camera is proposed.
图9是根据本发明可选实施例的另一种定位帧结构图,如图9所示,图9中的1110010为定位帧的帧头,移动终端检测到该码后,就定义为收到定位帧。Figure 9 is another positioning frame structure diagram according to an optional embodiment of the present invention, as shown in Figure 9, 1110010 in Figure 9 is the frame header of the positioning frame, after the mobile terminal detects this code, it is defined as receiving positioning frame.
图9中的LED-ID共32bits,为逻辑地址,与网络中的IP地址类似,索引到该终端所在场景的位置,即该场景下“指纹”库标号。The LED-ID in Figure 9 has a total of 32 bits, which is a logical address, similar to the IP address in the network, and is indexed to the location of the scene where the terminal is located, that is, the "fingerprint" library label in this scene.
图9中的RSSI为“指纹”,即移动终端接收到的光强度值。考虑到移动终端摄像头提取的光信息是灰度值形式,且灰度值与光强度值呈近似线性相关。因此,本实施例采用灰度值来表征光强度值。The RSSI in FIG. 9 is a "fingerprint", that is, the light intensity value received by the mobile terminal. Considering that the light information extracted by the camera of the mobile terminal is in the form of gray value, and the gray value is approximately linearly correlated with the light intensity value. Therefore, in this embodiment, the gray value is used to represent the light intensity value.
假设“1”符号为N个,“0”符号为M个,每个像素点有R,G,B三个通道,并且设其灰度化权重为A,B,C(A+B+C=1),“1”符号对应的R,G,B值是X1、Y1、ZY11;“0”符号对应X0、Y0、Z0。Suppose the "1" symbol is N, the "0" symbol is M, each pixel has three channels of R, G, and B, and its graying weight is set to A, B, C (A+B+C =1), the R, G, and B values corresponding to the "1" symbol are X1, Y1, ZY11; the "0" symbol corresponds to X0, Y0, Z0.
通过计算得到:By calculation:
其中表示这M个点(“0”符号)的R通道的平均值,同样分别表示G,B通道中“0”符号的平均值。通过计算: in Represents the average value of the R channel of these M points ("0" symbol), the same Respectively represent the average value of the "0" symbol in the G and B channels. via calculations:
得到整体信号的方差近似为: The variance of the obtained overall signal is approximated as:
化简可得 Simplify and get
灰度化过程就是在不同的通道值前面加对应的系数即The grayscale process is to add corresponding coefficients in front of different channel values, that is,
图9中的CRC为8位的循环冗余校验码,用于纠错。The CRC in FIG. 9 is an 8-bit cyclic redundancy check code for error correction.
考虑到本可选实施例是针对手机摄像头提出的,用于识别光信息强度,因此本实施例提出的RSSI计算方法和预留的长度(24bits)是不可替换的。本实施例提出的定位帧结构中的“帧同步”、“LED-ID”、“校验位”可视实际情况更改长度。例如,当室内环境较小时,定位帧长度越小,性能越优,以“短帧”为原则,可将“帧同步”缩小为“1111”或“0000”,或省去校验位。当室内环境较大时,可以选用复杂的纠错方案,提高信息的可靠性。Considering that this optional embodiment is proposed for the mobile phone camera to identify the intensity of light information, the RSSI calculation method and the reserved length (24 bits) proposed in this embodiment are irreplaceable. The lengths of "frame synchronization", "LED-ID" and "check digit" in the positioning frame structure proposed in this embodiment can be changed according to the actual situation. For example, when the indoor environment is small, the smaller the positioning frame length, the better the performance. Based on the principle of "short frame", the "frame synchronization" can be reduced to "1111" or "0000", or the check digit can be omitted. When the indoor environment is large, a complex error correction scheme can be selected to improve the reliability of the information.
需要说明的是,上述各个模块是可以通过软件或硬件来实现的,对于后者,可以通过以下方式实现,但不限于此:上述模块均位于同一处理器中;或者,上述模块分别位于多个处理器中。It should be noted that each of the above-mentioned modules can be implemented by software or hardware. For the latter, it can be implemented in the following manner, but not limited to this: the above-mentioned modules are all located in the same processor; or, the above-mentioned modules are respectively located in multiple in the processor.
本发明的实施例还提供了一种存储介质。可选地,在本实施例中,上述存储介质可以被设置为存储用于执行以下步骤的程序代码:The embodiment of the invention also provides a storage medium. Optionally, in this embodiment, the above-mentioned storage medium may be configured to store program codes for performing the following steps:
S1,第一终端获取所处环境的场景标识;S1. The first terminal obtains the scene identifier of the environment;
S2,第一终端接收所处环境中照明装置的光信号,并将光信号量化为二进制的灰度值,其中,灰度值用于表征光信号的光强度值;S2. The first terminal receives the light signal of the lighting device in the environment, and quantizes the light signal into a binary gray value, where the gray value is used to represent the light intensity value of the light signal;
S3,第一终端将场景标识与光强度值封装在定位帧中,并将定位帧发送到第二终端。S3. The first terminal encapsulates the scene identifier and the light intensity value in a positioning frame, and sends the positioning frame to the second terminal.
可选地,本实施例中的具体示例可以参考上述实施例及可选实施方式中所描述的示例,本实施例在此不再赘述。Optionally, for specific examples in this embodiment, reference may be made to the examples described in the foregoing embodiments and optional implementation manners, and details are not repeated in this embodiment.
显然,本领域的技术人员应该明白,上述的本发明的各模块或各步骤可以用通用的计算装置来实现,它们可以集中在单个的计算装置上,或者分布在多个计算装置所组成的网络上,可选地,它们可以用计算装置可执行的程序代码来实现,从而,可以将它们存储在存储装置中由计算装置来执行,并且在某些情况下,可以以不同于此处的顺序执行所示出或描述的步骤,或者将它们分别制作成各个集成电路模块,或者将它们中的多个模块或步骤制作成单个集成电路模块来实现。这样,本发明不限制于任何特定的硬件和软件结合。Obviously, those skilled in the art should understand that each module or each step of the above-mentioned present invention can be realized by a general-purpose computing device, and they can be concentrated on a single computing device, or distributed in a network formed by multiple computing devices Alternatively, they may be implemented in program code executable by a computing device so that they may be stored in a storage device to be executed by a computing device, and in some cases in an order different from that shown here The steps shown or described are carried out, or they are separately fabricated into individual integrated circuit modules, or multiple modules or steps among them are fabricated into a single integrated circuit module for implementation. As such, the present invention is not limited to any specific combination of hardware and software.
以上所述仅为本发明的优选实施例而已,并不用于限制本发明,对于本领域的技术人员来说,本发明可以有各种更改和变化。凡在本发明的精神和原则之内,所作的任何修改、等同替换、改进等,均应包含在本发明的保护范围之内。The above descriptions are only preferred embodiments of the present invention, and are not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and changes. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present invention shall be included within the protection scope of the present invention.
Claims (12)
Priority Applications (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201510642314.6A CN106556817A (en) | 2015-09-30 | 2015-09-30 | Terminal positioning method and device |
PCT/CN2015/094041 WO2016145880A1 (en) | 2015-09-30 | 2015-11-06 | Terminal positioning method and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201510642314.6A CN106556817A (en) | 2015-09-30 | 2015-09-30 | Terminal positioning method and device |
Publications (1)
Publication Number | Publication Date |
---|---|
CN106556817A true CN106556817A (en) | 2017-04-05 |
Family
ID=56918225
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201510642314.6A Withdrawn CN106556817A (en) | 2015-09-30 | 2015-09-30 | Terminal positioning method and device |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN106556817A (en) |
WO (1) | WO2016145880A1 (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113965259A (en) * | 2021-10-26 | 2022-01-21 | 中国矿业大学 | Single-base-station integrated communication and positioning integrated system based on visible light wireless transmission |
Families Citing this family (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114079693A (en) * | 2020-08-14 | 2022-02-22 | 北京金坤科创技术有限公司 | Positioning scene perception method based on mobile carrier identification |
CN114088095B (en) * | 2021-10-29 | 2023-07-25 | 鹏城实验室 | Three-dimensional indoor positioning method based on photodiode |
CN116758530A (en) * | 2023-06-07 | 2023-09-15 | 广东领业科技有限公司 | An anti-cheating truck weighing system |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US8018584B1 (en) * | 2007-07-17 | 2011-09-13 | Centrak, Inc. | Virtual walls in infrared based RTLS systems |
US20130136456A1 (en) * | 2011-11-29 | 2013-05-30 | Foundation Of Soongsil University-Industry Cooperation | Mobile terminal capable of localization, localization server and method for localizing the mobile terminal using the localization server |
CN103199923A (en) * | 2013-04-22 | 2013-07-10 | 中国矿业大学 | Underground moving target optical fingerprint positioning and tracking method based on visible light communication |
CN103823204A (en) * | 2014-03-10 | 2014-05-28 | 北京理工大学 | Indoor positioning method based on visible light label |
CN103823203A (en) * | 2014-02-26 | 2014-05-28 | 上海交通大学 | Indoor visible light three-dimensional positioning system and method based on receiver direction |
-
2015
- 2015-09-30 CN CN201510642314.6A patent/CN106556817A/en not_active Withdrawn
- 2015-11-06 WO PCT/CN2015/094041 patent/WO2016145880A1/en active Application Filing
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US8018584B1 (en) * | 2007-07-17 | 2011-09-13 | Centrak, Inc. | Virtual walls in infrared based RTLS systems |
US20130136456A1 (en) * | 2011-11-29 | 2013-05-30 | Foundation Of Soongsil University-Industry Cooperation | Mobile terminal capable of localization, localization server and method for localizing the mobile terminal using the localization server |
CN103199923A (en) * | 2013-04-22 | 2013-07-10 | 中国矿业大学 | Underground moving target optical fingerprint positioning and tracking method based on visible light communication |
CN103823203A (en) * | 2014-02-26 | 2014-05-28 | 上海交通大学 | Indoor visible light three-dimensional positioning system and method based on receiver direction |
CN103823204A (en) * | 2014-03-10 | 2014-05-28 | 北京理工大学 | Indoor positioning method based on visible light label |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113965259A (en) * | 2021-10-26 | 2022-01-21 | 中国矿业大学 | Single-base-station integrated communication and positioning integrated system based on visible light wireless transmission |
CN113965259B (en) * | 2021-10-26 | 2022-11-11 | 中国矿业大学 | Single base station integrated communication and positioning integrated system based on visible light wireless transmission |
Also Published As
Publication number | Publication date |
---|---|
WO2016145880A1 (en) | 2016-09-22 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
JP5223575B2 (en) | Wireless network access point and apparatus | |
Liu et al. | DIMLOC: Enabling high-precision visible light localization under dimmable LEDs in smart buildings | |
US10070253B2 (en) | Method, apparatus, and recording medium for radio fingerprint map construction and location tracking | |
US9749782B2 (en) | Light fixture commissioning using encoded light signals | |
Nakazawa et al. | Indoor positioning using a high-speed, fish-eye lens-equipped camera in visible light communication | |
CN105827311B (en) | Indoor orientation method based on visible light communication and positioning system | |
US7505607B2 (en) | Identifying objects tracked in images using active device | |
US20110176803A1 (en) | System and method for indoor positioning using led lighting | |
CN107835050B (en) | A positioning method and system based on visible light communication | |
CN110261823A (en) | Visible light indoor communications localization method and system based on single led lamp | |
US20140375982A1 (en) | Determination of positioning information of a mobile device using modulated light signals | |
CN106556817A (en) | Terminal positioning method and device | |
CN105848099B (en) | Method, system, server and mobile terminal for identifying geo-fence | |
US20150003832A1 (en) | Visible light communication system | |
US20150036016A1 (en) | Methods and apparatus for determining the orientation of a mobile phone in an indoor environment | |
JP2005536944A (en) | Method and system for detecting location in wireless local area network | |
US20160261987A1 (en) | Vlc-based vector field fingerprint mapping | |
CN115685060A (en) | Indoor fingerprint map construction method and related device | |
Zhu et al. | A survey on indoor visible light positioning systems: Fundamentals, applications, and challenges | |
CN109831820B (en) | Method and device for calibrating clock synchronization of positioning base station | |
CN106767822A (en) | Indoor locating system and method based on camera communication with framing technology | |
CN105162520A (en) | Automatic identification method and information service system based on visible light illumination | |
Li et al. | High‐Accuracy and Real‐Time Indoor Positioning System Based on Visible Light Communication and Mobile Robot | |
Tiku et al. | An overview of indoor localization techniques | |
CN108225330A (en) | A kind of visible ray dynamic positioning method based on Kalman filtering |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
WW01 | Invention patent application withdrawn after publication |
Application publication date: 20170405 |
|
WW01 | Invention patent application withdrawn after publication |