Image Processing Apparatus, Image Processing Method, and Electronic Device

The image processing device uses the connection area marking of the target image, which solves the problems of low efficiency and high complexity in the prior art, and realizes efficient and fast connection area marking and label map data output.

CN114897925BActive Publication Date: 2025-07-08FUZHOU ROCKCHIP SEMICON
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202210529875.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-05-16
Publication Date
2025-07-08
Estimated Expiration
2042-05-16

AI Technical Summary

Technical Problem

The prior art has low efficiency, high complexity, large computing volume, poor performance in the analysis of the connected area, and high bandwidth requirements, which is not conducive to chip implementation.

Method used

The image processing device is adopted, including a pixel point marking module, a mapping relationship update module, a connection area screening module and a tag map data mapping module. The target image is marked through the hardware architecture, and the large-area connection area is marked with limited label values to reduce hardware overhead.

Benefits of technology

It realizes efficient connected area marking, improves labeling efficiency, reduces hardware overhead, and can quickly output connected area tag map data, which has the advantages of fast speed, high efficiency and power saving.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114897925B_ABST
    Figure CN114897925B_ABST
Patent Text Reader

Abstract

The present disclosure provides an image processing apparatus, an image processing method, and an electronic device. The apparatus includes: a pixel point marking module configured to receive a target image and sequentially mark unmarked target pixel points in the target image until the target image is completely marked or there is no unused tag value, so as to generate first tag map data; a mapping relationship updating module configured to merge equivalent tag values and update the mapping relationship between the target pixel points and the tag values according to the merging result; a connected region screening module configured to screen the scanned connected regions and update the mapping relationship according to the screening result; and a tag map data mapping module configured to update the first tag map data according to the mapping relationship to generate second tag map data. The apparatus can implement the analysis of connected regions of a target image.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of image processing, and particularly to an image processing apparatus, an image processing method, and an electronic device. Background Art

[0002] A connected component usually refers to an image area composed of pixel points with the same label value and adjacent in position in an image. Connected Component Analysis refers to the process of merging pixel points with the same label value in an image into one or more areas, and then obtaining and analyzing and screening these areas, and finally outputting a label map and its related parameters. Currently, connected component analysis has been widely applied to scenarios such as OCR (Optical Character Recognition), visual tracking, and medical image processing. Summary of the Invention

[0003] An object of the present disclosure is to provide an image processing apparatus, an image processing method, and an electronic device for marking connected components in a target image.

[0004] To achieve the above object and other related objects, a first aspect of the present disclosure provides an image processing apparatus, including: a pixel point marking module configured to receive a target image and sequentially mark unmarked target pixel points in the target image until the target image is marked completely or there is no unused label value, so as to generate first label map data; a mapping relationship updating module configured to merge equivalent label values and update the mapping relationship between the target pixel points and the label values according to the merging result; a connected region screening module configured to screen the scanned connected regions and update the mapping relationship according to the screening result; and a label map data mapping module configured to update the first label map data according to the mapping relationship to generate second label map data.

[0005] In an embodiment of the first aspect, the image processing apparatus further includes: a control module configured to generate an image data reading command, a first label map data writing command, and a label map data reading command; a data reading module configured to read the target image in response to the image data reading command and send the target image to the pixel point marking module; and a data writing module configured to write the first label map data into a memory in response to the first label map data writing command. The data reading module is further configured to read the first label map data from the memory in response to the label map data reading command and send the first label map data to the label map data mapping module, and the data writing module is further configured to write the second label map data into the memory.

[0006] In an embodiment of the first aspect, the image processing apparatus further includes a first cache unit, a second cache unit, a third cache unit, and a fourth cache unit. The pixel point marking module is configured to: use the first un-scanned target pixel point in the target image as the current pixel point; mark the current pixel point and update the label value of the previous row stored in the first cache unit, the connected region area stored in the second cache unit, the connected region coordinates stored in the third cache unit, and the mapping relationship stored in the fourth cache unit according to the marking result; and if the target image is not completely marked and there are unused label values, use the next target pixel point of the current pixel point as the new current pixel point until the target image is completely marked or there are no unused label values.

[0007] In an embodiment of the first aspect, the mapping relationship updating module is configured to: obtain the equivalent label value according to the mapping relationship; and merge the equivalent label values and update the connected region area stored in the second cache unit, the connected region coordinates stored in the third cache unit, and the mapping relationship stored in the fourth cache unit according to the merging result.

[0008] In an embodiment of the first aspect, the connected region screening module is configured to: screen the scanned connected regions according to the connected region area stored in the second cache unit to obtain the screened connected regions that meet the screening conditions; and update the connected region area stored in the second cache unit, the connected region coordinates stored in the third cache unit, and the mapping relationship stored in the fourth cache unit according to the screened connected regions.

