Optical code positioning method, device, and image sensor chip
By implementing a new optical code positioning method on the image sensor chip, using boundary features and clustering processing, the problems of large memory consumption and computational complexity in the existing technology are solved, the accurate positioning of the optical code is achieved, and the cost and Computational overhead.
Patent Information
- Application Number
- CN202111548837.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-17
- Publication Date
- 2024-09-20
- Estimated Expiration
- 2041-12-17
AI Technical Summary
The existing optical code positioning algorithm consumes huge amounts of memory on the image sensor chip and is computationally complex. It cannot effectively realize the positioning of optical codes. It can only perform identification but cannot provide positioning information.
By implementing a new optical code positioning method on the image sensor chip, using only about one line of additional memory overhead, the image data is processed line by line to determine the boundary characteristics of each pixel, perform compression processing and clustering processing, and combine the global Optical code coordinate information list, output the starting row number and starting column number of the optical code to achieve accurate positioning.
The memory consumption and calculation amount are significantly reduced, the accurate positioning of optical codes is achieved, the software calculation overhead of the optical code recognition system is reduced, and the cost is reduced.
Smart Images

Figure CN114282559B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computers, and in particular to an optical code positioning method, device, image sensor chip, and computer-readable storage medium. Background Art
[0002] Optical code recognition systems are now widely used in people's lives. Express delivery, payment, and autonomous driving are all filled with optical code recognition systems. The optical code positioning function is an indispensable part of this system. In express delivery and industrial assembly lines, the cost of the camera system is an important consideration. Therefore, if the position information of the two-digit code can be obtained on the image sensor chip, part of the software calculation overhead of the optical code recognition system can be saved, thereby reducing costs and making the product more competitive.
[0003] The traditional optical code positioning algorithm is based on processing each frame of the image. By identifying the characteristic information of the optical code, its characteristics at the four corners. To locate the current position of the optical code. It is a software calculation method that does not take into account the scarcity of memory in the hardware. Therefore, it is difficult to migrate it to the hardware. The existing method consumes a huge amount of memory, and the memory consumed by the traditional software optical code positioning algorithm is in frames. Chinese patent CN113228051A proposes an optical code recognition algorithm on an image sensor. This method reads three lines of data and a reduced image of the original image into the memory each time. First, the three lines of data are convolved twice to obtain the high-frequency information of the image. Then the image is binarized to distinguish between high-frequency and low-frequency areas. Then the binary image is dilated by an algorithm, so that the complete optical code area can be obtained. Then the dilation result is etched, and the etching algorithm can converge the boundary that is too dilated, and finally map the result to the reduced image of the original image. Through this line-by-line operation, a reduced binary image can be obtained. The optical code area in the binarized image is white and the background is black. The final output binary image can show the position of the optical code, but it cannot provide the positioning information of the optical code and does not have the positioning function, so it can only be called an identification algorithm. The method proposed in this patent still consumes dozens of lines of memory space. Not only does it consume a huge amount of memory, its calculation is also complex, involving complex operations such as convolution operations, and each processing requires traversing the same row of images from left to right multiple times, with a large number of calculations and huge computational overhead. Summary of the invention
[0004] The present invention provides an optical code positioning method, device, image sensor chip, and computer-readable storage medium, which only use an additional memory overhead of about one row, and consume less memory. The algorithm only needs to traverse the image of each row once and the calculation operations are mostly simple conditional judgments, so the amount of calculation is smaller. The final output of the present invention can directly output the positioning information of each optical code, that is, the four parameters of the starting row number and the starting column number of each optical code in the image, giving accurate positioning, which is convenient for the optical code recognition system to perform the next step.
[0005] In one aspect of the present invention, an optical code positioning method is provided, wherein the method is applied to an image sensor chip, and the operation logic is to run line by line according to a preset rule. For each line of image data, the method includes:
[0006] Obtaining image data of the current row and a global optical code coordinate information list, wherein the global optical code coordinates refer to four pieces of information including the starting row number and the starting column number of the optical code in the image;
[0007] Determine the boundary characteristics of each pixel;
[0008] Compressing the boundary features to obtain a short boundary information list;
[0009] Performing clustering processing on the optical code of the current row based on the short boundary information list to obtain the abscissa information of the optical code of the current row;
[0010] The optical code horizontal coordinate information is merged with the global optical code coordinate information list to obtain an updated global optical code coordinate information list and output it.
[0011] As an optional solution, determining the boundary feature of each pixel includes:
[0012] The pixels of the current row are sequentially traversed along a first preset direction to determine a pixel value corresponding to each pixel;
[0013] The current pixel is classified according to the current pixel value until the classification of all pixels in the current row is completed, and the classification includes black pixels, white pixels or other pixels.
[0014] As an optional solution, classifying the current pixel according to the current pixel value includes:
[0015] Determine a current pixel whose current pixel value is greater than a first threshold as a black pixel;
[0016] Determine a current pixel whose current pixel value is less than a second threshold as a white pixel;
[0017] The current pixel located between a first threshold and the second threshold is determined as another pixel, wherein the first threshold is greater than the second threshold.
[0018] As an optional solution, it also includes:
[0019] When the current pixel type is a black pixel, if the next adjacent pixel type is still a black pixel, it is skipped. If the next adjacent pixel type is not a black pixel, it starts to search for pixels within a certain range. When the target black pixel is found, it jumps to the target black pixel and the logic is reset. When a white pixel is found, the current pixel position is recorded as a black-white boundary. When there is neither a black pixel nor a white pixel within a certain range, it is recorded as a black boundary type, or other boundary types;
[0020] When the current pixel type is a white pixel, if the next adjacent pixel type is also a white pixel, it is skipped. If the next pixel is not a white pixel, it starts to search for pixels within a certain range. When the target white pixel is found, it jumps to the target white pixel and the logic is reset. When it is confirmed that a black pixel is found, the current pixel position is recorded as a white-black boundary. When there is neither black nor white within a certain range, it is recorded as white or other boundary types, or;
[0021] When it is confirmed that the current pixel is another pixel, it is skipped directly.
[0022] As an optional solution, the boundary features are compressed to obtain a short boundary information list, including:
[0023] Determine the current boundary type;
[0024] When the current boundary type is a white-black boundary, if the current boundary list is empty, the boundary list is updated to add the white-black boundary and the index list is updated; if the current list is not empty and the previous boundary is a black-white boundary, the index list is updated to replace the last value of the index list with the current index value; if the current list is not empty, the white-black boundary is added to the boundary list and the index list is updated, or;
[0025] When the current boundary type is a black-white boundary, and the boundary list is not empty and the previous boundary closest to the current boundary is a white-black boundary, the black-white boundary is added to the boundary list, and the index list is updated, or;
[0026] When the current boundary type is a black other boundary, if the current boundary list is not empty and the previous boundary is a white-black boundary, then add a truncation symbol to the boundary list and update the index list at the same time, or;
[0027] When the current border type is a white other border, when the border list is not empty and the previous border is a black and white border, a truncation symbol is added to the border list, and the index list is updated.
[0028] As an optional solution, the clustering process of the optical code of the current row based on the short boundary information list to obtain the horizontal coordinate information of the optical code of the current row includes:
[0029] Traverse the boundary information list;
[0030] If the current boundary is a white-black boundary and the current coordinate information list is empty, add new coordinate information;
[0031] If the current boundary is a truncation symbol, skip the current position;
[0032] If the current boundary is a black-white boundary, the starting coordinates of the current optical code are updated.
[0033] As an optional solution, the step of fusing the optical code horizontal coordinate information with the global optical code coordinate information list to obtain an updated global optical code coordinate information list and outputting the updated list includes:
[0034] A certain length, defined as the search length, is downward from the starting position of each global optical code, and the row optical codes are fused within the fusion search range;
[0035] When it is confirmed that the column coordinates of the row optical code and the global optical code have an intersection, the row optical code is merged into the global code;
[0036] When it is confirmed that the column coordinates of the row optical code and the global optical code have no intersection, a new global optical code is generated;
[0037] After each row optical code is fused, the global optical code is self-fused again. When the starting positions of two global optical codes intersect, they are fused into one global optical code.
[0038] Another aspect of the present invention provides an optical code positioning device, which is applied to an image sensor chip, and the operation logic is to run line by line according to a preset rule. For each line of image data, the device includes:
[0039] An acquisition module, used to acquire the image data of the current row and a global optical code coordinate information list, wherein the global optical code coordinate refers to four information of the starting row number and the starting column number of the optical code in the image;
[0040] A determination module, used to determine the boundary features of each pixel;
[0041] A compression module, used for compressing the boundary features to obtain a short boundary information list;
[0042] A clustering module, configured to perform clustering processing on the optical code of the current row based on the short boundary information list to obtain the horizontal coordinate information of the optical code of the current row;
[0043] The fusion module is used to fuse the optical code horizontal coordinate information with the global optical code coordinate information list to obtain an updated global optical code coordinate information list and output it.
[0044] In another aspect of the present invention, an image sensor chip is provided, comprising:
[0045] at least one processor; and
[0046] a memory communicatively connected to the at least one processor; wherein,
[0047] The memory stores instructions that can be executed by the at least one processor. The instructions are executed by the at least one processor so that the at least one processor can perform the above method.
[0048] According to another aspect of the present invention, a non-transitory computer-readable storage medium storing computer instructions is provided, on which a computer program is stored, wherein the program implements the above method when executed by a processor.
[0049] The optical code positioning method, device, image sensor chip, and computer-readable storage medium provided by the present invention include obtaining image data of a current row and a global optical code coordinate information list, wherein the global optical code coordinate refers to four information of the starting row number and the starting column number of the optical code in the image, determining the boundary features of each pixel, compressing the boundary features to obtain a short boundary information list, clustering the optical code of the current row based on the short boundary information list to obtain the optical code horizontal coordinate information of the current row, fusing the optical code horizontal coordinate information with the global optical code coordinate information list to obtain an updated global optical code coordinate information list and output it, using the memory overhead of one row of image data, the coordinate information of multiple optical codes existing in the entire image can be output, mainly based on a clustering method based on conditional judgment, first clustering each row of pixels, and then fusing clusters of different rows, so as to obtain the coordinate information of multiple optical codes, and the method is applied to an image sensor chip imaging system and has the advantages of low memory overhead, simple calculation process, and the ability to output multiple optical code coordinate information. BRIEF DESCRIPTION OF THE DRAWINGS
[0050] Figure 1is a schematic flow chart of an optical code positioning method provided in an embodiment of the present invention;
[0051] Figure 2 is a schematic diagram of an optical code positioning method provided in an embodiment of the present invention;
[0052] Figure 3 It is a flow chart of a voiceprint registration method in the optical code positioning method provided in an embodiment of the present invention;
[0053] Figure 4 is a schematic flow chart of an optical code positioning method provided in an embodiment of the present invention;
[0054] Figure 5 is a schematic flow chart of an optical code positioning method provided in an embodiment of the present invention;
[0055] Figure 6 is another schematic flow chart of the optical code positioning method provided in an embodiment of the present invention;
[0056] Figure 7 It is a flow chart of a voiceprint registration method in the optical code positioning method provided in an embodiment of the present invention;
[0057] Figure 8 It is a structural block diagram of an optical code positioning device provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0058] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0059] The terms "first", "second", "third", "fourth", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments described herein can be implemented in an order other than that illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0060] Combination Figure 1 As shown, an optical code positioning method described in an embodiment of the present invention is applied to an image sensor chip, and the operation logic is to run line by line according to a preset rule. For each line of image data, the method includes:
[0061] S101. Obtain image data of the current row and a global optical code coordinate information list, wherein the global optical code coordinates refer to four information of the starting row number and the starting column number of the optical code in the image.
[0062] S102: Determine the boundary feature of each pixel.
[0063] S103: compress the boundary features to obtain a short boundary information list.
[0064] S104. Perform clustering processing on the optical codes of the current row based on the short boundary information list to obtain horizontal coordinate information of the optical codes of the current row.
[0065] S105: Merge the optical code horizontal coordinate information with the global optical code coordinate information list to obtain an updated global optical code coordinate information list and output the updated list.
[0066] An optical code positioning method is provided in an embodiment of the present invention, which uses only an additional memory overhead of about one row, and consumes less memory. The algorithm only needs to traverse each row of the image once and the calculation operations are mostly simple conditional judgments, so the amount of calculation is smaller. The final output of the present invention can directly output the positioning information of each optical code, that is, the four parameters of the starting row number and the starting column number of each optical code in the image, giving accurate positioning, which is convenient for the optical code recognition system to perform the next step of operation.
[0067] Specifically, in S102, determining the boundary feature of each pixel includes:
[0068] The pixels of the current row are traversed in sequence along the first preset direction to determine the pixel value corresponding to each pixel, and the current pixel is classified according to the current pixel value until the classification of all pixel points in the current row is completed, and the classification includes black pixels, white pixels or other pixels. The first preset direction can be from left to right or from right to left, and can be flexibly selected according to needs. There is no limitation on this. It should be noted that once the direction is determined, subsequent other direction indications are based on this direction.
[0069] Specifically, in S103, the current pixel is classified according to the current pixel value, including:
[0070] A current pixel whose current pixel value is greater than a first threshold is determined as a black pixel, a current pixel whose current pixel value is less than a second threshold is determined as a white pixel, and a current pixel whose current pixel is between the first threshold and the second threshold is determined as other pixels, wherein the first threshold is greater than the second threshold.
[0071] In a possible implementation, the classification may be determined in the following manner:
[0072] When the current pixel type is a black pixel, if the next adjacent pixel type is still a black pixel, it is skipped. If the next adjacent pixel type is not a black pixel, it starts to search for pixels within a certain range. When the target black pixel is found, it jumps to the target black pixel and the logic is reset. When a white pixel is found, the current pixel position is recorded as a black-white boundary. When there is neither a black pixel nor a white pixel within a certain range, it is recorded as a black boundary type, or other boundary types;
[0073] When the current pixel type is a white pixel, if the next adjacent pixel type is also a white pixel, it is skipped. If the next pixel is not a white pixel, it starts to search for pixels within a certain range. When the target white pixel is found, it jumps to the target white pixel and the logic is reset. When it is confirmed that a black pixel is found, the current pixel position is recorded as a white-black boundary. When there is neither black nor white within a certain range, it is recorded as white or other boundary types, or;
[0074] When it is confirmed that the current pixel is another pixel, it is skipped directly.
[0075] Specifically, in S104, compressing the boundary features to obtain a short boundary information list includes:
[0076] Determine the current boundary type;
[0077] When the current boundary type is a white-black boundary, if the current boundary list is empty, the boundary list is updated to add the white-black boundary and the index list is updated; if the current list is not empty and the previous boundary is a black-white boundary, the index list is updated to replace the last value of the index list with the current index value; if the current list is not empty, the white-black boundary is added to the boundary list and the index list is updated, or;
[0078] When the current boundary type is a black-white boundary, and the boundary list is not empty and the previous boundary closest to the current boundary is a white-black boundary, the black-white boundary is added to the boundary list, and the index list is updated, or;
[0079] When the current boundary type is a black other boundary, if the current boundary list is not empty and the previous boundary is a white-black boundary, then add a truncation symbol to the boundary list and update the index list at the same time, or;
[0080] When the current border type is a white other border, when the border list is not empty and the previous border is a black and white border, a truncation symbol is added to the border list, and the index list is updated.
[0081] Specifically, the clustering process of the optical code of the current row based on the short boundary information list to obtain the abscissa information of the optical code of the current row includes:
[0082] Traverse the boundary information list;
[0083] If the current boundary is a white-black boundary and the current coordinate information list is empty, add new coordinate information;
[0084] If the current boundary is a truncation symbol, skip the current position;
[0085] If the current boundary is a black-white boundary, the starting coordinates of the current optical code are updated.
[0086] As an optional solution, the step of fusing the optical code horizontal coordinate information with the global optical code coordinate information list to obtain an updated global optical code coordinate information list and outputting the updated list includes:
[0087] A certain length, defined as the search length, is downward from the starting position of each global optical code, and the row optical codes are fused within the fusion search range;
[0088] When it is confirmed that the column coordinates of the row optical code and the global optical code have an intersection, the row optical code is merged into the global code;
[0089] When it is confirmed that the column coordinates of the row optical code and the global optical code have no intersection, a new global optical code is generated;
[0090] After each row optical code is fused, the global optical code is self-fused again. When the starting positions of two global optical codes intersect, they are fused into one global optical code.
[0091] In order to better understand the Guanxue code positioning method provided by the present invention, a specific description is given below in conjunction with an implementation method. The method provided by the present invention can be run on an image sensor chip. The operation logic is that after one row of operation is completed, it is run row by row from top to bottom. Each row is run from left to right. The processing logic of each row is as follows: Figure 1 As shown, the input is a row of image data and a global optical code coordinate information list. The global optical code coordinates refer to the four information of the starting row number and the starting column number of the optical code in the image.
[0092] The processing of each row is mainly divided into four steps: the first step is to determine the boundary features of each pixel, the second step is to compress the boundary features to obtain a short boundary information list, the third step is to conditionally cluster the optical code of the current row based on the boundary information list to obtain the horizontal coordinate information of the optical code of the current row, and the fourth step is to merge the optical code coordinate information of the current row with the global optical code coordinate information. Finally, a row of data and an updated global optical code coordinate information list are output.
[0093] First, find the boundary features. We define three categories, black, white, and others. They are defined as white greater than a certain threshold, black less than a certain threshold, and the rest are others. Define the boundary as four categories, black and white, black others, white and black, white others. Read in a row of pixels, traverse from left to right and determine the boundary features in turn. There is some interference when determining as shown below:
[0094] Combination Figure 2 As shown, if the human eye distinguishes the position indicated by the arrow, it can be distinguished that the position is the white-black boundary, but due to problems such as the imaging system, there is a certain fuzzy boundary. This fuzzy boundary is an undesirable boundary and is an error that needs to be removed, so the method provided by the present invention can effectively avoid the influence of the fuzzy boundary. Since the optical code positioning algorithms executed on the image sensor are relatively simple, it is necessary to use the high-frequency boundary information of the optical code, and this fuzzy boundary will have a great impact. This phenomenon was observed through hundreds of chip direct-output images and compressed images, and this method is proposed to solve it.
[0095] Combination Figure 3 As shown, an exemplary method of finding boundary features may include:
[0096] First, the current pixel is classified according to its value, black, white or other.
[0097] If the current pixel type is a black pixel, the next one is also a black pixel and it is skipped. If the next one is not a black pixel, it starts to look for pixels within a certain range on the right. If a black pixel is found, it jumps to the black pixel and then resets the logic. If a white pixel is found, the current pixel position is recorded as a black-white boundary. If there is neither a black pixel nor a white pixel within a certain range, it is recorded as a black other boundary type.
[0098] If the current pixel is a white pixel, the next one is also a white pixel, so it is skipped. If the next one is not a white pixel, it starts to search for pixels within a certain range on the right. If a white pixel is found, it jumps to the white pixel, and then the logic is reset. If a black pixel is found, the current pixel position is recorded as a white-black boundary. If there are neither black pixels nor white pixels within a certain range, then it is recorded as white or other boundary types.
[0099] If the current pixel is other, skip it directly.
[0100] In summary, the boundary type of each pixel position can be clearly identified. Skipping means there is no type. It can be seen that the complexity of the calculation operation is very low, and they are all threshold judgment operations.
[0101] It should be noted that this method can determine the boundary type while compressing the list of boundary type information, which can better save storage.
[0102] Combination Figure 4 As shown, one implementation of compressing boundary information may include:
[0103] First, determine the current boundary type. There are many types of boundary types, and different operations need to be performed, including the following:
[0104] The first possibility is that if the current boundary is white or black, then the following judgment is made:
[0105] If the current boundary list is empty, update the boundary list to add the black-white boundary and update the index list. Here, the boundary list is a list that stores boundary information. Each row is initially empty. In hardware, special symbols can be used to represent empty. The index list represents the index list, which is initialized to empty at the beginning of each row. The index refers to the horizontal coordinate position corresponding to each boundary, specifically the column number. The index list and the boundary list correspond one to one. If the current list is not empty and the previous boundary is a black-white boundary, update the index list and replace the last value of the index list with the current index value. Next, judge the third possibility. If the current list is not empty, add the black-white boundary to the boundary list and update the index list.
[0106] The second case is that the current boundary is black and white. If the boundary list is not empty at this time and the previous boundary closest to the current one is a white-black boundary, then the black and white boundary is added to the boundary list and the index list is updated.
[0107] The third case is that the current boundary is black. If the current boundary list is not empty and the previous boundary is a white-black boundary, then a truncation symbol is added to the boundary list and the index list is updated at the same time.
[0108] The fourth case is that the current boundary is white. If the boundary list is not empty and the previous boundary is a black and white boundary, then a truncation symbol is added to the boundary list and the index list is updated.
[0109] In summary, the boundary information compression work is completed. In this way, in the subsequent processing, it is not necessary to traverse from the beginning of the line to the end of the line, but only to traverse the boundary information list, saving a lot of calculations. The calculations are almost all conditional judgments, which are relatively easy to implement and have a small amount of calculations.
[0110] Combination Figure 5 As shown, conditional clustering is performed on the boundary information list, and the result of clustering is the optical code of the current row. The conditional clustering here mainly involves two key factors: one is the black-white connected area, that is, the white-black boundary, the black-white boundary, the white-black boundary, and the continuous boundary pairs of the black-white boundary; the other is the distance between the two black-white connected areas. If the distance between the two black-white connected areas is too far, then we consider them to be two optical codes. The process of one implementation method of the clustering operation is as follows:
[0111] Traverse the boundary information list. The first possibility is that if the current boundary is a white-black boundary, and if the current coordinate information list is empty, then add new coordinate information. Here, the coordinate information list refers to the position of the optical code, that is, the column number of the starting position. Each group of start and end numbers corresponds to the optical code one by one. If the distance between the white-black boundary and the previous black-white boundary is relatively small, it means that this is the same optical code, and the column number of the starting position of the existing optical code is updated. If the distance between the white-black boundary and the previous black-white boundary is relatively large, it means that these are different optical codes. At this time, the starting position of the new optical code needs to be added. The second possibility is that the current boundary is a truncation symbol, so skip the current position. The third possibility is that the current boundary is a black-white boundary. If so, update the starting coordinates of the current optical code.
[0112] Combination Figure 6 As shown, all operations required in the row are completed. The optical code is a two-dimensional image. The present invention obtains the coordinate information of several optical codes that may exist in one image by fusing the optical codes in different rows from top to bottom.
[0113] First, the fusion occurs within a certain range, such as the fusion search area in the figure. That is, the fused objects need to have a positional connection. We define the search length as a certain length below the starting position of each global optical code, and the row optical code can be fused within the fusion search range. Here, the global optical code refers to the optical code coordinate information in the image, and each optical code has a row starting position and a column starting position. The row optical code refers to the optical code obtained for each row, and its coordinate information only contains the start and end positions of the horizontal coordinate. If the optical code is found in the search area, it is fused and the search area is further updated.
[0114] Combination Figure 7As shown in the figure, the fusion operation is processed from top to bottom in each row in a figure, and the fusion process is mainly divided into two stages. In the first stage, if the column coordinates of the row optical code and the global optical code have an intersection, then the row optical code is fused into the global code. If not, a new global optical code is generated. In the second stage, after each row optical code is fused, the global optical code is self-fused again. If the starting positions of the two global optical codes have an intersection, they are fused into a global optical code.
[0115] The optical code positioning method provided in the embodiment of the present invention is aimed at the optical code in the problem that almost all of them are white backgrounds and black content. Therefore, the present invention finds and summarizes the color law of its imaging, that is, the black and white connected area. The black and white connected area of the optical code must start from the white-black boundary and end with the black and white boundary. The white-black boundary and the black-white boundary cycle, and no other boundary may appear in the middle. In this method, the boundary information feature of each pixel is defined, and this feature is used to more conveniently divide the black and white connected area. The calculation is simple. This method proposes the problem of fuzzy boundaries in optical codes, and there is always a transition area between white and black. This fuzzy area has a significant impact on the results, and can effectively avoid the impact of fuzzy boundaries on the abnormal judgment of boundary types. By summarizing the law of effective boundary information in a row, a method for compressing boundary information is proposed, and the boundary information of each pixel in a row is compressed into a short boundary information list. The storage and calculation amount are greatly reduced. The conditional clustering method proposed in this method has two main factors that affect clustering. One is the type of boundary. Clustering needs to start from white and black, and then the white-black boundary and the black-white boundary are a group, and clustering is completed in groups. The second influencing factor is distance. If two black and white connected areas are close to each other, they are one optical code. If two black and white connected areas are far away from each other, they are two optical codes. This method fuses the row optical code and the global optical code by first determining the row optical code and then defining the inter-row search range. The row optical code is a one-dimensional information consisting of the start and end of the optical code's horizontal coordinate. In the fusion process, the row optical code is first integrated into the global code, and then the global code is integrated into this process. This operation sequence can effectively avoid duplication.
[0116] Compared with the prior art, the prior art can only identify optical codes on optical sensors but cannot locate them, while the present invention can clearly provide location information, which is an essential difference. The present invention locates optical codes by using boundary information, and the boundary feature information is compared with the high-frequency information used in the prior invention. High-frequency information requires at least 5 lines of memory and requires complex convolution calculation operations. The present invention only requires less than 1 line of additional memory and is calculated as a threshold judgment, which greatly reduces the amount of calculation and memory.
[0117] Compared with the prior art, which searches for optical codes by traversing a whole row of high-frequency features, the present invention compresses the boundary feature information while defining the boundary features. After that, searching for optical codes only requires traversing the boundary information list, which greatly reduces the amount of calculation and memory.
[0118] Compared with the prior art, which obtains the area where the optical code is located by dilation and etching, the present invention discovers and summarizes the boundary rules of the optical code in the image, and can divide the area where the optical code is located by only using threshold judgment calculation.
[0119] Combination Figure 8 As shown, an optical code positioning device 800 is also provided in an embodiment of the present invention, wherein the optical code positioning device 800 is applied to an image sensor chip, and the operation logic is to operate line by line according to a preset rule. For each line of image data, the device includes:
[0120] An acquisition module 801 is used to acquire the image data of the current row and a global optical code coordinate information list, wherein the global optical code coordinate refers to four information of the starting row number and the starting column number of the optical code in the image;
[0121] A determination module 802, used to determine the boundary features of each pixel;
[0122] A compression module 803 is used to compress the boundary features to obtain a short boundary information list;
[0123] A clustering module 804 is used to perform clustering processing on the optical code of the current row based on the short boundary information list to obtain the horizontal coordinate information of the optical code of the current row;
[0124] The fusion module 805 is used to fuse the optical code horizontal coordinate information with the global optical code coordinate information list to obtain an updated global optical code coordinate information list and output it.
[0125] An embodiment of the present invention further provides an image sensor chip, which includes:
[0126] at least one processor; and
[0127] a memory communicatively connected to the at least one processor; wherein,
[0128] The memory stores instructions that can be executed by the at least one processor. The instructions are executed by the at least one processor so that the at least one processor can perform the above method.
[0129] The present invention also provides a non-transitory computer-readable storage medium storing computer instructions, on which a computer program is stored, wherein when the program is executed by a processor, the optical code positioning method provided by all the inventive embodiments of the present application is applied to an image sensor chip, and the operation logic is to run line by line according to a preset rule. For each line of image data, the method includes:
[0130] Obtaining image data of the current row and a global optical code coordinate information list, wherein the global optical code coordinates refer to four pieces of information including the starting row number and the starting column number of the optical code in the image;
[0131] Determine the boundary characteristics of each pixel;
[0132] Compressing the boundary features to obtain a short boundary information list;
[0133] Performing clustering processing on the optical code of the current row based on the short boundary information list to obtain the abscissa information of the optical code of the current row;
[0134] The optical code horizontal coordinate information is merged with the global optical code coordinate information list to obtain an updated global optical code coordinate information list and output it.
[0135] The optical code positioning method, device, image sensor chip, and computer-readable storage medium provided by the present invention include obtaining image data of a current row and a global optical code coordinate information list, wherein the global optical code coordinate refers to four information of the starting row number and the starting column number of the optical code in the image, determining the boundary features of each pixel, compressing the boundary features to obtain a short boundary information list, clustering the optical code of the current row based on the short boundary information list to obtain the optical code horizontal coordinate information of the current row, fusing the optical code horizontal coordinate information with the global optical code coordinate information list to obtain an updated global optical code coordinate information list and output it, using the memory overhead of one row of image data, the coordinate information of multiple optical codes existing in the entire image can be output, mainly based on a clustering method based on conditional judgment, first clustering each row of pixels, and then fusing clusters of different rows, so as to obtain the coordinate information of multiple optical codes, and the method is applied to an image sensor chip imaging system and has the advantages of low memory overhead, simple calculation process, and the ability to output multiple optical code coordinate information.
[0136] The computer storage medium of the embodiment of the present invention can adopt any combination of one or more computer-readable media. The computer-readable medium can be a computer-readable signal medium or a computer-readable storage medium. The computer-readable storage medium can be, for example, but not limited to, a system, device or device of electricity, magnetism, light, electromagnetic, infrared, or semiconductor, or any combination of the above. More specific examples (non-exhaustive list) of computer-readable storage media include: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this document, a computer-readable storage medium can be any tangible medium containing or storing a program, which can be used by an instruction execution system, device or device or used in combination with it.
[0137] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, which carry computer-readable program code. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than a computer-readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device.
[0138] The program code embodied on the computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
[0139] Computer program code for performing the operations of the present invention may be written in one or more programming languages or a combination thereof, including object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0140] Note that the above are only preferred embodiments of the present invention and the technical principles used. Those skilled in the art will understand that the present invention is not limited to the specific embodiments described herein, and that various obvious changes, readjustments and substitutions can be made by those skilled in the art without departing from the scope of protection of the present invention. Therefore, although the present invention has been described in more detail through the above embodiments, the present invention is not limited to the above embodiments, and may include more other equivalent embodiments without departing from the concept of the present invention, and the scope of the present invention is determined by the scope of the appended claims.
[0141] The present invention also provides a computer program product, comprising a computer program, wherein the computer program implements the above-mentioned speech recognition method when executed by a processor.
[0142] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution disclosed in the present invention can be achieved, and this document does not limit this.
[0143] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims
1. An optical code positioning method, characterized in that: Applied to the image sensor chip, the operation logic is to run line by line according to the preset rules. For each line of image data, the method includes: Obtaining image data of the current row and a global optical code coordinate information list, wherein the global optical code coordinates refer to four pieces of information including the starting row number and the starting column number of the optical code in the image; Determine the boundary characteristics of each pixel; Compressing the boundary features to obtain a short boundary information list; Performing clustering processing on the optical code of the current row based on the short boundary information list to obtain the abscissa information of the optical code of the current row; The optical code horizontal coordinate information is merged with the global optical code coordinate information list to obtain an updated global optical code coordinate information list and output it; comprising the following steps: A certain length, defined as the search length, is downward from the starting position of each global optical code, and the row optical codes are fused within the fusion search range; When it is confirmed that the column coordinates of the row optical code and the global optical code have an intersection, the row optical code is merged into the global code; When it is confirmed that the column coordinates of the row optical code and the global optical code have no intersection, a new global optical code is generated; After each row optical code is fused, the global optical code is self-fused again. When the starting positions of two global optical codes intersect, they are fused into one global optical code.
2. The optical code positioning method according to claim 1, characterized in that: The step of determining the boundary feature of each pixel comprises: The pixels of the current row are sequentially traversed along a first preset direction to determine a pixel value corresponding to each pixel; The current pixel is classified according to the current pixel value until the classification of all pixels in the current row is completed, and the classification includes black pixels, white pixels or other pixels.
3. The optical code positioning method according to claim 2, characterized in that: Classifying the current pixel according to the current pixel value includes: Determine a current pixel whose current pixel value is greater than a first threshold as a black pixel; Determine a current pixel whose current pixel value is less than a second threshold as a white pixel; The current pixel located between a first threshold and the second threshold is determined as another pixel, wherein the first threshold is greater than the second threshold.
4. The optical code positioning method according to claim 3, characterized in that: Also includes: When the current pixel type is a black pixel, if the next adjacent pixel type is still a black pixel, it is skipped. If the next adjacent pixel type is not a black pixel, it starts to search for pixels within a certain range. When the target black pixel is found, it jumps to the target black pixel and the logic is reset. When a white pixel is found, the current pixel position is recorded as a black-white boundary. When there is neither a black pixel nor a white pixel within a certain range, it is recorded as a black boundary type, or other boundary types; When the current pixel type is a white pixel, if the next adjacent pixel type is also a white pixel, it is skipped. If the next pixel is not a white pixel, it starts to search for pixels within a certain range. When the target white pixel is found, it jumps to the target white pixel and the logic is reset. When it is confirmed that a black pixel is found, the current pixel position is recorded as a white-black boundary. When there is neither black nor white within a certain range, it is recorded as white or other boundary types, or; When it is confirmed that the current pixel is another pixel, it is skipped directly.
5. The optical code positioning method according to claim 4, characterized in that: The compressing the boundary features to obtain a short boundary information list includes: Determine the current boundary type; When the current boundary type is a white-black boundary, if the current boundary list is empty, the boundary list is updated to add the white-black boundary and the index list is updated; if the current list is not empty and the previous boundary is a black-white boundary, the index list is updated to replace the last value of the index list with the current index value; if the current list is not empty, the white-black boundary is added to the boundary list and the index list is updated, or; When the current boundary type is a black-white boundary, and the boundary list is not empty and the previous boundary closest to the current boundary is a white-black boundary, the black-white boundary is added to the boundary list, and the index list is updated, or; When the current boundary type is a black other boundary, if the current boundary list is not empty and the previous boundary is a white-black boundary, then add a truncation symbol to the boundary list and update the index list at the same time, or; When the current border type is a white other border, when the border list is not empty and the previous border is a black and white border, a truncation symbol is added to the border list, and the index list is updated.
6. The optical code positioning method according to claim 5, characterized in that: The clustering process of the optical code of the current row based on the short boundary information list to obtain the abscissa information of the optical code of the current row includes: Traverse the boundary information list; If the current boundary is a white-black boundary and the current coordinate information list is empty, add new coordinate information; If the current boundary is a truncation symbol, skip the current position; If the current boundary is a black-white boundary, the starting coordinates of the current optical code are updated.
7. An optical code positioning device, using the optical code positioning method as claimed in claim 1, characterized in that: Applied to image sensor chips, the operation logic is to run line by line according to preset rules. For each line of image data, the device includes: An acquisition module, used to acquire the image data of the current row and a global optical code coordinate information list, wherein the global optical code coordinate refers to four information of the starting row number and the starting column number of the optical code in the image; A determination module, used to determine the boundary features of each pixel; A compression module, used for compressing the boundary features to obtain a short boundary information list; A clustering module, configured to perform clustering processing on the optical code of the current row based on the short boundary information list to obtain the horizontal coordinate information of the optical code of the current row; The fusion module is used to fuse the optical code horizontal coordinate information with the global optical code coordinate information list to obtain an updated global optical code coordinate information list and output it.
8. An image sensor chip, characterized in that: include: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 6.
9. A non-transitory computer-readable storage medium storing computer instructions, on which a computer program is stored, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.
