Method and device for detecting number of tabs
View Patent ↗A method for detecting a number of tabs includes determining a pixel value of a first target pixel based on at least one pixel value of at least one first adjacent pixel adjacent to a first target pixel on a tab framework, and determining the number of tabs based on the pixel value of the first target pixel. Each of the at least one first adjacent pixel is an adjacent pixel of the first target pixel on a side in a first direction on the tab framework.
1 . A method for detecting a number of tabs, comprising:
determining a pixel value of a first target pixel based on at least one pixel value of at least one first adjacent pixel adjacent to a first target pixel on a tab framework, wherein each of the at least one first adjacent pixel is an adjacent pixel of the first target pixel on a side in a first direction on the tab framework;
determining the number of tabs based on the pixel value of the first target pixel, the first target pixel being an intersection on the tab framework; and
for one first adjacent pixel of the at least one first adjacent pixel, assigning a value of 0 to the one first adjacent pixel in response to a framework branch containing the one first adjacent pixel being not a tab.
2 . The method according to claim 1 , wherein determining the pixel value of the first target pixel comprises:
using a sum of the at least one pixel value of the at least one first adjacent pixel as the pixel value of the first target pixel.
3 . The method according to claim 1 , wherein:
the first target pixel is one of at least one first target pixel; and
determining the number of tabs comprises:
obtaining at least one tab calculation value, wherein each of the at least one tab calculation value is a sum of one or more pixel values of one or more of the at least one first target pixel in a second direction, and the second direction is perpendicular to the first direction; and
determining the number of tabs based on a maximum tab calculation value among the at least one tab calculation value.
4 . The method according to claim 1 , further comprising:
determining a first length by which the framework branch containing the one first adjacent pixel extends along the first direction; and
determining whether the framework branch containing the one first adjacent pixel is a tab based on the first length, comprising:
determining, in response to the first length being greater than or equal to a first threshold, that the framework branch containing the one first adjacent pixel is a tab; or
determining, in response to the first length being less than the first threshold, that the framework branch containing the one first adjacent pixel is not a tab.
5 . The method according to claim 4 , wherein the first direction is a negative direction of an abscissa axis, and determining the first length comprises:
in response to pixels adjacent to the one first adjacent pixel comprising another adjacent pixel, increasing the first length by 1 and using the another adjacent pixel as a next first adjacent pixel, wherein an abscissa of the another adjacent pixel is less than or equal to an abscissa of the one first adjacent pixel, and a pixel value of the another adjacent pixel is 1 ; and
obtaining the first length between the one first adjacent pixel and the first target pixel in response to the pixels adjacent to the one first adjacent pixel comprising no other adjacent pixel.
6 . The method according to claim 1 , wherein the first direction is a negative direction of an abscissa axis, and determining whether the framework branch containing the one first adjacent pixel is a tab comprises:
determining a length between another adjacent pixel and the one first adjacent pixel, wherein the another adjacent pixel is adjacent to the one first adjacent pixel, an abscissa of the another adjacent pixel is less than or equal to an abscissa of the one first adjacent pixel, and a pixel value of the another adjacent pixel is 1; and
using the another adjacent pixel as a next first adjacent pixel in response to the length being less than a threshold and pixels adjacent to the one first adjacent pixel comprising the another adjacent pixel; and
determining, in response to the length being less than the threshold and the pixels adjacent to the one first adjacent pixel comprising no other adjacent pixel, that the framework branch is not a tab; and
determining, in response to the length being greater than or equal to the threshold, that the framework branch is a tab.
7 . The method according to claim 1 , further comprising:
using a second adjacent pixel adjacent to the first target pixel on the tab framework as a next first target pixel, wherein the second adjacent pixel is an adjacent pixel of the first target pixel on a side in another direction on the tab framework, and the another direction is parallel to the first direction and opposite to the first direction.
8 . The method according to claim 7 , wherein the another direction is a positive direction of an abscissa axis, and an abscissa of the second adjacent pixel is greater than or equal to an abscissa of the first target pixel.
9 . A device for detecting a number of tabs, comprising:
a processing module, configured to perform the method according to claim 1 .
10 . A device for detecting a number of tabs, comprising:
a processor and a memory, wherein the memory stores an instruction, and, when executed by the processor, the instruction causes the device to perform the method according to claim 1 .
11 . A non-transitory computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and, when executed, the computer program causes a processor to perform the method according to claim 1 .
12 . A method for detecting a number of tabs, comprising:
determining a pixel value of a first target pixel based on at least one pixel value of at least one first adjacent pixel adjacent to a first target pixel on a tab framework, wherein each of the at least one first adjacent pixel is an adjacent pixel of the first target pixel on a side in a first direction on the tab framework;
determining the number of tabs based on the pixel value of the first target pixel; and
using a second adjacent pixel adjacent to the first target pixel on the tab framework as a next first target pixel, wherein the second adjacent pixel is an adjacent pixel of the first target pixel on a side in another direction on the tab framework, and the another direction is parallel to the first direction and opposite to the first direction.