[0009] In an embodiment of the first aspect, the connected region screening module is configured to: if the current row and the row above it contain all the tag values, use the scanned connected regions with an area smaller than an area threshold as the screened connected regions; and if the current row and the row above it do not contain all the tag values, use the scanned connected regions with an area smaller than the area threshold and not intersecting with the current row and the row above it as the screened connected regions.

[0010] In an embodiment of the first aspect, the connected region screening module is configured to: if the screened connected regions do not meet the preset conditions, adjust the area threshold and screen the scanned connected regions according to the adjusted area threshold to obtain the screened connected regions.

[0011] In an embodiment of the first aspect, the connected region screening module is configured to: if the current row and the row above it contain all the tag values, adjust the area threshold to be greater than the maximum value of the areas of the connected regions stored in the second buffer unit; and if the current row and the row above it do not contain all the tag values, adjust the area threshold to be greater than or equal to the minimum value of the areas of the connected regions stored in the second buffer unit.

[0012] In an embodiment of the first aspect, the image processing apparatus further includes: an initialization module configured to initialize the first buffer unit, the second buffer unit, the third buffer unit, and the fourth buffer unit.

[0013] In an embodiment of the first aspect, the image processing apparatus further includes: an initialization module configured to initialize the mapping relationship stored in the fourth buffer unit after the first tag map data is updated.

[0014] In an embodiment of the first aspect, if the target image is not completely labeled, the first tag map data is repeatedly updated until the target image is completely labeled.

[0015] In an embodiment of the first aspect, the control module is further configured to generate a second tag map write command, and the data write module is configured to write the second tag map data into the memory in response to the second tag map write command.

[0016] In an embodiment of the first aspect, the image processing apparatus further includes: a tag value identification register configured to store a tag value identification for identifying the usage status of each tag value.

[0017] A second aspect of the present disclosure provides an image processing method, the image processing method comprising: reading a target image; sequentially labeling unlabeled target pixel points in the target image until the target image is completely labeled or there is no unused tag value, to generate first tag map data; merging equivalent tag values, and updating the mapping relationship between the target pixel points and the tag values according to the merging result; screening the scanned connected regions, and updating the mapping relationship according to the screening result; and updating the first tag map data according to the mapping relationship to generate second tag map data.

[0018] A third aspect of the present disclosure provides an electronic device, the electronic device comprising: a memory configured to store a computer program; and a processor communicatively connected to the memory and configured to call the computer program to execute the image processing method according to any one of the first aspects of the present disclosure.

[0019] As described above, the image processing apparatus, the image processing method, and the electronic device according to one or more embodiments of the present disclosure have the following beneficial effects:

[0020] The image processing apparatus provides a hardware architecture, based on which the labeling of connected regions in a target image can be realized. In addition, the image processing apparatus can use limited tag values to label connected regions with a large area in the target image, has a high labeling efficiency, and can reduce the hardware overhead in the process of labeling connected regions. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] Figure 1A It shows a schematic structural diagram of an image processing system in an embodiment of the present disclosure.

[0022] Figure 1B It shows a schematic connection diagram inside an image processing apparatus in an embodiment of the present disclosure.

[0023] Figure 2 It shows a flowchart of labeling target pixel points in an embodiment of the present disclosure.

[0024] Figure 3 It shows a flowchart of updating the mapping relationship in an embodiment of the present disclosure.

[0025] Figure 4 It shows a flowchart of labeling target pixel points in an embodiment of the present disclosure.

[0026] Figure 5 It shows a flowchart of an image processing method in an embodiment of the present disclosure.

[0027] Figure 6 It shows a schematic structural diagram of an electronic device in an embodiment of the present disclosure. Detailed implementation manners

[0028] The following uses specific specific examples to illustrate the implementation manners of the present disclosure. Those skilled in the art can easily understand other advantages and effects of the present disclosure from the content disclosed in this specification. The present disclosure can also be implemented or applied through other different specific implementation manners. Various details in this specification can also be modified or changed based on different viewpoints and applications without departing from the spirit of the present disclosure. It should be noted that, without conflict, the following embodiments and the features in the embodiments can be combined with each other.

[0029] It should be noted that the diagrams provided in the following embodiments only illustrate the basic concept of the present disclosure in a schematic manner. The diagrams only show the components related to the present disclosure and are not drawn according to the number, shape, and size of the components in actual implementation. The type, quantity, and ratio of each component in its actual implementation can be arbitrarily changed, and the component layout type may also be more complex. In addition, in this article, relational terms such as "first", "second", etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations.

[0030] In related technologies, a method similar to software processing is usually adopted to implement connected region analysis. During the analysis process, the number of label values is not restricted, so the previous label values need to be repeatedly modified after label equivalence. On the other hand, the number of connected regions is not restricted in related technologies during connected region analysis, so a large number of screening calculations are required to obtain the final analysis result. Therefore, there are problems such as low efficiency, high complexity, large computational amount, and poor performance in related technologies during connected region analysis. In addition, related technologies have relatively high requirements for bandwidth, which is not conducive to chip implementation.

