CN112446818B - Image refinement method and device, storage medium and electronic equipment - Google Patents

Image refinement method and device, storage medium and electronic equipment Download PDF

Info

Publication number
CN112446818B
CN112446818B CN201910809978.5A CN201910809978A CN112446818B CN 112446818 B CN112446818 B CN 112446818B CN 201910809978 A CN201910809978 A CN 201910809978A CN 112446818 B CN112446818 B CN 112446818B
Authority
CN
China
Prior art keywords
image
pixels
target
refinement
pixel
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201910809978.5A
Other languages
Chinese (zh)
Other versions
CN112446818A (en
Inventor
雷磊
李振刚
黄臣
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
BYD Semiconductor Co Ltd
Original Assignee
BYD Semiconductor Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by BYD Semiconductor Co Ltd filed Critical BYD Semiconductor Co Ltd
Priority to CN201910809978.5A priority Critical patent/CN112446818B/en
Publication of CN112446818A publication Critical patent/CN112446818A/en
Application granted granted Critical
Publication of CN112446818B publication Critical patent/CN112446818B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • G06T3/04
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/12Edge-based segmentation

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Image Analysis (AREA)
  • Image Processing (AREA)

Abstract

The present disclosure relates to a method, an apparatus, a storage medium, and an electronic device for image refinement, where in a process of repeatedly performing refinement processing on a plurality of image pixels in a target image, the number of refinement times of performing refinement processing on the target image at a current time may be obtained; and if the refinement times reach a preset times threshold, determining target pixels which are not refined in the plurality of image pixels, and then performing image refinement on the target pixels.

Description

Image refinement method and device, storage medium and electronic equipment
Technical Field
The present disclosure relates to the field of image processing, and in particular, to a method, an apparatus, a storage medium, and an electronic device for image refinement.
Background
The image preprocessing is an important part in the image recognition process, the reliability and accuracy of image recognition are directly affected by the image preprocessing effect, and the image refinement processing is an important link in the image preprocessing, especially in the field of fingerprint image recognition.
In general, multiple refinements are required to be performed in the process of performing image refinement processing to complete refinement of the whole image, each image refinement process needs to traverse each pixel point of the whole image, then a target neighborhood centered on each pixel point is matched with a preset elimination template, however, in the image refinement method, iteration is required to be performed repeatedly before the last pixel refinement is completed, the image refinement step is performed repeatedly, and each pixel point of the whole image needs to be traversed each time, which results in longer calculation time, thereby affecting the image refinement efficiency.
Disclosure of Invention
The disclosure provides a method, a device, a storage medium and electronic equipment for image refinement.
In a first aspect, there is provided an image refinement method, the method comprising: in the process of repeatedly carrying out refinement treatment on a plurality of image pixels in a target image, obtaining the refinement times of the refinement treatment on the target image at the current moment; if the refinement times reach a preset times threshold value, determining target pixels which are not refined in the plurality of image pixels; and carrying out image refinement on the target pixel.
Optionally, the determining a target pixel of the plurality of image pixels that is not yet refined comprises: traversing each pixel in the plurality of image pixels in turn, and determining a pixel to be determined, which meets a preset condition, in the plurality of image pixels as the target pixel; wherein, the preset conditions include: the gray value of the pixel to be determined is 0, and the sum of the gray values of the pixels in the target neighborhood taking the pixel to be determined as the center is smaller than or equal to a preset gray threshold value on the target image, wherein the pixel to be determined is any one of a plurality of image pixels.
Optionally, the image refinement of the target pixel includes: determining adjacent pixels of the target pixel, and acquiring a preset elimination template; matching the adjacent pixels with the elimination template, and if the adjacent pixels are successfully matched with the elimination template, setting the gray value of the adjacent pixels as a preset gray value; the preset gray value is different from the gray value of the target pixel.
Optionally, after the image refinement of the target pixel, the method further comprises: and if the adjacent pixels of the plurality of target pixels are failed to match with the elimination template, determining that the refinement of the plurality of target pixels is completed.
In a second aspect, there is provided an apparatus for image refinement, the apparatus comprising: the acquisition module is used for acquiring the refinement times of the refinement processing of the target image at the current moment in the process of repeatedly performing the refinement processing on a plurality of image pixels in the target image; the first determining module is used for determining target pixels which are not refined in the plurality of image pixels if the refinement times reach a preset time threshold; and the image refinement module is used for performing image refinement on the target pixel.
Optionally, the first determining module is configured to traverse each pixel in the plurality of image pixels in turn, and determine, as the target pixel, a pixel to be determined, which satisfies a preset condition, in the plurality of image pixels; wherein, the preset conditions include: the gray value of the pixel to be determined is 0, and the sum of the gray values of the pixels in the target neighborhood taking the pixel to be determined as the center is smaller than or equal to a preset gray threshold value on the target image, wherein the pixel to be determined is any one of a plurality of image pixels.
Optionally, the image refinement module is configured to determine an adjacent pixel of the target pixel, and acquire a preset cancellation template; matching the adjacent pixels with the elimination template, and if the adjacent pixels are successfully matched with the elimination template, setting the gray value of the adjacent pixels as a preset gray value; the preset gray value is different from the gray value of the target pixel.
Optionally, the apparatus further comprises: and the second determining module is used for determining that the refinement of the plurality of target pixels is finished if the adjacent pixels of the plurality of target pixels are failed to match with the elimination template.
In a third aspect, there is provided a computer readable storage medium having stored thereon a computer program which when executed by a processor performs the steps of the method of the first aspect of the present disclosure.
In a fourth aspect, there is provided an electronic device comprising: a memory having a computer program stored thereon; a processor for executing the computer program in the memory to implement the steps of the method of the first aspect of the disclosure.
According to the technical scheme, in the process of repeatedly carrying out refinement treatment on a plurality of image pixels in the target image, the refinement times of the refinement treatment on the target image at the current moment are obtained; if the refinement times reach a preset times threshold value, determining target pixels which are not refined in the plurality of image pixels; and carrying out image refinement on the target pixels, so that after the refinement times reach the preset times threshold, refinement treatment can be carried out on the target pixels which are not refined in the plurality of image pixels, and a plurality of image pixels do not need to be traversed, thereby greatly reducing the calculation time of image refinement and improving the efficiency of image refinement.
Additional features and advantages of the present disclosure will be set forth in the detailed description which follows.
Drawings
The accompanying drawings are included to provide a further understanding of the disclosure, and are incorporated in and constitute a part of this specification, illustrate the disclosure and together with the description serve to explain, but do not limit the disclosure. In the drawings:
FIG. 1 is a schematic diagram of an eight neighborhood shown according to an exemplary embodiment;
FIG. 2 is a schematic diagram of an eight neighborhood cancellation template, shown in accordance with an exemplary embodiment;
FIG. 3 is a schematic diagram of an image refinement process, according to an example embodiment;
FIG. 4 is a flowchart illustrating a first image refinement method according to an exemplary embodiment;
FIG. 5 is a flowchart illustrating a second image refinement method according to an exemplary embodiment;
FIG. 6 is a schematic diagram of a pixel that has been refined according to an example embodiment;
FIG. 7 is a block diagram of a first image refining apparatus according to an exemplary embodiment;
FIG. 8 is a block diagram of a second image refining apparatus according to an exemplary embodiment;
fig. 9 is a block diagram of an electronic device, according to an example embodiment.
Detailed Description
Specific embodiments of the present disclosure are described in detail below with reference to the accompanying drawings. It should be understood that the detailed description and specific examples, while indicating and illustrating the disclosure, are not intended to limit the disclosure.
Firstly, introducing an application scenario of the present disclosure, the present disclosure is mainly applied to a scenario of performing image refinement on a binarized image in an image preprocessing process, for example, performing refinement processing on a fingerprint image, in general, before performing image recognition on the fingerprint image, performing binarization processing on an original fingerprint image to obtain a binarized image, and then performing refinement processing on the binarized image, in the process of performing refinement processing on the binarized image, selecting an eight-neighborhood template iterative method, where the eight-neighborhood is centered on a current pixel, 8 surrounding pixels become eight-neighborhood, and multiple refinement processing is required to be performed to complete refinement of the entire binarized image, each image refinement process needs to traverse each pixel point of the entire binary image, then respectively matching an eight-neighborhood region centered on each pixel point with a plurality of preset cancellation templates, and if one of the cancellation templates is successfully matched with the eight-neighborhood region, setting a gray value in the eight-neighborhood region to be a preset gray value (for example, 1 or 255).
For example, in a refinement process, assuming that the current time traverses to the P5 pixel point of the binarized image to be refined, it may be determined that an eight-neighborhood region with the P5 pixel point as the center in the binarized image is shown in fig. 1, P2, P3, P6, P9, P8, P7, and P4 are eight-neighborhood regions with the P5 pixel point as the center, fig. 2 shows eight preset eight-neighborhood cancellation templates, wherein 0 represents a ridge line, 1 represents a valley line, and X may be any value of 0 and 1, so that the eight-neighborhood region shown in fig. 1 may be sequentially matched with the eight-neighborhood cancellation template shown in fig. 2, if one of the eight-neighborhood cancellation templates is successfully matched with the eight-neighborhood region, the pixel gray value in the eight-neighborhood region may be set to 1, thereby completing the image refinement process corresponding to the P5 pixel point, and then, continuing to traverse the rest pixels of the binarized image, and then, carrying out thinning on each pixel according to the same method until all the pixels of the binarized image are traversed, wherein the process of image thinning is completed, but the fingerprint image shown in fig. 3 is taken as an example, the fingerprint image is required to be subjected to the image thinning process for 10 times to complete the thinning of the whole fingerprint image, that is, the conventional image thinning method is required to repeatedly carry out iteration before the last pixel is thinned, repeatedly carrying out the image thinning step for a plurality of times, and each pixel of the whole image is required to be traversed each time, so that the calculation time is long, and the image thinning efficiency is affected.
In order to solve the problems, the present disclosure provides a method, an apparatus, a storage medium, and an electronic device for image refinement, which may obtain a refinement frequency of performing refinement processing on a target image at a current time in a process of repeating refinement processing on a plurality of image pixels in the target image, and after the refinement frequency reaches the preset frequency threshold, may perform refinement processing on only a target pixel that is not refined in the plurality of image pixels, without traversing a plurality of image pixels, thereby greatly reducing calculation time of image refinement, improving efficiency of image refinement, and further improving user experience.
FIG. 4 is a flowchart illustrating a method of image refinement, as shown in FIG. 4, according to an exemplary embodiment, the method comprising the steps of:
In step 401, in the process of repeating the thinning process for a plurality of image pixels in the target image, the number of times of thinning process for the target image at the current time is acquired.
Wherein the target image may include an image requiring refinement processing, such as a fingerprint image, and since the object of image refinement is mostly a binarized image, the target image may include a binarized image requiring refinement processing and having undergone binarization processing, and the plurality of target pixels may include all pixels of the target image or include other pixels of the target image than edge pixels.
In the actual image thinning process, multiple times of thinning processing are needed to finish the thinning of the whole image, and each time of image thinning process needs to traverse each pixel point of the whole image, therefore, in one possible implementation manner of this step, after a plurality of image pixels of the target image are traversed once, the number of times of thinning can be recorded, for example, after a plurality of image pixels of the target image are traversed for the first time, the number of times of thinning is recorded to be 1, after a plurality of image pixels of the target image are traversed for the second time, the number of times of thinning is increased by 1, namely the number of times of thinning becomes 2, and the like, and after a plurality of image pixels of the target image are subjected to one time of thinning processing, the corresponding number of times of thinning can be obtained.
In step 402, if the refinement number reaches a preset number threshold, a target pixel that is not refined in the plurality of image pixels is determined.
The preset frequency threshold may be preset according to an empirical value and an actual image refinement requirement, which is not limited in the present disclosure.
In this step, each of the plurality of image pixels may be traversed in sequence, and a pixel to be determined, which satisfies a preset condition, of the plurality of image pixels may be determined as the target pixel; wherein, the preset condition includes: the gray value of the pixel to be determined is 0, and the sum of the gray values of the pixels in the target neighborhood taking the pixel to be determined as the center on the target image is smaller than or equal to a preset gray threshold value, wherein the pixel to be determined is any one of a plurality of pixels of the image.
The preset gray threshold value can be specifically set according to a preset refinement algorithm adopted by the current image refinement, and the preset gray threshold values corresponding to different preset refinement algorithms (such as an eight-neighborhood template iterative method, a sixteen-neighborhood template iterative method and the like) are different.
In step 403, the target pixel is image refined.
In this step, adjacent pixels of the target pixel may be determined, and a preset cancellation template may be acquired; matching the adjacent pixel with the elimination template, and if the adjacent pixel is successfully matched with the elimination template, setting the gray value of the adjacent pixel as a preset gray value; the preset gray value is different from the gray value of the target pixel.
The adjacent pixels are pixels adjacent to any target pixel, the adjacent pixels determined by different preset refinement algorithms are different, and the elimination templates corresponding to different preset refinement algorithms are also different.
By adopting the method, after the thinning times reach the preset times threshold, thinning processing can be carried out on target pixels which are not thinned in the plurality of image pixels, and a plurality of image pixels do not need to be traversed, so that the calculation time of image thinning can be greatly reduced, the efficiency of image thinning is improved, and further the user experience is improved.
Fig. 5 is a flowchart illustrating an image refinement method according to an exemplary embodiment, as shown in fig. 5, including the steps of:
In step 501, in the process of repeating the thinning process for a plurality of image pixels in the target image, the number of times of thinning process for the target image at the current time is acquired.
Wherein the target image may include an image requiring refinement processing, such as a fingerprint image, and since the object of image refinement is mostly a binarized image, the target image may include a binarized image requiring refinement processing and having undergone binarization processing, and the plurality of target pixels may include all pixels of the target image or include other pixels of the target image than edge pixels.
In the actual image thinning process, multiple times of thinning processing are needed to finish the thinning of the whole image, and each time of image thinning process needs to traverse each pixel point of the whole image, therefore, in one possible implementation manner of this step, after a plurality of image pixels of the target image are traversed once, the number of times of thinning can be recorded, for example, after a plurality of image pixels of the target image are traversed for the first time, the number of times of thinning is recorded to be 1, after a plurality of image pixels of the target image are traversed for the second time, the number of times of thinning is increased by 1, namely the number of times of thinning becomes 2, and the like, and after a plurality of image pixels of the target image are subjected to one time of thinning processing, the corresponding number of times of thinning can be obtained.
In step 502, if the number of refinements reaches a preset number of times threshold, each of the plurality of image pixels is traversed in turn, and a pixel to be determined, which satisfies a preset condition, in the plurality of image pixels is determined as a target pixel.
Wherein, the preset condition includes: the gray value of the pixel to be determined is 0 (the gray value is 0 to represent black), and the sum of the gray values of the pixels in the target neighborhood centered on the pixel to be determined is smaller than or equal to a preset gray threshold, the pixel to be determined is any one of a plurality of pixels in the image, the preset number of times threshold can be preset according to an experience value and an actual image thinning requirement, the disclosure is not limited to this, the preset gray threshold can be specifically set according to a preset thinning algorithm adopted for performing image thinning at present, and the preset gray thresholds corresponding to different preset thinning algorithms are different.
As an example, the process of image refinement can be understood as a process of reducing lines in a binarized image from a multi-pixel width to a unit pixel width, fig. 6 shows four cases of pixel points for which refinement has been completed after image refinement by adopting an eight-neighborhood iterative method, namely, horizontal line refinement, vertical line refinement, diagonal line refinement and corner line refinement, which correspond to refinement of a horizontal line region, refinement of a vertical line region, refinement of a diagonal line region and refinement of a corner line region in an actual target image, respectively, as shown in fig. 6, if the preset refinement algorithm is an eight-neighborhood iterative method, when refinement of a plurality of image pixels in a target image is repeated for a plurality of times by adopting the eight-neighborhood iterative method, a pixel gray value is 0 (i.e., represents black), and gray values of at most 2 pixels in the eight neighborhood at which refinement has been completed are 0, therefore, if the preset gray value in the subsequent step 504 is set to 1, the preset gray threshold may be set to a value of less than or equal to 5, which is not limited by the present disclosure.
It should be noted that, considering that the line width of different areas is different in the actual image thinning process, in the area with finer lines, the thinning process can be completed only by executing the image thinning process for a small number of times, and in the place with thicker lines, the thinning process can be successfully completed only by executing the image thinning process for a large number of times, and in the actual image thinning process, after the preset number of times (the preset number of times is usually smaller than the total thinning number required for completing the thinning of the whole image) is executed, the number of target pixels which are not completed in a plurality of image pixels of the target image is far smaller than the number of the image pixels, for example, the number of the image pixels is 2314, after the thinning process is repeatedly performed on the image pixels of the target image for 5 times (namely, the preset number of times threshold), only 791 pixels are not completed, at this time, if the thinning process is continuously performed according to the existing method, the preset number of times is required to be significantly increased, and the thinning process is not completed, for example, the current time is increased by calculating the pixels, and the number of times is significantly increased by only 5 when the preset number of times is required to be calculated, and the current time is increased, for the image is calculated, and the time is not completed, for the target time is increased, for the time is required to be increased, for the calculation, for the time is required to be increased, for completing the thinning the image pixels.
The target pixel needs to be determined from a plurality of the image pixels by executing this step before the target pixel is subjected to the thinning process, and a specific embodiment of this step will be described below by way of example.
For example, assuming that the preset number of times threshold is 5 times, the preset thinning algorithm is an eight-neighborhood iterative method, the preset gray threshold is 5, the number of the plurality of image pixels is 2314, after executing step 501, if the number of times of thinning the target image at the current time is 5 times, it may be determined that the number of times of thinning reaches the preset number of times threshold, at this time, 2314 image pixels of the target image may be traversed in sequence, and whether each pixel satisfies the following two conditions at the same time in sequence: 1. the gray value of the pixel is 0, the sum of the gray values of the pixels in eight neighborhood regions with the pixel as a center point (the pixels in the eight neighborhood regions are all adjacent pixels of the center point pixel) is less than or equal to 5, and then the pixel point satisfying the two conditions is determined as the target pixel, which is only exemplified by the above examples, and the disclosure is not limited thereto.
It should be further noted that, in order to facilitate marking and recording the target pixel, in determining the target pixel from the plurality of image pixels, a coordinate position (i.e., a number of rows and a number of columns) of each target pixel may be recorded, so that when the target pixel is subjected to refinement processing, each target pixel may be sequentially traversed according to the coordinate position.
After the target pixel is determined, image refinement processing may be performed on the target pixel by performing steps 503 to 504.
In step 503, adjacent pixels to the target pixel are determined, and a preset cancellation template is acquired.
The adjacent pixels refer to pixels adjacent to any target pixel, and the adjacent pixels determined by different preset refinement algorithms are also different, for example, if the preset refinement algorithm is an eight-neighborhood iterative method, the adjacent pixels of the target pixel are pixels in an eight-neighborhood region centered on the target pixel, as shown in fig. 1, assuming that one of the target pixels is a P5 pixel point, the adjacent pixels of the target pixel are eight pixels of P1, P2, P3, P6, P9, P8, P7, and P4 shown in fig. 1, which are only illustrative herein, the present disclosure does not limit the same, and in addition, if the preset refinement algorithm is an eight-neighborhood iterative method, the cancellation template corresponding to different preset refinement algorithms is also different, and may be eight templates as shown in fig. 2.
In step 504, the neighboring pixel is matched with the cancellation template, and if the neighboring pixel is successfully matched with the cancellation template, the gray value of the neighboring pixel is set to a preset gray value.
Since black may be represented by 0 and white may be represented by non-0 (e.g., 1 or 255) in the binarized image, the preset gray value may be generally set to any positive integer between 1 and 255, and in general, the preset gray value may be set to 1 for ease of calculation.
In one possible implementation, if each of the neighboring pixels has the same pixel value as the pixel located at the same position in any cancellation template, it may be determined that the neighboring pixel is successfully matched with the cancellation template.
As shown in fig. 1, assuming that the target pixel is a P5 pixel point, the neighboring pixels of the target pixel are P1, P2, P3, P6, P9, P8, P7, and P4 shown in fig. 1, in the process of matching the neighboring pixels with the elimination template shown in fig. 2, the neighboring pixels may be sequentially compared with 8 elimination templates one by one until an elimination template matching the neighboring pixels is found, if the current time matches P1, P2, P3, P6, P9, P8, P7, and P4 eight pixels with the first elimination template shown in fig. 2, for example, the neighboring pixels may be compared with one another in a clockwise direction (e.g., P1→p2→p3→p6→p9→p8→p7→p4), if the judgment P1=1, p2=1, p6=x, p9=0, p8=0, p7=x, and if the current time matches the neighboring pixels with the first elimination template with the neighboring pixels, if the second elimination template with the first elimination template with the same gray value, and if the second pixel with the second gray value can be further matched with the neighboring pixels with the first pixel with the second elimination template, if the neighboring pixels with the second gray value can be further matched with the neighboring pixels with the first pixel with the neighboring pixels, and the neighboring pixels with the second gray value can be further matched with the neighboring pixels with the first gray value; in addition, if it is determined that there is no template matching the eight neighboring pixels among the eight eliminated templates, it may be determined that the neighboring pixels failed to match the eliminated templates, which is merely illustrative and not limited by the present disclosure.
In another possible implementation manner, in the process of matching the adjacent pixels with the cancellation templates, a number sequence may be formed by sorting a plurality of adjacent pixels of the same target pixel in a clockwise direction, if the number sequence is a binary number sequence, the binary number sequence may be converted into a decimal number, then the pixels in the eight neighborhood region of each cancellation template are converted into a set of binary sequences according to the same method, then the binary sequence corresponding to each cancellation template is converted into a decimal number, if the decimal number converted by the adjacent pixels is equal to the decimal number corresponding to any cancellation template, it may be determined that the adjacent pixels are successfully matched with the cancellation templates, if the decimal number converted by the adjacent pixels is not equal to the decimal number corresponding to each cancellation template, it may be determined that the adjacent pixels are failed to match with the cancellation templates, so that the decimal algorithm may be further refined if the decimal numbers are equal after the decimal numbers are converted without comparing each adjacent pixel with the corresponding pixel points in the cancellation templates one by one.
For example, taking fig. 1 and fig. 2 as an example, as shown in fig. 1, assuming that the target pixel is a P5 pixel point, the neighboring pixels of the target pixel are eight pixels P1, P2, P3, P6, P9, P8, P7, and P4 shown in fig. 1, in the process of matching the neighboring pixels with the cancellation template shown in fig. 2, the eight neighboring pixels may be first formed into a binary sequence in a clockwise direction, and then the binary sequence is converted into a decimal number, which is:
(P1,P2,P3,P6,P9,P8,P7,P4)2=(Q1)10
wherein, (P1, P2, P3, P6, P9, P8, P7, P4) is a binary sequence composed of the eight adjacent pixels, Q1 is a decimal number obtained by converting the binary sequence composed of the eight adjacent pixels, then, the pixels located in the eight neighborhood region in each cancellation template can be converted into a group of binary sequences according to the same method, and then, the binary sequence corresponding to each cancellation template is converted into a decimal number, namely, the method comprises the following steps:
(K1,K2,K3,K6,K9,K8,K7,K4)2=(Q2)10
Wherein, (K1, K2, K3, K6, K9, K8, K7, K4) is a set of binary sequences formed by pixels located in eight adjacent areas in any one of the cancellation templates according to a clockwise direction, Q2 is a decimal number obtained by converting the binary sequences (i.e., a set of binary sequences formed by pixels located in eight adjacent areas in any one of the cancellation templates according to a clockwise direction), if q1=q2, it can be determined that the adjacent pixels are successfully matched with the cancellation template, and after it is determined that the adjacent pixels are successfully matched with the cancellation template, gray values of the eight adjacent pixels can be set to the preset gray value (for example, set to 1), so as to complete refinement processing of the target pixel P5 pixel point; in addition, if Q1 is not equal to the decimal number Q2 corresponding to each cancellation template, it may be determined that the adjacent pixel fails to match the cancellation template, which is only illustrated in the above example and is not limited in the disclosure.
In step 505, if the neighboring pixels of the plurality of target pixels fail to match the cancellation template, it is determined that the refinement of the plurality of target pixels is completed.
Wherein the plurality of target pixels may include all target pixels.
In this step, after each target pixel is refined according to the methods provided in steps 503 to 504, the target pixel may be traversed again, and then, according to the same method, the neighboring pixels of each target pixel are matched with the cancellation template, and if it is determined that all the neighboring pixels of the target pixel fail to be matched with the cancellation template, it may be determined that a plurality of target pixels are refined.
By adopting the method, after the thinning times reach the preset times threshold, thinning processing can be carried out on target pixels which are not thinned in the plurality of image pixels, and a plurality of image pixels do not need to be traversed, so that the calculation time of image thinning can be greatly reduced, the efficiency of image thinning is improved, and further the user experience is improved.
Fig. 7 is a block diagram illustrating an apparatus for image refinement according to an exemplary embodiment, as shown in fig. 7, the apparatus including:
An obtaining module 701, configured to obtain a number of refinement times of performing refinement processing on a target image at a current moment in a process of repeating refinement processing on a plurality of image pixels in the target image;
a first determining module 702, configured to determine a target pixel that is not refined in the plurality of image pixels if the refinement number reaches a preset number threshold;
An image refinement module 703, configured to perform image refinement on the target pixel.
Optionally, the first determining module 702 is configured to traverse each of the plurality of image pixels in turn, and determine a pixel to be determined, which satisfies a preset condition, in the plurality of image pixels as the target pixel; wherein, the preset condition includes: the gray value of the pixel to be determined is 0, and the sum of the gray values of the pixels in the target neighborhood taking the pixel to be determined as the center on the target image is smaller than or equal to a preset gray threshold value, wherein the pixel to be determined is any one of a plurality of pixels of the image.
Optionally, the image refinement module 703 is configured to determine an adjacent pixel of the target pixel, and acquire a preset cancellation template; matching the adjacent pixel with the elimination template, and if the adjacent pixel is successfully matched with the elimination template, setting the gray value of the adjacent pixel as a preset gray value; the preset gray value is different from the gray value of the target pixel.
Fig. 8 is a block diagram of an apparatus for image refinement according to the embodiment shown in fig. 7, the apparatus further comprising, as shown in fig. 8:
a second determining module 704, configured to determine that refinement of the plurality of target pixels is completed if the neighboring pixels of the plurality of target pixels all fail to match the cancellation template.
The specific manner in which the various modules perform the operations in the apparatus of the above embodiments have been described in detail in connection with the embodiments of the method, and will not be described in detail herein.
By adopting the device, after the thinning times reach the preset times threshold, thinning treatment can be carried out on target pixels which are not thinned in the plurality of image pixels, and the plurality of image pixels do not need to be traversed, so that the calculation time of image thinning can be greatly reduced, the efficiency of image thinning is improved, and further the user experience is improved.
Fig. 9 is a block diagram of an electronic device 900, according to an example embodiment. As shown in fig. 9, the electronic device 900 may include: processor 901, memory 902. The electronic device 900 may also include one or more of a multimedia component 903, an input/output (I/O) interface 904, and a communication component 905.
The processor 901 is configured to control the overall operation of the electronic device 900 to perform all or part of the steps in the image thinning method described above. The memory 902 is used to store various types of data to support operations at the electronic device 900, which may include, for example, instructions for any application or method operating on the electronic device 900, as well as application-related data, such as contact data, transceived messages, pictures, audio, video, and so forth. The memory 902 may be implemented by any type or combination of volatile or non-volatile memory devices, such as static random access memory (Static Random Access Memory, SRAM for short), electrically erasable programmable read-only memory (ELECTRICALLY ERASABLE PROGRAMMABLE READ-only memory, EEPROM for short), erasable programmable read-only memory (Erasable Programmable Read-only memory, EPROM for short), programmable read-only memory (Programmable Read-only memory, PROM for short), read-only memory (ROM for short), magnetic memory, flash memory, magnetic disk, or optical disk. The multimedia component 903 may include a screen and audio components. Wherein the screen may be, for example, a touch screen, the audio component being for outputting and/or inputting audio signals. For example, the audio component may include a microphone for receiving external audio signals. The received audio signal may be further stored in the memory 902 or transmitted through the communication component 905. The audio assembly further comprises at least one speaker for outputting audio signals. The I/O interface 904 provides an interface between the processor 901 and other interface modules, which may be a keyboard, mouse, buttons, etc. These buttons may be virtual buttons or physical buttons. The communication component 905 is used for wired or wireless communication between the electronic device 900 and other devices. Wireless Communication, such as Wi-Fi, bluetooth, near Field Communication (NFC) for short, 2G, 3G, 4G, NB-IOT, eMTC, or other 5G, etc., or one or a combination of more of them, is not limited herein. The corresponding communication component 905 may thus comprise: wi-Fi module, bluetooth module, NFC module, etc.
In an exemplary embodiment, the electronic device 900 may be implemented by one or more application-specific integrated circuits (ASIC), digital signal processor (DIGITAL SIGNAL processor, DSP), digital signal processing device (DIGITAL SIGNAL Processing Device, DSPD), programmable logic device (Programmable Logic Device, PLD), field programmable gate array (Field Programmable GATE ARRAY, FPGA), controller, microcontroller, microprocessor, or other electronic components for performing the image thinning method described above.
In another exemplary embodiment, a computer readable storage medium comprising program instructions which, when executed by a processor, implement the steps of the image refinement method described above is also provided. For example, the computer readable storage medium may be the memory 902 described above including program instructions executable by the processor 901 of the electronic device 900 to perform the image refinement method described above.
The preferred embodiments of the present disclosure have been described in detail above with reference to the accompanying drawings, but the present disclosure is not limited to the specific details of the embodiments described above, and various simple modifications may be made to the technical solutions of the present disclosure within the scope of the technical concept of the present disclosure, and all the simple modifications belong to the protection scope of the present disclosure.
In addition, the specific features described in the foregoing embodiments may be combined in any suitable manner, and in order to avoid unnecessary repetition, the present disclosure does not further describe various possible combinations.
Moreover, any combination between the various embodiments of the present disclosure is possible as long as it does not depart from the spirit of the present disclosure, which should also be construed as the disclosure of the present disclosure.

Claims (8)

1. A method of image refinement, the method comprising:
in the process of repeatedly carrying out refinement treatment on a plurality of image pixels in a target image, obtaining the refinement times of the refinement treatment on the target image at the current moment;
If the refinement times reach a preset times threshold value, determining target pixels which are not refined in the plurality of image pixels;
performing image refinement on the target pixel;
the image refinement of the target pixel includes:
determining adjacent pixels of the target pixel, and acquiring a preset elimination template;
Sequencing adjacent pixels of the target pixel in a clockwise direction to form a digital sequence, and converting the binary digital sequence into decimal numbers if the digital sequence is the binary digital sequence;
for any elimination template, converting pixels in the elimination template, which are positioned in the target neighborhood, into a group of binary sequences, and converting the binary sequences into decimal numbers;
Detecting whether the decimal number converted by the target pixel is equal to the decimal number corresponding to any elimination template, if so, confirming that the adjacent pixel is successfully matched with the elimination template, and setting the gray value of the adjacent pixel as a preset gray value; the preset gray value is different from the gray value of the target pixel.
2. The method of claim 1, wherein the determining a target pixel of the plurality of image pixels that has not been refined comprises:
Traversing each pixel in the plurality of image pixels in turn, and determining a pixel to be determined, which meets a preset condition, in the plurality of image pixels as the target pixel; wherein, the preset conditions include:
the gray value of the pixel to be determined is 0, and the sum of the gray values of the pixels in the target neighborhood taking the pixel to be determined as the center is smaller than or equal to a preset gray threshold value on the target image, wherein the pixel to be determined is any one of a plurality of image pixels.
3. The method of claim 1, wherein after said image refinement of said target pixel, said method further comprises:
and if the adjacent pixels of the plurality of target pixels are failed to match with the elimination template, determining that the refinement of the plurality of target pixels is completed.
4. An apparatus for image refinement, the apparatus comprising:
The acquisition module is used for acquiring the refinement times of the refinement processing of the target image at the current moment in the process of repeatedly performing the refinement processing on a plurality of image pixels in the target image;
the first determining module is used for determining target pixels which are not refined in the plurality of image pixels if the refinement times reach a preset time threshold;
the image refinement module is used for performing image refinement on the target pixels;
the image refinement module performs image refinement on the target pixel, including:
determining adjacent pixels of the target pixel, and acquiring a preset elimination template;
Sequencing adjacent pixels of the target pixel in a clockwise direction to form a digital sequence, and converting the binary digital sequence into decimal numbers if the digital sequence is the binary digital sequence;
for any elimination template, converting pixels in the elimination template, which are positioned in the target neighborhood, into a group of binary sequences, and converting the binary sequences into decimal numbers;
Detecting whether the decimal number converted by the target pixel is equal to the decimal number corresponding to any elimination template, if so, confirming that the adjacent pixel is successfully matched with the elimination template, and setting the gray value of the adjacent pixel as a preset gray value; the preset gray value is different from the gray value of the target pixel.
5. The apparatus according to claim 4, wherein the first determining module is configured to traverse each of the plurality of image pixels in turn, and determine, as the target pixel, a pixel to be determined, which satisfies a preset condition, of the plurality of image pixels; wherein, the preset conditions include: the gray value of the pixel to be determined is 0, and the sum of the gray values of the pixels in the target neighborhood taking the pixel to be determined as the center is smaller than or equal to a preset gray threshold value on the target image, wherein the pixel to be determined is any one of a plurality of image pixels.
6. The apparatus of claim 4, wherein the apparatus further comprises:
And the second determining module is used for determining that the refinement of the plurality of target pixels is finished if the adjacent pixels of the plurality of target pixels are failed to match with the elimination template.
7. A computer readable storage medium, on which a computer program is stored, characterized in that the program, when being executed by a processor, implements the steps of the method according to any of claims 1-3.
8. An electronic device, comprising:
A memory having a computer program stored thereon;
A processor for executing the computer program in the memory to carry out the steps of the method of any one of claims 1-3.
CN201910809978.5A 2019-08-29 2019-08-29 Image refinement method and device, storage medium and electronic equipment Active CN112446818B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910809978.5A CN112446818B (en) 2019-08-29 2019-08-29 Image refinement method and device, storage medium and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910809978.5A CN112446818B (en) 2019-08-29 2019-08-29 Image refinement method and device, storage medium and electronic equipment

Publications (2)

Publication Number Publication Date
CN112446818A CN112446818A (en) 2021-03-05
CN112446818B true CN112446818B (en) 2024-04-16

Family

ID=74742351

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910809978.5A Active CN112446818B (en) 2019-08-29 2019-08-29 Image refinement method and device, storage medium and electronic equipment

Country Status (1)

Country Link
CN (1) CN112446818B (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101266644A (en) * 2008-04-02 2008-09-17 范九伦 Fingerprint image thinning method based on formwork
CN101382999A (en) * 2008-10-17 2009-03-11 哈尔滨工业大学 Fast highly efficient finger print thinning method
CN102005058A (en) * 2010-11-30 2011-04-06 南京信息工程大学 Rapid implementation method aiming at OPTA (One-Pass Thinning Algorithm) of image
CN110097495A (en) * 2019-04-27 2019-08-06 南京理工大学 A kind of improved Zhang parallel image thinning algorithm

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101266644A (en) * 2008-04-02 2008-09-17 范九伦 Fingerprint image thinning method based on formwork
CN101382999A (en) * 2008-10-17 2009-03-11 哈尔滨工业大学 Fast highly efficient finger print thinning method
CN102005058A (en) * 2010-11-30 2011-04-06 南京信息工程大学 Rapid implementation method aiming at OPTA (One-Pass Thinning Algorithm) of image
CN110097495A (en) * 2019-04-27 2019-08-06 南京理工大学 A kind of improved Zhang parallel image thinning algorithm

Also Published As

Publication number Publication date
CN112446818A (en) 2021-03-05

Similar Documents

Publication Publication Date Title
US8861054B2 (en) Image processing apparatus, image processing method, computer readable medium and image processing system
CN107220640B (en) Character recognition method, character recognition device, computer equipment and computer-readable storage medium
CN107678551B (en) Gesture recognition method and device and electronic equipment
CN112686919B (en) Object boundary line determining method and device, electronic equipment and storage medium
US20220051387A1 (en) Image processing method, image processing apparatus, and program
CN109255277B (en) Two-dimensional code analysis method and device
US10509934B1 (en) Methods and apparatus for improving QR code locator detectability and/or finding the corners of a locator pattern
CN111080665B (en) Image frame recognition method, device, equipment and computer storage medium
KR100630732B1 (en) Parallel thinning process and device
CN113221601A (en) Character recognition method, device and computer readable storage medium
JPS59136875A (en) Pattern identifier
CN112446818B (en) Image refinement method and device, storage medium and electronic equipment
CN105956553B (en) Unlocking method and mobile terminal
CN107077617B (en) Fingerprint extraction method and device
CN108629219B (en) Method and device for identifying one-dimensional code
CN108460386B (en) Character image cutting method, device, equipment and storage medium
US20200043141A1 (en) Image processing apparatus and method
CN110992387A (en) Image processing method and device, electronic equipment and storage medium
CN110874814A (en) Image processing method, image processing device and terminal equipment
CN110245537B (en) Graphic code decoding method, device, storage medium and electronic equipment
JP4257264B2 (en) Pattern matching device, image quality verification method, and image quality verification program
CN110390231B (en) Fingerprint identification module abnormity determination method and device, storage medium and electronic equipment
CN107392205B (en) Code value table generation method and device of remote controller
CN112927288B (en) Image coordinate extraction method, image processing device and storage device
CN111986111B (en) Image segmentation method

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant