Encoding identification method for visible light communication, electronic device and computer readable medium

CN115393833BActive Publication Date: 2026-09-25JIHAO TECHNOLOGY (TIANJIN) CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202210895962.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-07-27
Publication Date
2026-09-25
Estimated Expiration
2042-07-27

AI Technical Summary

Technical Problem

[0004]本申请实施例提出了可见光通信的编码识别方法、电子设备和计算机可读介质,以解决现有技术中编码图案识别的成功率较低以及识别效率较低的技术问题

Benefits of technology

[0009]本申请实施例提供的可见光通信的编码识别方法、电子设备和计算机可读介质,可通过设置于第一电子设备的图像采集单元对第二电子设备的显示屏的目标区域进行图像采集,获取到上述目标区域中所显示的呈周期性排布的编码图案的待测图像,以实现可见光通信;第一电子设备在获取到待测图像后,可检测其中的黑点和白点以得到黑白点阵,并从黑白点阵中选取目标尺寸的子点阵以进行校验,进而在校验通过的情况下基于子点阵识别出编码图案对应的编码信息。由于编码图案呈周期性排布,因此无需使采集区域和目标区域精确对准,提高了对编码图案识别的成功率;进一步地,由于编码图案呈周期性排布,因此仅需对黑白点阵中的局部的子点检进行校验,无需对全局进行校验,从而提高了编码识别效率。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115393833B_ABST
    Figure CN115393833B_ABST
Patent Text Reader

Abstract

Embodiments of the present application disclose a coding recognition method for visible light communication, an electronic device and a computer readable medium. An embodiment of the method comprises: acquiring a to-be-tested image, the to-be-tested image being an image collected by an image collection unit for a target region of a display screen of a second electronic device, the target region displaying a periodically arranged coding pattern; detecting black and white points in the to-be-tested image to obtain a black and white point array; selecting a sub-point array of a target size from the black and white point array, verifying the sub-point array; and determining coding information corresponding to the coding pattern based on the sub-point array that passes the verification. The embodiment improves the success rate and recognition efficiency of coding pattern recognition.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, specifically to encoding and identification methods, electronic devices, and computer-readable media for visible light communication. Background Technology

[0002] Visible Light Communication (VLC) refers to a communication method that uses light in the visible light band as an information carrier to transmit light signals through the air. In the process of visible light communication, the transmitting end can output an encoded pattern through components such as light-emitting diodes (LEDs), and the receiving end can receive and identify the encoded pattern.

[0003] In existing technologies, terminal devices can utilize the macro characteristics of image acquisition units to achieve visible light communication. However, for coded patterns such as QR codes that require precise alignment for successful recognition, the low resolution and small field of view of under-display image sensors usually require alignment for successful recognition. Therefore, the success rate and efficiency of coded pattern recognition are low. Summary of the Invention

[0004] This application proposes a coding recognition method, electronic device, and computer-readable medium for visible light communication to solve the technical problems of low success rate and low recognition efficiency of coded pattern recognition in the prior art.

[0005] In a first aspect, embodiments of this application provide a coding recognition method for visible light communication, applied to a first electronic device. The first electronic device is equipped with an image acquisition unit. The method includes: acquiring a test image, wherein the test image is an image acquired by the image acquisition unit for a target area of ​​a display screen of a second electronic device, and the target area displays a periodically arranged coding pattern; detecting black and white dots in the test image to obtain a black and white dot matrix; selecting a sub-dot matrix of a target size from the black and white dot matrix and verifying the sub-dot matrix; and determining the coding information corresponding to the coding pattern based on the verified sub-dot matrix.

[0006] In a second aspect, embodiments of this application provide an electronic device, including: one or more processors; and a storage device having one or more programs stored thereon, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the method described in the first aspect.

[0007] Thirdly, embodiments of this application provide a computer-readable medium having a computer program stored thereon that, when executed by a processor, implements the method described in the first aspect.

[0008] Fourthly, embodiments of this application provide a computer program product, including a computer program that, when executed by a processor, implements the method described in the first aspect.

[0009] The visible light communication encoding recognition method, electronic device, and computer-readable medium provided in this application embodiment can acquire an image of a target area of ​​a display screen of a second electronic device through an image acquisition unit disposed in a first electronic device, thereby obtaining a test image of a periodically arranged encoding pattern displayed in the target area to achieve visible light communication. After acquiring the test image, the first electronic device can detect black and white dots to obtain a black and white dot matrix, and select a sub-dot matrix of the target size from the black and white dot matrix for verification. Then, if the verification is successful, the encoding information corresponding to the encoding pattern is identified based on the sub-dot matrix. Since the encoding pattern is periodically arranged, it is not necessary to precisely align the acquisition area and the target area, thus improving the success rate of encoding pattern recognition. Furthermore, since the encoding pattern is periodically arranged, it is only necessary to verify local sub-dots in the black and white dot matrix, without verifying the entire matrix, thereby improving the encoding recognition efficiency. Attached Figure Description

[0010] Other features, objects, and advantages of this application will become more apparent from the following detailed description of non-limiting embodiments with reference to the accompanying drawings: Figure 1 This is a flowchart of an embodiment of the visible light communication encoding and identification method of this application; Figure 2 This is a schematic diagram of the display screen of the second electronic device of this application; Figure 3 This is a schematic diagram illustrating an application scenario of the visible light communication encoding and recognition method of this application; Figure 4 This is a flowchart of the process for detecting black and white dots and generating a black and white dot matrix in this application; Figure 5 These are comparison images of the preprocessing results before and after this application; Figure 6 This is a comparison image of the black spot filtering process before and after in this application; Figure 7 This is a schematic diagram of the black and white dot matrix generation process of this application; Figure 8 This is a flowchart of the sub-matrix verification process in this application; Figure 9 This is a schematic diagram illustrating the conversion of the sub-matrix of this application into the initial matrix; Figure 10 This is a comparison diagram of the matrix to be processed in this application before and after row offset; Figure 11This is a comparison diagram of the matrix to be processed in this application before and after column offset; Figure 12 This is a comparison diagram of the initial matrix of this application and the offset matrix that satisfies the encoding rules; Figure 13 This is a schematic diagram of the sub-dot matrix conforming to the encoding rules of this application; Figure 14 This is a flowchart of one embodiment of the visible light communication encoding and identification device of this application; Figure 15 This is a schematic diagram of the structure of a computer system used to implement the electronic device of the present application. Detailed Implementation

[0011] The present application will now be described in further detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and not intended to limit it. Furthermore, it should be noted that, for ease of description, only the parts relevant to the invention are shown in the accompanying drawings.

[0012] It should be noted that, unless otherwise specified, the embodiments and features described in this application can be combined with each other. This application will now be described in detail with reference to the accompanying drawings and embodiments.

[0013] It should be noted that all actions involving the acquisition of signals, information, or data in this application are carried out in compliance with the relevant data protection laws and policies of the country where the application is located, and with the authorization granted by the owner of the relevant device.

[0014] In recent years, biometric technology has been widely applied to various terminal devices and electronic devices. Biometric recognition technologies include, but are not limited to, fingerprint recognition, palm print recognition, vein recognition, iris recognition, face recognition, liveness detection, and anti-counterfeiting technologies. Among them, fingerprint recognition typically includes optical fingerprint recognition, capacitive fingerprint recognition, and ultrasonic fingerprint recognition. With the rise of full-screen technology, fingerprint recognition modules can be placed in a partial or complete area under the display screen, thus forming under-display optical fingerprint recognition; alternatively, the optical fingerprint recognition module can be partially or completely integrated into the display screen of the electronic device, thus forming in-display optical fingerprint recognition. The aforementioned display screen can be an organic light-emitting diode (OLED) display or a liquid crystal display (LCD), etc. Fingerprint recognition methods typically include steps such as fingerprint image acquisition, preprocessing, feature extraction, and feature matching. Some or all of the above steps can be implemented using traditional computer vision (CV) algorithms or deep learning algorithms based on artificial intelligence (AI). Fingerprint recognition technology can be applied to portable or mobile terminals such as smartphones, tablets, and gaming devices, as well as other electronic devices such as smart door locks, cars, and bank ATMs, for fingerprint unlocking, fingerprint payment, fingerprint attendance, and identity authentication.

[0015] Currently, when biometric recognition modules in terminal devices are applied to visible light communication scenarios, the low resolution and small field of view of the image sensors in these modules often require precise alignment for successful recognition, resulting in low success rates and efficiency in coded pattern recognition. This application provides a coded recognition method for visible light communication that can improve the success rate and efficiency of coded pattern recognition.

[0016] Please refer to Figure 1This document illustrates a flowchart of an embodiment of the visible light communication encoding and identification method according to this application. The visible light communication encoding and identification method can be applied to a first electronic device. The first electronic device can be various electronic devices with a display screen. For example, it may include, but is not limited to, smartphones, tablets, e-book readers, MP3 (Moving Picture Experts Group Audio Layer III) players, MP4 (Moving Picture Experts Group Audio Layer IV) players, laptops, in-vehicle computers, handheld computers, desktop computers, set-top boxes, smart TVs, wearable devices, etc. The aforementioned display screen can be various types of display screens such as organic light-emitting diode displays and liquid crystal displays. The executing entity of the visible light communication encoding and identification method can be the processor in the aforementioned first electronic device, for example... Figure 15 The processing device 1501 in the middle.

[0017] The encoding and identification method for visible light communication includes the following steps: Step 101: Obtain the image to be tested.

[0018] In this embodiment, the first electronic device may be equipped with an image acquisition unit. The image acquisition unit can be used to acquire images. The image to be tested may be an image acquired by the image acquisition unit for a target area of ​​the display screen of the second electronic device. The second electronic device may be any electronic device with a display screen. The target area may be a partial area or the entire area of ​​the display screen of the second electronic device, which is not limited here.

[0019] In some scenarios, the image acquisition unit can be a camera. The camera may include, but is not limited to, at least one of the following: a front-facing camera and a rear-facing camera. When the image acquisition unit is a front-facing camera, the image to be tested can be an image captured by the front-facing camera of the target area when the target area of ​​the second electronic device's display screen is close to the first electronic device. In practice, a distance sensor can be placed near the front-facing camera to detect whether other electronic devices are approaching.

[0020] In other scenarios, the aforementioned image acquisition unit may be a biometric identification module. The display screen of the first electronic device may include an acquisition area. This acquisition area may be a partial or complete area of ​​the display screen of the first electronic device, without limitation. The biometric identification module may be positioned below the acquisition area, enabling it to acquire under-screen images. When the target area of ​​the display screen of the second electronic device approaches the acquisition area, the executing entity can acquire the under-screen image acquired by the biometric identification module and use it as the image to be tested. In practice, the biometric identification module may include an image sensor, through which under-screen images can be acquired. The biometric identification module may include, but is not limited to, fingerprint modules, palmprint modules, etc. This biometric identification module may be used solely for image acquisition, or it may be used for both image acquisition and image recognition.

[0021] As an example, see Figure 2 This diagram illustrates an application scenario of the visible light communication encoding and recognition method of this application. For example... Figure 2 As shown, the display screen of the first electronic device can have a "biometric identification module 1" in its acquisition area. The target area of ​​the display screen of the second electronic device can display "coded pattern 1". When the acquisition area of ​​the display screen of the first electronic device approaches the target area of ​​the display screen of the second electronic device, the "biometric identification module 1" can acquire an image of "coded pattern 1". It should be noted that the display screen of the second electronic device can also include an acquisition area, below which a "biometric identification module 2" can be set. The display screen of the first electronic device can also have a target area, which can display "coded pattern 2". When the acquisition area of ​​the display screen of the first electronic device approaches the target area of ​​the second electronic device, the "biometric identification module 2" can also simultaneously acquire an image of "coded pattern 2". Thus, visible light communication can be performed simultaneously for the biometric identification modules below the displays of the first and second electronic devices. Similarly, visible light communication can also be performed simultaneously for the front-facing cameras of the first and second electronic devices, which will not be elaborated here.

[0022] In this embodiment, the target area may display a periodically arranged coded pattern. See, for example... Figure 3 The diagram shows a display screen of the second electronic device. A periodically arranged coded pattern is shown in reference numeral 201. The coded pattern is displayed via light-emitting diodes or other components of the display screen when the user performs a target operation (e.g., launches a target application). The coded pattern is obtained by encoding the original coded information using a preset encoding rule. The coded information can be used to establish communication between the first and second electronic devices, and may include, but is not limited to, information in string form, for example... Figure 3 The "Ali4977153" in the text.

[0023] Step 102: Detect black and white dots in the image to be tested to obtain a black and white dot matrix.

[0024] In this embodiment, the image to be tested can be a grayscale image. The aforementioned execution entity can first determine the black and white points based on the pixel values ​​of each pixel in the image to be tested. As an example, pixels with pixel values ​​greater than a first threshold can be designated as white points, and pixels with pixel values ​​less than a second threshold can be designated as black points. As another example, a sliding window can be used to perform sliding detection on the image to be tested to determine the maximum and minimum pixel values ​​within the sliding window. The maximum pixel value greater than the first threshold is designated as a white point, and the maximum pixel value less than the second threshold is designated as a black point. As yet another example, the image to be tested can first be preprocessed to improve image quality. Then, a sliding window can be used to perform sliding detection on the preprocessed image to determine the maximum and minimum pixel values ​​within the sliding window. The maximum pixel value greater than the first threshold is designated as a white point, and the maximum pixel value less than the second threshold is designated as a black point.

[0025] After detecting black and white dots in the image under test, the aforementioned execution entity can generate a black and white dot matrix based on the positions of the black and white dots in the image. The black and white dot matrix can be visualized in the form of a grayscale image. For example, the pixel value of the black dots can be set to a first value (e.g., 0), the pixel value of the white dots can be set to a second value (e.g., 255), and the values ​​of the remaining dots can be set to an intermediate value greater than the first value and less than the second value (e.g., 128), displaying the black and white dot matrix in the form of an image for easy observation.

[0026] Step 103: Select a sub-matrix of the target size from the black and white dot matrix and verify the sub-matrix.

[0027] In this embodiment, since the encoding pattern changes periodically, the black and white dot matrix also changes periodically. A target size can be pre-set based on the size of a single-period region of the verification encoding pattern. During verification, the execution entity can select a local dot matrix of the target size from the black and white dot matrix as a sub-dot matrix, and only verify the sub-dot matrix, thereby reducing the amount of verification data and improving verification efficiency. In practice, the target size can be set to N×N or N×M. N is a positive integer, for example, N=12. M is a positive integer different from N.

[0028] In this embodiment, the aforementioned execution entity can verify the sub-dot matrix based on preset rules. If the verification passes, step 104 can be executed. If the verification fails, another sub-dot matrix of the target size can be selected from the black and white dot matrix, and the reselected sub-dot matrix can be verified to avoid errors in the verification result due to misidentified black and white dots in the factor dot matrix, thereby improving the accuracy of the verification result. In addition, since the black and white dot matrix changes periodically, even if the user does not align the encoding pattern and the acquisition area, an accurate verification result can still be obtained through at least one selection and verification of the sub-dot matrix, improving the success rate of encoding recognition.

[0029] In some optional implementations, the aforementioned execution entity can first select target points from the aforementioned black and white dot matrix according to a pre-set first target order. The first target order can be set as needed. For example, it can be set to an order from left to right or from top to bottom. Another example is that since the image center is clearer than the edges, it can be set to an order from the center to the edge, etc., without limitation here. After selecting the target point, a sub-dot matrix processing step can be performed: starting from the target point, extracting a sub-dot matrix of the target size from the target dot matrix, and verifying the sub-dot matrix. If the verification passes, step 104 can be executed. If the verification fails, the next point in the black and white dot matrix can be selected as the target point according to the aforementioned first target order, and the aforementioned sub-dot matrix processing step can continue. Thus, the sub-dot matrix can be traversed, avoiding omissions or repetitions in sub-dot matrix selection. If none of the traversed sub-dot matrices pass the verification, a prompt message can be displayed, such as "Please move closer to the electronic device again for visible light communication," etc., without specific limitation here.

[0030] Step 104: Based on the verified sub-dot matrix, determine the encoding information corresponding to the encoding pattern.

[0031] In this embodiment, the execution entity can extract a binary data stream based on the binary matrix corresponding to the verified sub-dot matrix. Then, the binary data stream can be converted into a string to obtain the encoded information corresponding to the encoded pattern.

[0032] In some optional implementations, after determining the encoding information corresponding to the aforementioned encoding pattern, the executing entity can also communicate with the second electronic device based on the aforementioned encoding information. This communication with the second electronic device can include at least one of the following: transferring files (e.g., images, videos, text, business cards, encrypted text, accounts, passwords, etc.), establishing connections (e.g., Bluetooth connection, socket connection), encryption authentication, string authentication, etc. Therefore, communication between the first and second electronic devices can be established without requiring complex user operations, improving the convenience of the communication connection.

[0033] The method provided in the above embodiments of this application can acquire an image of a target area of ​​the display screen of a second electronic device through an image acquisition unit disposed in a first electronic device, thereby obtaining a test image of a periodically arranged coded pattern displayed in the target area to achieve visible light communication. After acquiring the test image, the first electronic device can detect black and white dots to obtain a black and white dot matrix, and select a sub-dot matrix of the target size from the black and white dot matrix for verification. Then, if the verification is successful, the coded information corresponding to the coded pattern can be identified based on the sub-dot matrix. Since the coded pattern is periodically arranged, it is not necessary to precisely align the acquisition area and the target area, thereby improving the success rate of coded pattern recognition. Furthermore, since the coded pattern is periodically arranged, it is only necessary to verify the local sub-dots in the black and white dot matrix, without verifying the entire matrix, thereby improving the efficiency of code recognition.

[0034] In some alternative embodiments, see Figure 4 Step 102 above (i.e., detecting black and white dots in the image to be tested and obtaining a black and white dot matrix) can be specifically performed according to steps 401 to 403 as follows: Step 401: Preprocess the image to be tested to obtain a first preprocessed image for detecting white points and a second preprocessed image for detecting black points. Here, the preprocessing may include, but is not limited to, at least one of the following: Gaussian blurring, image subtraction, erosion, etc.

[0035] In some alternative implementations, the specific process includes: Sub-step 4011 involves applying Gaussian blur to the image under test using a first blur radius and a second blur radius, respectively, to obtain a first blurred image and a second blurred image. Gaussian blur, also known as Gaussian smoothing, can be used to reduce image noise and detail. For an image, the Gaussian blur process can be viewed as a filtering process using a low-pass filter. Here, the first blur radius can be smaller than the second blur radius. The first blurred image obtained after processing with a smaller first blur radius can remove some local noise. The second blurred image obtained after processing with a larger second blur radius can be used as a background image to remove vignetting in the image.

[0036] Sub-step 4012 involves subtracting the first blurred image (which can be denoted as blurred) and the second blurred image (which can be denoted as background) as the images to be subtracted, respectively, to obtain a first difference image (which can be denoted as blurred-background) and a second difference image (which can be denoted as background-blurred). The image subtraction process can be used to subtract the pixel values ​​of the two images pixel by pixel, and the pixel value of each pixel in the resulting difference image is the pixel difference between the corresponding pixels in the two images. It should be noted that after the image subtraction process, since there are negative values ​​in the difference image, normalization can be performed. For example, the pixel value of each pixel in the difference image can be added to a constant to ensure that the pixel value range of each pixel is within a target interval (e.g., [0, 255]).

[0037] Sub-step 4013 involves performing image erosion processing on the first difference image and the second difference image, respectively, to obtain a first pre-processed image (obtained after erosion processing of the first difference image) for detecting white points and a second pre-processed image (obtained after erosion processing of the second difference image) for detecting black points. The erosion processing can be used to reduce the range of white points in the image, facilitating subsequent detection. See [link to relevant documentation] Figure 5 The images shown are comparisons of the preprocessing results before and after. The image to be tested is shown as 501. After preprocessing, a first preprocessed image as shown as 502 and a second preprocessed image as shown as 503 can be obtained.

[0038] Step 402: Based on the first preprocessed image, detect white points in the test image, and based on the second preprocessed image, detect black points in the test image. Here, the first and second preprocessed images can be traversed separately, and the pixel with the largest pixel value in a local area can be selected with the traversed pixel as the center. Then, the largest pixel value is compared with a threshold value to determine whether it is a white point or a black point based on the comparison result.

[0039] In some optional implementations, a sliding window approach can be used to detect the maximum pixel value within a local range. Specifically, a sliding window can first be used to perform sliding detection on the first preprocessed image. If the maximum pixel value in the sliding window is greater than a target threshold, the pixel corresponding to the maximum pixel value can be identified as a white point. Then, the same sliding window can be used to perform sliding detection on the second preprocessed image. If the maximum pixel value in the sliding window is greater than the aforementioned target threshold, the pixel corresponding to the maximum pixel value can be identified as a black point. The size of the sliding window can be set to be smaller than the distance between black and white points to avoid selecting two points with the largest pixel values ​​in the same window. It can be understood that since the second preprocessed image is obtained based on the second difference image, which can be considered as a pixel value inversion of the first difference image, when using a sliding window to detect the maximum pixel value within a local range in the second preprocessed image, the corresponding point in the image under test is a black point.