[0031] At least for the above problems, an image processing system is provided according to an embodiment of the present disclosure. Hereinafter, the specific implementation manners of the present disclosure will be described with reference to the accompanying drawings through exemplary embodiments.

[0032] Figure 1A is a schematic structural diagram showing an image processing system according to an embodiment of the present disclosure. As Figure 1AAs shown, in the embodiment of the present disclosure, the image processing system includes an image processing device 1, a general controller 2, a first memory 3, and a second memory 4. The general controller 2 is connected to the image processing device 1, and is configured to send a start signal to the image processing device 1 to cause the image processing device 1 to start performing connected component analysis on a target image, and is configured to send an end signal to the image processing device 1 to cause the image processing device 1 to end the processing of the target image. The first memory 3, for example, may be an image data cache unit, and is connected to the image processing device 1 for storing the target image. The second memory 4, for example, may be a DDR (Double Data Rate) memory, and is connected to the image processing device 1 for storing first label map data and second label map data generated when the image processing device 1 processes the target image.

[0033] Figure 1B is an example diagram showing the internal connection relationship of the image processing device 1 in the embodiment of the present disclosure. As Figure 1B shown, in the embodiment of the present disclosure, the image processing device 1 includes a pixel point marking module 11, a mapping relationship updating module 12, a connected component screening module 13, and a label map data mapping module 14.

[0034] The pixel point marking module 11 is configured to receive a target image, and sequentially mark unmarked target pixel points in the target image until the target image is completely marked or there is no unused label value, so as to generate first label map data. Wherein the target image may be a binary image, and the target pixel points are, for example, foreground pixel points in the target image. Specifically, the pixel point marking module 11 may scan the pixel points in the target image sequentially along a specific direction, for example, from left to right and from top to bottom. If a target pixel point is scanned, the target pixel point is marked to generate the first label map data. For each of the marked target pixel points, the connected components that have been scanned may be obtained according to their label values as the scanned connected components. For example, the target pixel points with the same label value may be merged into one scanned connected component.

[0035] The mapping relationship updating module 12 is configured to merge equivalent tag values and update the mapping relationship between the target pixel points and the tag values according to the merging result. Specifically, for any two scanned connected regions, if they are connected to each other, the tag values of the two scanned connected regions are equivalent tag values, where the tag value of the scanned connected region refers to the tag values of all target pixel points included in the scanned connected region. The method for merging the equivalent tag values can be: selecting one tag value from the equivalent tag values as the merged tag value, and the remaining tag values as the equivalent-by tag values; marking the target pixel points corresponding to each of the equivalent-by tag values as the merged tag value, and then configuring each of the equivalent-by tag values as unused and updating the mapping relationship. For example, if tag values a, b, and c are equivalent tag values, where a < b < c, a can be selected as the merged tag value in step S108. At this time, b and c are the equivalent-by tag values. Based on this, the mapping relationship updating module 12 can configure the tag values of the target pixel points with tag values b and c (that is, the target pixel points corresponding to tag values b and c) as a, and configure tag values b and c as unused.

[0036] The connected region screening module 13 is configured to screen the scanned connected regions and update the mapping relationship according to the screening result. Specifically, the connected region screening module 13 can update the scanned connected regions according to the tag values after equivalent merging and screen the updated scanned connected regions to obtain one or more screened connected regions. Thereafter, the connected region screening module 13 can configure the tag values of the screened connected regions as unused and update the mapping relationship.

[0037] The label map data mapping module 14 is configured to update the first label map data according to the mapping relationship to generate a second label map data. Based on the second label map data, the connected regions in the target image can be obtained.

[0038] Optionally, the image processing device 1 may further include a control module 15, a data reading module (not shown in the figure), and a data writing module (not shown in the figure). The control module 15 is configured to generate an image data reading command, a first label map data writing command, and a label map data reading command. The data reading module is configured to read the target image in response to the image data reading command, and send the target image to the pixel marking module. The data writing module is configured to write the first label map data into the second memory 4 in response to the first label map data writing command. In addition, the data reading module is further configured to read the first label map data from the second memory 4 in response to the label map data reading command, and send the first label map data to the label map data mapping module. The data writing module is further configured to write the second label map data into the second memory 4.

[0039] Optionally, the data writing module may also be configured to write parameters such as the area and coordinates of the connected region into the second memory 4.

[0040] Optionally, the control module 15 may send the image data reading command to the data reading module only once, and the data reading module continuously sends the data in the target image to the pixel marking module 11 in response to the image data reading command. For example, every time the image processing device 1 finishes processing n rows of data, the data reading module sends the unprocessed n rows of data in the target image to the pixel marking module 11, where n is a positive integer.

