Image processing method, device, chip, equipment and storage medium
By calling the binarization engine and the contour search engine in parallel, the connected domains in the image are binarized and contour search is performed, which solves the problem of inefficient image contour search in the prior art, and achieves a fast and real-time contour search effect.
Patent Information
- Application Number
- CN202311285133.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-28
- Publication Date
- 2025-05-13
- Estimated Expiration
- 2043-09-28
AI Technical Summary
The prior art is inefficient in image contour search process, resulting in limited business performance, especially in real-time applications such as fast detection of pedestrians.
By obtaining N connected domains and their attribute information in the image, M binarization engines and Q contour search engines are dynamically generated, and these engines are called in parallel to perform binary processing and contour search on the image.
It realizes fast image contour search, improves contour search efficiency, and can detect pedestrians and other targets in real-time applications in time.
Smart Images

Figure CN117314942B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to fields such as Internet technologies, and in particular to an image processing method, apparatus, chip, device and storage medium. Background Art
[0002] With the development of image technology, image contour search algorithms are commonly used algorithms in computer vision, pattern recognition, and image analysis and processing. They are widely used in character segmentation and extraction in OCR recognition (license plate recognition, text recognition, subtitle recognition, etc.), motion foreground segmentation and extraction in visual detection (pedestrian intrusion detection, abandoned object detection, vision-based vehicle detection, etc.), medical image processing (interest target region extraction), etc. However, in the current image contour search process, it takes a long time to search the image contour in order to obtain the contour in the image, resulting in limited business performance. For example, in the process of detecting pedestrians on the road, if the pedestrian's contour is not searched in time, this may cause a traffic accident. Based on this, how to quickly search the image contour is a problem that needs to be solved urgently. Summary of the invention
[0003] The embodiments of the present application provide an image processing method, apparatus, device and storage medium, which can quickly perform contour search on an image and improve the efficiency of contour search.
[0004] An embodiment of the present application provides an image processing method, including:
[0005] Obtaining N connected domains in the image to be processed and attribute information of the N connected domains; N is a positive integer;
[0006] Generate binarization strategies corresponding to M binarization engines respectively according to the attribute information; M is a positive integer less than or equal to N;
[0007] The M binarization engines are called in parallel to perform binarization processing on the images respectively according to their corresponding binarization strategies to obtain M binarized images;
[0008] Q contour search engines are called in parallel to perform contour searches on the N connected domains in the M binary images; Q is a positive integer less than or equal to N.
[0009] An embodiment of the present application provides an image processing device, including:
[0010] An acquisition module, used to acquire N connected domains in the image to be processed and attribute information of the N connected domains; N is a positive integer;
[0011] A generating module, used for generating binarization strategies corresponding to M binarization engines respectively according to the attribute information; M is a positive integer less than or equal to N;
[0012] A first calling module is used to call the M binarization engines in parallel, and perform binarization processing on the images respectively according to their corresponding binarization strategies to obtain M binarized images;
[0013] The second calling module is used to call Q contour search engines in parallel to perform contour search on the N connected domains in the M binary images; Q is a positive integer less than or equal to N.
[0014] Optionally, the attribute information includes pixel label values corresponding to the N connected domains respectively and the number of connected domains in the image;
[0015] The generating module generates binarization strategies corresponding to M binarization engines respectively according to the attribute information, including:
[0016] Determining connected domains associated with the M binarization engines, respectively, according to the number of connected domains in the image and pixel label values corresponding to the N connected domains;
[0017] According to the pixel label values of the connected domain corresponding to the binarization engine i, a valid label value interval i corresponding to the binarization engine i is generated; the pixel label values of the connected domain corresponding to the binarization engine i belong to the valid label value interval; i is a positive integer less than or equal to M;
[0018] The valid label value interval i is determined as the binarization strategy of the binarization engine i, until the binarization strategies corresponding to the M binarization engines are respectively obtained.
[0019] Optionally, the generating module determines the connected domains respectively associated with the M binarization engines according to the number of connected domains in the image and the pixel label values respectively corresponding to the N connected domains, including:
[0020] Determining the number of connected domains to be associated with the M binarization engines respectively according to the number of connected domains in the image;
[0021] If the number of connected domains to be associated with the binary engine i is single, any connected domain that is not associated among the N connected domains is determined as the connected domain associated with the binary engine i;
[0022] If the number of connected domains to be associated with the binarization engine i is k, then k connected domains that are not associated and have continuous pixel label values among the N connected domains are determined as connected domains associated with the binarization engine i; k is an integer greater than 1 and less than N;
[0023] Until the connected domains respectively associated with the M binarization engines are obtained.
[0024] Optionally, the M binarization engines include a binarization engine i, and the binarization strategy corresponding to the binarization engine i includes a valid label value interval i, where i is a positive integer less than or equal to M;
[0025] The binarization engine i performs binarization processing on the image according to its corresponding binarization strategy, including:
[0026] Calling the binarization engine i, obtaining valid pixel points in the image whose pixel label values belong to the valid label value interval i, and binarizing the pixel values of the valid pixel points into valid values;
[0027] The binarization engine i is called to obtain invalid pixels in the image whose pixel label values do not belong to the valid label value interval i, and the pixel values of the invalid pixels are binarized into invalid values to obtain a binarized image i.
[0028] Optionally, the second calling module calls Q contour search engines in parallel to perform contour search on the N connected domains in the M binary images, including:
[0029] Invoke a task scheduling management engine to allocate connected domains to the Q contour search engines;
[0030] The Q contour search engines are called in parallel to perform contour searches on the connected domains corresponding to the M binary images.
[0031] Optionally, the second calling module calls the task scheduling management engine to allocate connected domains to the Q contour search engines, including:
[0032] If M is less than or equal to Q, the task scheduling management engine is called to count the number of connected areas whose pixel values in the M binary images are valid values as the valid number;
[0033] Calling the task scheduling management engine to obtain performance parameters corresponding to the Q profile search engines;
[0034] The task scheduling management engine is called to allocate connected domains to the Q contour search engines according to the performance parameters and the effective numbers respectively corresponding to the M binary images.
[0035] Optionally, the second calling module 714 calls the task scheduling management engine to allocate connected domains to the Q contour search engines according to the performance parameter and the effective numbers respectively corresponding to the M binary images, including:
[0036] Calling the task scheduling management engine to generate serial numbers corresponding to the Q profile search engines respectively according to the performance parameters;
[0037] Calling the task scheduling management engine to generate serial numbers corresponding to the M binary images respectively according to the valid quantities corresponding to the M binary images respectively;
[0038] Calling the task scheduling management engine, determining the binary image whose serial number matches the serial number of the contour search engine j among the M binary images as the binary image associated with the contour search engine j; j is less than or equal to Q;
[0039] The task scheduling management engine is called to assign the connected domains whose pixel values are valid values in the binary image associated with the contour search engine j to the contour search engine j until the Q contour search engines are all assigned connected domains.
[0040] Optionally, the second calling module calls the task scheduling management engine to allocate connected domains to the Q contour search engines, including:
[0041] If M is greater than Q, the task scheduling management engine is called to obtain the processing priorities corresponding to the N connected domains and the working states corresponding to the Q contour search engines;
[0042] Connected domains are allocated to the Q contour search engines according to the processing priorities and the working states.
[0043] Optionally, the second calling module calls the task scheduling management engine to obtain the processing priorities corresponding to the N connected domains, including:
[0044] Calling the task scheduling management engine to obtain the performance parameters corresponding to the M binarization engines respectively;
[0045] The processing priorities respectively corresponding to the N connected domains are determined according to the performance parameters respectively corresponding to the M binarization engines.
[0046] Optionally, the second calling module calls the task scheduling management engine to obtain the processing priorities corresponding to the N connected domains, including:
[0047] Calling the task scheduling management engine to obtain description information of the image;
[0048] The processing priorities respectively corresponding to the N connected domains are determined according to the description information of the image.
[0049] Optionally, the second calling module calls the task scheduling management engine to allocate connected domains to the Q contour search engines, including:
[0050] constructing an image processing task on the image;
[0051] The image processing task is split into N subtasks; one connected domain corresponds to one subtask;
[0052] The task scheduling management engine is called to allocate the N subtasks to the Q contour search engines.
[0053] Optionally, the second calling module calls the Q contour search engines in parallel, and performs contour search on each corresponding connected domain of the M binary images, including:
[0054] Calling the task scheduling management engine to send parallel execution instructions to the Q contour search engines;
[0055] The Q contour search engines are controlled by the parallel execution instructions to execute their respective assigned subtasks in parallel according to the M binary images.
[0056] Optionally, the N subtasks include a subtask a, and the subtask a corresponds to a connected domain A; the Q contour search engines include a contour search engine j; the subtask a is assigned to the contour search engine j, and a is a positive integer less than or equal to N;
[0057] The contour search engine j performs contour search processing on the connected domain A, including:
[0058] The contour search engine j obtains a binary image b in which the pixel values of the pixels in the connected area A are valid values from the M binary images; b is a positive integer less than or equal to M;
[0059] The contour search engine j performs contour search in the binary image b starting from the starting point according to the coordinates of the starting point of the connected domain A in the image, and obtains the boundary points of the connected domain A;
[0060] Based on the starting point and boundary points of the connected domain A, the contour of the connected domain A is determined.
[0061] On the one hand, an embodiment of the present application provides an integrated chip, the integrated chip includes a storage area and multiple engines; the storage area includes a memory and / or an on-chip cache; wherein,
[0062] The integrated chip schedules each of the engines to execute the method described above.
[0063] On one hand, an embodiment of the present application provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the above method when executing the computer program.
[0064] On one hand, an embodiment of the present application provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the steps of the above method are implemented.
[0065] On the one hand, an embodiment of the present application provides a computer program product, including a computer program, which implements the steps of the above method when executed by a processor.
[0066] In the present application, by obtaining N connected domains in the image to be processed, different connected domains correspond to different image areas in the image, that is, the N connected domains are independent of each other, and the contour search process for any connected domain does not need to rely on the contour search process (or search results) of other connected domains. Therefore, in the present application, M binarization engines and Q contour search engines can perform contour search on the connected domains in the image in parallel, so that the contour search on the image can be quickly realized and the contour search efficiency can be improved. In the specific implementation process, the computer device can dynamically generate the binarization strategies corresponding to the M binarization engines based on the attribute information of the N connected domains in the image, call the M binarization engines in parallel, and binarize the image based on the respective corresponding binarization strategies to obtain M binary images, improve the efficiency of the binarization processing of the image, and create necessary conditions for subsequent parallel contour search. By calling Q contour search engines in parallel, the contour search is performed on the N connected domains in the M binary images, so that the contour search efficiency can be improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0067] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0068] Figure 1a A schematic diagram of image contour search provided by the prior art;
[0069] Figure 1b It is a schematic diagram of an integrated chip provided by this application;
[0070] Figure 2 It is a flowchart of an image processing method provided by the present application;
[0071] Figure 3It is a flowchart of another image processing method provided by the present application;
[0072] Figure 4 It is a scene schematic diagram of an image processing method provided by this application;
[0073] Figure 5 It is a scene schematic diagram of an image processing method provided by this application;
[0074] Figure 6 It is a flowchart of another image processing method provided by the present application;
[0075] Figure 7 is a structural schematic diagram of an image processing device provided in an embodiment of the present application;
[0076] Figure 8 It is a structural diagram of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0077] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0078] In order to facilitate understanding, the terms involved in this application are first explained:
[0079] 1. Connected Domain
[0080] A connected domain, as the name implies, refers to a connected area. The so-called connectivity means that if two identical pixels (such as pixel A and pixel B) are adjacent, then the two pixels are considered to be connected. At the same time, if pixel A and pixel B are connected, and pixel B and pixel C are connected, then pixel A and pixel C are also considered to be connected. In an embodiment of the present application, a connected domain refers to an image area composed of pixels with the same pixel value and adjacent positions in the image. The connected domain in the image can be obtained by performing a connected domain analysis on the image. The so-called connected domain analysis refers to finding a connected domain in an image and marking the found connected domain, wherein the pixel label values (label) marked by the pixels belonging to the same connected domain are the same, and the pixel label values marked by the pixels of different connected domains are different, that is, each connected domain corresponds to a different pixel label value. At least one connected domain can be included in any image.
[0081] 2. Outline of Connected Domain
[0082] The contour of a connected domain is composed of the boundary points of the connected domain. In the process of searching the contour of a connected domain, the boundary points of the connected domain are actually obtained, and the contour of the connected domain is obtained based on the obtained boundary points.
[0083] 3. Artificial Intelligence (AI)
[0084] AI is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results. In other words, artificial intelligence is a comprehensive technology in computer science that attempts to understand the essence of intelligence and produce a new intelligent machine that can respond in a similar way to human intelligence. Artificial intelligence is to study the design principles and implementation methods of various intelligent machines so that machines have the functions of perception, reasoning and decision-making. Artificial intelligence technology is a comprehensive discipline that covers a wide range of fields, including both hardware-level technology and software-level technology. The basic technologies of artificial intelligence generally include sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, big data processing technology, pre-trained model technology, operation / interaction system, mechatronics, etc. Among them, the pre-trained model is also called a large model or a basic model. After fine-tuning, it can be widely used in downstream tasks in various major directions of artificial intelligence. Artificial intelligence software technology mainly includes computer vision technology, speech processing technology, natural language processing technology, and machine learning / deep learning.
[0085] Among them, computer vision technology (CV) in artificial intelligence software technology is a science that studies how to make machines "see". To put it more specifically, it refers to machine vision such as using cameras and computers to replace human eyes to identify and measure targets, and further perform graphic processing to make computer processing into images that are more suitable for human eye observation or transmission to instruments for detection. As a scientific discipline, computer vision studies related theories and technologies, and attempts to establish an artificial intelligence system that can obtain information from images or multidimensional data. Large model technology has brought important changes to the development of computer vision technology. Pre-trained models in the visual field such as swin-transformer, ViT, V-MOE, and MAE can be quickly and widely applied to downstream specific tasks after fine tuning. Computer vision technology usually includes image processing, image recognition, image semantic understanding, image retrieval, OCR, video processing, video semantic understanding, video content / behavior recognition, three-dimensional object reconstruction, 3D technology, virtual reality, augmented reality, simultaneous positioning and map construction, and other technologies, as well as common biometric recognition technologies such as face recognition and fingerprint recognition.
[0086] The embodiments of the present application relate to computer vision technology in AI. Schematically, after performing a contour search on a connected domain of an image, the contour of the connected domain can be extracted by computer vision technology, and objects included in the contour can be identified (such as OCR recognition).
[0087] At present, image contour search is mainly implemented based on raster scanning technology, such as Figure 1a A schematic diagram of image contour search provided by the prior art. Figure 1a In the figure, the image Z includes four contours. The contour search process for the image Z includes: scanning from left to right and from top to bottom by raster scanning technology, and first scanning to obtain the first contour in the image (i.e. Figure 1a The contour shown by the label 1 in the image), and then the second contour in the image is obtained by scanning based on the first contour (i.e. Figure 1a The contour shown by the label 2 in the figure), and then continue scanning based on the second contour to obtain the third contour (i.e. Figure 1a The fourth contour is obtained by scanning the third contour (i.e. Figure 1a As shown in the figure by the number 4 in FIG. 1 , it can be seen from the above that the process of searching the image contour by the raster scanning technology is a serial and interdependent process, and the efficiency of the contour search is relatively low.
[0088] Based on this, the present application proposes an image processing method, which obtains N connected domains in the image to be processed, and different connected domains correspond to different image areas in the image, that is, the N connected domains are independent of each other, and the contour search process for each connected domain does not need to rely on the contour search process of other connected domains. Therefore, in the present application, M binarization engines and Q contour search engines can perform contour searches on connected domains in the image in parallel, so that contour searches on the image can be quickly realized and the efficiency of contour searches can be improved.
[0089] In order to facilitate a clearer understanding of the present application, the integrated chip implementing the present application is first introduced, such as Figure 1b As shown, the integrated chip includes a task scheduling management engine, Y binarization engines, U contour search engines and a post-processing engine, the Y binarization engines are marked as binarization engine 1, binarization engine 2, ..., binarization engine Y, and the U contour search engines are marked as contour search engine 1, contour search engine 2, ..., contour search engine U. Y and U are both positive integers, Y can be greater than or equal to U, or, Y can be less than U.
[0090] Among them, the task scheduling management engine is used to schedule Y binarization engines and U contour search engines to perform tasks related to image processing. For example, the task scheduling management engine is used to schedule Y binarization engines to perform image binarization processing tasks, and the task scheduling management engine is used to schedule U contour search engines to perform contour search tasks.
[0091] Among them, the binarization engine is used to binarize the image, and the binarization process can convert the image into a binary image. In the present application, different binarization engines correspond to different binarization strategies, and each binarization engine can binarize the image based on the corresponding binarization strategy to obtain a binary image. The binarization strategy includes a valid label value interval, and the valid label value interval is determined according to the pixel value label of the connected domain associated with the corresponding binarization engine. The valid label value interval is used to instruct the binarization engine to binarize the pixel values of the pixel points of the connected domain to which it is associated as valid values, and to binarize the pixel values of the pixel points in other areas of the image as invalid values. Other areas include connected domains in the image that are not associated with the binarization engine, and areas in the image other than all connected domains. The valid value is different from the invalid value, such as the valid value can be 1, and the invalid value can be 0. Among them, the number of binarization engines can be flexibly set according to actual needs. For example, the number of binarization engines can be determined by one or more of the following: the contour search efficiency of the contour search engine, the number of contour search engines, the average number of connected domains, and the number of images to be processed received by the integrated chip per unit time; the average number of connected domains is determined based on the number of connected domains of multiple images, and the unit time can refer to 1 minute, one day, 1 month, etc.
[0092] Among them, the contour search engine is used to perform contour search processing on the connected domain in the image based on the binarized image. Schematically, the number of contour search engines can be U, and each contour search engine can perform contour search on different connected domains in the image in parallel, thereby realizing parallel contour search on the image. It should be pointed out that the value of U can be flexibly set according to actual needs, and the number of contour search engines can be determined according to one or more of the following: the binarization efficiency of the binarization engine, the number of binarization engines, the average number of connected domains, and the number of images to be processed received by the integrated chip per unit time.
[0093] The post-processing engine is used to filter, merge, sort, encapsulate, identify and process the contours searched by various contour search engines to obtain the target object in the image. The target object may include at least one of the following: license plate, text, subtitle, moving object, area of interest, etc.
[0094] It is understandable that the integrated chip can be deployed in a server or terminal. The server can be an independent physical server, or a server cluster or distributed system composed of at least two physical servers, or 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, Content Delivery Network (CDN), and big data and artificial intelligence platforms. The terminal can specifically refer to a vehicle-mounted terminal, a smart phone, a tablet computer, a laptop, a desktop computer, a smart speaker, a screen speaker, a smart watch, etc., but is not limited to this.
[0095] In practical applications, Figure 1b The integrated chip can be called by computer equipment to achieve Figure 2 The image processing method shown in the figure may include the following steps S11 to S15:
[0096] S11. Convert the image format; the computer device can obtain the image to be processed, and the image may include but is not limited to: static images, dynamic images, or video frame images included in any video. The number of images can be one or more, and the embodiment of the present application does not impose any restrictions on this. As an implementation method, the image to be processed can be acquired in real time by a camera component (such as a camera, an external camera device, etc.); as another implementation method, the image to be processed can be obtained from a pre-saved image resource or video resource. Further, according to the image format matching the integrated chip, the image is format converted to obtain an image after format conversion. The image format matching the integrated chip refers to the image format that the integrated chip can process. The image format may include but is not limited to: JPEG format, DDS format, PSD format, PDT format, WebP format, XMP format, GIF format, BMP format, SVG format, TIFF format, etc.
[0097] S12, adjusting the size of the image; the computer device can adjust the size of the image after the format conversion, that is, the computer device can scale the size of the image after the format conversion to obtain an image of a preset size, and the preset size can be determined according to the image processing performance of the integrated chip.
[0098] S13, marking the connected domain in the image; the computer device may use a connected domain marking algorithm to perform connected domain marking processing on the image obtained in step S12. In a specific implementation, a connected domain marking algorithm is used to determine the pixels in the image that have the same pixel points and are adjacent in position, and based on the pixels that have the same pixel points and are adjacent in position, a connected domain in the image is obtained. The connected domain marking algorithm here may include but is not limited to: a 4-adjacent algorithm and an 8-adjacent algorithm. Where 4 and 8 refer to directions; taking the 4-adjacent algorithm as an example, the 4-adjacent algorithm means: if there are white pixels in the adjacent upper, adjacent lower, adjacent right, and adjacent left directions (a total of 4 directions) of the target white pixel point X in the image, then determine that the white pixels corresponding to the adjacent upper, adjacent lower, adjacent right, and adjacent left directions are adjacent to the target white pixel point X, and mark the white pixels corresponding to the adjacent upper, adjacent lower, adjacent right, and adjacent left directions as the same pixel label value as the target white pixel point X. Continue to determine the white pixels adjacent to the white pixels corresponding to the adjacent white pixels above, so as to mark the white pixels adjacent to the white pixels corresponding to the adjacent white pixels above with the same pixel label value as the target white pixel X, and so on, the connected domain in the image is formed according to the pixels with the same pixel label value. Similar to the 4-neighbor algorithm, the 8-neighbor algorithm determines the connected domain by searching in the binary image whether there are white pixels in the diagonal directions (a total of 8 directions) of the target white pixel X, which will not be described in detail here.
[0099] It should be noted that one connected domain corresponds to one pixel label value, that is, the pixels in the connected domain correspond to the same pixel label value, and different connected domains correspond to different pixel label values. The pixel label value is used to uniquely identify the connected domain. The pixel label value of the connected domain in the image can be composed of continuous values, such as the pixel label values corresponding to connected domain 1 and connected domain 2 are 1 and 2 respectively. The above-mentioned white pixel point may refer to a pixel point in the image whose pixel value is greater than a pixel value threshold. The pixel value threshold may be a fixed value or may be dynamically determined according to the pixel value of the pixel point in the image.
[0100] S14, binarization processing is performed on the image; the task scheduling management engine in the integrated chip of the computer device can determine the M binarization engines that perform the binarization task (i.e., the current binarization task). Specifically, the task scheduling management engine can determine the M binarization engines that perform the binarization task by at least one of the following methods: Method 1, the task scheduling management can determine the M binarization engines that perform the binarization task from the Y binarization engines based on the description information of the image, and the description information can include one or more items such as the resolution, complexity, and number of connected domains in the image. Method 2, the task scheduling management engine can determine the M binarization engines that perform the binarization task from the Y binarization engines based on the working status of the binarization engines in the integrated chip, such as determining the binarization engines that are in an idle state among the Y binarization engines as the M binarization engines that perform the binarization task. The working state includes an idle state and a non-idle state. The idle state means that the task amount corresponding to the current binarization task to be processed by the binarization engine is less than the task amount threshold, and the non-idle state means that the task amount corresponding to the current binarization task to be processed by the binarization engine is greater than or equal to the task amount threshold. M is a positive integer less than or equal to Y.
[0101] Further, the computer device can generate binarization strategies corresponding to M binarization engines respectively according to the attribute information of the connected domain in the image, and the attribute information of the connected domain includes the pixel label value of the connected domain and the number of connected domains in the image; the computer device can call the M binarization engines in parallel, and binarize the image obtained in step S13 according to the corresponding binarization strategies to obtain M binary images, wherein every two binary images in the M binary images are different, and only the pixel values of the pixels in the connected domain in the binary images are valid values. For example, M is 2, the image includes connected domain 1, connected domain 2, connected domain 3 and connected domain 4, the M binary images include binary image 1 and binary image 2, and in binary image 1, only the pixel values of the pixels in connected domain 1 and connected domain 2 are valid values, that is, binary image 1 can be used to perform contour search on connected domain 1 and connected domain 2; in binary image 2, only the pixel values of the pixels in connected domain 3 and connected domain 4 are valid values, that is, binary image 2 can be used to perform contour search on connected domain 3 and connected domain 4.
[0102] S15, contour search; the task scheduling management engine in the integrated chip of the computer device can determine Q contour search engines that perform the contour search task (i.e., this contour search task), Q is a positive integer, and Q can be less than or equal to U; specifically, in one embodiment, the task scheduling management can determine the Q contour search engines that perform the contour search task from the U binarization engines based on the description information of the image. In one embodiment, the task scheduling management engine can determine the Q contour search engines that perform the contour search task from the U contour search engines based on the number of binarization engines, for example, U can be less than or equal to Q. In one implementation, the task scheduling management engine can determine the Q contour search engines that perform the contour search task from the U contour search engines based on the working status of the contour search engines, such as determining the contour search engines that are in the idle state among the U contour search engines as the Q contour search engines that perform the contour search task. After determining the Q contour search engines, the computer device can call the Q contour search engines in parallel, perform contour search on the connected domain in the image based on the M binary images, and obtain contour search results, and the contour search results include contours corresponding to the connected domains.
[0103] Furthermore, the post-processing engine can filter, merge, sort, encapsulate and process the contour search results of each connected domain to obtain the contour corresponding to each connected domain, identify each contour and obtain the target object.
[0104] The contour of the connected domain may include a target object. The target object may include at least one of the following: a license plate, text, subtitles, a moving object, a region of interest, etc. Accordingly, the recognition process includes but is not limited to: license plate recognition, text recognition, subtitle recognition, moving object (such as pedestrians, vehicles) recognition, region of interest recognition, etc. The following two examples are used to illustrate:
[0105] Example 1: In pedestrian intrusion detection, the image to be processed is an image obtained by photographing the road, and the recognition process includes pedestrian recognition. The image includes at least one connected domain, and each connected domain may include a pedestrian on the road; after scheduling M binary engines in parallel to perform the above step S14, and scheduling Q contour search engines in parallel to perform the above step S15, pedestrian recognition is performed on the contours corresponding to each connected domain to obtain the pedestrians in the image. Based on the pedestrians in the image, the vehicle can be controlled to reduce the driving speed to avoid traffic accidents.
[0106] Example 2: In a text recognition scenario, the text recognition scenario refers to converting text content in image format into editable text content, and editable text refers to word, txt, table, etc.; the image to be processed includes an image of text content, and the image includes at least one connected domain, each connected domain may include one or more characters of the text content, and after parallel scheduling of M binarization engines to execute the above step S14, and parallel scheduling of Q contour search engines to execute the above step S15, text recognition can be performed on the contours corresponding to each connected domain to obtain editable text content.
[0107] In summary, by calling M binarization engines and Q contour search engines, the image is searched for contours in parallel, so that the image can be searched for contours quickly and the efficiency of contour search can be improved. In the specific implementation process, the computer device can dynamically generate binarization strategies corresponding to the M binarization engines based on the attribute information of the N connected domains in the image, call the M binarization engines in parallel, and binarize the image based on the corresponding binarization strategies to obtain M binary images, thereby improving the efficiency of binarization processing of the image and creating necessary conditions for subsequent parallel contour searches. By calling Q contour search engines in parallel, the contour search of the N connected domains in the M binary images can be performed, so that the efficiency of contour search can be improved.
[0108] For further information, see Figure 3 , is a flow chart of an image processing method provided in an embodiment of the present application. Figure 3 As shown, the method can be executed by a computer device, in which a Figure 1b The integrated chip shown. The method may include the following steps:
[0109] S101, obtaining N connected domains in an image to be processed and attribute information of the N connected domains; N is a positive integer.
[0110] In the present application, the computer device can obtain the image to be processed from the network or local storage, use the connected domain labeling algorithm mentioned above to perform connected domain labeling on the image, obtain N connected domains in the image, and obtain attribute information of the N connected domains, the attribute information includes the number of connected domains in the image, the pixel label value of each connected domain, etc.
[0111] S102: Generate binarization strategies corresponding to M binarization engines respectively according to the attribute information; M is a positive integer less than or equal to N.
[0112] In the present application, the computer device may refer to the above step S14, call the task scheduling management engine, determine the M binarization engines that execute the binarization task, and generate the binarization strategies corresponding to the M binarization engines respectively according to the attribute information of the N connected domains.
[0113] Optionally, the attribute information includes pixel label values corresponding to the N connected domains and the number of connected domains in the image; the step S102 includes the following steps S21 to S23:
[0114] S21 . Determine connected domains respectively associated with the M binarization engines according to the number of connected domains in the image and pixel label values respectively corresponding to the N connected domains.
[0115] Specifically, the connected domain associated with the binarization engine refers to the connected domain to be processed by the binarization engine, that is, the computer device can call the task scheduling management engine in the integrated chip to determine the connected domains associated with the M binarization engines respectively according to the number of connected domains in the image and the pixel label values corresponding to the N connected domains. It should be noted that a binarization engine is associated with one or more connected domains, and different binarization engines are associated with different connected domains.
[0116] S22. Generate a valid label value interval i corresponding to the binarization engine i according to the pixel label values of the connected domain corresponding to the binarization engine i; the pixel label values of the connected domain corresponding to the binarization engine i belong to the valid label value interval; i is a positive integer less than or equal to M.
[0117] It should be noted that the binarization engine i can be any of the M binarization engines, and the valid label value interval i is used to instruct the binarization engine i to binarize the pixel values of the pixels whose pixel label values belong to the valid label value interval i in the image into valid values, and to binarize the pixel values of the pixels whose pixel label values do not belong to the valid label value interval i into invalid values. In the image, only the pixel label values of the pixels in the connected domain corresponding to the binarization engine i belong to the valid label value interval i. Therefore, the valid label value interval i is used to instruct to binarize the pixel values of the pixels in the connected domain corresponding to the binarization engine i into valid values, and to binarize the pixel values of the pixels in the remaining area into invalid values. The remaining area is the area in the image other than the connected domain corresponding to the binarization engine i.
[0118] S23: Determine the valid label value interval i as the binarization strategy of the binarization engine i, until the binarization strategies corresponding to the M binarization engines are obtained.
[0119] Specifically, the computer device can determine the valid label value interval i as the binarization strategy of the binarization engine i. In the binarized image obtained based on the binarization strategy of the binarization engine i, only the pixel values of the pixels in the connected domain corresponding to the binarization engine i are valid values. Therefore, the binarized image obtained by the binarization engine i can be used to search for contours in the connected domain corresponding to the binarization engine i. Repeat the above steps S21 to S23 until the binarization strategies corresponding to the M binarization engines are obtained.
[0120] It should be noted that a binarization strategy corresponds to one or more valid label value intervals, and different binarization strategies correspond to different valid label value intervals; the binarization strategy is used to indicate that the pixel values of the pixels in the image whose pixel label values belong to the valid label value interval are updated to valid values, and the pixel values of the pixels in the image whose pixel label values do not belong to the valid label value interval are updated to invalid values. The pixel values of the pixels in the image processed by the binarization strategy are either valid values or invalid values, that is, the image after binarization includes two pixel values, so the image after binarization is called a binary image.
[0121] Optionally, the above S22 may include the following steps S221 to S224:
[0122] S221 . Determine the number of connected domains to be associated with the M binarization engines respectively according to the number of connected domains in the image.
[0123] Specifically, when the number of connected domains is the same as the number of binarization engines, the computer device can determine that the number of connected domains to be associated with any binarization engine is one. When the number of connected domains is greater than the number of binarization engines, the computer device can determine the number of connected domains to be associated with the M binarization engines respectively according to the performance parameters of the binarization engines, and the performance parameters include one or more of binarization processing efficiency, error rate, and failure rate; if the binarization processing efficiency corresponding to the binarization engine i is relatively high, the number of connected domains to be associated with the binarization engine i is more; conversely, the binarization processing efficiency corresponding to the binarization engine i is relatively low, the number of connected domains to be associated with the binarization engine i is less.
[0124] S222: If the number of connected domains to be associated with the binarization engine i is single (ie, one), any unassociated connected domain among the N connected domains is determined as a connected domain associated with the binarization engine i.
[0125] Specifically, when the number of connected domains to be associated with the binarization engine i is one, the computer device may randomly select a connected domain from the N connected domains that are not associated as the connected domain associated with the binarization engine i.
[0126] S223. If the number of connected domains to be associated with the binarization engine i is k, then k connected domains that are not associated among the N connected domains and whose pixel label values have a continuous relationship are determined as connected domains associated with the binarization engine; k is an integer greater than 1 and less than N.
[0127] Specifically, when there are multiple connected domains to be associated with the binarization engine i, the computer device can select a connected domain with a continuous relationship in pixel label values from the N connected domains that are not associated, as the connected domain associated with the binarization engine i. In this way, only one valid label value interval needs to be generated for multiple connected domains, and there is no need to generate a valid label value interval for each connected domain, thereby simplifying the generation complexity of the binarization strategy.
[0128] It should be noted that if the number of connected domains to be associated with the binarization engine i is k, the computer device can determine any k connected domains that are not associated among the N connected domains as connected domains associated with the binarization engine. For example, k connected domains that are not associated among the N connected domains and whose pixel label values do not have a continuous relationship are determined as connected domains associated with the binarization engine. This application is mainly described by taking k connected domains whose pixel label values have a continuous relationship as an example.
[0129] S224, until the connected domains respectively associated with the M binarization engines are obtained.
[0130] Specifically, the above steps S221 to S223 are repeatedly executed until connected domains respectively associated with M binarization engines are obtained.
[0131] For example, Figure 4As shown, the image 40a to be processed includes 4 connected domains, namely connected domain 41a, connected domain 42a, connected domain 43a and connected domain 44a; the pixel label value of connected domain 41a is 1, the pixel label value of connected domain 42a is 2, the pixel label value of connected domain 43a is 3, and the pixel label value of connected domain 44a is 4; the pixel label value of the pixel points in the non-connected general area in image 40a can be 0, or other values different from the pixel label value of the connected domain. In this application, the pixel label value of the pixel points in the non-connected area is 0 for illustration, and the non-connected area is the area other than the N connected domains in the image. Assume that the number of binarization engines is two, that is, M is 2, and the two binarization engines are binarization engine 1 and binarization engine 2. Optionally, if the difference between the performance parameters of binarization engine 1 and the performance parameters of binarization engine 2 is relatively small, the 4 connected domains can be evenly distributed to the two binarization engines. For example, the binarization engine 1 is associated with the connected domains 41a and 42a, and the binarization engine 2 is associated with the connected domains 43a and 44a. The valid label value interval corresponding to the binarization engine 1 is [1,2]. The pixel label values of the pixels in the connected domains 41a and 42a in the image belong to [1,2]. That is, [1,2] is used to instruct the binarization engine 1 to generate a binarized image for contour search of the connected domains 41a and 42a. The valid label value interval corresponding to the binarization engine 2 is [3,4]. The pixel label values of the pixels in the connected domains 43a and 44a in the image belong to [3,4]. That is, [3,4] is used to instruct the binarization engine 2 to generate a binarized image for contour search of the connected domains 43a and 44a. By generating different binarization strategies, it is beneficial to generate different binarized images.
[0132] Optional, such as Figure 4As shown, if the binarization processing performance of the binarization engine 1 is better than that of the binarization engine 2, three connected domains can be assigned to the binarization engine 1, and one binarization engine can be assigned to the binarization engine 3. For example, the binarization engine 1 is associated with the connected domains 41a, 42a, and 43a, and the binarization engine 2 is associated with the connected domain 44a. The valid label value interval corresponding to the binarization engine 1 is [1,3] or [1,4). In the image, only the pixel label values of the pixels in the connected domains 41a, 42a, and 43a belong to [1,3] and [1,4), that is, [1,3] and [1,4) are used to instruct the binarization engine 1 to generate a binary image for contour search of the connected domains 41a, 42a, and 43a. The valid label value interval corresponding to the binarization engine 2 is (3,4] or [4,5). In the image, only the pixel label values of the pixels within the connected domain 44a belong to (3,4] and [4,5]. (3,4] and [4,5) are both used to instruct the binarization engine 2 to generate a binary image for contour search of the connected domain 44a.
[0133] For example, Figure 5As shown, the image 50a to be processed includes 4 connected domains, namely connected domain 51a, connected domain 52a, connected domain 53a and connected domain 54a; the pixel label value of connected domain 51a is 1, the pixel label value of connected domain 52a is 2, the pixel label value of connected domain 53a is 3, and the pixel label value of connected domain 54a is 4; the pixel label value of the pixel points in the non-connected common area in the image 50a can be 0. Assuming that the number of binarization engines is three, that is, M is 3, the three binarization engines are binarization engine 1, binarization engine 2, and binarization engine 3. Assuming that the binarization processing performance of binarization engine 1 is better than the binarization processing performance of binarization engine 2 and the binarization processing performance of binarization engine 3, two connected domains can be allocated to binarization engine 1, and one connected domain can be allocated to binarization engine 2 and binarization engine 3 respectively. For example, the binarization engine 1 is associated with the connected domain 51a and the connected domain 52a, the binarization engine 2 is associated with the connected domain 53a, and the binarization engine 3 is associated with the connected domain 54a. The valid label value interval corresponding to the binarization engine 1 is [1,2], and the pixel label values of the pixels in the connected domains 51a and 52a in the image belong to [1,2], that is, [1,2] is used to instruct the binarization engine 1 to generate a binary image for contour search of the connected domains 51a and 52a. The valid label value interval corresponding to the binarization engine 2 is [3,4), and the pixel label values of the pixels in the connected domain 53a in the image belong to [3,4), that is, [3,4) is used to instruct the binarization engine 2 to generate a binary image for contour search of the connected domain 53a. The valid label value interval corresponding to the binarization engine 3 is (3, 4], and the pixel label values of the pixels in the connected domain 54a in the image belong to (3, 4], that is, (3, 4] is used to indicate that the binarization engine 3 generates a binary image for contour search of the connected domain 54a.
[0134] S103 , calling the M binarization engines in parallel, and performing binarization processing on the images respectively according to their corresponding binarization strategies, to obtain M binarized images.
[0135] In the present application, the computer device can call M binarization engines in parallel, and perform binarization processing on the image according to their corresponding binarization strategies to obtain M binarized images, that is, call M binarization engines, and perform binarization processing on the image in parallel (simultaneously) according to their corresponding binarization strategies to obtain M binarized images.
[0136] Among them, one binary image is used to perform contour search on one or more connected domains in the image, and different binary images are used to perform contour search on different connected domains in the image. By generating different binary images, necessary conditions are created for subsequent parallel contour search on connected domains.
[0137] Optionally, the M binarization engines include a binarization engine i, and the binarization strategy corresponding to the binarization engine i includes a valid label value interval i, i being a positive integer less than or equal to M; the binarization engine i performs binarization processing on the image according to its corresponding binarization strategy, including: the computer device can call the binarization engine i, obtain valid pixel points in the image whose pixel label values belong to the valid label value interval i, and binarize the pixel values of the valid pixel points into valid values; valid pixel points refer to pixel points in the image whose pixel label values belong to the valid label value interval i. Further, the binarization engine i is called to obtain invalid pixel points in the image whose pixel label values do not belong to the valid label value interval i, and the pixel values of the invalid pixel points are binarized into invalid values to obtain a binary image i, and the invalid pixel points are pixel points in the image whose pixel label values do not belong to the valid label value interval i.
[0138] For example, Figure 4 As shown, when the valid label value interval in the binarization strategy corresponding to the binarization engine 1 is [1,2], and the valid label value interval in the binarization strategy corresponding to the binarization engine 2 is [3,4], the computer device can call the binarization engine 1 to treat the pixel points in the image 40a whose pixel label values belong to [1,2] as valid pixel points, and set the pixel values of the valid pixel points to valid values; treat the pixel points in the image 40a whose pixel label values do not belong to [1,2] as invalid pixel points, and set the pixel values of the invalid pixel points to invalid values, thereby obtaining a binary image 45a. In the binary image 45a, only the pixel values of the pixels in the connected domains 41a and 42a are valid values, that is, the binary image 45a can be used to perform contour search on the connected domains 41a and 42a. Similarly, the computer device can call the binarization engine 2 to treat the pixel points in the image 40a whose pixel label values belong to [3,4] as valid pixel points, and set the pixel values of the valid pixel points to valid values; treat the pixel points in the image 40a whose pixel label values do not belong to [3,4] as invalid pixel points, and set the pixel values of the invalid pixel points to invalid values, thereby obtaining a binary image 46a. In the binary image 46a, only the pixel values of the pixels in the connected domains 43a and 44a are valid values, that is, the binary image 46a can be used to perform contour search on the connected domains 43a and 44a.
[0139] It should be noted that in Figure 4 In the figure, when the valid label value interval in the binarization strategy corresponding to the binarization engine 1 is [1,3] or [1,4), and the valid label value interval in the binarization strategy corresponding to the binarization engine 2 is (3,4] or [4,5), the binarization engine 1 and the binarization engine 2 perform binarization processing on the image according to their corresponding valid label value intervals. The above description can be referred to, and the repeated parts will not be repeated.
[0140] For example, Figure 5 As shown, the valid label value interval in the binarization strategy corresponding to the binarization engine 1 is [1,2], the valid label value interval in the binarization strategy corresponding to the binarization engine 2 is [3,4), and the valid label value interval in the binarization strategy corresponding to the binarization engine 3 is (3,4). The computer device can call the binarization engine 1 to treat the pixel points whose pixel label values in the image 50a belong to [1,2] as valid pixel points, and set the pixel values of the valid pixel points to valid values; treat the pixel points whose pixel label values in the image 50a do not belong to [1,2] as invalid pixel points, and set the pixel values of the invalid pixel points to invalid values, so as to obtain To the binary image 55a. In the binary image 55a, only the pixel values of the pixels in the connected domain 51a and the connected domain 52a are valid values, that is, the binary image 55a can be used to perform contour search on the connected domain 51a and the connected domain 52a. Similarly, the computer device can call the binarization engine 2 to treat the pixel points in the image 50a whose pixel label values belong to [3,4) as valid pixels, and set the pixel values of the valid pixels to valid values; treat the pixel points in the image 50a whose pixel label values do not belong to [3,4) as invalid pixels, and set the pixel values of the invalid pixels to invalid values, to obtain the binary image 56a. In the binary image 56a, only the pixel values of the pixels in the connected domain 53a are valid values, that is, the binary image 56a can be used to perform contour search on the connected domain 53a. Similarly, the computer device can call the binarization engine 3 to treat the pixel points whose pixel label values in the image 50a belong to (3, 4] as valid pixel points, and set the pixel values of the valid pixel points to valid values; treat the pixel points whose pixel label values in the image 50a do not belong to (3, 4] as invalid pixel points, and set the pixel values of the invalid pixel points to invalid values, thereby obtaining a binary image 57a. In the binary image 57a, only the pixel values of the pixels in the connected domain 54a are valid values, that is, the binary image 57a can be used to perform contour search on the connected domain 54a.
[0141] S104 , calling Q contour search engines in parallel to perform contour search on the N connected domains in the M binary images; Q is a positive integer less than or equal to N.
[0142] In the present application, the computer device can call Q contour search engines to perform contour searches on the N connected domains in M binary images in parallel, so that contour searches can be performed quickly on the images, thereby improving contour search efficiency.
[0143] In the present application, by obtaining N connected domains in the image to be processed, different connected domains correspond to different image areas in the image, that is, the N connected domains are independent of each other, and the contour search process for any connected domain does not need to rely on the contour search process (or search results) of other connected domains. Therefore, in the present application, M binarization engines and Q contour search engines can perform contour search on the connected domains in the image in parallel, so that the contour search on the image can be quickly realized and the contour search efficiency can be improved. In the specific implementation process, the computer device can dynamically generate the binarization strategies corresponding to the M binarization engines based on the attribute information of the N connected domains in the image, call the M binarization engines in parallel, and binarize the image based on the respective corresponding binarization strategies to obtain M binary images, improve the efficiency of the binarization processing of the image, and create necessary conditions for subsequent parallel contour search. By calling Q contour search engines in parallel, the contour search is performed on the N connected domains in the M binary images, so that the contour search efficiency can be improved.
[0144] For further information, see Figure 6 , is a flow chart of an image processing method provided in an embodiment of the present application. Figure 6 As shown, the method can be executed by a computer device, in which a Figure 1b The integrated chip shown. The method may include the following steps:
[0145] S201, obtaining N connected domains in the image to be processed and attribute information of the N connected domains; N is a positive integer.
[0146] S202: Generate binarization strategies corresponding to M binarization engines respectively according to the attribute information; M is a positive integer less than or equal to N.
[0147] S203 , calling the M binarization engines in parallel, and performing binarization processing on the image respectively according to their corresponding binarization strategies to obtain M binarized images.
[0148] S204: Calling a task scheduling management engine to allocate connected domains to the Q contour search engines.
[0149] In the present application, the computer device can call the task scheduling management engine to allocate connected domains to Q contour search engines. The contour search engines only perform contour searches for the connected domains allocated to them. One contour search engine is allocated one or more connected domains.
[0150] In one embodiment, the above S204 may include the following steps S31 to S33:
[0151] S31. If M is less than or equal to Q, the task scheduling management engine is called to count the number of connected areas whose pixel values in the M binary images are valid values as the valid number.
[0152] Specifically, if M is less than or equal to Q, that is, the number of binarization engines is less than or equal to the number of contour search engines, the computer device can call the task call management engine to count the number of connected areas whose pixel values are valid values in the M binary images as the valid number.
[0153] S32: Call the task scheduling management engine to obtain performance parameters corresponding to the Q profile search engines.
[0154] Specifically, the computer device can call the task scheduling management engine to obtain the performance parameters corresponding to the Q contour search engines from the log data of the Q contour search engines. The performance parameters of the contour search engines include one or more of contour search efficiency, error rate, and failure rate.
[0155] S33, calling the task scheduling management engine, and allocating connected domains to the Q contour search engines according to the performance parameter and the effective numbers respectively corresponding to the M binary images.
[0156] Specifically, the computer device can call the task scheduling management engine to allocate connected domains to the Q contour search engines according to the performance parameters and the effective numbers corresponding to the M binary images, which is conducive to improving the efficiency of contour search.
[0157] Optionally, the above step S33 may include the following steps S331 to S334:
[0158] S331, calling the task scheduling management engine, and generating serial numbers corresponding to the Q contour search engines respectively according to the performance parameters.
[0159] Specifically, the computer device can call the task scheduling management engine to determine the contour search performance of the Q contour search engines according to the performance parameter. The contour search performance is used to reflect at least one of the contour search efficiency and the contour search accuracy of the contour search engine. The contour search performance of the contour search engine is good, the contour search efficiency of the contour search engine is high, and / or, the contour search accuracy is high; on the contrary, the contour search performance of the contour search engine is poor, the contour search efficiency of the contour search engine is low, and / or, the contour search accuracy is low. The Q contour search engines can be sorted in the order of the contour search performance of the Q contour search engines from high to low, and the serial numbers corresponding to the Q contour search engines are obtained. Alternatively, the Q contour search engines can be sorted in the order of the contour search performance of the Q contour search engines from low to high, and the serial numbers corresponding to the Q contour search engines are obtained.
[0160] S332 , calling the task scheduling management engine to generate serial numbers corresponding to the M binary images respectively according to the valid quantities corresponding to the M binary images respectively.
[0161] Specifically, when the sequence numbers corresponding to the Q contour search engines are obtained by sorting the contour search performances of the Q contour search engines from high to low, the computer device can call the task scheduling management engine to sort the M binary images in the order of the effective numbers corresponding to the M binary images from large to small, and obtain the sequence numbers corresponding to the M binary images. When the sequence numbers corresponding to the Q contour search engines are obtained by sorting the contour search performances of the Q contour search engines from low to high, the computer device can call the task scheduling management engine to sort the M binary images in the order of the effective numbers corresponding to the M binary images from small to large, and obtain the sequence numbers corresponding to the M binary images.
[0162] S333, calling the task scheduling management engine, and determining the binary image whose serial number matches the serial number of the contour search engine j among the M binary images as the binary image associated with the contour search engine j; j is less than or equal to Q.
[0163] Specifically, the binary image whose serial number matches the serial number of the contour search engine j in the M binary images may refer to: the binary image whose serial number difference with the serial number of the contour search engine j is less than or equal to the difference threshold. This can realize the assignment of connected domains located in the same binary image to the same contour search engine, and this is beneficial for assigning a larger number of connected domains to contour search engines with high contour search performance and a smaller number of connected domains to contour search engines with low contour search performance, thereby improving contour search efficiency and contour search accuracy.
[0164] S334, calling the task scheduling management engine, and assigning the connected domains whose pixel values are valid values in the binary image associated with the contour search engine j to the contour search engine j, until all the Q contour search engines are assigned connected domains.
[0165] Specifically, the computer device may call the task scheduling management engine to assign the connected domain of pixels with valid pixel values in the binary image associated with the contour search engine j to the contour search engine j. Repeat the above steps S333 and S334 until the Q contour search engines are all assigned connected domains.
[0166] In one embodiment, the above S204 may include the following steps S41-S42:
[0167] S41. If M is greater than Q, the task scheduling management engine is called to obtain the processing priorities corresponding to the N connected domains and the working states corresponding to the Q contour search engines.
[0168] Specifically, if M is greater than Q, that is, when the number of binarization engines is greater than the number of contour search engines, the computer device can call the task call management engine to obtain the processing priorities corresponding to the N connected domains and the working states corresponding to the Q contour search engines, and the working states include idle states and non-idle states.
[0169] S42: Allocate connected domains to the Q contour search engines according to the processing priority and the working status.
[0170] Specifically, the computer device can allocate connected domains to the Q contour search engines according to the processing priority and the working status. For example, the connected domain with a high processing priority can be allocated to the contour search engine with an idle working status. After the contour search of the connected domain with a high processing priority is completed, the connected domain with a low processing priority can be allocated to the contour search engine with an idle working status.
[0171] Optionally, the above step S41 includes: the computer device can call the task scheduling management engine to obtain the performance parameters corresponding to the M binarization engines respectively; the performance parameters of the binarization engine include one or more of binarization processing efficiency, error rate, and failure rate; according to the performance parameters corresponding to the M binarization engines respectively, the processing priorities corresponding to the N connected domains are determined. If the binarization processing efficiency corresponding to the binarization engine i is relatively high, the processing priority of the connected domain associated with the binarization engine i is higher; conversely, the binarization processing efficiency corresponding to the binarization engine i is relatively low, the processing priority of the connected domain associated with the binarization engine i is lower. The connected domain associated with the binarization engine i refers to: the connected domain whose pixel value of the pixel point in the binarization image obtained by the binarization engine i is a valid value. This is conducive to preferentially performing contour search on the connected domain in the first generated binary image, and then performing contour search on the connected domain in the later generated binary image, thereby improving the efficiency of contour search.
[0172] Optionally, the above step S41 includes: the computer device may call the task scheduling management engine to obtain description information of the image, and the description information may include resolution, complexity, etc. of the image, and the complexity of the image may be determined according to the number of color categories, the number of target objects, etc. in the image. Further, the computer device may determine the processing priorities corresponding to the N connected domains according to the description information of the image, such as the higher the complexity of the corresponding connected domain in the image, the higher the processing priority of the corresponding connected domain; conversely, the lower the complexity of the corresponding connected domain in the image, the lower the processing priority of the corresponding connected domain.
[0173] It should be noted that the processing priorities of the N connected domains may be specified by the user.
[0174] In one embodiment, the above S204 may include the following steps S51 to S53:
[0175] S51, constructing an image processing task for the image.
[0176] Specifically, the computer device may construct an image processing task regarding the image, where the image processing task is used to instruct to perform contour search on N connected domains in the image.
[0177] S52, split the image processing task to obtain N subtasks; one connected domain corresponds to one subtask.
[0178] Specifically, the computer device may split the image processing task into N subtasks, where one subtask corresponds to one connected domain.
[0179] S53: Call the task scheduling management engine to assign the N subtasks to the Q contour search engines.
[0180] Specifically, the computer device can call the task scheduling management engine, refer to the above steps S31 to S33; or refer to the above steps S41 to S42, to assign the N subtasks to the Q contour search engines. By splitting the image processing task into multiple subtasks and assigning the subtasks to multiple contour search engines, it is beneficial to improve the contour search efficiency.
[0181] S205 , calling the Q contour search engines in parallel, and performing contour searches on the connected domains corresponding to the M binary images.
[0182] In the present application, the computer device can call Q contour search engines in parallel, and perform contour searches on their respective corresponding connected domains based on M binary image transmissions, so that the contour search of the image can be performed quickly, thereby improving the efficiency of the contour search.
[0183] For example, Figure 4 As shown, it is assumed that the contour search engine includes contour search engine 1 and contour search engine 2; the number of contour search engines is the same as the number of binarization engines. Contour search engine 1 is associated with the binarized image 45a obtained by binarization engine 1, and contour search engine 2 is associated with the binarized image 46a obtained by the binarization image. In the binarized image 45a, only the pixel values of the pixels in the connected domains 41a and 42a are valid values, and in the binarized image 46a, only the pixel values of the pixels in the connected domains 43a and 44a are valid values. Therefore, the connected domains 41a and 42a are assigned to the contour search engine 1, that is, the computer device can call the contour search engine 1, and perform contour searches on the connected domains 41a and 42a in parallel in the binarized image 45a to obtain the contour corresponding to the connected domain 41a and the contour corresponding to the connected domain 42a. At the same time, the connected domain 43a and the connected domain 44a are assigned to the contour search engine 2. The computer device can call the contour search engine 2 to perform contour searches on the connected domain 43a and the connected domain 44a in parallel in the binary image 46a to obtain the contour corresponding to the connected domain 43a and the contour corresponding to the connected domain 44a.
[0184] For example, Figure 5As shown, it is assumed that the contour search engine includes contour search engine 1 and contour search engine 2; the number of contour search engines is less than the number of binarization engines. In the binary image 55a obtained by binarization engine 1, only the pixel values of the pixels in the connected domain 51a and the connected domain 52a are valid values, in the binary image 56a obtained by binarization engine 2, only the pixel values of the pixels in the connected domain 53a are valid values, and in the binary image 57a obtained by binarization engine 3, only the pixel values of the pixels in the connected domain 54a are valid values. At time T0, the working states of contour search engine 1 and contour search engine 2 are both idle states, and the connected domain 51a in the binary image 55a can be assigned to contour search engine 1, and contour search engine 1 performs contour search on the connected domain 51a in the binary image 55a to obtain the contour corresponding to the connected domain 51a; the connected domain 53a in the binary image 56a is assigned to contour engine 2, and contour search engine 2 performs contour search on the connected domain 53a in the binary image 56a to obtain the contour corresponding to the connected domain 53a.
[0185] At time T1, contour search engine 1 completes the search for connected domain 51a, and can assign connected domain 54a in binary image 57a to contour search engine 1. Contour search engine 1 can perform contour search on connected domain 54a in binary image 57a to obtain the contour corresponding to connected domain 54a. At time T2, contour search engine 2 completes the search for connected domain 53a, and can assign connected domain 52a in binary image 55a to contour search engine 2. Contour search engine 2 can perform contour search on connected domain 52a in binary image 55a to obtain the contour corresponding to connected domain 52a.
[0186] It should be noted that at time T1, contour search engine 2 completes the search for connected domain 53a, and can assign connected domain 52a in binary image 55a to contour search engine 2. Contour search engine 2 can perform contour search on connected domain 52a in binary image 55a to obtain the contour corresponding to connected domain 52a. At time T2, contour search engine 1 completes the search for connected domain 51a, and can assign connected domain 54a in binary image 57a to contour search engine 1. Contour search engine 1 can perform contour search on connected domain 54a in binary image 57a to obtain the contour corresponding to connected domain 54a.
[0187] In one embodiment, step S205 includes: the computer device can call the task scheduling management engine to send a parallel execution instruction to the Q contour search engines, and through the parallel execution instruction, control the Q contour search engines to execute their respective assigned subtasks in parallel according to the M binary images.
[0188] Optionally, the N subtasks include subtask a, which corresponds to the connected domain A; the Q contour search engines include contour search engine j; the subtask a is assigned to the contour search engine j; subtask a may refer to any subtask among the N subtasks, and a may be a positive integer less than or equal to N.
[0189] The above-mentioned contour search engine j performs contour search processing on the connected domain A, including: the contour search engine j obtains a binary image b in which the pixel values of the pixels in the connected area A are valid values from the M binary images; b is a positive integer less than or equal to M; the contour search engine j performs contour search in the binary image b from the starting point of the connected domain A according to the coordinates of the starting point in the image, and obtains the boundary points of the connected domain A until the search returns to the starting point. Based on the starting point and boundary points of the connected domain A, the contour of the connected domain A is determined.
[0190] It should be noted that when the image includes N connected domains and the number of binarization engines in the integrated chip is M, the contour search time T for the image can be expressed by the following formula (1):
[0191] T=ceil(N / M)*max(1,2…M) (1)
[0192] Among them, the ceil function in formula (1) is a method for returning the smallest integer greater than or equal to a given value (i.e., N / M). By calling the binarization engine and the contour search engine in parallel in this application, the time required for end-to-end contour search is increased by nearly 20 times, and the processing time is reduced from 42ms to 220us, greatly improving the efficiency of contour search.
[0193] In the present application, by calling M binarization engines and Q contour search engines, the image is searched for contours in parallel, so that the image can be searched for contours quickly and the efficiency of contour search can be improved. In the specific implementation process, the computer device can dynamically generate the binarization strategies corresponding to the M binarization engines based on the attribute information of the N connected domains in the image, call the M binarization engines in parallel, and binarize the image based on the corresponding binarization strategies to obtain M binary images, thereby improving the efficiency of binarization processing of the image and creating necessary conditions for subsequent parallel contour searches. By calling Q contour search engines in parallel, the contour search is performed on the N connected domains in the M binary images, so that the efficiency of contour search can be improved.
[0194] See also Figure 7 , is a schematic diagram of the structure of an image processing device provided in an embodiment of the present application. Figure 7 As shown, the image processing device may include:
[0195] The acquisition module 711 is used to acquire N connected domains in the image to be processed and the attribute information of the N connected domains; N is a positive integer;
[0196] A generating module 712 is used to generate binarization strategies corresponding to M binarization engines respectively according to the attribute information; M is a positive integer less than or equal to N;
[0197] A first calling module 713 is used to call the M binarization engines in parallel, and perform binarization processing on the images respectively according to their corresponding binarization strategies to obtain M binarized images;
[0198] The second calling module 714 is used to call Q contour search engines in parallel to perform contour search on the N connected domains in the M binary images; Q is a positive integer less than or equal to N.
[0199] Optionally, the attribute information includes pixel label values corresponding to the N connected domains respectively and the number of connected domains in the image;
[0200] The generating module 712 generates binarization strategies corresponding to the M binarization engines respectively according to the attribute information, including:
[0201] Determining connected domains associated with the M binarization engines, respectively, according to the number of connected domains in the image and pixel label values corresponding to the N connected domains;
[0202] According to the pixel label values of the connected domain corresponding to the binarization engine i, a valid label value interval i corresponding to the binarization engine i is generated; the pixel label values of the connected domain corresponding to the binarization engine i belong to the valid label value interval; i is a positive integer less than or equal to M;
[0203] The valid label value interval i is determined as the binarization strategy of the binarization engine i, until the binarization strategies corresponding to the M binarization engines are respectively obtained.
[0204] Optionally, the generating module 712 determines the connected domains respectively associated with the M binarization engines according to the number of connected domains in the image and the pixel label values respectively corresponding to the N connected domains, including:
[0205] Determining the number of connected domains to be associated with the M binarization engines respectively according to the number of connected domains in the image;
[0206] If the number of connected domains to be associated with the binary engine i is single, any connected domain that is not associated among the N connected domains is determined as the connected domain associated with the binary engine i;
[0207] If the number of connected domains to be associated with the binarization engine i is k, then k connected domains that are not associated and have continuous pixel label values among the N connected domains are determined as connected domains associated with the binarization engine i; k is an integer greater than 1 and less than N;
[0208] Until the connected domains respectively associated with the M binarization engines are obtained.
[0209] Optionally, the M binarization engines include a binarization engine i, and the binarization strategy corresponding to the binarization engine i includes a valid label value interval i, where i is a positive integer less than or equal to M;
[0210] The binarization engine i performs binarization processing on the image according to its corresponding binarization strategy, including:
[0211] Calling the binarization engine i, obtaining valid pixel points in the image whose pixel label values belong to the valid label value interval i, and binarizing the pixel values of the valid pixel points into valid values;
[0212] The binarization engine i is called to obtain invalid pixels in the image whose pixel label values do not belong to the valid label value interval i, and the pixel values of the invalid pixels are binarized into invalid values to obtain a binarized image i.
[0213] Optionally, the second calling module 714 calls Q contour search engines in parallel to perform contour search on the N connected domains in the M binary images, including:
[0214] Invoke a task scheduling management engine to allocate connected domains to the Q contour search engines;
[0215] The Q contour search engines are called in parallel to perform contour searches on the connected domains corresponding to the M binary images.
[0216] Optionally, the second calling module 714 calls a task scheduling management engine to allocate connected domains to the Q contour search engines, including:
[0217] If M is less than or equal to Q, the task scheduling management engine is called to count the number of connected areas whose pixel values in the M binary images are valid values as the valid number;
[0218] Calling the task scheduling management engine to obtain performance parameters corresponding to the Q profile search engines;
[0219] The task scheduling management engine is called to allocate connected domains to the Q contour search engines according to the performance parameters and the effective numbers respectively corresponding to the M binary images.
[0220] Optionally, the second calling module 714 calls the task scheduling management engine to allocate connected domains to the Q contour search engines according to the performance parameter and the effective numbers respectively corresponding to the M binary images, including:
[0221] Calling the task scheduling management engine to generate serial numbers corresponding to the Q profile search engines respectively according to the performance parameters;
[0222] Calling the task scheduling management engine to generate serial numbers corresponding to the M binary images respectively according to the valid quantities corresponding to the M binary images respectively;
[0223] Calling the task scheduling management engine, determining the binary image whose serial number matches the serial number of the contour search engine j among the M binary images as the binary image associated with the contour search engine j; j is less than or equal to Q;
[0224] The task scheduling management engine is called to assign the connected domains whose pixel values are valid values in the binary image associated with the contour search engine j to the contour search engine j until the Q contour search engines are all assigned connected domains.
[0225] Optionally, the second calling module 714 calls the task scheduling management engine to allocate connected domains to the Q contour search engines, including:
[0226] If M is greater than Q, the task scheduling management engine is called to obtain the processing priorities corresponding to the N connected domains and the working states corresponding to the Q contour search engines;
[0227] Connected domains are allocated to the Q contour search engines according to the processing priorities and the working states.
[0228] Optionally, the second calling module 714 calls the task scheduling management engine to obtain the processing priorities corresponding to the N connected domains, including:
[0229] Calling the task scheduling management engine to obtain the performance parameters corresponding to the M binarization engines respectively;
[0230] The processing priorities respectively corresponding to the N connected domains are determined according to the performance parameters respectively corresponding to the M binarization engines.
[0231] Optionally, the second calling module 714 calls the task scheduling management engine to obtain the processing priorities corresponding to the N connected domains, including:
[0232] Calling the task scheduling management engine to obtain description information of the image;
[0233] The processing priorities respectively corresponding to the N connected domains are determined according to the description information of the image.
[0234] Optionally, the second calling module 714 calls the task scheduling management engine to allocate connected domains to the Q contour search engines, including:
[0235] constructing an image processing task on the image;
[0236] The image processing task is split into N subtasks; one connected domain corresponds to one subtask;
[0237] The task scheduling management engine is called to allocate the N subtasks to the Q contour search engines.
[0238] Optionally, the second calling module 714 calls the Q contour search engines in parallel, and performs contour search on each corresponding connected domain according to the M binary images, including:
[0239] Calling the task scheduling management engine to send parallel execution instructions to the Q contour search engines;
[0240] The Q contour search engines are controlled by the parallel execution instructions to execute their respective assigned subtasks in parallel according to the M binary images.
[0241] Optionally, the N subtasks include a subtask a, and the subtask a corresponds to a connected domain A; the Q contour search engines include a contour search engine j; the subtask a is assigned to the contour search engine j, and a is a positive integer less than or equal to N;
[0242] The contour search engine j performs contour search processing on the connected domain A, including:
[0243] The contour search engine j obtains a binary image b in which the pixel values of the pixels in the connected area A are valid values from the M binary images; b is a positive integer less than or equal to M;
[0244] The contour search engine j performs contour search in the binary image b starting from the starting point according to the coordinates of the starting point of the connected domain A in the image, and obtains the boundary points of the connected domain A;
[0245] Based on the starting point and boundary points of the connected domain A, the contour of the connected domain A is determined.
[0246] According to one embodiment of the present application, Figure 7The various modules in the image processing device 1 shown can be separately or completely combined into one or several units to form, or one (some) of the units can be further divided into multiple functionally smaller sub-units, which can achieve the same operation without affecting the realization of the technical effects of the embodiments of the present application. The above modules are divided based on logical functions. In practical applications, the functions of a module can also be implemented by multiple units, or the functions of multiple modules can be implemented by one unit. In other embodiments of the present application, the image processing device may also include other units. In practical applications, these functions can also be implemented with the assistance of other units, and can be implemented by the collaboration of multiple units.
[0247] If it needs to be explained, the image processing device in the present application can be used to execute the description of the above-mentioned image processing method in the corresponding embodiment of the previous text. When the image processing device executes the description of the image processing method of the previous text, the beneficial effects brought about can refer to the beneficial effects described in the embodiment corresponding to the image processing method of the previous text, and will not be repeated here.
[0248] In the present application, by obtaining N connected domains in the image to be processed, different connected domains correspond to different image areas in the image, that is, the N connected domains are independent of each other, and the contour search process for any connected domain does not need to rely on the contour search process (or search results) of other connected domains. Therefore, in the present application, M binarization engines and Q contour search engines can perform contour search on the connected domains in the image in parallel, so that the contour search on the image can be quickly realized and the contour search efficiency can be improved. In the specific implementation process, the computer device can dynamically generate the binarization strategies corresponding to the M binarization engines based on the attribute information of the N connected domains in the image, call the M binarization engines in parallel, and binarize the image based on the respective corresponding binarization strategies to obtain M binary images, improve the efficiency of the binarization processing of the image, and create necessary conditions for subsequent parallel contour search. By calling Q contour search engines in parallel, the contour search is performed on the N connected domains in the M binary images, so that the contour search efficiency can be improved.
[0249] See also Figure 8 , is a schematic diagram of the structure of a computer device provided in an embodiment of the present application. Figure 8As shown, the computer device 1000 can be the first device in the method, specifically a terminal or a server, including: a processor 1001, a network interface 1004 and a memory 1005. In addition, the computer device 1000 can also include: a user interface 1003, and at least one communication bus 1002. The communication bus 1002 is used to realize the connection and communication between these components. In some embodiments, the user interface 1003 can include a display screen (Display), a keyboard (Keyboard), and the optional user interface 1003 can also include a standard wired interface and a wireless interface.
[0250] The network interface 1004 may optionally include a standard wired interface or a wireless interface (such as a WI-FI interface). The memory 1005 may be a high-speed RAM memory or a non-volatile memory, such as at least one disk memory. The memory 1005 may also be at least one storage device located away from the processor 1001. Figure 8 As shown, the memory 1005 as a computer-readable storage medium may include an operating system, a network communication module, a user interface module, and a computer application program.
[0251] exist Figure 8 In the computer device 1000 shown, the network interface 1004 can provide a network communication function; the user interface 1003 is mainly used to provide an input interface; and the processor 1001 can be used to call a computer application stored in the memory 1005 to achieve:
[0252] Obtaining N connected domains in the image to be processed and attribute information of the N connected domains; N is a positive integer;
[0253] Generate binarization strategies corresponding to M binarization engines respectively according to the attribute information; M is a positive integer less than or equal to N;
[0254] The M binarization engines are called in parallel to perform binarization processing on the images respectively according to their corresponding binarization strategies to obtain M binarized images;
[0255] Q contour search engines are called in parallel to perform contour searches on the N connected domains in the M binary images; Q is a positive integer less than or equal to N.
[0256] Optionally, the attribute information includes pixel label values corresponding to the N connected domains respectively and the number of connected domains in the image;
[0257] The processor 1001 may be used to call a computer application stored in the memory 1005 to generate binarization strategies corresponding to the M binarization engines according to the attribute information, including:
[0258] Determining connected domains associated with the M binarization engines, respectively, according to the number of connected domains in the image and pixel label values corresponding to the N connected domains;
[0259] According to the pixel label values of the connected domain corresponding to the binarization engine i, a valid label value interval i corresponding to the binarization engine i is generated; the pixel label values of the connected domain corresponding to the binarization engine i belong to the valid label value interval; i is a positive integer less than or equal to M;
[0260] The valid label value interval i is determined as the binarization strategy of the binarization engine i, until the binarization strategies corresponding to the M binarization engines are respectively obtained.
[0261] Optionally, the processor 1001 may be used to call a computer application stored in the memory 1005 to determine the connected domains associated with the M binarization engines, respectively, according to the number of connected domains in the image and the pixel label values corresponding to the N connected domains, including:
[0262] Determining the number of connected domains to be associated with the M binarization engines respectively according to the number of connected domains in the image;
[0263] If the number of connected domains to be associated with the binary engine i is single, any connected domain that is not associated among the N connected domains is determined as the connected domain associated with the binary engine i;
[0264] If the number of connected domains to be associated with the binarization engine i is k, then k connected domains that are not associated and have continuous pixel label values among the N connected domains are determined as connected domains associated with the binarization engine i; k is an integer greater than 1 and less than N;
[0265] Until the connected domains respectively associated with the M binarization engines are obtained.
[0266] Optionally, the M binarization engines include a binarization engine i, and the binarization strategy corresponding to the binarization engine i includes a valid label value interval i, where i is a positive integer less than or equal to M;
[0267] The binarization engine i performs binarization processing on the image according to its corresponding binarization strategy, including:
[0268] Calling the binarization engine i, obtaining valid pixel points in the image whose pixel label values belong to the valid label value interval i, and binarizing the pixel values of the valid pixel points into valid values;
[0269] The binarization engine i is called to obtain invalid pixels in the image whose pixel label values do not belong to the valid label value interval i, and the pixel values of the invalid pixels are binarized into invalid values to obtain a binarized image i.
[0270] Optionally, the processor 1001 may be used to call a computer application stored in the memory 1005 to implement parallel calling of Q contour search engines, and to perform contour search on the N connected domains in the M binary images, including:
[0271] Invoke a task scheduling management engine to allocate connected domains to the Q contour search engines;
[0272] The Q contour search engines are called in parallel to perform contour searches on the connected domains corresponding to the M binary images.
[0273] Optionally, the processor 1001 may be used to call a computer application stored in the memory 1005 to call a task scheduling management engine to allocate connected domains to the Q contour search engines, including:
[0274] If M is less than or equal to Q, the task scheduling management engine is called to count the number of connected areas whose pixel values in the M binary images are valid values as the valid number;
[0275] Calling the task scheduling management engine to obtain performance parameters corresponding to the Q profile search engines;
[0276] The task scheduling management engine is called to allocate connected domains to the Q contour search engines according to the performance parameters and the effective numbers respectively corresponding to the M binary images.
[0277] Optionally, the processor 1001 may be used to call a computer application stored in the memory 1005 to call the task scheduling management engine, and allocate connected domains to the Q contour search engines according to the performance parameters and the effective numbers respectively corresponding to the M binary images, including:
[0278] Calling the task scheduling management engine to generate serial numbers corresponding to the Q profile search engines respectively according to the performance parameters;
[0279] Calling the task scheduling management engine to generate serial numbers corresponding to the M binary images respectively according to the valid quantities corresponding to the M binary images respectively;
[0280] Calling the task scheduling management engine, determining the binary image whose serial number matches the serial number of the contour search engine j among the M binary images as the binary image associated with the contour search engine j; j is less than or equal to Q;
[0281] The task scheduling management engine is called to assign the connected domains whose pixel values are valid values in the binary image associated with the contour search engine j to the contour search engine j until the Q contour search engines are all assigned connected domains.
[0282] Optionally, the processor 1001 may be used to call a computer application stored in the memory 1005 to call a task scheduling management engine to allocate connected domains to the Q contour search engines, including:
[0283] If M is greater than Q, the task scheduling management engine is called to obtain the processing priorities corresponding to the N connected domains and the working states corresponding to the Q contour search engines;
[0284] Connected domains are allocated to the Q contour search engines according to the processing priorities and the working states.
[0285] Optionally, the processor 1001 may be configured to call a computer application stored in the memory 1005 to implement calling the task scheduling management engine and obtaining the processing priorities corresponding to the N connected domains, including:
[0286] Calling the task scheduling management engine to obtain the performance parameters corresponding to the M binarization engines respectively;
[0287] The processing priorities respectively corresponding to the N connected domains are determined according to the performance parameters respectively corresponding to the M binarization engines.
[0288] Optionally, the processor 1001 may be configured to call a computer application stored in the memory 1005 to implement calling the task scheduling management engine and obtaining the processing priorities corresponding to the N connected domains, including:
[0289] Calling the task scheduling management engine to obtain description information of the image;
[0290] The processing priorities respectively corresponding to the N connected domains are determined according to the description information of the image.
[0291] Optionally, the processor 1001 may be used to call a computer application stored in the memory 1005 to call a task scheduling management engine to allocate connected domains to the Q contour search engines, including:
[0292] constructing an image processing task on the image;
[0293] The image processing task is split into N subtasks; one connected domain corresponds to one subtask;
[0294] The task scheduling management engine is called to allocate the N subtasks to the Q contour search engines.
[0295] Optionally, the processor 1001 may be used to call a computer application stored in the memory 1005 to implement parallel calling of the Q contour search engines, and perform contour searches on the connected domains corresponding to the M binary images, including:
[0296] Calling the task scheduling management engine to send parallel execution instructions to the Q contour search engines;
[0297] The Q contour search engines are controlled by the parallel execution instructions to execute their respective assigned subtasks in parallel according to the M binary images.
[0298] Optionally, the N subtasks include a subtask a, and the subtask a corresponds to a connected domain A; the Q contour search engines include a contour search engine j; the subtask a is assigned to the contour search engine j, and a is a positive integer less than or equal to N;
[0299] The contour search engine j performs contour search processing on the connected domain A, including:
[0300] The contour search engine j obtains a binary image b in which the pixel values of the pixels in the connected area A are valid values from the M binary images; b is a positive integer less than or equal to M;
[0301] The contour search engine j performs contour search in the binary image b starting from the starting point according to the coordinates of the starting point of the connected domain A in the image, and obtains the boundary points of the connected domain A;
[0302] Based on the starting point and boundary points of the connected domain A, the contour of the connected domain A is determined.
[0303] In the present application, by obtaining N connected domains in the image to be processed, different connected domains correspond to different image areas in the image, that is, the N connected domains are independent of each other, and the contour search process for any connected domain does not need to rely on the contour search process (or search results) of other connected domains. Therefore, in the present application, M binarization engines and Q contour search engines can perform contour search on the connected domains in the image in parallel, so that the contour search on the image can be quickly realized and the contour search efficiency can be improved. In the specific implementation process, the computer device can dynamically generate the binarization strategies corresponding to the M binarization engines based on the attribute information of the N connected domains in the image, call the M binarization engines in parallel, and binarize the image based on the respective corresponding binarization strategies to obtain M binary images, improve the efficiency of the binarization processing of the image, and create necessary conditions for subsequent parallel contour search. By calling Q contour search engines in parallel, the contour search is performed on the N connected domains in the M binary images, so that the contour search efficiency can be improved.
[0304] It should be understood that the computer device described in the embodiments of the present application can execute the description of the above-mentioned image processing method in the corresponding embodiments above, and can also execute the description of the above-mentioned image processing device in the corresponding embodiments above, which will not be repeated here. In addition, the description of the beneficial effects of adopting the same method will not be repeated.
[0305] In addition, it should be pointed out here that: the embodiment of the present application also provides a computer-readable storage medium, and the above-mentioned computer-readable storage medium stores a computer program executed by the image processing device mentioned above, and the above-mentioned computer program includes program instructions. When the above-mentioned processor executes the above-mentioned program instructions, it can execute the description of the above-mentioned image processing method in the corresponding embodiment above, so it will not be repeated here. In addition, the description of the beneficial effects of using the same method will not be repeated. For technical details not disclosed in the computer-readable storage medium embodiment involved in this application, please refer to the description of the method embodiment of this application.
[0306] As an example, the above program instructions may be deployed on a computer device for execution, or deployed on at least two computer devices at one location for execution, or executed on at least two computer devices distributed at at least two locations and interconnected through a communication network. At least two computer devices distributed at at least two locations and interconnected through a communication network may constitute a blockchain network.
[0307] The computer-readable storage medium may be the image processing apparatus provided in any of the above embodiments or the central storage unit of the computer device, such as a hard disk or a memory of the computer device. The computer-readable storage medium may also be an external storage device of the computer device, such as a plug-in hard disk, a smart memory card (Smart Media card, SMC), a secure digital (Secure digital, SD) card, a flash card, etc., provided on the computer device.
[0308] Furthermore, the computer-readable storage medium may also include both the central storage unit of the computer device and an external storage device. The computer-readable storage medium is used to store the computer program and other programs and data required by the computer device. The computer-readable storage medium may also be used to temporarily store data that has been output or is to be output.
[0309] The terms "first", "second", etc. in the description, claims, and drawings of the embodiments of the present application are used to distinguish between contents in different media, rather than to describe a specific order. In addition, the terms "including" and any of their variations are intended to cover non-exclusive inclusions. For example, a process, method, device, product, or equipment that includes a series of steps or units is not limited to the listed steps or modules, but may optionally include steps or modules that are not listed, or may optionally include other step units inherent to these processes, methods, devices, products, or equipment.
[0310] The data collection and processing in this application should be strictly in accordance with the requirements of relevant national laws and regulations when applied in practice, and the informed consent or separate consent of the personal information subject should be obtained. Subsequent data use and processing should be carried out within the scope of authorization of laws and regulations and the personal information subject.
[0311] The embodiment of the present application also provides a computer program product, including a computer program / instruction, which, when executed by a processor, implements the description of the above-mentioned image processing method and decoding method in the corresponding embodiment above, so it will not be repeated here. In addition, the description of the beneficial effects of adopting the same method will not be repeated. For technical details not disclosed in the embodiment of the computer program product involved in the present application, please refer to the description of the method embodiment of the present application.
[0312] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in terms of function in the above description. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0313] The method and related apparatus provided by the embodiment of the present application are described with reference to the method flow chart and / or structural schematic diagram provided by the embodiment of the present application, and each process and / or box of the method flow chart and / or structural schematic diagram, as well as the combination of the processes and / or boxes in the flow chart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable network connection device to generate a machine, so that the instructions executed by the processor of the computer or other programmable network connection device generate a device for implementing the functions specified in one process or multiple processes in the flow chart and / or one box or multiple boxes in the structural schematic diagram.
[0314] The computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable network-connected device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture including an instruction device that implements the functions specified in one or more processes of the flowchart and / or one or more blocks of the structural diagram. These computer program instructions may also be loaded onto a computer or other programmable network-connected device, so that a series of operating steps are performed on the computer or other programmable device to produce a computer-implemented process, so that the instructions executed on the computer or other programmable device provide steps for implementing the functions specified in one or more processes of the flowchart and / or one or more blocks of the structural diagram.
[0315] The above disclosure is only the preferred embodiment of the present application, which 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 N connected domains in the image to be processed, and attribute information of the N connected domains; N is a positive integer; The attribute information includes pixel label values corresponding to the N connected domains and the number of connected domains in the image; Determining connected domains respectively associated with M binarization engines according to the number of connected domains in the image and pixel label values respectively corresponding to the N connected domains; Generate a valid label value interval i corresponding to the binarization engine i according to the pixel label values of the connected domain corresponding to the binarization engine i; The pixel label value of the connected domain corresponding to the binarization engine i belongs to the valid label value interval; i is a positive integer less than or equal to M; Determine the valid label value interval i as the binarization strategy of the binarization engine i, until the binarization strategies corresponding to the M binarization engines are respectively obtained; M is a positive integer less than or equal to N; The M binarization engines are called in parallel to perform binarization processing on the images respectively according to their corresponding binarization strategies to obtain M binarized images; Q contour search engines are called in parallel to perform contour searches on the N connected domains in the M binary images; Q is a positive integer less than or equal to N.
2. The method according to claim 1, characterized in that The determining, according to the number of connected domains in the image and the pixel label values respectively corresponding to the N connected domains, connected domains respectively associated with the M binarization engines comprises: Determining the number of connected domains to be associated with the M binarization engines respectively according to the number of connected domains in the image; If the number of connected domains to be associated with the binary engine i is single, any connected domain that is not associated among the N connected domains is determined as the connected domain associated with the binary engine i; If the number of connected domains to be associated with the binarization engine i is k, then k connected domains that are not associated and have continuous pixel label values among the N connected domains are determined as connected domains associated with the binarization engine i; k is an integer greater than 1 and less than N; Until the connected domains respectively associated with the M binarization engines are obtained.
3. The method according to claim 1, characterized in that The M binarization engines include a binarization engine i, and the binarization strategy corresponding to the binarization engine i includes a valid label value interval i, where i is a positive integer less than or equal to M; The binarization engine i performs binarization processing on the image according to its corresponding binarization strategy, including: Calling the binarization engine i, obtaining valid pixel points in the image whose pixel label values belong to the valid label value interval i, and binarizing the pixel values of the valid pixel points into valid values; The binarization engine i is called to obtain invalid pixels in the image whose pixel label values do not belong to the valid label value interval i, and the pixel values of the invalid pixels are binarized into invalid values to obtain a binarized image i.
4. The method according to claim 1, characterized in that The parallel calling of Q contour search engines to perform contour search on the N connected domains in the M binary images includes: Invoke a task scheduling management engine to allocate connected domains to the Q contour search engines; The Q contour search engines are called in parallel to perform contour searches on the connected domains corresponding to the M binary images.
5. The method according to claim 4, characterized in that The calling of the task scheduling management engine to allocate connected domains to the Q contour search engines includes: If M is less than or equal to Q, the task scheduling management engine is called to count the number of connected areas whose pixel values in the M binary images are valid values as the valid number; Calling the task scheduling management engine to obtain performance parameters corresponding to the Q profile search engines; The task scheduling management engine is called to allocate connected domains to the Q contour search engines according to the performance parameters and the effective numbers respectively corresponding to the M binary images.
6. The method according to claim 5, characterized in that The calling of the task scheduling management engine to allocate connected domains to the Q contour search engines according to the performance parameters and the effective numbers respectively corresponding to the M binary images includes: Calling the task scheduling management engine to generate serial numbers corresponding to the Q profile search engines respectively according to the performance parameters; Calling the task scheduling management engine to generate serial numbers corresponding to the M binary images respectively according to the valid quantities corresponding to the M binary images respectively; Calling the task scheduling management engine, determining the binary image whose serial number matches the serial number of the contour search engine j among the M binary images as the binary image associated with the contour search engine j; j is a positive integer less than or equal to Q; The task scheduling management engine is called to assign the connected domains whose pixel values are valid values in the binary image associated with the contour search engine j to the contour search engine j until the Q contour search engines are all assigned connected domains.
7. The method according to claim 4, characterized in that The calling of the task scheduling management engine to allocate connected domains to the Q contour search engines includes: If M is greater than Q, the task scheduling management engine is called to obtain the processing priorities corresponding to the N connected domains and the working states corresponding to the Q contour search engines; Connected domains are allocated to the Q contour search engines according to the processing priorities and the working states.
8. The method according to claim 7, characterized in that The calling of the task scheduling management engine to obtain the processing priorities respectively corresponding to the N connected domains includes: Calling the task scheduling management engine to obtain the performance parameters corresponding to the M binarization engines respectively; The processing priorities respectively corresponding to the N connected domains are determined according to the performance parameters respectively corresponding to the M binarization engines.
9. The method according to claim 7, characterized in that The calling of the task scheduling management engine to obtain the processing priorities respectively corresponding to the N connected domains includes: Calling the task scheduling management engine to obtain description information of the image; The processing priorities respectively corresponding to the N connected domains are determined according to the description information of the image.
10. The method according to claim 4, characterized in that The calling of the task scheduling management engine to allocate connected domains to the Q contour search engines includes: constructing an image processing task on the image; The image processing task is split into N subtasks; one connected domain corresponds to one subtask; The task scheduling management engine is called to allocate the N subtasks to the Q contour search engines.
11. The method according to claim 10, characterized in that The parallel calling of the Q contour search engines to perform contour searches on the connected domains corresponding to the M binary images comprises: Calling the task scheduling management engine to send parallel execution instructions to the Q contour search engines; The Q contour search engines are controlled by the parallel execution instructions to execute their respective assigned subtasks in parallel according to the M binary images.
12. The method according to claim 10, characterized in that The N subtasks include subtask a, and the subtask a corresponds to a connected domain A; the Q contour search engines include contour search engine j; the subtask a is assigned to the contour search engine j, where a is a positive integer less than or equal to N, and j is a positive integer less than or equal to Q; The contour search engine j performs contour search processing on the connected domain A, including: The contour search engine j obtains a binary image b whose pixel values of the pixels in the connected domain A are valid values from the M binary images; b is a positive integer less than or equal to M; The contour search engine j performs contour search in the binary image b starting from the starting point according to the coordinates of the starting point of the connected domain A in the image, and obtains the boundary points of the connected domain A; Based on the starting point and boundary points of the connected domain A, the contour of the connected domain A is determined.
13. An image processing device, characterized in that: include: An acquisition module, used for acquiring N connected domains in the image to be processed, and attribute information of the N connected domains; N is a positive integer; The attribute information includes pixel label values corresponding to the N connected domains and the number of connected domains in the image; A generating module, used for determining connected domains respectively associated with M binarization engines according to the number of connected domains in the image and the pixel label values respectively corresponding to the N connected domains; Generate a valid label value interval i corresponding to the binarization engine i according to the pixel label values of the connected domain corresponding to the binarization engine i; The pixel label value of the connected domain corresponding to the binarization engine i belongs to the valid label value interval; i is a positive integer less than or equal to M; Determine the valid label value interval i as the binarization strategy of the binarization engine i, until the binarization strategies corresponding to the M binarization engines are respectively obtained; M is a positive integer less than or equal to N; A first calling module is used to call the M binarization engines in parallel, and perform binarization processing on the images respectively according to their corresponding binarization strategies to obtain M binarized images; The second calling module is used to call Q contour search engines in parallel to perform contour search on the N connected domains in the M binary images; Q is a positive integer less than or equal to N.
14. An integrated chip, characterized in that: The integrated chip includes a storage area and multiple engines; the storage area includes at least one of a memory and an on-chip cache; wherein, The integrated chip schedules each of the engines to execute the method according to any one of claims 1-12.
15. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 12 are implemented.
16. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 12 are implemented.
17. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 12 are implemented.
Citation Information
Patent Citations
Binary image connected region parallel detection method and system
CN105225236A
Human face contour parallel calculation method and apparatus
CN108052891A