[0040] Furthermore, since white dots have stronger features than black dots, black dots are more easily misjudged than white dots. Therefore, in some optional implementations, after determining the black and white dots, the executing entity can filter the black dots based on the coordinates of the white dots to remove those whose positional relationship does not meet the conditions, thus eliminating misjudged points. For example, since there is a certain distance between black and white dots, if the distance between a black dot and a white dot is too small, it is usually a misjudged point. Therefore, black dots with a distance less than a certain threshold from the white dot can be filtered out to remove the misjudged point. See [example example]. Figure 6 The image shown is a comparison of the black and white dot matrix before and after black dot filtering. By filtering black dots, misjudged points can be removed, thus making the black and white dot matrix more accurate.

[0041] Step 403: Generate a black and white dot matrix based on the coordinates of the white dots and the black dots.

[0042] In some alternative implementations, sub-steps 4031 to 4034 can be performed as follows: Sub-step 4031 stores the coordinates of the white point, the coordinates of the black point, and the type identifier of each point to the target array. The type identifier can be used to indicate the type of the point. The point type can include white and black points. For example, 0 can represent a black point and 1 can represent a white point. As another example, the type identifier can be a pixel value, where 0 represents a black point and 255 represents a white point.

[0043] Sub-step 4032: Determine the center point of the black and white dot matrix based on the coordinates of the midpoint of the image to be tested and the target array. Here, a first coordinate can be selected from the target array based on the coordinates of the midpoint of the image to be tested, and the point corresponding to the first coordinate can be taken as the center point of the black and white dot matrix. Here, the first coordinate can be the coordinate in the target array that is closest to the midpoint of the image to be tested. After determining the center point of the black and white dot matrix, the aforementioned execution entity can mark the center point, for example, it can be marked as [0,0].

[0044] Sub-step 4033: Based on the center point and the target array, determine the center column of the black and white dot matrix and the points in the same row of each point in the center column. Specifically, the execution entity can select a second coordinate from the target array with a similar horizontal coordinate based on the first coordinate of the center point, and generate the center column of the black and white dot matrix based on the points corresponding to the center point and the second coordinate. As an example, if the difference between the horizontal coordinate of a certain coordinate in the target array and the horizontal coordinate of the first coordinate is within a preset error range, then that coordinate can be used as the second coordinate, and the center column of the black and white dot matrix can be generated based on the points corresponding to each of the selected second coordinates. Then, for each point in the center column, based on the coordinate of that point, select a third coordinate from the target array with a similar vertical coordinate, and take the point corresponding to the third coordinate as the point in the same row as that point. As an example, for each point in the center column, if the difference between the vertical coordinate of a certain coordinate in the target array and the vertical coordinate of that point is within a preset error range, then that coordinate can be used as the third coordinate, and the point corresponding to that coordinate can be taken as the point in the same row as that point.

[0045] In practice, the aforementioned execution entity can first query the target array for the center point to find neighboring points that meet certain conditions (e.g., the distance from the center point or the difference between the center point's ordinate and the center point's ordinate is within a preset first range, and the difference between the center point's abscissa and the center point's abscissa is within a preset second range), and mark them as [1,0] and [-1,0]. Then, for each neighboring point found, it continues to query the remaining coordinates in the target array to find neighboring points that meet the conditions (e.g., the distance from the neighboring point or the difference between the center point's ordinate and the center point's ordinate is within a preset first range, and the difference between the neighboring point's abscissa and the center point's abscissa is within a preset second range), obtaining [2,0] and [-2,0]; and so on, until no new neighboring points exist, thus obtaining the center column of the black and white dot matrix (which can be represented as [±n,0], where n is a non-negative integer). Here, the aforementioned first range can be used to find neighboring points, and the aforementioned second range can be used to make the abscissas of each found neighboring point close to that of the center point, so that each neighboring point is in the same column as the center point. The center column of the black and white dot matrix can be visualized, and the visualization results can be found in [link to visualization]. Figure 7 As shown in label 701.

[0046] Next, for each point in the central column, the execution entity can first query the target array for that point and find neighboring points that meet certain conditions (e.g., the distance from or the difference between the point's x-coordinate and the point's x-coordinate is within a preset first range, and the difference between the point's y-coordinate and the point's y-coordinate is within a preset second range), and mark them. Then, for each neighboring point found, the execution entity continues to query the remaining coordinates in the target array for neighboring points that meet the conditions (e.g., the distance from or the difference between the point's x-coordinate and the point's y-coordinate is within a preset first range, and the difference between the point's y-coordinate and the point's y-coordinate is within a preset second range), and mark them. This process continues until no new neighboring points are found. The first range is used to find neighboring points, and the second range is used to ensure that the y-coordinates of the found neighboring points are close to the y-coordinates of the points in the central column, so that the points in the central column and the successively found neighboring points are in the same row. The execution entity can then treat each neighboring point found for that point as a point in the same row as that point. After performing the above operation on each point in the center column, the points in the same row as each point in the center column can be obtained (which can be represented as [±n,±m], where m and n are both non-negative integers).

[0047] Sub-step 4034 generates a black and white dot matrix based on the central column and the points in the same row as each point in the central column. Here, the executing entity can determine the row and column relationship based on the marks of each point in the central column and the points in the same row as each point in the central column, thereby generating the black and white dot matrix.

[0048] It should be noted that the aforementioned executing entity can also generate the black and white dot matrix using other methods as needed, and is not limited to the methods described above. For example, in sub-step 4033, the center row of the black and white dot matrix and the corresponding columns of each point in the center row can be determined based on the center point and the target array; in sub-step 4034, the black and white dot matrix can be generated based on the center row and the corresponding columns of each point in the center row. As another example, the top-left vertex can be determined first, then the first column points can be determined, and finally the points in the same row as each first column point can be determined. These will not be elaborated further here.

[0049] Furthermore, to improve the accuracy of the black and white dot matrix, in some optional implementations, the aforementioned execution entity can also perform dot-filling operations during the generation of the black and white dot matrix. Specifically, an initial dot matrix can be generated first based on the center column and the points in the same row of the center column, or based on the center row and the points in the same column of the center row, and the empty and missing points in the initial dot matrix can be determined. The initial dot matrix is ​​described in [reference needed]. Figure 7As shown in reference numeral 702. Empty defects can be copied based on the positional relationship between existing points and their neighboring points. After identifying empty defects in the initial dot matrix, it is possible to check whether there are coordinates in the target array that satisfy the target point-filling condition (which can be denoted as the fourth coordinate). The target point-filling condition can include: the corresponding point is a neighboring point of the empty defect. The neighboring point can be determined by its distance from the empty defect. For example, if the distance between a point corresponding to a certain coordinate and the empty defect is less than a preset value, then the point corresponding to that coordinate can be considered a neighboring point of the empty defect. When there is a fourth coordinate in the target array that satisfies the target point-filling condition for the empty defect, it means that there is a neighboring point of the empty defect in the initial dot matrix, and the empty defect can be considered valid and added to the black and white dot matrix. Since the white dot signal is stronger than the black dot signal, black dots are easily missed. Therefore, if there is a coordinate in the target array that satisfies the target point-filling condition for the empty defect, then the empty defect can be set as a black dot. The dot matrix obtained after filling the initial dot matrix is ​​the black and white dot matrix. The resulting black and white dot matrix after adding dots can be seen in [reference]. Figure 7 As shown in reference numeral 703. By adding dots, the accuracy of the black and white dot matrix can be improved, thereby improving the accuracy of code recognition.