[0041] In addition, in one or more other embodiments, the data reading module may also be included outside the image processing device 1, and in this case, the data reading module is communicatively connected to the image processing device 1. In one or more other embodiments, the data writing module may also be included outside the image processing device 1, and in this case, the data writing module is communicatively connected to the image processing device 1.

[0042] Optionally, the image processing device may further include a label data cache unit 5. The data reading module reads the first label map data from the second memory 4 into the label data cache unit 5, and reads the first label map data from the label data cache unit 5 and sends it to the label map data mapping module 14.

[0043] In an embodiment according to the present disclosure, the image processing apparatus 1 may further include a first buffer unit 161, a second buffer unit 162, a third buffer unit 163, and a fourth buffer unit 164. The first buffer unit 161 is used to store the tag values of the previous row, where the tag values of the previous row refer to the tag values of all target pixel points included in the row above the current pixel point (i.e., the current row). The second buffer unit 162 is used to store the area of the scanned connected region. The third buffer unit 163 is used to store the coordinates of the scanned connected region. The fourth buffer unit 164 is used to store the mapping relationship, and the mapping relationship may be stored in the fourth buffer unit 164 in the form of a mapping table, for example.

[0044] Optionally, the coordinates of the scanned connected region may include x_left, x_right, y_top, and y_bottom, where x_left and x_right are the abscissas of the leftmost and rightmost pixel points in the scanned connected region, respectively, and y_top and y_bottom are the ordinates of the uppermost and lowermost pixel points in the scanned connected region, respectively.

[0045] In an embodiment of the present disclosure, the pixel marking module may be configured to perform the following steps S21 to S23.

[0046] In step S21, the first un-scanned target pixel point in the target image is taken as the current pixel point. Specifically, when step S21 is first executed, the first un-scanned target pixel point in the target image is the first target pixel point in the target image. During the process of repeatedly executing step S21, the first un-scanned target pixel point in the target image refers to the next target pixel point of the last target pixel point scanned in the previous cycle.

[0047] In step S22, the current pixel point is marked and the tag values of the previous row stored in the first buffer unit, the area of the connected region stored in the second buffer unit, the coordinates of the connected region stored in the third buffer unit, and the mapping relationship stored in the fourth buffer unit are updated according to the marking result.

[0048] In step S23, if the target image is not completely marked and there are unused tag values, the next target pixel point of the current pixel point is taken as the new current pixel point, and steps S22 and S23 are repeatedly executed until the target image is completely marked or there are no unused tag values.

[0049] Optionally, the pixel marking module 11 described in step S22 may mark the current pixel according to the label values of the neighboring pixels of the current pixel, where the neighboring pixels of the current pixel refer to the target pixels included in the neighborhood of the current pixel. The neighborhood of the current pixel may be an eight-neighborhood or a four-neighborhood, and in specific applications, it may be specified by the general controller 2 to use an eight-neighborhood or a four-neighborhood. For example, when the image processing device 1 scans the target image in the order from left to right and from top to bottom, if the eight-neighborhood of the current pixel is used to mark the current pixel and the coordinates of the current pixel are (x n , y n ), then the pixel marking module 11 may mark the current pixel according to the label values of its left pixel (x n-1 , y n ), the upper left pixel (x n-1 , y n-1 ), the upper pixel (x n , y n-1 ) and / or the upper right pixel (x n+1 , y n-1 ). Among them, the label values of the pixels (x n , y n-1 ), (x n-1 , y n-1 ) and (x n+1 , y n-1 ) can be obtained from the first cache unit 161. In particular, when the current pixel is located at the leftmost side of the target image, the pixel values of its left pixel and upper left pixel can be fixed to 0.

[0050] Optionally, the pixel point marking module 11 may mark the current pixel point according to the following rules: If the pixel value of the current pixel point is 0, the label value of the current pixel point is marked as 0; otherwise, if the label value of the pixel point above the current pixel point is not 0, the label value of the current pixel point is marked as the label value of its upper pixel point; otherwise, if the label values of the upper left pixel point and the upper right pixel point of the current pixel point are both not 0, the label value of the current pixel point is marked as the label value after equivalence of its upper left pixel point and upper right pixel point; otherwise, if the label values of the left pixel point and the upper right pixel point of the current pixel point are both not 0, the label value of the current pixel point is marked as the label value after equivalence of its left pixel point and upper right pixel point; otherwise, if the label value of the upper right pixel point of the current pixel point is not 0, the label value of the current pixel point is marked as the label value of its upper right pixel point; otherwise, if the label value of the upper left pixel point of the current pixel point is not 0, the label value of the current pixel point is marked as the label value of its upper left pixel point; otherwise, if the label value of the left pixel point of the current pixel point is not 0, the label value of the current pixel point is marked as the label value of its left pixel point; otherwise, the label value of the current pixel point is marked as an unused label value. It should be noted that the above marking rules are only a feasible way of the embodiments of the present disclosure, but the present disclosure is not limited thereto.

