Image processing method and related device
By using the relative positional relationship of the contour search algorithm in image processing, parallel processing of image contour search is achieved, and the problem of inefficient contour search in the prior art is solved, and the search efficiency and system performance are improved.
Patent Information
- Application Number
- PCT/CN2024/108385
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-09-28
- Filing Date
- 2024-07-30
- Publication Date
- 2025-04-03
AI Technical Summary
In the prior art, image contour search efficiency is low, and each search needs to wait until the last search is completed before the next search is started, resulting in inefficient serial iteration process.
By obtaining the contour search algorithm of the image, the relative position relationship between the contour search center point and the key point is calculated. Multiple contour searches are performed in parallel based on this relationship, and the results of the previous search are used as the center point of the next search.
The parallel processing of image contour search is realized, the efficiency of contour search is improved, the search time is reduced, and the system performance is improved.
Smart Images

Figure CN2024108385_03042025_PF_FP_ABST
Abstract
Description
Image processing method and related equipment
[0001] This application claims priority to the Chinese patent application filed with the China Patent Office on September 28, 2023, with application number 2023112944361 and application name “A Method for Image Processing and Related Equipment”, the entire contents of which are incorporated by reference into this application. Technical Field
[0002] The present application relates to the field of image processing technology, specifically to an image processing method and related equipment, and in particular to an image processing method, an image processing device, an integrated chip, a computer device, a computer-readable storage medium and a computer program product. Background Art
[0003] With the development of image processing technology, image contour search has been introduced in fields such as computer vision and image recognition. For example, in the field of license plate recognition, it is necessary to perform contour search on the image containing the license plate to obtain the contour of the license plate, and then recognize the license plate contour.
[0004] Currently, each round of image search typically yields only one contour search result (i.e., a key point), and the next contour search must wait until the current contour search completes. This means that the current contour search performed on an image is a serial iterative process, which is inefficient.
[0005] Summary of the Invention
[0006] The embodiments of the present application provide an image processing method and related devices, which can improve the efficiency of image contour search.
[0007] In one aspect, an embodiment of the present application provides an image processing method, the method comprising:
[0008] Obtaining an image to be processed and a contour search algorithm corresponding to the image, wherein the contour search algorithm is used to indicate: a relative positional relationship between a center point of the contour search and a key point, where the key point refers to a result of the contour search;
[0009] Obtain the center point i of the qth contour search of the image, and calculate the position of the key point j that can be obtained by the qth contour search based on the relative position relationship indicated by the contour search algorithm and the position of the center point i, where q is a positive integer;
[0010] Determine the key point j as the center point i+1 of the q+1th contour search of the image;
[0011] Based on the center point i and the center point i+1, the qth contour search and the q+1th contour search are performed on the image in parallel.
[0012] In one aspect, an embodiment of the present application provides an image processing device, comprising:
[0013] an acquisition unit, configured to acquire an image to be processed and obtain a contour search algorithm corresponding to the image, wherein the contour search algorithm indicates a relative positional relationship between a center point of the contour search and a key point, wherein the key point refers to a result of the contour search;
[0014] a processing unit, configured to obtain a center point i of a qth contour search of the image, and calculate a position of a key point j obtainable by the qth contour search based on the relative position relationship indicated by the contour search algorithm and the position of the center point i, where q is a positive integer;
[0015] The processing unit is further configured to determine the key point j as the center point i+1 of the q+1th contour search on the image;
[0016] The processing unit is further configured to perform a qth contour search and a q+1th contour search on the image in parallel based on the center point i and the center point i+1.
[0017] On the one hand, an embodiment of the present application provides an integrated chip, which includes a data input bus interface unit, a contour parallel search engine, and a data output bus interface unit; wherein the integrated chip schedules the contour parallel search engine to execute the above-mentioned image processing method.
[0018] On the one hand, an embodiment of the present application provides a computer device, which includes a processor, an input device, an output device and a memory; a computer program is stored in the memory; when the computer program is executed by the processor, the above-mentioned image processing method is executed.
[0019] On the one hand, an embodiment of the present application provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, the above-mentioned image processing method is performed.
[0020] On the one hand, an embodiment of the present application provides a computer program product, which includes a computer program. When the computer program is executed by a processor, the above-mentioned image processing method is performed.
[0021] In an embodiment of the present application, an image to be processed is obtained, and a contour search algorithm corresponding to the image is obtained, the contour search algorithm is used to indicate: the relative positional relationship between the center point of the contour search and the key point, the key point being the result of the contour search; the center point i of the qth contour search of the image can also be obtained, and based on the relative positional relationship indicated by the contour search algorithm and the position of the center point i, the position of the key point j that can be obtained by the qth contour search is calculated, where q is a positive integer; the key point j is determined as the center point i+1 of the q+1th contour search of the image; based on the center point i and the center point i+1, the qth contour search and the q+1th contour search are performed on the image in parallel. It can be seen that the present application can calculate the center point of the next contour search based on the center point of the previous contour search based on the relative positional relationship between the center point indicated by the contour search algorithm and the contour search result (i.e., the key point), then based on the center points of the two adjacent contour searches determined, the contour of the image can be searched in parallel, thereby improving the efficiency of the contour search of the image. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] FIG1a is a schematic diagram of a structure of four neighborhoods provided in an embodiment of the present application;
[0023] FIG1b is a schematic diagram of the structure of an eight-neighborhood provided in an embodiment of the present application;
[0024] FIG1c is a schematic diagram of a six-neighborhood structure provided in an embodiment of the present application;
[0025] FIG2a is a schematic structural diagram of an image processing system provided in an embodiment of the present application;
[0026] FIG2 b is a schematic structural diagram of an integrated chip provided in an embodiment of the present application;
[0027] FIG3 is a flow chart of an image processing method provided in an embodiment of the present application;
[0028] FIG4a is a schematic diagram of the relative position relationship between a key point and a center point provided in an embodiment of the present application;
[0029] FIG4 b is a schematic diagram of the relative position relationship between another key point and the center point provided in an embodiment of the present application;
[0030] FIG4c is a schematic diagram of the relative position relationship between another key point and the center point provided in an embodiment of the present application;
[0031] FIG4 d is a schematic diagram of the relative position relationship between another key point and the center point provided in an embodiment of the present application;
[0032] FIG4e is a schematic diagram of the relative position relationship between another key point and the center point provided in an embodiment of the present application;
[0033] FIG4f is a schematic diagram of the relative position relationship between another key point and the center point provided in an embodiment of the present application;
[0034] FIG4g is a schematic diagram of the relative position relationship between another key point and the center point provided in an embodiment of the present application;
[0035] FIG4h is a schematic diagram of the relative position relationship between another key point and the center point provided in an embodiment of the present application;
[0036] FIG5 is a schematic diagram of a flow chart of a contour search according to an embodiment of the present application;
[0037] FIG6 a is a schematic diagram of a parallel contour search provided by an embodiment of the present application;
[0038] FIG6 b is a schematic diagram of another parallel contour search provided by an embodiment of the present application;
[0039] FIG6 c is a schematic diagram of another parallel contour search provided by an embodiment of the present application;
[0040] FIG6 d is a schematic diagram of another parallel contour search provided by an embodiment of the present application;
[0041] FIG6e is a schematic diagram of another parallel contour search provided by an embodiment of the present application;
[0042] FIG6f is a schematic diagram of another parallel contour search provided by an embodiment of the present application;
[0043] FIG6g is a schematic diagram of another parallel contour search provided by an embodiment of the present application;
[0044] FIG6h is a schematic diagram of another parallel contour search provided by an embodiment of the present application;
[0045] FIG7 is a schematic diagram of a license plate recognition scenario provided by an embodiment of the present application;
[0046] FIG8 is a schematic structural diagram of an image processing device provided in an embodiment of the present application;
[0047] FIG9 is a schematic structural diagram of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0048] An embodiment of the present application provides an image processing solution, which can be applied to OCR (Optical Character Recognition) scenarios such as license plate recognition scenarios, text recognition scenarios, subtitle recognition scenarios, motion recognition scenarios, and region of interest recognition scenarios. It can perform parallel contour search on the image in the above-mentioned recognition scenarios to obtain multiple key points, so as to facilitate image recognition based on the multiple key points searched. Since the multiple key points are obtained through the parallel contour search algorithm, the efficiency of image recognition can be improved. Among them, in the above recognition scenario, it mainly involves the parallel execution of contour search on the image. The general principle of the image processing scheme for parallel execution of contour search is as follows: obtain the image to be processed and obtain the contour search algorithm corresponding to the image, the contour search algorithm is used to indicate: the relative position relationship between the center point of the contour search and the key point, the key point refers to the result of the contour search; the center point i of the qth contour search of the image can also be obtained, and based on the relative position relationship indicated by the contour search algorithm and the position of the center point i, the position of the key point j that can be obtained by the qth contour search is calculated, where q is a positive integer; the key point j is determined as the center point i+1 of the q+1th contour search of the image; based on the center point i and the center point i+1, the qth contour search and the q+1th contour search are performed on the image in parallel. It can be seen that the present application can calculate the center point of the next contour search based on the center point of the previous contour search based on the relative position relationship between the center point indicated by the contour search algorithm and the contour search result (i.e., the key point), then based on the center points of the two adjacent contour searches determined, the contour search of the image can be realized in parallel, thereby improving the efficiency of the contour search of the image.
[0049] The following is an introduction to the key technical terms involved in this application.
[0050] 1. Contour search algorithm.
[0051] The contour search algorithm, as the name implies, is an algorithm for searching for contours. The contour here refers to the contour of the image, and the contour is composed of multiple pixels in the image. In this application, performing a contour search on an image refers to the process of searching for each pixel included in the contour to determine a key point from the current contour; specifically, the contour search algorithm defines the relative position relationship between the center point of the contour search and the contour search result (i.e., the key point). The so-called relative position relationship means that after determining the position of any one of the two (such as the center point and the key point), the other position can be determined. That is, for the current image, after determining the center point to be searched, the result obtained after the contour search (i.e., the key point) can be determined according to the relative position relationship defined by the contour search algorithm. Among them, the contour can be a contour of any shape, such as a triangle contour, a quadrilateral contour, an arbitrary polygon contour, a K neighborhood, etc.
[0052] 2. K neighborhood.
[0053] K neighborhood refers to an area consisting of K pixels with an adjacent relationship to any pixel in the image as the center point. Wherein, any pixel with an adjacent relationship to the center point refers to: a pixel located in a certain direction of the center point. For example, K neighborhood can generally include four neighborhoods and eight neighborhoods. ① Please refer to Figure 1a, which is a structural diagram of a four-neighborhood provided in an embodiment of the present application. As shown in Figure 1a, the center point of the four neighborhoods is pixel A, and the pixels with an adjacent relationship to the center point A include: B1, B2, B3, and B4. Therefore, the area consisting of these four pixels (B1, B2, B3, and B4) is represented as the four neighborhoods of the center point A. Wherein, each pixel in the four areas has an adjacent relationship with the center point A, pixel B1 is located to the right of the center point A, pixel B2 is located above the center point A, pixel B3 is located to the left of the center point A, and pixel B4 is located below the center point A. ②Please refer to Figure 1b, which is a schematic diagram of the structure of an eight-neighborhood provided in an embodiment of the present application. As shown in Figure 1b, the center point of the eight-neighborhood is pixel point A, and the pixel points that have an adjacent relationship with the center point A include: B1, B2, B3, B4, B5, B6, B7, B8. Therefore, the area formed by these eight pixel points (B1, B2, B3, B4, B5, B6, B7, B8) is represented as the eight-neighborhood of the center point A. Similarly, each pixel point in the eight-neighborhood has an adjacent relationship with the center point A.
[0054] Optionally, the K neighborhood may also include an area consisting of K pixels designated by each pixel having an adjacent relationship with the center point. Please refer to Figure 1c, which is a schematic diagram of the structure of a six-neighborhood provided by an embodiment of the present application. Based on the eight neighborhoods shown in Figure 1b, the six pixels B1, B2, B4, B5, B6, and B8 can be used as designated pixels to form the six-neighborhood structure shown in Figure 1c.
[0055] 3. Contour search performed on the image.
[0056] The contour search performed on an image refers to the process of searching for each pixel point in the image. Specifically, the process of performing contour search on an image in the present application refers to the process of searching the K neighborhood formed by any center point in the image in sequence. Taking the four areas shown in Figure 1a as an example, in the four neighborhoods, starting from a certain starting point, pixel search is performed on each pixel point in the four neighborhoods in a preset direction (for example, counterclockwise or clockwise). Assuming that the starting point is B1, the contour search is performed according to: B1->B2->B3->B4. When a pixel point that meets the preset value (such as 1) is detected, the contour search of the current four neighborhoods is completed, and the pixel point that meets the preset value (for example, B3) is used as the result of this contour search. Among them, the contour search result of this time (ie B3) will be used as the center point of the next contour search, so that the contour search is performed again in the image based on the K neighborhood formed by the center point of the next contour search, and so on. Each time a contour search process is performed on the image, a contour search result can be obtained.
[0057] 4. Key points and center points.
[0058] Key points are pixels identified after performing a contour search on an image. Because contour search is performed within the K-neighborhood of the center point, key points are located within the K-neighborhood of the center point. For example, if a contour search is performed within the four neighborhoods of center point A, a key point is any one of B1, B2, B3, or B4.
[0059] The center point refers to the center point of the K-neighborhood when performing a contour search. Any pixel in the image can be used as the center point, and the center point is used to determine the K-neighborhood. Contour search of the K-neighborhood can determine the key points. During the contour search process, the contour search algorithm mentioned above can be used to perform the contour search. Therefore, based on the center point and the contour search process performed by the contour search algorithm, the contour search result, i.e., the key points, can be determined.
[0060] Next, the image processing system provided in the embodiment of the present application will be described in conjunction with Figures 2a and 2b.
[0061] Please refer to Figure 2a, which is a structural diagram of an image processing system provided in an embodiment of the present application. As shown in Figure 2a, the image processing system may include: a terminal device 201 and a server 202. The terminal device 201 and the server 202 may be directly or indirectly connected via a network; the above-mentioned network may include but is not limited to: a wired network, a wireless network, wherein the wired network includes: a local area network, a metropolitan area network and a wide area network, and the wireless network includes: Bluetooth, WIFI (Wireless Fidelity, a standard wireless local area network), and other networks that implement wireless communication. Among them, the terminal device 201 can be a mobile phone, a tablet computer, a laptop computer, a PDA, a mobile internet device (MID, mobile internet device), a vehicle-mounted device, an aircraft, a wearable device (such as a smart watch, a smart bracelet, a pedometer, etc.), a virtual reality device (such as a VR (Virtual Reality) device, an AR (Augmented Reality) device), etc. Server 202 can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers. It can also be a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN (Content Delivery Network), as well as big data and artificial intelligence platforms.
[0062] The following describes the interaction process between the terminal device 201 and the server 202 in the image processing system in conjunction with the embodiment of the present application:
[0063] ① The terminal device 201 obtains an image to be processed. The image to be processed can be captured in real time by the terminal device using a camera (e.g., a mobile phone camera); or the image to be processed can be obtained by the terminal device from a pre-collected image library.
[0064] ② The terminal device sends the image to be processed to the server 202 for contour search processing.
[0065] ③ After the server 202 receives the image to be processed, it can obtain the contour search algorithm corresponding to the image. The contour search algorithm is used to indicate: the relative position relationship between the center point of the contour search and the key point, where the key point refers to the result of the contour search; obtain the center point i of the qth contour search of the image, and based on the relative position relationship indicated by the contour search algorithm and the position of the center point i, calculate the position of the key point j that can be obtained by the qth contour search, where q is a positive integer; determine the key point j as the center point i+1 of the q+1th contour search of the image; based on the center point i and the center point i+1, perform the qth contour search and the q+1th contour search on the image in parallel.
[0066] ④ Server 202 sends the key point data corresponding to the qth contour search result (key point j) and the q+1th contour search result (key point j+1) to terminal device 201. Each key point corresponds to a key point data, and the key point data may include the position data (e.g., coordinates) of each key point in the image. Optionally, server 202 may collect all the results (key point data) of the contour search and then send them to terminal device 201 for subsequent processing.
[0067] ⑤ The terminal device 201 determines each key point from the image to be processed based on the key point data returned by the server 202, so that the target object in the image can be determined based on each key point. For example, the target object may include but is not limited to: license plates, text, subtitles, moving objects, and areas of interest.
[0068] It should be noted that the interactive process of the above image processing flow is for illustrative purposes only and does not limit the specific execution process of the terminal device and server. Optionally, the contour search algorithm for obtaining the corresponding image can also be executed by the terminal device; or the target object can be determined from the image to be processed based on various key points by the server; or the above image processing process can be executed independently by the terminal device or server in the image processing system, etc.
[0069] Please refer to Figure 2b, which is a schematic diagram of the structure of an integrated chip provided in an embodiment of the present application. The integrated chip can be integrated into a terminal device or server in the image processing system shown in Figure 2a, wherein the integrated chip may include: a data input bus interface unit, a contour parallel search engine, and a data output bus interface unit. Specifically, the contour parallel search engine is connected to the data input bus interface unit and the data output bus interface unit, respectively.
[0070] 1) Data input bus interface unit: used to receive images to be processed.
[0071] 2) Contour Parallel Search Engine: This system uses a contour parallel search algorithm to perform the qth and q+1th contour searches on the image being processed in parallel. Furthermore, the contour parallel search algorithm can be used to perform N contour searches on the image in parallel to obtain N key points (i.e., the contour search results). The specific number N can be determined based on the business scenario requirements of the image and the throughput and performance of the image processing system.
[0072] Optionally, the call to the contour parallel search engine can also preprocess the image to be processed to obtain a preprocessed image. The preprocessing here can include, but is not limited to, any one or more of binarization, image enhancement, and image segmentation. Performing preprocessing on the image can improve the image's clarity and quality, thereby facilitating subsequent contour search processing on the image. A contour parallel search is performed on the preprocessed image to obtain multiple key points. Each key point can also be post-processed to obtain key point data for each key point after data post-processing. For example, the key point data (e.g., coordinate data) of any key point can be normalized.
[0073] 3) Data output bus interface unit: used to output key point data of each key point obtained after parallel contour search of the image, wherein the key point data can be the position data of the current key point in the image, for example, the position data can include: coordinates, orientation, etc.
[0074] Based on the integrated chip provided by the present application, an image to be processed is obtained, and a contour search algorithm corresponding to the image is obtained, the contour search algorithm is used to indicate: the relative position relationship between the center point of the contour search and the key point, the key point refers to the result of the contour search; the center point i of the qth contour search of the image can also be obtained, and based on the relative position relationship indicated by the contour search algorithm and the position of the center point i, the position of the key point j that can be obtained by the qth contour search is calculated, where q is a positive integer; the key point j is determined as the center point i+1 of the q+1th contour search of the image; based on the center point i and the center point i+1, the qth contour search and the q+1th contour search are performed on the image in parallel. It can be seen that the present application can calculate the center point of the next contour search based on the center point of the previous contour search based on the relative position relationship between the center point indicated by the contour search algorithm and the contour search result (i.e., the key point), then based on the center points of the two adjacent contour searches determined, the contour of the image can be searched in parallel, thereby improving the efficiency of the contour search of the image.
[0075] It can be understood that the image processing system described in the embodiment of the present application is for the purpose of more clearly illustrating the technical solution of the embodiment of the present application, and does not constitute a limitation on the technical solution provided in the embodiment of the present application. It is known to those skilled in the art that with the evolution of the system architecture and the emergence of new business scenarios, the technical solution provided in the embodiment of the present application is also applicable to similar technical problems.
[0076] Please refer to Figure 3, which is a flow chart of an image processing method provided in an embodiment of the present application. The image processing method can be executed by a computer device. Schematically, the computer device can call an integrated chip to execute the method. The integrated chip can be set in the computer device, which can be a terminal device or a server. The image processing method provided in the embodiment of the present application can include the following steps S301-S304:
[0077] S301 , obtaining an image to be processed and obtaining a contour search algorithm corresponding to the image, wherein the contour search algorithm is used to indicate a relative positional relationship between a center point of the contour search and a key point, where the key point refers to a result of the contour search.
[0078] Specifically, the present application can obtain the image to be processed in an online or offline manner.
[0079] (1) Obtaining images to be processed online. Specifically, corresponding business images (such as game images, medical images, live broadcast images, traffic images, etc.) can be collected in real time from at least one business field (such as the game field, medical field, live broadcast field, traffic field, etc.). For example, the current game screen can be captured in real time during the game as a game image. For example, the road test equipment next to the road can be called on a real-time traffic road to collect traffic images as traffic images, etc.; thus, the collected business images can be used as images to be processed. This online image collection method can collect business images within the business field in real time and can ensure the timeliness of business images.
[0080] (2) Acquire the image to be processed in an offline manner. Specifically, a preset image library can be obtained, which contains at least one acquired image, and then any image can be directly selected from the preset image library as the image to be processed. This offline acquisition method saves time and effort, can reduce workload, and can improve the efficiency of image acquisition.
[0081] In one possible implementation, after acquiring the image to be processed, it can be binarized to produce a binary image. Subsequently, contour search can be performed based on this binary image. Binarization involves binarizing the pixel values of each pixel in the image to either 0 or 1. Therefore, the pixel value of any pixel in the binary image is either 0 or 1. This approach facilitates image calculations and processing, improving image processing efficiency.
[0082] In which, the image contains multiple contours, and the contour search algorithm corresponding to the image is used to instruct contour search for each contour in the image; optionally, the specific process of obtaining the contour search algorithm corresponding to the image is as follows: the image to be processed can be divided into multiple contours to be contour searched, and the contour type here refers to K-neighborhood types such as eight-neighborhood and four-neighborhood; if the contour types in the image are all four-neighborhood, then the contour search algorithm corresponding to the image here is the four-neighborhood contour search algorithm, and the so-called four-neighborhood contour search algorithm refers to an algorithm that searches for contours such as four-neighborhood; if the contour types in the image are all eight-neighborhood, then the contour search algorithm corresponding to the image here is the eight-neighborhood contour search algorithm, and the so-called eight-neighborhood contour search algorithm refers to an algorithm that searches for contours such as eight-neighborhood; if the contour types in the image include both four-neighborhood and eight-neighborhood, then the contour search algorithms corresponding to the image here include the four-neighborhood contour search algorithm and the eight-neighborhood contour search algorithm, so that the four-neighborhood contour search algorithm is used to search for contours of four neighborhoods in the image, and the eight-neighborhood contour search algorithm is used to search for contours of eight neighborhoods in the image. In summary, the contour search algorithm obtained here is determined according to the contour type in the image and matches the contour type of the image. For the sake of convenience, in actual applications, a contour search algorithm of one type (such as the four-neighborhood contour search algorithm or the eight-neighborhood contour search algorithm) can be used for contour search processing for any image.
[0083] In one possible implementation, a contour search algorithm is used to instruct a contour search based on a K-neighborhood, where the K-neighborhood includes a center point for contour search and K pixels to be searched, with any pixel located in one direction of the center point of the K-neighborhood. For example, the K-neighborhood can include at least four neighborhoods, eight neighborhoods, six neighborhoods, and the like. For example, the four neighborhoods shown in FIG1a include: pixel B1 to the right of center point A, pixel B2 above center point A, pixel B3 to the left of center point A, and pixel B4 below center point A. For another example, the eight neighborhoods shown in FIG1b include: pixel B1 to the right of center point A, pixel B2 above center point A, pixel B3 above center point A, pixel B4 above center point A, pixel B5 to the left of center point A, pixel B6 below center point A, pixel B7 below center point A, and pixel B8 below center point A. For example, the eight neighborhoods shown in Figure 1c include: pixel B1 located to the right of the center point A, pixel B2 located to the upper right of the center point A, pixel B4 located to the upper left of the center point A, pixel B5 located to the left of the center point A, pixel B6 located to the lower left of the center point A, and pixel B8 located to the lower right of the center point A.
[0084] From the above, it can be seen that the relative position relationship indicated by the contour search algorithm includes K types of relative position relationships, where K is a positive integer. Specifically, ① if the contour search algorithm is used to indicate a contour search for four neighborhoods, then the relative position relationship between the center point of the contour search indicated by the contour search algorithm and the key point is four types, namely: right, top, left, and bottom. ② If the contour search algorithm is used to indicate a contour search for eight neighborhoods, then the relative position relationship between the center point of the contour search indicated by the contour search algorithm and the key point is eight types, namely: right, top right, top, top left, left, bottom left, bottom, and bottom right. ③ If the contour search algorithm is used to indicate a contour search for six neighborhoods, then the relative position relationship between the center point of the contour search indicated by the contour search algorithm and the key point is six types, namely: right, top right, top left, left, bottom left, and bottom right.
[0085] In one possible implementation, in a K-neighborhood, the relative positional relationship between the center point of the contour search and each of the K pixel points is encoded separately according to a preset encoding rule to obtain an encoding result; wherein the encoding result includes K sub-encoding results, and each sub-encoding result corresponds to a type of relative positional relationship. In a specific implementation, the encoding rule is used to indicate that each pixel point is encoded in sequence according to a preset direction, and the preset direction may include: counterclockwise or clockwise. In addition, during the encoding process, any one or more encoding forms such as digital numbers (e.g., 0, 1, 2, 3...), English characters (e.g., a, b, c...), Chinese characters (e.g., up, down, left, right...) can be used to encode the relative positional relationship between the center point and the key point. This application does not specifically limit the encoding form of the encoding rule. For convenience of explanation, in the embodiment of the present application, each pixel point is encoded in sequence in a counterclockwise direction and using a digitally numbered encoding form.
[0086] For example, according to the coding rules, the coding results of the four relative position relationships in the four neighborhoods including right, above, left, and below are shown in Table 1 below:
[0087] Table 1. Coding of relative position relationship of four neighborhoods
[0088] According to the coding relationship shown in Table 1 above, in the four neighborhoods shown in Figure 1a, pixel point B1 is located to the right of center point A, and the relative position relationship between pixel point B1 and center point A is encoded as 0; similarly, pixel point B2 is located above center point A, and the relative position relationship between pixel point B2 and center point A is encoded as 1. Similarly, the relative position relationship between each pixel point and the center point in the four neighborhoods can be represented by digital numbers.
[0089] For another example, according to the coding rules, the coding results of the eight relative position relationships in the eight neighborhoods including right, upper right, upper, upper left, left, lower left, lower, and lower right are shown in Table 2 below:
[0090] Table 2. Relative position relationship encoding of eight neighborhoods
[0091] It should be noted that the relative positional relationship between the center point and the key point of the contour search is used to indicate: the positional direction of the key point relative to the center point. For example, as shown in Figure 1a, the relative positional relationship between key point B1 and center point A is expressed as: key point B1 is located to the right of center point A, or, center point A is located to the left of key point B1; similarly, the relative positional relationship between key point B2 and center point A is expressed as: key point B2 is located above center point A, or, center point A is located below key point B2. For the sake of convenience, in the subsequent embodiments of this application, the relative positional relationship between the two is expressed by the positional direction of each key point relative to the center point.
[0092] S302, obtaining the center point i of the qth contour search on the image, and calculating the position of the key point j that can be obtained by the qth contour search based on the relative position relationship indicated by the contour search algorithm and the position of the center point i, where q is a positive integer.
[0093] In one possible implementation, obtaining the center point i of the qth contour search may include any of the following: using any pixel in the image as the center point i of the qth contour search; or using a pixel at a specified position in the image (e.g., the center position of the current image) as the center point i of the qth contour search; or using the result (key point) of the executed i-1th contour search as the center point i of the qth contour search. Optionally, if q=1, the center point i is any pixel in the image or a specified pixel (e.g., the center pixel of the current image); if q>1, the center point i refers to the key point obtained by the q-1th contour search.
[0094] As mentioned above, the relative position relationship indicated by the K-neighborhood-based contour search algorithm includes K types of relative position relationships. In the eight-neighborhood contour search, there are the following eight types of relative position relationships between the center point and the key points.
[0095] ① The relative position relationship is type 1. Please refer to Figure 4a, which is a schematic diagram of the relative position relationship between a key point and a center point provided in an embodiment of the present application. As shown in Figure 4a, the key point j of the qth contour search is located to the upper right of the center point i of the qth contour search. In this case, if the coordinates of the key point j are (1, 2), then the coordinates of the center point i are (2, 1).
[0096] ② The relative position relationship is type 2. Please refer to Figure 4b, which is a schematic diagram of another relative position relationship between key points and center points provided in an embodiment of the present application. As shown in Figure 4b, the key point j of the qth contour search is located above the center point i of the qth contour search. In this case, if the coordinates of key point j are (1, 2), the coordinates of center point i are (2, 2).
[0097] ③ The relative position relationship is type 3. Please refer to Figure 4c, which is a schematic diagram of another relative position relationship between key points and center points provided in an embodiment of the present application. As shown in Figure 4c, the key point j of the qth contour search is located to the upper left of the center point i of the qth contour search. In this case, if the coordinates of key point j are (1, 2), the coordinates of center point i are (2, 3).
[0098] ④ The relative position relationship is type 4. Please refer to Figure 4d, which is a schematic diagram of the relative position relationship between a key point and a center point provided in an embodiment of the present application. As shown in Figure 4d, the key point j of the qth contour search is located to the left of the center point i of the qth contour search. In this case, if the coordinates of the key point j are (1, 2), the coordinates of the center point i are (1, 3).
[0099] ⑤ The relative position relationship is type 5. Please refer to Figure 4e, which is another schematic diagram of the relative position relationship between key points and center points provided in an embodiment of the present application. As shown in Figure 4e, the key point j of the qth contour search is located to the lower left of the center point i of the qth contour search. In this case, if the coordinates of key point j are (1, 2), the coordinates of center point i are (0, 3).
[0100] ⑥ The relative position relationship is type 6. Please refer to Figure 4f, which is a schematic diagram of another relative position relationship between key points and center points provided in an embodiment of the present application. As shown in Figure 4f, key point j in the qth contour search is located below center point i in the qth contour search. In this case, if the coordinates of key point j are (1, 2), the coordinates of center point i are (0, 2).
[0101] ⑦ The relative position relationship is type 7. Please refer to Figure 4g, which is a schematic diagram of another relative position relationship between key points and center points provided in an embodiment of the present application. As shown in Figure 4g, the key point j of the qth contour search is located to the lower right of the center point i of the qth contour search. In this case, if the coordinates of key point j are (1, 2), the coordinates of center point i are (0, 1).
[0102] ⑧ The relative position relationship is type 8. Please refer to Figure 4h, which is a schematic diagram of another relative position relationship between key points and center points provided in an embodiment of the present application. As shown in Figure 4h, key point j in the qth contour search is located to the right of center point i in the qth contour search. In this case, if the coordinates of key point j are (1, 2), the coordinates of center point i are (1, 1).
[0103] It should be noted that the relative position relationship between the key point and the center point indicated by the contour search algorithm may include: taking the key point as the reference standard, determining K types of relative position relationships between the center point and the referenced key point in the K neighborhood, for example, there are eight types of relative position relationships between the key point and the center point in the eight neighborhoods; or, taking the center point as the reference standard, determining K types of relative position relationships between the key point and the referenced center point in the K neighborhood, for example, there are four types of relative position relationships between the key point and the center point in the four neighborhoods. Similarly, if the contour search algorithm is a contour search algorithm based on four neighborhoods, then the contour search algorithm is used to indicate four types of relative position relationships between the key point and the center point of the contour search. The relative position relationship between the key point and the center point in the four neighborhoods can refer to the relative position relationship defined in the eight neighborhoods above, and the embodiments of the present application will not be repeated here.
[0104] Furthermore, based on the relative position relationship indicated by the contour search algorithm and the position of center point i, a matching sub-encoding result is determined from the encoding result; based on the relative position relationship reflected by the matching sub-encoding result and the position of center point i, the position of key point j that can be obtained by the qth contour search is obtained. For example, when performing a contour search based on an eight-neighborhood, if the position of center point i is (1, 1), the position of key point j can be calculated as (2, 2); if the position of center point i is (2, 2), the position of key point j can be calculated as (3, 3).
[0105] S303 : Determine the key point j as the center point i+1 of the q+1th contour search on the image.
[0106] In this application, the result of the qth contour search (i.e., the key point j of the qth contour search) is used as the center point of the q+1th contour search. Therefore, in this application, the result of the previous contour search is used to determine the center point of the next contour search. Based on this, after the center point i+1 of the q+1th contour search is determined, the above-mentioned contour search algorithm can be used to perform the q+1th contour search on the image based on the center point i+1, and the result of the q+1th contour search (i.e., the key point of the q+1th contour search) is obtained; further, the key point of the q+1th contour search is determined as the center point i+2 of the q+2th contour search, and then based on the center point i+2, the above-mentioned contour search algorithm is used to perform the q+2th contour search on the image, and the result of the q+2th contour search (i.e., the key point of the q+2th contour search) is obtained. Similarly, there is an association relationship between any two contour searches performed on the image, that is, the result of the previous contour search is used to determine the center point of the next contour search. Therefore, when the present application needs to perform N contour searches on the image, according to the association relationship between any two contour searches (such as the qth contour search and the q+1th contour search), the present application can realize N rounds of contour searches on the image in parallel.
[0107] S304 : Based on the center point i and the center point i+1, perform the qth contour search and the q+1th contour search on the image in parallel.
[0108] In one possible implementation, based on the center point i and the center point i+1, the qth contour search and the q+1th contour search are performed on the image in parallel, specifically including: based on the center point i, determining the K neighborhood of the center point i from the image, and performing a contour search within the K neighborhood of the center point i to obtain the key point j; and, based on the center point i+1, determining the K neighborhood of the center point i+1 from the image, and performing a contour search within the K neighborhood of the center point i+1 to obtain the key point j+1.
[0109] Specifically, a contour search is performed within the K neighborhood of the center point i to obtain a key point j, which specifically includes the following process: obtaining the starting point p of the qth contour search; within the K neighborhood of the center point i, starting from the starting point p, performing pixel detection in a preset direction; when a pixel with a preset pixel value is detected, stopping the pixel detection of the K neighborhood of the center point i, and using the pixel with the preset pixel value as the key point j. The starting point p can be any pixel within the K neighborhood of the center point i, the preset direction can be, for example, counterclockwise, and the preset pixel value can be 1. Please refer to Figure 5, which is a schematic diagram of a contour search process provided in an embodiment of the present application. As shown in Figure 5, the contour search is used to indicate the contour search in the eight-neighborhood. During the contour search process in the eight-neighborhood, pixel search is performed in a counterclockwise direction starting from the starting point p, that is, pixel search is performed in sequence: B5->B6->B7->B8->B1->B2->B3->B4; when the first pixel point (for example, pixel point B2) with a non-zero value (for example, 1) is detected, the pixel point B2 is used as the result of the current contour search (that is, the key point).
[0110] Similarly, a contour search is performed within the K neighborhood of the center point i+1 to obtain the key point j+1, which specifically includes the following process: obtaining the starting point q of the q+1th contour search; within the K neighborhood of the center point i+1, starting from the starting point q, performing pixel detection in a preset direction; when a pixel with a preset pixel value is detected, stopping the pixel detection of the K neighborhood of the center point i, and using the pixel with the preset pixel value as the key point j. It should be noted that the starting point q of the q+1th contour search refers to the center point of the qth contour search; and the specific process of the q+1th contour search can be referred to the specific process of the qth contour search, and the embodiments of this application will not be repeated here.
[0111] As can be seen from the above, in the embodiment of the present application, two contour searches (i.e., the qth contour search and the q+1th contour search) can be performed in parallel. Therefore, the present application can process two pixel points in parallel, thereby obtaining two key points. Therefore, the use of the contour parallel search method of the embodiment of the present application can improve the efficiency of the contour search, thereby improving the system performance. Furthermore, based on the relative position relationship indicated by the contour search algorithm and the position of the center point i+1, the position of the key point j+1 that can be obtained by the q+1th contour search can be calculated; then the key point j+1 can be determined as the center point i+2 of the q+2th contour search for the image; finally, based on the center point i, the center point i+1, and the center point i+2, the qth contour search, the q+1th contour search, and the q+2th contour search are performed in parallel on the image. By analogy, the center point of each contour search can be determined by the key point of the previous adjacent contour search. Based on the correlation between the two adjacent contour searches, the center point of each contour search in N contour searches can be determined in turn, and then N contour searches can be performed on the image in parallel based on the N center points to improve the efficiency of the contour search and enhance the system performance.
[0112] In an embodiment of the present application, an image to be processed is obtained, and a contour search algorithm corresponding to the image is obtained, the contour search algorithm is used to indicate: the relative positional relationship between the center point of the contour search and the key point, the key point being the result of the contour search; the center point i of the qth contour search of the image can also be obtained, and based on the relative positional relationship indicated by the contour search algorithm and the position of the center point i, the position of the key point j that can be obtained by the qth contour search is calculated, where q is a positive integer; the key point j is determined as the center point i+1 of the q+1th contour search of the image; based on the center point i and the center point i+1, the qth contour search and the q+1th contour search are performed on the image in parallel. It can be seen that the present application can calculate the center point of the next contour search based on the center point of the previous contour search based on the relative positional relationship between the center point indicated by the contour search algorithm and the contour search result (i.e., the key point), then based on the center points of the two adjacent contour searches determined, the contour of the image can be searched in parallel, thereby improving the efficiency of the contour search of the image.
[0113] Based on the embodiment of Figure 3, the center point of the q+1th contour search can be determined by the center point of the qth contour search, the center point of the q+2th contour search can be determined by the center point of the q+1th contour search, and so on. The present application can process N contour search processes in parallel. Below, taking any two contour searches (the qth contour search and the q+1th contour search) in the N contour searches as an example, the eight-neighborhood constructed with the result of the qth contour search (key point j) and the center point i of the qth contour search is used as an extension of the second search, and the specific process of executing the qth contour search and the q+1th contour search in parallel is described in detail.
[0114] The following table introduces the relevant coordinates involved in the contour search and their meanings.
[0115] Table 3. Coordinate numbers and meanings
[0116] Where (i2, j2) can be any pixel point or a specified pixel point in the image. Combined with Table 3 above, the specific execution process of the contour parallel search algorithm includes the following steps 1-4:
[0117] Step 1: Use the coordinates (i3, j3) as the center point of the eight-neighborhood, and the next pixel counterclockwise from the coordinates (i2, j2) as the starting point, recorded as (i2_next, j2_next). The coordinates (i3, j3) correspond to the center point i of the qth contour search.
[0118] Step 2: Starting from (i2_next, j2_next), search the eight-neighborhood of (i3, j3) in a counterclockwise direction until the first pixel with a non-zero value (such as 1) is found, recorded as coordinates (i4, j4), and the pixel corresponding to (i4, j4) is used as the result of the q-th contour search (x1, y1).
[0119] Step 3: Use the coordinate (i4, j4) as the center point of the eight-neighborhood, and the next pixel point in the counterclockwise direction of the coordinate (i3, j3) in step 1 as the starting point, recorded as (i2_next, j2_next).
[0120] Step 4: Starting from (i2_next, j2_next), search the eight-neighborhood of (i4, j4) in a counterclockwise direction until the first pixel with a non-zero value (such as 1) is found, and refresh the assigned coordinates (i4, j4). The pixel corresponding to the refreshed (i4, j4) is used as the result (x2, y2) of the q+1th contour search.
[0121] It should be understood that the above steps 1-2 are the process of the qth contour search, and steps 3-4 are the process of the q+1th contour search; in an embodiment of the present application, the above steps 1-2 and steps 3-4 are executed in parallel, that is, the present application can realize the parallel execution of contour search.
[0122] The specific process of parallel contour search is described below with reference to the accompanying drawings. It should be noted that the coordinate expressions of each pixel point in the following eight cases can all be expressed by referring to the coordinate axis establishment method shown in FIG6a, where the x-axis is the vertical axis and the y-axis is the horizontal axis.
[0123] Case 1: The key point j obtained by the qth contour search is located in the upper right position of the center point i.
[0124] Please refer to Figure 6a, which is a schematic diagram of a parallel contour search provided by an embodiment of the present application. As shown in Figure 6a, in this case, the eight neighborhoods of the center point i are determined based on the center point i of the qth contour search, and the eight neighborhoods of the center point i+1 are determined based on the center point i+1 of the q+1th contour search; then a parallel search is performed in the eight neighborhoods of the center point i and the eight neighborhoods of the center point i+1. Among them, the starting point (i2, j2) of the eight-neighborhood search of the center point i can be a specified starting point such as (3, 2). According to the coordinate axis establishment method shown in Figure 6a, the coordinates of the center point i can be expressed as (3, 3), and the center point i+1 is (2, 4). Starting from the starting point (3, 2) in the eight neighborhoods of the center point i (3, 3), each pixel point is detected in turn in a counterclockwise direction. If a pixel point that meets the preset pixel value (such as 1) is detected, the current pixel point is used as the key point j of the qth contour search, for example For example, if the key point j is (2, 4), that is, the center point i+1; similarly, the starting point (i2, j2) of the eight-neighborhood search of the center point i+1 can be the center point i(3, 3) of the q-th contour search. Starting from the starting point (3, 3) in the eight-neighborhood of the center point i+1 (2, 4), each pixel point is detected in a counterclockwise direction. If a pixel point that meets the preset pixel value (such as 1) is detected, the current pixel point is used as the key point j+1 of the q+1-th contour search. For example, the key point j+1 is (1, 5).
[0125] Case 2: The key point j obtained by the qth contour search is located above the center point i.
[0126] Please refer to Figure 6b, which is a schematic diagram of another parallel contour search provided by an embodiment of the present application. As shown in Figure 6b, in this case, the eight neighborhoods of center point i are determined based on center point i in the qth contour search, and the eight neighborhoods of center point i+1 are determined based on center point i+1 in the q+1th contour search; then, parallel searches are performed in the eight neighborhoods of center point i and the eight neighborhoods of center point i+1. Among them, the starting point (i2, j2) of the eight-neighborhood search of the center point i can be a specified starting point, for example (3, 2), then the center point i is (3, 3), and the center point i+1 is (2, 3). Starting from the starting point (3, 2) in the eight-neighborhood of the center point i (3, 3), each pixel point is detected in a counterclockwise direction. If a pixel point that meets the preset pixel value (such as 1) is detected, the current pixel point is used as the key point j of the q-th contour search, for example, the key point can be (2, 3); similarly, starting from the starting point (3, 3) in the eight-neighborhood of the center point i+1 (2, 3), each pixel point is detected in a counterclockwise direction, and the key point j+1 of the q+1-th search can be (1, 4).
[0127] Case 3: The key point j obtained by the qth contour search is located in the upper left position of the center point i.
[0128] Please refer to Figure 6c, which is a schematic diagram of another contour parallel search provided by an embodiment of the present application. As shown in Figure 6c, in this case, the eight neighborhoods of center point i are determined based on the center point i of the qth contour search, and the eight neighborhoods of center point i+1 are determined based on the center point i+1 of the q+1th contour search; then parallel searches are performed in the eight neighborhoods of center point i and the eight neighborhoods of center point i+1. Among them, center point i can be (3, 3) and center point i+1 can be (2, 2), and then contour searches are performed in the eight neighborhoods of center point i (3, 3) and the eight neighborhoods of center point i+1 (2, 2), respectively, so that key point j and key point j+1 can be obtained.
[0129] Case 4: The key point j obtained by the qth contour search is located to the left of the center point i.
[0130] Please refer to Figure 6d, which is a schematic diagram of another contour parallel search provided by an embodiment of the present application. As shown in Figure 6d, in this case, the eight neighborhoods of center point i are determined based on the center point i of the qth contour search, and the eight neighborhoods of center point i+1 are determined based on the center point i+1 of the q+1th contour search; then parallel searches are performed in the eight neighborhoods of center point i and the eight neighborhoods of center point i+1. Among them, center point i can be (3, 3), and center point i+1 can be (3, 2), and then contour searches are performed in the eight neighborhoods of center point i (3, 3) and the eight neighborhoods of center point i+1 (3, 2), respectively, so that key point j and key point j+1 can be obtained.
[0131] Case 5: The key point j obtained by the qth contour search is located at the lower left position of the center point i.
[0132] Please refer to Figure 6e, which is a schematic diagram of another contour parallel search provided by an embodiment of the present application. As shown in Figure 6e, in this case, the eight neighborhoods of center point i are determined based on the center point i of the qth contour search, and the eight neighborhoods of center point i+1 are determined based on the center point i+1 of the q+1th contour search; then parallel searches are performed in the eight neighborhoods of center point i and the eight neighborhoods of center point i+1. Among them, center point i can be (3, 3) and center point i+1 can be (4, 2), and then contour searches are performed in the eight neighborhoods of center point i (3, 3) and the eight neighborhoods of center point i+1 (4, 2), respectively, so that key point j and key point j+1 can be obtained.
[0133] Case 6: The key point j obtained by the qth contour search is located below the center point i.
[0134] Please refer to Figure 6f, which is a schematic diagram of another contour parallel search provided by an embodiment of the present application. As shown in Figure 6f, in this case, the eight neighborhoods of center point i are determined based on the center point i of the qth contour search, and the eight neighborhoods of center point i+1 are determined based on the center point i+1 of the q+1th contour search; then parallel searches are performed in the eight neighborhoods of center point i and the eight neighborhoods of center point i+1. Among them, center point i can be (3, 3) and center point i+1 can be (4, 3), and then contour searches are performed in the eight neighborhoods of center point i (3, 3) and the eight neighborhoods of center point i+1 (4, 3), respectively, so that key point j and key point j+1 can be obtained.
[0135] Case 7: The key point j obtained by the qth contour search is located at the lower right position of the center point i.
[0136] Please refer to Figure 6g, which is a schematic diagram of another contour parallel search provided by an embodiment of the present application. As shown in Figure 6g, in this case, the eight neighborhoods of center point i are determined based on the center point i of the qth contour search, and the eight neighborhoods of center point i+1 are determined based on the center point i+1 of the q+1th contour search; then parallel searches are performed in the eight neighborhoods of center point i and the eight neighborhoods of center point i+1. Among them, center point i can be (3, 3) and center point i+1 can be (4, 4), and then contour searches are performed in the eight neighborhoods of center point i (3, 3) and in the eight neighborhoods of center point i+1 (4, 4), respectively, so that key point j and key point j+1 can be obtained.
[0137] Case 8: The key point j obtained by the qth contour search is located to the right of the center point i.
[0138] Please refer to Figure 6h, which is a schematic diagram of another contour parallel search provided by an embodiment of the present application. As shown in Figure 6h, in this case, the eight neighborhoods of center point i are determined based on the center point i of the qth contour search, and the eight neighborhoods of center point i+1 are determined based on the center point i+1 of the q+1th contour search; then parallel searches are performed in the eight neighborhoods of center point i and the eight neighborhoods of center point i+1. Among them, center point i can be (3, 3), and center point i+1 can be (3, 4), and then contour searches are performed in the eight neighborhoods of center point i (3, 3) and in the eight neighborhoods of center point i+1 (3, 4), respectively, so that key point j and key point j+1 can be obtained.
[0139] In one possible implementation, the image processing solution provided by the embodiments of the present application is applicable to various OCR recognition scenarios, such as license plate recognition, text recognition, subtitle recognition, moving object recognition, and region of interest recognition. Specifically, the above recognition scenarios may include: obtaining key point j obtained from the qth contour search and key point j+1 obtained from the q+1th contour search; and determining a target object from the image based on key point j and key point j+1. The target object includes at least one of the following: a license plate, text, subtitles, a moving object, or a region of interest. Specifically, determining the target object from the image based on the key points obtained from the contour search may include the following methods: Method 1: directly combining the key points into a target object; Method 2: performing contour connection processing on the key points to generate a contour region, and representing this contour region as the target object. For example, if the target object is a license plate, the key points obtained from the contour search can be directly contour-connected to obtain the license plate. For example, if N key points are obtained from the image through contour search, these N key points can be directly contour-connected. The region formed by the contour connection can be used to identify the region in the image where the license plate is located. If the target object is text, the key points obtained by contour search can be directly combined into text. For example, if contour search of an image yields N key points, each corresponding to a character, then combining these N characters will yield text. This is explained in detail below using the license plate recognition scenario as an example.
[0140] In the field of smart transportation, the license plates of vehicles can be identified and processed, wherein the vehicles here include: vehicles traveling on the road, vehicles parked in garages, vehicles parked on the roadside, etc. Please refer to Figure 7, which is a schematic diagram of a license plate recognition scenario provided by an embodiment of the present application. As shown in Figure 7, taking a vehicle S701 traveling on the road as an example, ① first, the vehicle traveling on the road is collected by a collection device on the road (such as a road test unit S702) to obtain an image to be processed, and the image to be processed contains a license plate. ② Then, based on the image processing method provided by an embodiment of the present application, N contour searches can be performed in parallel on the image containing the license plate to obtain N key points. ③ Finally, the license plate is determined from the image based on the N key points, for example, the N key points are combined into a license plate, or the area formed by the N key points is determined as the area where the license plate is located, thereby identifying the license plate from the current image. ④ Subsequently, the current vehicle can be processed based on the recognized license plate, such as detecting the current vehicle's driving speed, detecting the current vehicle's driving area, counting the traffic volume on the current road, and so on.
[0141] In an embodiment of the present application, after determining the center point of any two contour searches, any two contour searches are allowed to be performed in parallel, thereby enabling two key points to be searched in parallel, improving the efficiency of the contour search and thereby enhancing system performance. Furthermore, by expanding upon the concept of a parallel contour search algorithm, the present application can also be extended to perform N contour searches in parallel on an image. In practical application scenarios, this can greatly improve the efficiency of the contour search and the overall performance of the system.
[0142] Next, the image processing device provided in the embodiment of the present application is described.
[0143] Please refer to Figure 8, which is a schematic diagram of the structure of an image processing device provided in an embodiment of the present application. As shown in Figure 8, the image processing device 800 can be applied to the computer device (such as a terminal device or a server) mentioned in the aforementioned embodiment. Specifically, the image processing device 800 can be a computer program (including program code) running in a computer device, for example, the image processing device 800 is an application software; the image processing device 800 can be used to execute the corresponding steps in the image processing method provided in an embodiment of the present application. In specific implementation, the image processing device 800 can specifically include:
[0144] An acquisition unit 801 is configured to acquire an image to be processed and obtain a contour search algorithm corresponding to the image. The contour search algorithm indicates the relative positional relationship between a center point of the contour search and a key point. The key point refers to the result of the contour search.
[0145] Processing unit 802 is configured to obtain a center point i of the qth contour search performed on the image, and calculate the position of a key point j that can be obtained by the qth contour search based on the relative position relationship indicated by the contour search algorithm and the position of the center point i, where q is a positive integer;
[0146] The processing unit 802 is further configured to determine the key point j as the center point i+1 of the q+1th contour search on the image;
[0147] The processing unit 802 is further configured to perform a qth contour search and a q+1th contour search on the image in parallel based on the center point i and the center point i+1.
[0148] In one possible implementation, the qth contour search and the q+1th contour search refer to any two contour searches among N contour searches performed in parallel on the image, where N is determined based on the scenario requirements of the business scenario to which the image belongs, and N is a positive integer; the processing unit 802 is further configured to perform the following operations:
[0149] Based on the relative position relationship indicated by the contour search algorithm and the position of the center point i+1, the position of the key point j+1 that can be obtained by the q+1th contour search is calculated;
[0150] Determine the key point j+1 as the center point i+2 of the q+2th contour search of the image;
[0151] Based on the center point i, the center point i+1, and the center point i+2, a qth contour search, a q+1th contour search, and a q+2th contour search are performed on the image in parallel.
[0152] In one possible implementation, the contour search algorithm is used to instruct a contour search based on a K-neighborhood, where the K-neighborhood includes a center point for contour search and K pixels to be searched, and any pixel is located in a direction of the center point of the K-neighborhood; wherein the relative position relationship indicated by the contour search algorithm includes K types of relative position relationships, where K is a positive integer; and the processing unit 802 is further used to perform the following operations:
[0153] In the K neighborhood, the relative position relationship between the center point of the contour search and each pixel in the K pixels is encoded according to the preset encoding rules to obtain the encoding result;
[0154] The encoding result includes K sub-encoding results, and one sub-encoding result corresponds to one type of relative position relationship.
[0155] In one possible implementation, the processing unit 802 calculates the position of the key point j obtained by the qth contour search based on the relative position relationship indicated by the contour search algorithm and the position of the center point i, and performs the following operations:
[0156] Based on the relative position relationship indicated by the contour search algorithm and the position of the center point i, a matching sub-encoding result is determined from the encoding result;
[0157] Based on the relative position relationship reflected by the matched sub-coding results and the position of the center point i, the position of the key point j that can be obtained by the q-th contour search is obtained.
[0158] In a possible implementation, the processing unit 802 performs the qth contour search and the q+1th contour search on the image in parallel based on the center point i and the center point i+1, and is configured to perform the following operations:
[0159] Based on the center point i, determine the K neighborhood of the center point i from the image, and perform contour search in the K neighborhood of the center point i to obtain the key point j; and,
[0160] Based on the center point i+1, the K neighborhood of the center point i+1 is determined from the image, and a contour search is performed within the K neighborhood of the center point i+1 to obtain the key point j+1.
[0161] In one possible implementation, the processing unit 802 performs a contour search in a K-neighborhood of the center point i to obtain a key point j, which is used to perform the following operations:
[0162] Get the starting point p of the qth contour search;
[0163] In the K neighborhood of the center point i, pixel detection is performed starting from the starting point p along the preset direction;
[0164] When a pixel point with a preset pixel value is detected, the pixel point detection of the K neighborhood of the center point i is stopped, and the pixel point with the preset pixel value is used as the key point j.
[0165] In a possible implementation, the processing unit 802 is further configured to perform the following operations:
[0166] Get the key point j obtained by the qth contour search and the key point j+1 obtained by the q+1th contour search;
[0167] Based on key point j and key point j+1, a target object is determined from the image, where the target object includes at least one of the following: a license plate, text, subtitles, a moving object, and a region of interest.
[0168] In a possible implementation, the above-mentioned image processing method is executed by calling an integrated chip, which includes: a data input bus interface unit, a contour parallel search engine, and a data output bus interface unit; wherein,
[0169] A data input bus interface unit, used for receiving images to be processed;
[0170] A contour parallel search engine, configured to perform a qth contour search and a q+1th contour search in parallel on the image to be processed;
[0171] The data output bus interface unit is used to output the key point data of the key point j obtained by the qth contour search and the key point data of the key point j+1 obtained by the q+1th contour search.
[0172] In a possible implementation, the processing unit 802 is further configured to perform the following operations:
[0173] Calling a contour parallel search engine to preprocess the image to be processed to obtain a preprocessed image, wherein the preprocessing includes: any one or more of binarization processing, image enhancement processing, and image segmentation;
[0174] Perform contour parallel search on the preprocessed image to obtain multiple key points;
[0175] Each key point is subjected to data post-processing respectively to obtain key point data of each key point after data post-processing.
[0176] In an embodiment of the present application, based on the relative positional relationship between the center point indicated by the contour search algorithm and the contour search result (i.e., the key point), the center point of the next contour search can be calculated based on the center point of the previous contour search. Then, based on the center points of the two adjacent contour searches determined, parallel search of the image contour can be achieved, thereby improving the efficiency of contour search of the image.
[0177] Please refer to Figure 9, which is a structural diagram of a computer device provided in an embodiment of the present application. The computer device 900 is configured with an integrated chip for executing the image processing method in the aforementioned method embodiment. The computer device 900 includes: one or more processors 901; one or more input devices 902, one or more output devices 903 and a memory 904. The above-mentioned processors 901, input devices 902, output devices 903 and memory 904 are connected via a bus 905. Specifically, the memory 904 is used to store a computer program, and the computer program includes program instructions. The processor 901 is used to call the program instructions stored in the memory 904 to perform the following operations:
[0178] Obtaining an image to be processed and a contour search algorithm corresponding to the image, wherein the contour search algorithm is used to indicate: a relative positional relationship between a center point of the contour search and a key point, where the key point refers to a result of the contour search;
[0179] Obtain the center point i of the qth contour search of the image, and calculate the position of the key point j that can be obtained by the qth contour search based on the relative position relationship indicated by the contour search algorithm and the position of the center point i, where q is a positive integer;
[0180] Determine the key point j as the center point i+1 of the q+1th contour search of the image;
[0181] Based on the center point i and the center point i+1, the qth contour search and the q+1th contour search are performed on the image in parallel.
[0182] In one possible implementation, the qth contour search and the q+1th contour search refer to any two contour searches among N contour searches performed in parallel on the image, where N is determined based on the scenario requirements of the business scenario to which the image belongs, and N is a positive integer; the processor 901 is further configured to perform the following operations:
[0183] Based on the relative position relationship indicated by the contour search algorithm and the position of the center point i+1, the position of the key point j+1 that can be obtained by the q+1th contour search is calculated;
[0184] Determine the key point j+1 as the center point i+2 of the q+2th contour search of the image;
[0185] Based on the center point i, the center point i+1, and the center point i+2, a qth contour search, a q+1th contour search, and a q+2th contour search are performed on the image in parallel.
[0186] In one possible implementation, a contour search algorithm is used to instruct a contour search based on a K-neighborhood, where the K-neighborhood includes a center point for contour search and K pixels to be searched, and any pixel is located in a direction of the center point of the K-neighborhood; wherein the relative position relationship indicated by the contour search algorithm includes K types of relative position relationships, where K is a positive integer; and the processor 901 is further used to perform the following operations:
[0187] In the K neighborhood, the relative position relationship between the center point of the contour search and each pixel in the K pixels is encoded according to the preset encoding rules to obtain the encoding result;
[0188] The encoding result includes K sub-encoding results, and one sub-encoding result corresponds to one type of relative position relationship.
[0189] In one possible implementation, the processor 901 calculates the position of the key point j obtained by the qth contour search based on the relative position relationship indicated by the contour search algorithm and the position of the center point i, and performs the following operations:
[0190] Based on the relative position relationship indicated by the contour search algorithm and the position of the center point i, a matching sub-encoding result is determined from the encoding result;
[0191] Based on the relative position relationship reflected by the matched sub-coding results and the position of the center point i, the position of the key point j that can be obtained by the q-th contour search is obtained.
[0192] In one possible implementation, the processor 901 performs the qth contour search and the q+1th contour search on the image in parallel based on the center point i and the center point i+1, and is configured to perform the following operations:
[0193] Based on the center point i, determine the K neighborhood of the center point i from the image, and perform contour search in the K neighborhood of the center point i to obtain the key point j; and,
[0194] Based on the center point i+1, the K neighborhood of the center point i+1 is determined from the image, and a contour search is performed within the K neighborhood of the center point i+1 to obtain the key point j+1.
[0195] In one possible implementation, the processor 901 performs a contour search in a K-neighborhood of the center point i to obtain a key point j, which is used to perform the following operations:
[0196] Get the starting point p of the qth contour search;
[0197] In the K neighborhood of the center point i, pixel detection is performed starting from the starting point p along the preset direction;
[0198] When a pixel point with a preset pixel value is detected, the pixel point detection of the K neighborhood of the center point i is stopped, and the pixel point with the preset pixel value is used as the key point j.
[0199] In a possible implementation, the processor 901 is further configured to perform the following operations:
[0200] Get the key point j obtained by the qth contour search and the key point j+1 obtained by the q+1th contour search;
[0201] Based on key point j and key point j+1, a target object is determined from the image, where the target object includes at least one of the following: a license plate, text, subtitles, a moving object, and a region of interest.
[0202] In a possible implementation, the above-mentioned image processing method is executed by calling an integrated chip, which includes: a data input bus interface unit, a contour parallel search engine, and a data output bus interface unit; wherein,
[0203] A data input bus interface unit, used for receiving images to be processed;
[0204] A contour parallel search engine, configured to perform a qth contour search and a q+1th contour search in parallel on the image to be processed;
[0205] The data output bus interface unit is used to output the key point data of the key point j obtained by the qth contour search and the key point data of the key point j+1 obtained by the q+1th contour search.
[0206] In a possible implementation, the processor 901 is further configured to perform the following operations:
[0207] Calling a contour parallel search engine to preprocess the image to be processed to obtain a preprocessed image, wherein the preprocessing includes: any one or more of binarization processing, image enhancement processing, and image segmentation;
[0208] Perform contour parallel search on the preprocessed image to obtain multiple key points;
[0209] Each key point is subjected to data post-processing respectively to obtain key point data of each key point after data post-processing.
[0210] In an embodiment of the present application, based on the relative positional relationship between the center point indicated by the contour search algorithm and the contour search result (i.e., the key point), the center point of the next contour search can be calculated based on the center point of the previous contour search. Then, based on the center points of the two adjacent contour searches determined, parallel search of the image contour can be achieved, thereby improving the efficiency of contour search of the image.
[0211] According to one aspect of the present application, an embodiment of the present application further provides a computer storage medium, and a computer program is stored in the computer storage medium, and the computer program includes program instructions. When the processor executes the above program instructions, it can execute the method in the corresponding embodiment described above, so it will not be described in detail here. For technical details not disclosed in the computer storage medium embodiment involved in this application, please refer to the description of the method embodiment of the present application. As an example, the program instructions can be deployed on a computer device, or executed on multiple computer devices located in one place, or, executed on multiple computer devices distributed in multiple locations and interconnected by a communication network.
[0212] According to one aspect of the present application, embodiments of the present application further provide a computer program product or computer program, which includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, so that the computer device can perform the methods described in the corresponding embodiments above. Therefore, these methods will not be described in detail here.
[0213] Those skilled in the art will appreciate that the units and algorithmic steps of each example described in conjunction with the embodiments disclosed in this application can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional technical personnel may use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0214] In the above embodiments, all or part of the embodiments can be implemented by software, hardware, firmware, or any combination thereof. When implemented using software, all or part of the embodiments can be implemented in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of the present invention are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted via a computer-readable storage medium. The computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via a wired (e.g., coaxial cable, optical fiber, digital line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) method. The computer-readable storage medium can be any available medium that can be accessed by a computer or a data processing device such as a server or data center that includes one or more available media. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state drive (SSD)).
[0215] The above disclosure is only a preferred embodiment of the present application, and certainly cannot be used to limit the scope of rights of the present application. Therefore, equivalent changes made according to the claims of the present application are still within the scope covered by the present application.
Claims
1. An image processing method, characterized in that: include: Acquire an image to be processed, and acquire a contour search algorithm corresponding to the image, wherein the contour search algorithm is used to indicate: a relative position relationship between a center point of the contour search and a key point, wherein the key point refers to a result of the contour search; Obtaining a center point i of the qth contour search of the image, and calculating the position of a key point j that can be obtained by the qth contour search based on the relative position relationship indicated by the contour search algorithm and the position of the center point i, where q is a positive integer; Determine the key point j as the center point i+1 of the q+1th contour search of the image; Based on the center point i and the center point i+1, the qth contour search and the q+1th contour search are performed on the image in parallel.
2. The method according to claim 1, characterized in that The qth contour search and the q+1th contour search refer to any two contour searches among the N contour searches performed in parallel on the image, where N is determined based on the scenario requirements of the business scenario to which the image belongs, and N is a positive integer; the method further includes: Based on the relative position relationship indicated by the contour search algorithm and the position of the center point i+1, the position of the key point j+1 that can be obtained by the q+1th contour search is calculated; Determine the key point j+1 as the center point i+2 of the q+2th contour search of the image; Based on the center point i, the center point i+1, and the center point i+2, a qth contour search, a q+1th contour search, and a q+2th contour search are performed on the image in parallel.
3. The method according to claim 1 or 2, characterized in that The contour search algorithm is used to indicate that a contour search is performed based on a K neighborhood, wherein the K neighborhood includes a center point for contour search and K pixels to be searched, and any pixel point is located in a direction of the center point of the K neighborhood; wherein the relative position relationship indicated by the contour search algorithm includes K types of relative position relationships, and K is a positive integer; and the method further includes: In the K neighborhood, encoding the relative position relationship between the center point of the contour search and each pixel point in the K pixels according to a preset encoding rule to obtain an encoding result; The encoding result includes K sub-encoding results, and one sub-encoding result corresponds to one type of relative position relationship.
4. The method according to any one of claims 1 to 3, characterized in that: The step of calculating the position of the key point j obtained by the qth contour search based on the relative position relationship indicated by the contour search algorithm and the position of the center point i comprises: Based on the relative position relationship indicated by the contour search algorithm and the position of the center point i, determining a matching sub-encoding result from the encoding result; Based on the relative position relationship reflected by the matched sub-coding results and the position of the center point i, the position of the key point j that can be obtained by the q-th contour search is obtained.
5. The method according to any one of claims 1 to 4, characterized in that: The step of performing the qth contour search and the q+1th contour search on the image in parallel based on the center point i and the center point i+1 comprises: Based on the center point i, determine the K neighborhood of the center point i from the image, and perform contour search in the K neighborhood of the center point i to obtain a key point j; and, Based on the center point i+1, a K neighborhood of the center point i+1 is determined from the image, and a contour search is performed within the K neighborhood of the center point i+1 to obtain a key point j+1.
6. The method according to any one of claims 1 to 5, characterized in that: The contour search is performed in the K neighborhood of the center point i to obtain the key point j, including: Get the starting point p of the qth contour search; In the K neighborhood of the center point i, pixel detection is performed starting from the starting point p in a preset direction; When a pixel point with a preset pixel value is detected, the detection of the pixel points in the K neighborhood of the center point i is stopped, and the pixel point with the preset pixel value is used as the key point j.
7. The method according to any one of claims 1 to 6, characterized in that: The method further comprises: Obtaining the key point j obtained by the qth contour search, and obtaining the key point j+1 obtained by the q+1th contour search; Based on the key point j and the key point j+1, a target object is determined from the image.
8. The method according to any one of claims 1 to 7, characterized in that: The image processing method is executed by calling an integrated chip, wherein the integrated chip includes: a data input bus interface unit, a contour parallel search engine, and a data output bus interface unit; wherein, The data input bus interface unit is used to receive the image to be processed; The contour parallel search engine is used to perform the qth contour search and the q+1th contour search in parallel on the image to be processed; The data output bus interface unit is used to output the key point data of the key point j obtained by the qth contour search and the key point data of the key point j+1 obtained by the q+1th contour search.
9. The method according to any one of claims 1 to 8, characterized in that The method further comprises: Calling the contour parallel search engine to preprocess the image to be processed to obtain a preprocessed image, wherein the preprocessing includes: any one or more of binarization processing, image enhancement processing, and image segmentation; Performing a parallel contour search on the preprocessed image to obtain a plurality of key points; Perform data post-processing on each key point respectively to obtain key point data of each key point after data post-processing.
10. An image processing device, characterized in that: include: An acquisition unit, used to acquire an image to be processed and acquire a contour search algorithm corresponding to the image, wherein the contour search algorithm is used to indicate: a relative position relationship between a center point of the contour search and a key point, wherein the key point refers to a result of the contour search; a processing unit, configured to obtain a center point i of the qth contour search performed on the image, and calculate a position of a key point j that can be obtained by the qth contour search based on the relative position relationship indicated by the contour search algorithm and the position of the center point i, where q is a positive integer; The processing unit is further used to determine the key point j as the center point i+1 of the q+1th contour search for the image; The processing unit is further configured to perform the qth contour search and the q+1th contour search on the image in parallel based on the center point i and the center point i+1.
11. An integrated chip, characterized in that: The integrated chip includes a data input bus interface unit, a contour parallel search engine, and a data output bus interface unit; wherein, The integrated chip schedules the contour parallel search engine to execute the image processing method according to any one of claims 1-9.
12. A computer device, characterized in that: processors, input devices, output devices, and memory; The memory stores a computer program; When the computer program is executed by the processor, the image processing method according to any one of claims 1 to 9 is performed.
13. A computer-readable storage medium, characterized in that: The computer storage medium stores a computer program, and when the computer program is executed by a processor, the image processing method according to any one of claims 1 to 9 is executed.
14. A computer program product, characterized in that The computer program product comprises a computer program, and when the computer program is executed by a processor, the image processing method according to any one of claims 1 to 9 is executed.
Citation Information
Patent Citations
Method for detecting and extracting chromosome contour based on directional searching
CN101414358A
Method for extracting gesture contour in augmented reality system
CN106326872A
Object contour detection method, device and equipment and storage medium
CN112085755A
Image contour searching method and device, server and medium
CN112733868A
Image processing method and related equipment
CN117314944A