[0050] In some optional embodiments, the sub-dot matrix verification process in step 103 above can be performed as follows: The binary matrix corresponding to the sub-dot matrix is ​​used as the initial matrix, and it is determined whether the initial matrix conforms to the encoding rules of the encoding pattern. If the initial matrix conforms to the encoding rules, the verification is deemed successful, and the sub-dot matrix corresponding to the initial matrix is ​​taken as the verified sub-dot matrix. If the initial matrix does not conform to the encoding rules, the offset matrices of the initial matrix are traversed. When any offset matrix encountered conforms to the encoding rules, the verification is deemed successful, and the sub-dot matrix corresponding to the offset matrix conforming to the encoding rules is taken as the verified sub-dot matrix. The offset matrices are obtained by performing row and / or column offsets on the initial matrix.

[0051] Specifically, see Figure 8 Specifically, you can follow steps 801 to 810 as follows: Step 801: Use the binary matrix corresponding to the sub-matrix as the initial matrix. See [example example]. Figure 9 The diagram shown illustrates the conversion of a sub-matrix into an initial matrix. The initial matrix can be a matrix composed of 0s and 1s, where 0 represents a black dot and 1 represents a white dot.

[0052] Step 802: Determine whether the initial matrix conforms to the encoding rules of the encoding pattern.

[0053] Step 803: If the initial matrix conforms to the encoding rules, then the verification is confirmed to be successful.

[0054] Step 804: If the initial matrix does not conform to the encoding rules, the initial matrix is ​​used as the matrix to be processed, and the offset processing steps are performed (including steps 805 to 809).

[0055] Step 805: According to the offset rules, perform row or column offset on the matrix to be processed to obtain the offset matrix. Here, the offset rules can specify the method of each offset. For example, row offset or column offset, the number of rows or columns to be offset, the offset direction, etc. Among them, row offset and column offset can perform a global offset on the matrix to be processed.

[0056] In some examples, each row shift moves the non-tail row of the matrix to be processed down one row and moves the tail row up to the first row. For example, if the matrix to be processed has 4 rows, denoted as A, B, C, and D, after the first row shift, the row order is D, A, B, C. After the second row shift, the row order is C, D, A, B. After the third row shift, the row order is B, C, D, A. See [link to documentation] for details. Figure 10 The image shows a comparison of the matrix to be processed before and after the row shift. The matrix to be processed is shown as label 1001. After one row shift, the resulting shift matrix is ​​shown as label 1002.

[0057] Similarly, each column shift moves the non-tailed columns of the matrix to be processed one column to the right and moves the tailed column to the first column to the left. For example, if the matrix to be processed has four columns, denoted as a, b, c, and d, after the first column shift, the column order is d, a, b, c. After the second column shift, the column order is c, d, a, b. After the third column shift, the column order is b, c, d, a. See below for details. Figure 11 The image shows a comparison of the matrix to be processed before and after the column shift. The matrix to be processed is shown in label 1101. After one column shift, the resulting shift matrix is ​​shown in label 1102.

[0058] It should be noted that the aforementioned execution entity can also be configured with other offset methods as needed. For example, each row offset can move all non-first rows of the matrix to be processed up one row and move the first row down to the last row. Each column offset can move all non-first columns of the matrix to be processed to the left one column and move the first column right to the last column. Further details will not be elaborated here.

[0059] Step 806: Determine whether the offset matrix conforms to the encoding rules. This step can be determined using the method described in sub-step 802 above, and will not be repeated here.

[0060] Step 807: If the offset matrix conforms to the encoding rules, then the verification is considered successful. As an example, Figure 12 A comparison diagram is shown between the initial matrix corresponding to the sub-matrix and the offset matrix that satisfies the encoding rules. For example... Figure 12As shown, the offset matrix that satisfies the encoding rules is obtained by performing 6 row offsets and 3 column offsets on the initial matrix.

[0061] Step 808: If the offset matrix does not conform to the encoding rules, determine whether the offset matrix has been traversed completely.

[0062] Step 809: If the offset matrix has not been traversed completely, then the offset matrix is ​​used as the matrix to be processed, and the offset processing steps are continued.

[0063] Step 810: If the offset matrix traversal is complete, then the verification is determined to have failed.

[0064] Because the black and white dot matrix changes periodically, the two-dimensional array corresponding to the selected sub-dot matrix may not conform to the encoding rules due to overall offset. This optional embodiment, when the two-dimensional matrix corresponding to the sub-dot matrix does not conform to the encoding rules, traverses its offset matrix and checks its conformity to the encoding rules. If any offset matrix conforms to the encoding rules, the verification is considered successful. This reduces the number of sub-matrices extracted, thereby reducing the requirement for the number of recognizable black and white dots in the entire image and improving verification efficiency.

[0065] In some optional embodiments, the encoding rules of the encoding pattern may include: the first row satisfies odd parity, the remaining rows satisfy even parity, the last column satisfies odd parity, and the remaining columns except the first and last columns satisfy even parity. Based on the above encoding rules, the execution entity can determine whether the initial matrix or the offset matrix conforms to the encoding rules of the encoding pattern by the following steps: performing odd parity on the first row and last column of the target matrix (including the initial matrix or offset matrix), and performing even parity on the non-first row and the remaining columns except the first and last columns of the target matrix. If both odd and even parity checks pass, the target matrix is ​​determined to conform to the encoding rules; if either odd or even parity checks fail, the target matrix is ​​determined to not conform to the encoding rules. Here, if it is determined whether the initial matrix conforms to the encoding rules, the target matrix is ​​the initial matrix. If it is determined whether the offset matrix conforms to the encoding rules, the target matrix is ​​the offset matrix.

[0066] In practice, odd and even parity checks are methods used to detect data errors during transmission. They are based on whether the number of "1"s in the transmitted data is odd or even. During encoding, a parity bit is typically set to ensure the number of "1"s is odd or even. For example, with odd parity, if the number of "1"s in the actual data is even, the parity bit is set to "1" to meet the odd parity requirement. When the receiving end receives a set of data, it checks whether the number of "1"s is odd. If it is odd, the data transmission is considered correct; otherwise, it is considered incorrect.

[0067] This encoding rule has two advantages. First, at least four misidentified points must exist, and these four misidentified points must form a 4×4 rectangle for the verification to fail. Since the probability of such misidentification is low, it reduces the likelihood of false positives and improves the accuracy of the verification. Second, because only one row and one column satisfy the odd check, the orientation of the matrix can be uniquely determined based on the verification result. Even if the black and white dot matrix is ​​rotated, its encoding arrangement can still be uniquely determined, providing rotation resistance.

[0068] It should be noted that the encoding rules for the encoding pattern can be set in other ways as needed. For example, it can be set as follows: the first row satisfies even parity, the remaining rows satisfy odd parity, the last column satisfies even parity, and the remaining columns except the first and last columns satisfy odd parity. Another example is: the first two rows satisfy odd parity, the remaining rows satisfy even parity, the last column satisfies odd parity, and the remaining columns except the first and last columns satisfy even parity, etc. The encoding rules for the encoding pattern can be set to any parity check method that can uniquely determine the direction of the matrix, and are not limited to the examples listed above.