[0051] Optionally, the mapping relationship updating module 12 is configured to execute Figure 3 the steps S31 and S32 shown below.

[0052] In step S31, the equivalent label value is obtained according to the mapping relationship.

[0053] In step S32, the equivalent label values are merged, and according to the merging result, the area of the connected region stored in the second cache unit 162, the coordinates of the connected region stored in the third cache unit 163, and the mapping relationship stored in the fourth cache unit 164 are updated. For example, if the label value of the scanned connected region 1 is a, the label value of the scanned connected region 2 is b, and the label value of the scanned connected region 3 is c, and a, b, and c are equivalent label values, then after a, b, and c are equivalently merged into a, the label values of all target pixel points in the scanned connected regions 2 and 3 are reconfigured to a. At this time, the mapping relationship updating module 12 may merge the areas of the scanned connected regions 2 and 3 stored in the second cache unit 162 into the scanned connected region 1, merge the coordinates of the scanned connected regions 2 and 3 stored in the third cache unit 163 into the scanned connected region 1, and clear the mapping relationship between the label values b, c and the pixel points stored in the fourth cache unit 164.

[0054] Optionally, the connected region screening module 13 is configured to: if the current row and the row above it contain all the tag values, use the scanned connected regions with an area smaller than an area threshold as the screened connected regions; and if the current row and the row above it do not contain all the tag values, use the scanned connected regions with an area smaller than the area threshold and not intersecting with the current row and the row above it as the screened connected regions.

[0055] Optionally, the connected region screening module 13 may screen the scanned connected regions according to the relationship between the area of the scanned connected regions stored in the second buffer unit 162 and an area threshold.

[0056] Optionally, if the current row and the row above it contain all the tag values, the connected region screening module 13 may use the scanned connected regions with an area smaller than the area threshold as the screened connected regions. The area of the scanned connected regions may be obtained from the second buffer unit 162.

[0057] Optionally, if the current row and the row above it do not contain all the tag values, the connected region screening module 13 may use the scanned connected regions with an area smaller than the area threshold and not intersecting with the current row and the row above it as the screened connected regions. The area of the scanned connected regions may be obtained from the second buffer unit 162. The fact that the scanned connected region does not intersect with the current row and the row above it means that all the pixel points in the scanned connected region are not included in the current row and the row above it. In this way, the scanned connected regions intersecting with the current row and the row above it can be protected, preventing these scanned connected regions from being deleted after only a part of them has been scanned, thus ensuring the integrity of the connected regions as much as possible.

[0058] Optionally, the connected region screening module 13 may further be configured to update the area of the connected regions stored in the second cache unit 162, the coordinates of the connected regions stored in the third cache unit 163, and the mapping relationship stored in the fourth cache unit 164 according to the screened connected regions. Specifically, the connected region screening module 13 may clear the area of the screened connected regions stored in the second cache unit 162, clear the coordinates of the screened connected regions stored in the third cache unit 163, and clear the mapping relationship of the screened tag values stored in the fourth cache unit 164, where the screened tag value refers to the tag value of the target pixel points included in the screened connected regions. In addition, the connected region screening module 13 may configure the tag value of the screened connected regions as unused so that these tag values can be continuously used to mark the un-scanned target pixel points during the subsequent marking process, where the tag value of the screened connected regions refers to the tag values of all the target pixel points included in the screened connected regions.

[0059] Optionally, in the embodiments of the present disclosure, the connected region screening module 13 may further be configured to: if the screened connected regions do not meet the preset conditions, adjust the area threshold and screen the scanned connected regions according to the adjusted area threshold to obtain the screened connected regions. The preset conditions may be set according to actual requirements. For example, the preset conditions may be configured such that the number of the screened connected regions is 0.

[0060] Optionally, the connected region screening module 13 may further be configured to adjust the area threshold in a step-by-step manner, and the step size used in the adjustment process may be set according to actual requirements.

[0061] Optionally, the connected region screening module 13 may further be configured to: if the current row and the row above it contain all the tag values, adjust the area threshold to be greater than the maximum value of the areas of the connected regions stored in the second cache unit; if the current row and the row above it do not contain all the tag values, adjust the area threshold to be greater than or equal to the minimum value of the areas of the connected regions stored in the second cache unit.

[0062] Optionally, the image processing device 1 may further include an initialization module 17. The initialization module 17 is configured to initialize the first buffer unit 161, the second buffer unit 162, the third buffer unit 163, and the fourth buffer unit 164. Specifically, the initialization module 17 may clear the first buffer unit 161 and the second buffer unit 162 to initialize them, and may initialize the connected region coordinates stored in the third buffer unit 163 to a default rectangular box, and the coordinates of the default rectangular box are (x_left = 0xffff, x_right = 0x0, y_top = 0xffff, y_bottom = 0x0). In addition, the initialization module 17 may also initialize the mapping relationship stored in the fourth buffer unit 164. For example, when using a mapping table to represent the mapping relationship, the initialization module 17 may initialize the mapping table in the fourth buffer unit 164 to 0 to 2 m -1, where the tag value is m bits, m is a positive integer, and its value is, for example, 8.

[0063] Optionally, the initialization module 17 may also be configured to initialize the mapping relationship stored in the fourth buffer unit 164.

[0064] Optionally, if the target image is not marked completely, the first tag map data is repeatedly updated until the target image is marked completely. Specifically, Figure 4 is a flowchart showing the marking of a target image according to an embodiment of the present disclosure. As Figure 4 shown, the process includes the following steps S41 to step S45.

[0065] In step S41, the pixel point marking module 11 receives a target image, and sequentially marks the unmarked target pixel points in the target image until the target image is marked completely or there is no unused tag value, so as to generate first tag map data.

[0066] In step S42, the mapping relationship updating module 12 merges equivalent tag values, and updates the mapping relationship between the target pixel points and the tag values according to the merging result.

[0067] In step S43, the connected region screening module 13 screens the scanned connected regions, and updates the mapping relationship according to the screening result.

[0068] In step S44, the tag map data mapping module 14 updates the first tag map data according to the mapping relationship to generate second tag map data.

[0069] In step S45, if the target image is not completely labeled and there are unused tag values, the pixel point labeling module 11 continues to label the unlabeled target pixel points in the target image until the target image is completely labeled or there are no unused tag values, and updates the first tag map data. Steps S42 to S45 are repeatedly executed until the target image is completely labeled or there are no unused tag values.

[0070] In an embodiment according to the present disclosure, the control module 15 is further configured to generate a second tag map write command, and the data write module is configured to write the second tag map data into the second memory 4 in response to the second tag map write command. Preferably, the control module 15 may send the second tag map write command to the data write module only once, and thereafter the data write module will continuously write the second tag map data into the second memory 4.

[0071] In an embodiment according to the present disclosure, the image processing apparatus 1 further includes a tag value identification register, which is configured to store a tag value identification for identifying the usage status of each tag value. The number of bits of the tag value identification is the same as the number of tag values, and each bit of the tag value identification corresponds to a tag value, and its value is used to identify the usage status of the corresponding tag value. For example, if a certain bit of the tag value identification is 1, it means that the corresponding tag value is used, and if a certain bit of the tag value identification is 0, it means that the corresponding tag value is unused.

[0072] Optionally, the tag value identification may include a tag value usage status identification label_flag, a current row tag value identification cur_label_flag, and a previous row tag value identification last_label_flag. The current row tag value identification cur_label_flag is used to identify the tag values that appear in the current row, and the previous row tag value identification last_label_flag is used to identify the tag values that appear in the previous row. Both of them require a 2 m -bit register for caching.

[0073] Optionally, the default value of the label value usage identifier label_flag can be configured to all 1s. For example, for an 8-bit label value, the default value of its label value usage identifier label_flag can be ffff_ffff_ffff_ffff_ffff_ffff_ffff_ffff_ffff_ffff_ffff_ffff_ffff_ffff_ffff_ffff. During the process of processing the target image, if a label value is used, the corresponding bit in the label value usage identifier label_flag is configured to 0. Based on this, when all bits in the label value usage identifier label_flag are 0, all label values have been used, that is, there are currently no unused label values. At this time, the label value usage identifier label_flag overflows, and the pixel marking module 11 sends an end signal to the control module 15. After remapping the first label map data between the last overflow position and the current overflow position into the second label map data, the pixel marking module 11 can use the currently unused label values for the next round of marking. Therefore, by configuring the equivalent label values as unused and the label values of the filtered connected regions as unused, the reuse of label values can be achieved.

[0074] Optionally, the default values of both the current row label value identifier cur_label_flag and the previous row label value identifier last_label_flag are all 0. During the process of the pixel marking module 11 marking the target pixel points, if a label value appears in the current row, the corresponding bit in the current row label value identifier cur_label_flag is configured to 1. After completing the marking of the target pixel points in the current row, the current row label value identifier cur_label_flag is assigned to the previous row label value identifier last_label_flag, and all bits in the current row label value identifier cur_label_flag are configured to 0, and then the marking of the next row continues.