[0069] Furthermore, in some optional embodiments, the encoding rules of the encoding pattern, in addition to those listed above, may include, but are not limited to: the first row and first column being parity bits, and the non-first row and non-first column being data bits, with the values ​​in the data bits written by the binary data stream according to the second target order. For example, writing line by line in a left-to-right, top-to-bottom order. As an example, Figure 13 A schematic diagram of a sub-dot matrix conforming to the encoding rules is shown. The black box represents the sub-dot matrix conforming to the encoding rules, and its size can be 12×12. Dots within white boxes correspond to data bits, with a size of 11×11. Dots located outside the white boxes but within the black boxes correspond to parity bits. After conversion to the initial matrix, the value corresponding to white dots is 1, and the value corresponding to black dots is 0. In the first row of the sub-dot matrix, there are 3 white dots, thus satisfying odd parity. In the second row, there are 4 white dots, thus satisfying even parity. In the third row, there are 5 white dots in the data bits, and the parity bits are set to white dots, resulting in 6 white dots in this row, satisfying even parity. The other rows and columns of the sub-dot matrix also satisfy the above encoding rules, which will not be elaborated further here.

[0070] Based on this encoding rule, step 104 above can be performed as follows: First, remove the first row and first column of the binary matrix corresponding to the verified sub-dot matrix to obtain the data bit matrix. Then, extract the values ​​from the data bit matrix according to the second target order to obtain the binary data stream. Finally, based on the obtained binary data stream, determine the encoding information corresponding to the encoding pattern. The encoding information may include, but is not limited to, information in string form. For example, Figure 3The encoded pattern in the image corresponds to the string "Ali4977153". Setting the encoding rules in this way allows for convenient, quick, and accurate identification of the encoded information.

[0071] Further reference Figure 14 As an implementation of the methods shown in the above figures, this application provides an embodiment of an encoding and identification device for visible light communication, which is similar to... Figure 1 Corresponding to the illustrated method embodiment, this device can be specifically applied to various electronic devices. For example, it can be applied to a first electronic device that is equipped with an image acquisition unit.

[0072] like Figure 14 As shown, the visible light communication encoding recognition device 1400 of this embodiment includes: an acquisition unit 1401, used to acquire a test image, wherein the test image is an image acquired by the image acquisition unit for a target area of ​​the display screen of a second electronic device, and the target area displays a periodically arranged encoding pattern; a detection unit 1402, used to detect black and white dots in the test image to obtain a black and white dot matrix; a verification unit 1403, used to select a sub-dot matrix of a target size from the black and white dot matrix and verify the sub-dot matrix; and a determination unit 1404, used to determine the encoding information corresponding to the encoding pattern based on the verified sub-dot matrix.

[0073] In some optional implementations of this embodiment, the detection unit 1402 is further configured to preprocess the image to be tested to obtain a first preprocessed image for detecting white points and a second preprocessed image for detecting black points; based on the first preprocessed image, white points in the image to be tested are detected, and based on the second preprocessed image, black points in the image to be tested are detected; and based on the coordinates of the white points and the coordinates of the black points, a black and white dot matrix is ​​generated.

[0074] In some optional implementations of this embodiment, the detection unit 1402 is further configured to perform Gaussian blur processing on the image to be tested using a first blur radius and a second blur radius respectively, to obtain a first blurred image and a second blurred image, wherein the first blur radius is smaller than the second blur radius; to perform image subtraction processing on the first blurred image and the second blurred image respectively, using the first blurred image and the second blurred image as the subtracted images, to obtain a first difference image and a second difference image; and to perform image erosion processing on the first difference image and the second difference image respectively, to obtain a first preprocessed image for detecting white points and a second preprocessed image for detecting black points.

[0075] In some optional implementations of this embodiment, the detection unit 1402 is further configured to perform sliding detection on the first preprocessed image using a sliding window, and if the maximum pixel value in the sliding window is greater than the target threshold, then the pixel corresponding to the maximum pixel value is determined as a white point; and to perform sliding detection on the second preprocessed image using the sliding window, and if the maximum pixel value in the sliding window is greater than the target threshold, then the pixel corresponding to the maximum pixel value is determined as a black point.

[0076] In some optional implementations of this embodiment, the detection unit 1402 is further used to filter the black dots based on the coordinates of the white dots.

[0077] In some optional implementations of this embodiment, the detection unit 1402 is further configured to store the coordinates of the white points, the coordinates of the black points, and the type identifiers of the points corresponding to each coordinate in a target array, wherein the type identifiers are used to indicate black points or white points; determine the center point of the black and white dot matrix based on the coordinates of the midpoint of the image to be tested and the target array; determine the center column of the black and white dot matrix and the points in the same row of the center column, or determine the center row of the black and white dot matrix and the points in the same column of the center row, based on the center column and the points in the same row of the center column, or based on the center row and the points in the same column of the center row, and generate the black and white dot matrix based on the center column and the points in the same row of the center column, or based on the center row and the points in the same column of the center row.

[0078] In some optional implementations of this embodiment, the detection unit 1402 is further configured to generate an initial dot matrix based on the center column and the points in the same row of the center column, or based on the center row and the points in the same column of the center row, and determine the empty defects in the initial dot matrix; if there are coordinates in the target array that satisfy the target filling point condition with the coordinates of the empty defects, then the empty defects are set as black dots to obtain a black and white dot matrix.

[0079] In some optional implementations of this embodiment, the verification unit 1403 is further configured to select target points in the black and white dot matrix according to the first target order; and perform the following sub-dot matrix processing steps: starting from the target point, extracting a sub-dot matrix of the target size from the target dot matrix; verifying the sub-dot matrix; if the verification fails, then selecting the next point in the black and white dot matrix as the target point according to the first target order, and continuing to perform the sub-dot matrix processing steps.

[0080] In some optional implementations of this embodiment, the verification unit 1403 is further configured to use the binary matrix corresponding to the sub-dot matrix as an initial matrix to determine whether the initial matrix conforms to the encoding rules of the encoding pattern; if the initial matrix conforms to the encoding rules, the verification is determined to be passed, and the sub-dot matrix corresponding to the initial matrix is ​​taken as the verified sub-dot matrix; if the initial matrix does not conform to the encoding rules, the offset matrix of the initial matrix is ​​traversed, and when any offset matrix traversed conforms to the encoding rules, the verification is determined to be passed, and the sub-dot matrix corresponding to the offset matrix that conforms to the encoding rules is taken as the verified sub-dot matrix. The offset matrix is ​​obtained by performing row offset and / or column offset on the initial matrix.

[0081] In some optional implementations of this embodiment, the above encoding rules include: the first row satisfies odd parity, the remaining rows satisfy even parity, the last column satisfies odd parity, and the remaining columns except the first and last columns satisfy even parity; the above verification unit 1403 is further used to determine whether the above initial matrix or the above offset matrix conforms to the above encoding rules through the following steps: performing odd parity on the first row and last column of the target matrix, performing even parity on the non-first row and the remaining columns except the first and last columns of the target matrix, the target matrix being the above initial matrix or the above offset matrix; if the above odd parity and the above even parity pass, it is determined that the above target matrix conforms to the encoding rules; if the above odd parity or the above even parity fails, it is determined that the above target matrix does not conform to the encoding rules.