[0075] Optionally, when the label value usage identifier label_flag overflows, if the sum of the current row label value identifier cur_label_flag and the previous row label value identifier last_label_flag is all 1, it indicates that all label values have appeared within the most recent two rows, that is, the current row and the previous row contain all label values. At this time, the connected region filtering module 12 can delete all connected regions and configure all bits in the label identifier label_flag to 1. Thereafter, all label values can be used again.

[0076] In an embodiment of the present disclosure, the tag graph data mapping module 14 remaps only the first tag graph between the last overflow and the current overflow according to the mapping relationship to generate the second tag graph data. This method can reduce the bandwidth and performance wasted by repeatedly modifying tag values.

[0077] According to another aspect of the present disclosure, an image processing method is also provided. Figure 5 It is a flowchart showing an image processing method according to an embodiment of the present disclosure. As Figure 5 shown, the image processing method in the embodiment of the present disclosure includes the following steps S51 to S55.

[0078] In step S51, the target image is read.

[0079] In step S52, the unlabeled target pixel points in the target image are labeled in sequence until the target image is completely labeled or there are no unused tag values, to generate the first tag graph data.

[0080] In step S53, equivalent tag values are merged, and the mapping relationship between the target pixel points and the tag values is updated according to the merging result.

[0081] In step S54, the scanned connected regions are screened, and the mapping relationship is updated according to the screening result.

[0082] In step S55, the first tag graph data is updated according to the mapping relationship to generate the second tag graph data.

[0083] The protection scope of the image processing method described in the present disclosure is not limited to the execution order of the steps listed in this embodiment. Any solution achieved by adding or subtracting steps of the prior art and replacing steps according to the principle of the present disclosure is included in the protection scope of the present disclosure.

[0084] In addition, the present disclosure also provides an image processing apparatus. The image processing apparatus can implement the image processing method described in the present disclosure. However, the implementation apparatus of the image processing method described in the present disclosure includes but is not limited to the image processing apparatus listed in this embodiment. Any structural deformation and replacement of the prior art made according to the principle of the present disclosure are included in the protection scope of the present disclosure.

[0085] According to yet another aspect of the present disclosure, an electronic device is also provided. Figure 6 It is a schematic structural diagram showing an electronic device 600 according to an embodiment of the present disclosure. As Figure 6As shown in the figure, in the embodiment of the present disclosure, the electronic device 600 includes a memory 610 and a processor 620. The memory 610 is configured to store a computer program. The processor 620 is communicatively connected to the memory 610 and is configured to call the computer program to execute the image processing method described in the present disclosure.

[0086] In summary, the image processing device described in the embodiment of the present disclosure can quickly output connected region label map data, area, and coordinates, and has the advantages of high speed, high efficiency, and power consumption saving compared with the software analysis method. In some embodiments, the image processing device can analyze 1 pixel point every two clocks on average, and its processing speed can reach up to 1080P@96fps at a 400MHZ clock.

[0087] In addition, the connected region analysis method in the related art needs to allocate the bit width of the label according to the image width and height. Assuming the image is 1080P, at least 21bit bit width is required in the related art to represent all label maps. In one or more embodiments of the present disclosure, the image processing device can fix the bit number of the label as m (for example, 8), thereby reducing the data bit width and DDR bit width required.

[0088] Furthermore, the image processing device described in one or more embodiments of the present disclosure can analyze various connected regions, support configurable area thresholds and accumulation steps, and can support the output of up to 2 m -1 connected region areas and coordinates.

[0089] Therefore, the present disclosure effectively overcomes various disadvantages in the prior art and has high industrial utilization value.

[0090] The above embodiments are only illustrative of the principles and effects of the present disclosure, and are not used to limit the present disclosure. Any person familiar with this technology can modify or change the above embodiments without departing from the spirit and scope of the present disclosure. Therefore, all equivalent modifications or changes made by those with ordinary knowledge in the technical field without departing from the spirit and technical ideas disclosed by the present disclosure should still be covered by the claims of the present disclosure.

Claims

1. An image processing apparatus, characterized in that, including: a pixel marking module, configured to receive a target image and sequentially mark unmarked target pixels in the target image until the target image is completely marked or there is no unused tag value, so as to generate first tag map data; a mapping relationship update module, configured to merge equivalent tag values and update the mapping relationship between the target pixels and the tag values according to the merging result; a connected region screening module, configured to screen the scanned connected regions, configure the tag values of the screened connected regions as unused and update the mapping relationship; a tag map data mapping module, configured to update the first tag map data according to the mapping relationship to generate second tag map data; and a first cache unit, a second cache unit, a third cache unit, and a fourth cache unit, wherein the pixel marking module is configured to: use the first un-scanned target pixel in the target image as the current pixel; mark the current pixel and update the tag value of the previous row stored in the first cache unit, the connected region area stored in the second cache unit, the connected region coordinates stored in the third cache unit, and the mapping relationship stored in the fourth cache unit according to the marking result; and if the target image is not completely marked and there is an unused tag value, use the next target pixel of the current pixel as the new current pixel until the target image is completely marked or there is no unused tag value, wherein the connected region screening module is configured to: screen the scanned connected regions according to the connected region area stored in the second cache unit to obtain the screened connected regions that meet the screening conditions; and update the connected region area stored in the second cache unit, the connected region coordinates stored in the third cache unit, and the mapping relationship stored in the fourth cache unit according to the screened connected regions.

2. The image processing apparatus according to claim 1, wherein further including: a control module, configured to generate an image data reading command, a first tag map data writing command, and a tag map data reading command; a data reading module, configured to read the target image in response to the image data reading command and send the target image to the pixel marking module; and a data writing module, configured to write the first tag map data into a memory in response to the first tag map data writing command, the data reading module is further configured to read the first tag map data from the memory in response to the tag map data reading command and send the first tag map data to the tag map data mapping module, and the data writing module is further configured to write the second tag map data into the memory.

3. The image processing apparatus according to claim 1, wherein The mapping relationship update module is configured to: obtain the equivalent tag values according to the mapping relationship; and merge the equivalent tag values and update the connected region area stored in the second cache unit, the connected region coordinates stored in the third cache unit, and the mapping relationship stored in the fourth cache unit according to the merging result.

4. The image processing apparatus according to claim 3, wherein The connected region screening module is configured to: If the current row and the row above it contain all the tag values, then use the scanned connected regions with an area smaller than an area threshold as the screened connected regions; and If the current row and the row above it do not contain all the tag values, then use the scanned connected regions with an area smaller than the area threshold and that do not intersect with the current row and the row above it as the screened connected regions.

5. The image processing apparatus according to claim 4, wherein The connected region screening module is configured to: If the screened connected regions do not meet the preset conditions, then adjust the area threshold and screen the scanned connected regions according to the adjusted area threshold to obtain the screened connected regions.

6. The image processing apparatus according to claim 5, wherein The connected region screening module is configured to: If the current row and the row above it contain all the tag values, then adjust the area threshold to be greater than the maximum value of the areas of the connected regions stored in the second cache unit; And If the current row and the row above it do not contain all the tag values, then adjust the area threshold to be greater than or equal to the minimum value of the areas of the connected regions stored in the second cache unit.

7. The image processing apparatus according to claim 1, wherein Further included is: An initialization module, configured to initialize the first cache unit, the second cache unit, the third cache unit, and the fourth cache unit.

8. The image processing apparatus according to claim 1, wherein Further included is: An initialization module, configured to initialize the mapping relationship stored in the fourth cache unit after the first tag map data is updated.

9. The image processing apparatus according to claim 8, wherein If the target image is not completely labeled, then the first tag map data is repeatedly updated until the target image is completely labeled.

10. The image processing apparatus according to claim 2, wherein The control module is further configured to generate a second tag map write command, and the data write module is configured to write the second tag map data into the memory in response to the second tag map write command.

11. The image processing apparatus according to claim 1, wherein Further included is: A tag value identification register, configured to store a tag value identification, which is used to identify the usage status of each tag value.

12. An image processing method, characterized in that, Including: Read the target image; Successively label the unlabeled target pixel points in the target image until the target image is completely labeled or there are no unused tag values, to generate first tag map data; Merge equivalent tag values, and update the mapping relationship between the target pixel points and the tag values according to the merge result; Screen the scanned connected regions, configure the tag values of the screened connected regions as unused and update the mapping relationship; And Updating the first label map data according to the mapping relationship to generate second label map data, where the unlabeled target pixel points in the target image are labeled sequentially until the target image is completely labeled or there are no unused label values, including: taking the first un-scanned target pixel point in the target image as the current pixel point; labeling the current pixel point and updating the label values of the previous row stored in the first cache unit, the area of the connected region stored in the second cache unit, the coordinates of the connected region stored in the third cache unit, and the mapping relationship stored in the fourth cache unit according to the labeling result; and if the target image is not completely labeled and there are unused label values, taking the next target pixel point of the current pixel point as the new current pixel point until the target image is completely labeled or there are no unused label values. Among them, screening the scanned connected regions, configuring the label values of the screened connected regions as unused and updating the mapping relationship includes: screening the scanned connected regions according to the area of the connected region stored in the second cache unit to obtain the screened connected regions that meet the screening conditions; and updating the area of the connected region stored in the second cache unit, the coordinates of the connected region stored in the third cache unit, and the mapping relationship stored in the fourth cache unit according to the screened connected regions.

13. An electronic device, characterized in that, Including: A memory configured to store a computer program; And A processor communicatively connected to the memory and configured to call the computer program to execute the image processing method according to claim 12.

Citation Information

Patent Citations

  • Image impurity removal method and device, equipment and storage medium

    CN114418880A