[0082] In some optional implementations of this embodiment, the above encoding rules further include: the first row and first column are check bits, and the non-first row and non-first column are data bits, the values ​​in the data bits are written by the binary data stream according to the second target order; the above determining unit 1404 is further used to remove the first row and first column of the binary matrix corresponding to the sub-dot matrix that has passed the check, to obtain a data bit matrix; according to the above second target order, extract the values ​​in the above data bit matrix to obtain a binary data stream; based on the obtained binary data stream, determine the encoding information corresponding to the above encoding pattern.

[0083] In some optional implementations of this embodiment, the device further includes a communication unit for communicating with the second electronic device based on the encoded information; the communication with the second electronic device includes at least one of the following: file transfer, connection establishment, encryption authentication, and string authentication.

[0084] In some optional implementations of this embodiment, the image acquisition unit includes at least one of the following: a biometric identification module and a camera; the biometric identification module is disposed below the acquisition area of ​​the display screen of the first electronic device, and the biometric identification module includes a fingerprint module; when the image acquisition unit is the biometric identification module, the image to be tested is an under-screen image acquired by the biometric identification module when the target area of ​​the display screen of the second electronic device is close to the acquisition area.

[0085] The apparatus provided in the above embodiments of this application can acquire an image of a target area of ​​a display screen of a second electronic device through an image acquisition unit disposed in a first electronic device, thereby obtaining a test image of a periodically arranged coded pattern displayed in the target area to achieve visible light communication. After acquiring the test image, the first electronic device can detect black and white dots to obtain a black and white dot matrix, and select a sub-dot matrix of the target size from the black and white dot matrix for verification. If the verification is successful, the coded information corresponding to the coded pattern can be identified based on the sub-dot matrix. Since the coded pattern is periodically arranged, it is not necessary to precisely align the acquisition area and the target area, thus improving the success rate of coded pattern recognition. Furthermore, since the coded pattern is periodically arranged, it is only necessary to verify local sub-dots in the black and white dot matrix, without verifying the entire matrix, thereby improving the efficiency of code recognition.

[0086] This application also provides an electronic device, including one or more processors and a storage device storing one or more programs thereon. When the one or more programs are executed by the one or more processors, the one or more processors implement the above-described encoding and identification method for visible light communication.

[0087] The following is for reference. Figure 15 It shows a schematic diagram of the structure of an electronic device used to implement some embodiments of this application. Figure 15 The electronic device shown is merely an example and should not be construed as limiting the functionality and scope of the embodiments of this application.

[0088] like Figure 15 As shown, electronic device 1500 may include a processing device (e.g., a central processing unit, a graphics processor, etc.) 1501, which can perform various appropriate actions and processes according to a program stored in read-only memory (ROM) 1502 or a program loaded from storage device 1508 into random access memory (RAM) 1503. The RAM 1503 also stores various programs and data required for the operation of electronic device 1500. The processing device 1501, ROM 1502, and RAM 1503 are interconnected via bus 1504. Input / output (I / O) interface 1505 is also connected to bus 1504.

[0089] Typically, the following devices can be connected to I / O interface 1505: input devices 1506 including, for example, touchscreens, touchpads, keyboards, mice, cameras, microphones, accelerometers, gyroscopes, etc.; output devices 1507 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; storage devices 1508 including, for example, disks, hard disks, etc.; and communication devices 1509. Communication device 1509 allows electronic device 1500 to communicate wirelessly or wiredly with other devices to exchange data. Although Figure 15 An electronic device 1500 with various devices is shown; however, it should be understood that it is not required to implement or possess all of the devices shown. More or fewer devices may be implemented or possessed alternatively. Figure 15 Each box shown can represent a device or multiple devices as needed.

[0090] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the above-described encoding and recognition method for visible light communication.

[0091] In particular, according to some embodiments of this application, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, some embodiments of this application include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via communication device 1509, or installed from storage device 1508, or installed from ROM 1502. When the computer program is executed by processing device 1501, it performs the functions defined above in the methods of some embodiments of this application.

[0092] This application also provides a computer-readable medium storing a computer program that, when executed by a processor, implements the above-described encoding and recognition method for visible light communication.

[0093] It should be noted that the computer-readable medium described in some embodiments of this application may be a computer-readable signal medium or a computer-readable storage medium, or any combination thereof. A computer-readable storage medium may be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In some embodiments of this application, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In some embodiments of this application, a computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A computer-readable signal medium can be any computer-readable medium other than a computer-readable storage medium, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to: wires, optical fibers, RF (radio frequency), etc., or any suitable combination thereof.

[0094] In some implementations, clients and servers can communicate using any currently known or future-developed network protocol, such as HTTP (Hypertext Transfer Protocol), and can interconnect with digital data communication (e.g., communication networks) of any form or medium. Examples of communication networks include local area networks (“LANs”), wide area networks (“WANs”), the Internet (e.g., the Internet of Things), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any currently known or future-developed networks.

[0095] The aforementioned computer-readable medium may be included in the aforementioned electronic device; or it may exist independently and not assembled into the electronic device. The aforementioned computer-readable medium carries one or more programs that, when executed by the electronic device, cause the electronic device to: acquire a test image, wherein the test image is an image acquired by the image acquisition unit when the target area of ​​the display screen of the second electronic device is close to the image acquisition unit, and the target area displays a periodically arranged coded pattern; detect black and white dots in the test image to obtain a black and white dot matrix; select a sub-dot matrix of a target size from the black and white dot matrix and verify the sub-dot matrix; and determine the coded information corresponding to the coded pattern based on the verified sub-dot matrix.

[0096] Computer program code for performing operations of some embodiments of this application can be written in one or more programming languages ​​or a combination thereof, including object-oriented programming languages ​​such as Java, Smalltalk, and C++; and conventional procedural programming languages ​​such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network, or it can be connected to an external computer (e.g., via the Internet using an Internet service provider), including local area networks (LANs) or wide area networks (WANs).

[0097] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.

[0098] The units described in some embodiments of this application can be implemented in software or hardware. The described units can also be housed in a processor; for example, a processor may be described as including a first determining unit, a second determining unit, a selecting unit, and a third determining unit. The names of these units do not necessarily limit the specific unit itself.

[0099] The functions described above in this document can be performed at least in part by one or more hardware logic components. For example, exemplary types of hardware logic components that can be used, without limitation, include: field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), system-on-a-chip (SoCs), complex programmable logic devices (CPLDs), and so on.

[0100] The above description is merely a selection of preferred embodiments of this application and an explanation of the technical principles employed. Those skilled in the art should understand that the scope of the invention involved in the embodiments of this application is not limited to technical solutions formed by specific combinations of the above-described technical features, but should also cover other technical solutions formed by arbitrary combinations of the above-described technical features or their equivalents without departing from the above-described inventive concept. For example, technical solutions formed by substituting the above-described features with (but not limited to) technical features with similar functions disclosed in the embodiments of this application.

Claims

1. A coding and identification method for visible light communication, characterized in that, Applied to a first electronic device, the first electronic device being provided with an image acquisition unit, the method includes: Acquire a test image, wherein the test image is an image acquired by the image acquisition unit for a target area of ​​the display screen of the second electronic device, and the target area displays a periodically arranged coded pattern; Detect the black and white dots in the image to be tested to obtain a black and white dot matrix; A sub-dot matrix of the target size is selected from the black and white dot matrix, and the sub-dot matrix is ​​verified; the target size is preset based on the size of a single-period region of the verification coding pattern. Based on the verified sub-dot matrix, the encoding information corresponding to the encoding pattern is determined; The step of verifying the sub-matrix includes: Using the binary matrix corresponding to the sub-dot matrix as the initial matrix, determine whether the initial matrix conforms to the encoding rules of the encoding pattern; If the initial matrix conforms to the encoding rules, the verification is determined to be successful, and the sub-matrix corresponding to the initial matrix is ​​taken as the verified sub-matrix. If the initial matrix does not conform to the encoding rule, the offset matrix of the initial matrix is ​​traversed. When any offset matrix traversed conforms to the encoding rule, the verification is determined to be successful, and the sub-matrix corresponding to the offset matrix that conforms to the encoding rule is taken as the verified sub-matrix. The offset matrix is ​​obtained by performing row offset and / or column offset on the initial matrix.

2. The method according to claim 1, characterized in that, The process of detecting black and white dots in the image to be tested to obtain a black and white dot matrix includes: The image to be tested is preprocessed to obtain a first preprocessed image for detecting white spots and a second preprocessed image for detecting black spots; Based on the first preprocessed image, white points in the image to be tested are detected, and based on the second preprocessed image, black points in the image to be tested are detected. A black and white dot matrix is ​​generated based on the coordinates of the white dots and the coordinates of the black dots.

3. The method according to claim 2, characterized in that, The preprocessing of the image to be tested to obtain a first preprocessed image for detecting white points and a second preprocessed image for detecting black points includes: Gaussian blurring is performed on the image to be tested using a first blur radius and a second blur radius, respectively, to obtain a first blurred image and a second blurred image, wherein the first blur radius is smaller than the second blur radius; Using the first blurred image and the second blurred image as the images to be subtracted, image subtraction is performed on the first blurred image and the second blurred image to obtain a first difference image and a second difference image. Image erosion processing is performed on the first difference image and the second difference image respectively to obtain a first preprocessed image for detecting white points and a second preprocessed image for detecting black points.

4. The method according to claim 2, characterized in that, The step of detecting white points in the image under test based on the first preprocessed image and detecting black points in the image under test based on the second preprocessed image includes: A sliding window is used to perform sliding detection on the first preprocessed image. If the maximum pixel value in the sliding window is greater than the target threshold, the pixel corresponding to the maximum pixel value in the sliding window is determined as a white point. The sliding window is used to perform sliding detection on the second preprocessed image. If the maximum pixel value in the sliding window is greater than the target threshold, the pixel corresponding to the maximum pixel value in the sliding window is determined as a black point.

5. The method according to claim 4, characterized in that, After determining the pixel corresponding to the maximum pixel value as a black point, the step of detecting white points in the image to be tested based on the first preprocessed image and detecting black points in the image to be tested based on the second preprocessed image further includes: The black dots are filtered based on the coordinates of the white dots.

6. The method according to claim 2, characterized in that, The process of generating a black-and-white dot matrix based on the coordinates of the white dots and the coordinates of the black dots includes: Store the coordinates of the white point, the coordinates of the black point, and the type identifier of the point corresponding to each coordinate in the target array. The type identifier is used to indicate whether it is a black point or a white point. Based on the coordinates of the midpoint of the image to be tested and the target array, determine the center point of the black and white dot matrix; Based on the center point and the target array, determine the center column of the black and white dot matrix and the points in the same row of each point in the center column, or determine the center row of the black and white dot matrix and the points in the same column of each point in the center row. A black and white dot matrix is ​​generated based on the central column and the points in the same row of the central column, or based on the central row and the points in the same column of the central row.

7. The method according to claim 6, characterized in that, The generation of a black and white dot matrix based on the central column and the points in the same row of the central column, or based on the central row and the points in the same column of the central row, includes: An initial point matrix is ​​generated based on the central column and the points in the same row of the central column, or based on the central row and the points in the same column of the central row, and empty points in the initial point matrix are determined. If there exists a coordinate in the target array that satisfies the target point filling condition with the coordinate of the empty defect, then the empty defect is set as a black point, resulting in a black and white dot matrix.

8. The method according to any one of claims 1-7, characterized in that, The step of selecting a sub-matrix of the target size from the black and white dot matrix and verifying the sub-matrix includes: Select target points from the black and white dot matrix according to the first target order; The following sub-matrix processing steps are performed: starting from the target point, extract the sub-matrix of the target size from the target matrices, and verify the sub-matrix; If the verification fails, then according to the first target order, select the next point in the black and white dot matrix as the target point, and continue to execute the sub-dot matrix processing steps.

9. The method according to any one of claims 1-8, characterized in that, The encoding rules include: the first row satisfies odd parity, the remaining rows satisfy even parity, the last column satisfies odd parity, and the remaining columns except the first and last columns satisfy even parity. Furthermore, the following steps are used to determine whether the initial matrix or the offset matrix conforms to the encoding rules: Odd parity is performed on the first row and last column of the target matrix, and even parity is performed on the non-first row and all other columns of the target matrix except the first and last columns. The target matrix is ​​the initial matrix or the offset matrix. If the odd parity check and the even parity check pass, then the target matrix is ​​determined to conform to the encoding rules; If either the odd parity check or the even parity check fails, then the target matrix is ​​determined to be inconsistent with the encoding rules.

10. The method according to any one of claims 1-9, characterized in that, The encoding rules of the encoding pattern include: the first row and the first column are check bits, and the non-first row and non-first column are data bits, and the values ​​in the data bits are written by the binary data stream according to the second target order; The step of determining the encoding information corresponding to the encoding pattern based on the verified sub-dot matrix includes: Remove the first row and first column of the binary matrix corresponding to the sub-matrix that passed the verification to obtain the data bit matrix; Following the second target order, extract the values ​​from the data bit matrix to obtain a binary data stream; Based on the obtained binary data stream, the encoding information corresponding to the encoding pattern is determined.

11. The method according to any one of claims 1-10, characterized in that, After determining the encoding information corresponding to the encoding pattern, the method further includes: Based on the encoded information, communication is established with the second electronic device; The communication with the second electronic device includes at least one of the following: file transfer, connection establishment, encryption authentication, and string authentication.

12. The method according to any one of claims 1-11, characterized in that, The image acquisition unit includes at least one of the following: a biometric identification module and a camera; the biometric identification module is disposed below the acquisition area of ​​the display screen of the first electronic device, and the biometric identification module includes a fingerprint module; When the image acquisition unit is the biometric identification module, the image to be tested is an under-screen image acquired by the biometric identification module when the target area of ​​the display screen of the second electronic device is close to the acquisition area.

13. An electronic device, characterized in that, include: One or more processors; Storage device, on which one or more programs are stored, When the one or more programs are executed by the one or more processors, the one or more processors implement the method as described in any one of claims 1-12.

14. A computer-readable medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the method as described in any one of claims 1-12.

15. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the method described in any one of claims 1-12.

Citation Information

Patent Citations

  • Channel establishment and information transmission method and device, storage medium and program product

    CN114727267A