CN112862843A - Official seal image segmentation method and system based on neighborhood pixel multi-weight decision - Google Patents

Official seal image segmentation method and system based on neighborhood pixel multi-weight decision Download PDF

Info

Publication number
CN112862843A
CN112862843A CN202110018876.9A CN202110018876A CN112862843A CN 112862843 A CN112862843 A CN 112862843A CN 202110018876 A CN202110018876 A CN 202110018876A CN 112862843 A CN112862843 A CN 112862843A
Authority
CN
China
Prior art keywords
pixel
difference value
foreground
neighborhood
background
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.)
Pending
Application number
CN202110018876.9A
Other languages
Chinese (zh)
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.)
Beijing Huilang Times Technology Co Ltd
Original Assignee
Beijing Huilang Times Technology 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 Beijing Huilang Times Technology Co Ltd filed Critical Beijing Huilang Times Technology Co Ltd
Priority to CN202110018876.9A priority Critical patent/CN112862843A/en
Publication of CN112862843A publication Critical patent/CN112862843A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/12Edge-based segmentation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/13Edge detection
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20112Image segmentation details
    • G06T2207/20152Watershed segmentation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/30Subject of image; Context of image processing
    • G06T2207/30204Marker

Abstract

The invention discloses a official seal image segmentation method based on neighborhood pixel multi-weight decision, which comprises the following steps of: obtaining a official seal image, and segmenting the official seal image by adopting a watershed segmentation method to obtain an initial segmentation image and labeling the edge area of the initial segmentation image to obtain a labeled image; acquiring each unknown edge pixel in the marked image, and acquiring an adjacent region with a distance of n x n around each unknown edge pixel; calculating to obtain a foreground neighborhood pixel difference value and a background neighborhood pixel difference value of each unknown edge pixel; comparing the foreground neighborhood pixel difference value and the background neighborhood pixel difference value of each unknown edge pixel to generate a comparison result; determining the pixel category of each unknown edge pixel, and generating and sending a pixel confirmation result; and optimizing the initial segmentation image to obtain a target segmentation image. The invention also discloses a official seal image segmentation system based on the neighborhood pixel multi-weight decision. The invention can ensure the accuracy of the segmentation result.

Description

Official seal image segmentation method and system based on neighborhood pixel multi-weight decision
Technical Field
The invention relates to the technical field of image segmentation, in particular to a official seal image segmentation method and system based on neighborhood pixel multi-weight decision.
Background
With the progress of the times, the legal consciousness of people is improved more and more, and related contracts and agreements are signed every day in order to protect the legal rights and interests of the people. In the process of signing, a plurality of official seals appear in the contract and agreement, and the official seals become official seal images after being scanned. How to effectively segment the official seal image is the premise of the processes of comparison, identification and the like. The segmentation method based on deep learning consumes huge computing resources, and meanwhile, the traditional low-consumption segmentation method has no ideal segmentation effect. Therefore, how to achieve high-precision segmentation results by using the traditional method with low energy consumption is a very meaningful task.
As a classical traditional segmentation method, a watershed segmentation method can relatively well segment an image, but the method has the defects of poor processing on segmentation edges and obvious defects. For the problem, the segmentation optimization algorithm based on the domain pixels partially optimizes the segmentation result to a certain extent, but the accuracy of the segmentation result is still to be improved. The specific reasons are that: on one hand, a plurality of neighborhood pixels without reference value are considered, so that the segmentation precision is directly reduced; on the other hand, for pixels of reference value, their disparity is not taken into account, i.e. their contribution is not made to the target. Therefore, if a segmentation method based on the neighborhood pixels is established, the neighborhood pixels can be sufficiently used as a reference, and the method is very meaningful work.
Disclosure of Invention
In order to overcome the above problems or at least partially solve the above problems, embodiments of the present invention provide a method and a system for segmenting a official seal image based on a neighborhood pixel multi-weight decision, which perform depth optimization on a segmentation result by using a neighborhood pixel multi-weight decision method, so as to ensure accuracy of the segmentation result.
The embodiment of the invention is realized by the following steps:
in a first aspect, an embodiment of the present invention provides a official seal image segmentation method based on neighborhood pixel multi-weight decision, including the following steps:
obtaining a official seal image, and segmenting the official seal image by adopting a watershed segmentation method to obtain an initial segmentation image;
labeling the edge area of the initial segmentation image to obtain a labeled image;
acquiring each unknown edge pixel in the marked image, and acquiring an adjacent region with a distance of n x n around each unknown edge pixel, wherein n is a radius value of the region with the unknown edge pixel point as a dot, and n is more than or equal to 1;
acquiring a foreground pixel and a background pixel of each unknown edge pixel and an adjacent region of the unknown edge pixel, and calculating a difference value of the foreground pixel and a difference value of the background pixel of each unknown edge pixel and the adjacent region of the unknown edge pixel to obtain a foreground neighborhood pixel difference value and a background neighborhood pixel difference value of each unknown edge pixel;
comparing the foreground neighborhood pixel difference value and the background neighborhood pixel difference value of each unknown edge pixel to generate a comparison result;
determining the pixel type of each unknown edge pixel according to the comparison result, and generating and sending a pixel confirmation result;
and optimizing the initial segmentation image according to the pixel confirmation result to obtain a target segmentation image.
When the official seal image is divided, multiple optimization is carried out so as to improve the accuracy of division and division. Firstly, acquiring a official seal image, segmenting the official seal image by a watershed segmentation method to obtain a plurality of initial segmentation images, and labeling an edge region of each segmentation image to obtain each labeled image; then, judging unknown edge pixels in each marked image so as to perform optimized division on the image subsequently, finding adjacent areas with n x n distance around the unknown edge pixels for any unknown edge pixel, then obtaining foreground pixels and background pixels of each unknown edge pixel and the adjacent areas, calculating the difference value of the edge pixel and the neighborhood foreground pixels, weighting by using the inverse ratio of the distance to obtain the difference value of the foreground neighborhood pixels, calculating the difference value of the edge pixel and the neighborhood background pixels, and weighting by using the inverse ratio of the distance to obtain the difference value of the background neighborhood pixels; then comparing the foreground neighborhood pixel difference value with the background neighborhood pixel difference value to generate a comparison result; determining the pixel category of each unknown edge pixel according to the comparison result, generating and sending a pixel confirmation result, and judging the unknown edge pixel as a foreground pixel when the difference value of the foreground neighborhood pixels is smaller than that of the background neighborhood pixels; when the difference value of the foreground neighborhood pixels is larger than the difference value of the background neighborhood pixels, the unknown edge pixels are judged as background pixels; repeating the above process until the unknown edge pixel can be judged; and finally, optimizing the initial segmentation image according to the pixel confirmation result to obtain a final optimized segmentation result so as to obtain a target segmentation image.
According to the method, the depth optimization is carried out on the segmentation result through a domain pixel multi-weight decision method, the official seal image is accurately and effectively divided, and the accuracy of the segmentation result is ensured.
Based on the first aspect, in some embodiments of the present invention, the method for calculating the difference between the foreground pixel and the background pixel of each unknown edge pixel and its neighboring area to obtain the foreground neighborhood pixel difference and the background neighborhood pixel difference of each unknown edge pixel includes the following steps:
calculating the difference value of each unknown edge pixel and the foreground pixel of the adjacent region of each unknown edge pixel, and weighting the difference value by adopting the inverse ratio of the distance to obtain the difference value of the foreground neighborhood pixels;
and calculating the difference value of each unknown edge pixel and the background pixel of the adjacent region of each unknown edge pixel, and weighting the difference value by adopting the inverse ratio of the distance to obtain the background neighborhood pixel difference value.
Based on the first aspect, in some embodiments of the present invention, the above method for comparing the foreground neighborhood pixel difference value and the background neighborhood pixel difference value of each unknown edge pixel to generate a comparison result includes the following steps:
comparing the foreground neighborhood pixel difference value and the background neighborhood pixel difference value of each unknown edge pixel, judging whether the foreground neighborhood pixel difference value is larger than the background neighborhood pixel difference value or not, and if so, generating and sending a background comparison result; and if not, generating and sending a foreground comparison result.
Based on the first aspect, in some embodiments of the present invention, the method for determining the pixel class of each unknown edge pixel according to the comparison result and generating and sending the pixel confirmation result includes the following steps:
determining the unknown edge pixel as a background pixel according to the background comparison result, and generating and sending a background pixel confirmation result;
and determining the unknown edge pixel as a foreground pixel according to the foreground comparison result, and generating and sending a foreground pixel confirmation result.
Based on the first aspect, in some embodiments of the present invention, the official seal image segmentation method based on neighborhood pixel multi-weight decision further includes the following steps:
a1, judging whether the foreground neighborhood pixel difference value and the background neighborhood pixel difference value of each unknown edge pixel are the same, if so, entering the step A2; if not, generating and sending a comparison result;
and A2, acquiring pixels of the auxiliary adjacent area at m × m distance around each unknown edge pixel, wherein m is larger than n, and calculating the difference value of the foreground pixel and the background pixel of each unknown edge pixel and the auxiliary adjacent area until the pixel of each unknown edge pixel is determined.
In a second aspect, an embodiment of the present invention provides a official seal image segmentation system based on neighborhood pixel multi-weight decision, including an initial segmentation module, an edge labeling module, a neighboring region module, a difference calculation module, a difference comparison module, a pixel confirmation module, and an image optimization module, where:
the initial segmentation module is used for acquiring a official seal image and segmenting the official seal image by adopting a watershed segmentation method to obtain an initial segmentation image;
the edge labeling module is used for labeling the edge area of the initial segmentation image to obtain a labeled image;
the adjacent region module is used for acquiring each unknown edge pixel in the marked image and acquiring an adjacent region with a distance of n x n around each unknown edge pixel, wherein n is a radius value of a region taking an unknown edge pixel point as a dot, and n is more than or equal to 1;
the difference value calculation module is used for acquiring a foreground pixel and a background pixel of each unknown edge pixel and an adjacent region of the unknown edge pixel, and calculating a difference value of the foreground pixel and a difference value of the background pixel of each unknown edge pixel and the adjacent region of the unknown edge pixel so as to obtain a foreground neighborhood pixel difference value and a background neighborhood pixel difference value of each unknown edge pixel;
the difference value comparison module is used for comparing the foreground neighborhood pixel difference value and the background neighborhood pixel difference value of each unknown edge pixel to generate a comparison result;
the pixel confirmation module is used for determining the pixel type of each unknown edge pixel according to the comparison result, and generating and sending a pixel confirmation result;
and the image optimization module is used for optimizing the initial segmentation image according to the pixel confirmation result so as to obtain the target segmentation image.
When the official seal image is divided, multiple optimization is carried out so as to improve the accuracy of division and division. Firstly, acquiring a official seal image through an initial segmentation module, segmenting the official seal image by a watershed segmentation method to obtain a plurality of initial segmentation images, and labeling an edge region of each segmentation image through an edge labeling module to obtain each labeled image; then, judging unknown edge pixels in each marked image so as to perform optimized division on the image subsequently, finding out adjacent regions with n × n distance around any unknown edge pixel through an adjacent region module, then obtaining foreground pixels and background pixels of each unknown edge pixel and the adjacent regions through a difference value calculation module, calculating the difference value of the edge pixel and the neighborhood foreground pixels, weighting by using the inverse ratio of the distance to obtain the difference value of the foreground neighborhood pixels, calculating the difference value of the edge pixel and the neighborhood background pixels, and weighting by using the inverse ratio of the distance to obtain the difference value of the background neighborhood pixels; then comparing the foreground neighborhood pixel difference value with the background neighborhood pixel difference value through a difference value comparison module to generate a comparison result; determining the pixel category of each unknown edge pixel according to the comparison result through a pixel confirmation module, generating and sending a pixel confirmation result, and judging the unknown edge pixel as a foreground pixel when the difference value of the foreground neighborhood pixels is smaller than that of the background neighborhood pixels; when the difference value of the foreground neighborhood pixels is larger than the difference value of the background neighborhood pixels, the unknown edge pixels are judged as background pixels; repeating the above process until the unknown edge pixel can be judged; and finally, optimizing the initial segmentation image according to the pixel confirmation result through an image optimization module to obtain a final optimized segmentation result so as to obtain a target segmentation image.
The system performs depth optimization on the segmentation result through a domain pixel multi-weight decision method, accurately and effectively divides the official seal image, and ensures the accuracy of the segmentation result.
Based on the second aspect, in some embodiments of the invention, the difference calculating module includes a foreground pixel sub-module and a background pixel sub-module, wherein:
the foreground pixel submodule is used for calculating the difference value of each unknown edge pixel and the foreground pixel of the adjacent region of the unknown edge pixel, and weighting the difference value by adopting the inverse ratio of the distance to obtain the difference value of the foreground neighborhood pixels;
and the background pixel submodule is used for calculating the difference value of each unknown edge pixel and the background pixel of the adjacent region of the unknown edge pixel, and weighting the difference value by adopting the inverse ratio of the distance to obtain the background neighborhood pixel difference value.
Based on the second aspect, in some embodiments of the present invention, the difference comparison module includes a difference judgment sub-module, configured to compare a foreground neighborhood pixel difference value and a background neighborhood pixel difference value of each unknown edge pixel, judge whether the foreground neighborhood pixel difference value is greater than the background neighborhood pixel difference value, and if yes, generate and send a background comparison result; and if not, generating and sending a foreground comparison result.
Based on the second aspect, in some embodiments of the invention, the pixel confirmation module includes a background result sub-module and a foreground result sub-module, wherein:
the background result submodule is used for determining the unknown edge pixel as a background pixel according to a background comparison result, and generating and sending a background pixel confirmation result;
and the foreground result submodule is used for determining the unknown edge pixel as a foreground pixel according to the foreground comparison result, and generating and sending a foreground pixel confirmation result.
Based on the second aspect, in some embodiments of the present invention, the official seal image segmentation system based on neighborhood pixel multi-weight decision further includes an identity determination module and a repetition determination module, wherein:
the identity judging module is used for judging whether the foreground neighborhood pixel difference value and the background neighborhood pixel difference value of each unknown edge pixel are the same or not, and if so, the determining module is repeatedly operated; if not, generating and sending a comparison result;
and the repeated determining module is used for obtaining pixels of the auxiliary adjacent area at the distance of m × m around each unknown edge pixel, wherein m is larger than n, and calculating the difference value of the foreground pixel and the background pixel of each unknown edge pixel and the auxiliary adjacent area until the pixel of each unknown edge pixel is determined.
The embodiment of the invention at least has the following advantages or beneficial effects:
the embodiment of the invention provides a official seal image segmentation method based on neighborhood pixel multi-weight decision, which comprises the steps of obtaining an official seal image, segmenting the official seal image by using a watershed segmentation method to obtain a plurality of initial segmentation images, and labeling the edge region of each segmentation image to obtain each labeled image; then, judging unknown edge pixels in each marked image so as to perform optimized division on the image subsequently, finding out adjacent areas around any unknown edge pixel for any unknown edge pixel, then obtaining foreground pixels and background pixels of each unknown edge pixel and the adjacent areas, calculating and comparing the difference value of the foreground neighborhood pixels with the difference value of the background neighborhood pixels, and generating a comparison result; repeating the above process until the unknown edge pixel can be judged; and finally, optimizing the initial segmentation image according to the pixel confirmation result to obtain a final optimized segmentation result so as to obtain a target segmentation image. According to the method, the depth optimization is carried out on the segmentation result through a domain pixel multi-weight decision method, the official seal image is accurately and effectively divided, and the accuracy of the segmentation result is ensured.
The embodiment of the invention also provides a official seal image segmentation system based on neighborhood pixel multi-weight decision, which is characterized in that an initial segmentation module is used for obtaining an official seal image, the official seal image is segmented by a watershed segmentation method to obtain a plurality of initial segmentation images, and an edge region of each segmentation image is labeled by an edge labeling module to obtain each labeled image; then, judging unknown edge pixels in each marked image so as to perform optimized division on the image subsequently, finding out adjacent regions with n × n distance around any unknown edge pixel through an adjacent region module, then obtaining foreground pixels and background pixels of each unknown edge pixel and the adjacent regions through a difference value calculation module, calculating the difference value of the edge pixel and the neighborhood foreground pixels, weighting by using the inverse ratio of the distance to obtain the difference value of the foreground neighborhood pixels, calculating the difference value of the edge pixel and the neighborhood background pixels, and weighting by using the inverse ratio of the distance to obtain the difference value of the background neighborhood pixels; then comparing the foreground neighborhood pixel difference value with the background neighborhood pixel difference value through a difference value comparison module to generate a comparison result; determining the pixel type of each unknown edge pixel according to the comparison result through a pixel confirmation module, and generating and sending a pixel confirmation result; repeating the above process until the unknown edge pixel can be judged; and finally, optimizing the initial segmentation image according to the pixel confirmation result through an image optimization module to obtain a final optimized segmentation result so as to obtain a target segmentation image. The system performs depth optimization on the segmentation result through a domain pixel multi-weight decision method, accurately and effectively divides the official seal image, and ensures the accuracy of the segmentation result.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings needed to be used in the embodiments will be briefly described below, it should be understood that the following drawings only illustrate some embodiments of the present invention and therefore should not be considered as limiting the scope, and for those skilled in the art, other related drawings can be obtained according to the drawings without inventive efforts.
FIG. 1 is a flowchart of a method for segmenting a official seal image based on neighborhood pixel multi-weight decision according to an embodiment of the present invention;
FIG. 2 is a flowchart of the difference identity determination in a method for segmenting a official seal image based on neighborhood pixel multi-weight decision according to an embodiment of the present invention;
fig. 3 is a schematic block diagram of a official seal image segmentation system based on neighborhood pixel multi-weight decision according to an embodiment of the present invention.
Icon: 100. an initial segmentation module; 200. an edge labeling module; 300. a neighboring region module; 400. a difference value calculation module; 410. a foreground pixel sub-module; 420. a background pixel sub-module; 500. a difference comparison module; 510. a difference value judgment submodule; 600. a pixel confirmation module; 610. a background result submodule; 620. a foreground result submodule; 700. an image optimization module; 800. a same judgment module; 900. the determination module is repeated.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention. The components of embodiments of the present invention generally described and illustrated in the figures herein may be arranged and designed in a wide variety of different configurations.
Thus, the following detailed description of the embodiments of the present invention, presented in the figures, is not intended to limit the scope of the invention, as claimed, but is merely representative of selected embodiments of the invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
It should be noted that: like reference numbers and letters refer to like items in the following figures, and thus, once an item is defined in one figure, it need not be further defined and explained in subsequent figures.
It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
Examples
As shown in fig. 1, in a first aspect, an embodiment of the present invention provides a method for segmenting a official seal image based on neighborhood pixel multi-weight decision, including the following steps:
s1, obtaining a official seal image, and segmenting the official seal image by adopting a watershed segmentation method to obtain an initial segmentation image;
s2, labeling the edge area of the initial segmentation image to obtain a labeled image;
s3, acquiring each unknown edge pixel in the marked image, and acquiring an adjacent region with a distance of n x n around each unknown edge pixel, wherein n is a radius value of the region taking the unknown edge pixel point as a dot, and n is more than or equal to 1; the adjacent area of the edge pixel is a circular area which takes the pixel as the center and n as the radius;
s4, acquiring foreground pixels and background pixels of each unknown edge pixel and adjacent regions of the unknown edge pixel, and calculating the difference value of the foreground pixels and the difference value of the background pixels of each unknown edge pixel and the adjacent regions of the unknown edge pixel to obtain the foreground neighborhood pixel difference value and the background neighborhood pixel difference value of each unknown edge pixel;
s5, comparing the foreground neighborhood pixel difference value and the background neighborhood pixel difference value of each unknown edge pixel to generate a comparison result;
s6, determining the pixel type of each unknown edge pixel according to the comparison result, and generating and sending a pixel confirmation result;
and S7, optimizing the initial segmentation image according to the pixel confirmation result to obtain the target segmentation image.
When the official seal image is divided, multiple optimization is carried out so as to improve the accuracy of division and division. Firstly, acquiring a official seal image, segmenting the official seal image by a watershed segmentation method to obtain a plurality of initial segmentation images, and labeling an edge region of each segmentation image to obtain each labeled image; then, judging unknown edge pixels in each marked image so as to perform optimized division on the image subsequently, finding adjacent areas with n x n distance around the unknown edge pixels for any unknown edge pixel, then obtaining foreground pixels and background pixels of each unknown edge pixel and the adjacent areas, calculating the difference value of the edge pixel and the neighborhood foreground pixels, weighting by using the inverse ratio of the distance to obtain the difference value of the foreground neighborhood pixels, calculating the difference value of the edge pixel and the neighborhood background pixels, and weighting by using the inverse ratio of the distance to obtain the difference value of the background neighborhood pixels; then comparing the foreground neighborhood pixel difference value with the background neighborhood pixel difference value to generate a comparison result; determining the pixel category of each unknown edge pixel according to the comparison result, generating and sending a pixel confirmation result, and judging the unknown edge pixel as a foreground pixel when the difference value of the foreground neighborhood pixels is smaller than that of the background neighborhood pixels; when the difference value of the foreground neighborhood pixels is larger than the difference value of the background neighborhood pixels, the unknown edge pixels are judged as background pixels; repeating the above process until the unknown edge pixel can be judged; and finally, optimizing the initial segmentation image according to the pixel confirmation result to obtain a final optimized segmentation result so as to obtain a target segmentation image.
According to the method, the depth optimization is carried out on the segmentation result through a domain pixel multi-weight decision method, the official seal image is accurately and effectively divided, and the accuracy of the segmentation result is ensured.
Based on the first aspect, in some embodiments of the present invention, the method for calculating the difference between the foreground pixel and the background pixel of each unknown edge pixel and its neighboring area to obtain the foreground neighborhood pixel difference and the background neighborhood pixel difference of each unknown edge pixel includes the following steps:
calculating the difference value of each unknown edge pixel and the foreground pixel of the adjacent region of each unknown edge pixel, and weighting the difference value by adopting the inverse ratio of the distance to obtain the difference value of the foreground neighborhood pixels;
and calculating the difference value of each unknown edge pixel and the background pixel of the adjacent region of each unknown edge pixel, and weighting the difference value by adopting the inverse ratio of the distance to obtain the background neighborhood pixel difference value.
And calculating a foreground neighborhood pixel difference value and a background neighborhood difference value so as to perform pixel judgment subsequently, and judging unknown edge pixels according to pixels of adjacent regions so as to perform depth segmentation on the image. When calculating the foreground pixel difference, assuming that a neighborhood foreground pixel or background pixel is n from the center of the unknown edge pixel, the pixel is multiplied by 1/n as a weight when calculating the difference, and the difference is weighted.
Based on the first aspect, in some embodiments of the present invention, the above method for comparing the foreground neighborhood pixel difference value and the background neighborhood pixel difference value of each unknown edge pixel to generate a comparison result includes the following steps:
comparing the foreground neighborhood pixel difference value and the background neighborhood pixel difference value of each unknown edge pixel, judging whether the foreground neighborhood pixel difference value is larger than the background neighborhood pixel difference value or not, and if so, generating and sending a background comparison result; and if not, generating and sending a foreground comparison result.
Comparing and judging the foreground neighborhood pixel difference value and the background neighborhood pixel difference value, judging the unknown edge pixel as a foreground pixel when the current scene neighborhood pixel difference value is smaller than the background neighborhood pixel difference value, and generating and sending a foreground comparison result; when the difference value of the pixels in the foreground neighborhood is greater than the difference value of the pixels in the background neighborhood, the unknown edge pixels are judged as background pixels, and a background comparison result is generated and sent.
Based on the first aspect, in some embodiments of the present invention, the method for determining the pixel class of each unknown edge pixel according to the comparison result and generating and sending the pixel confirmation result includes the following steps:
determining the unknown edge pixel as a background pixel according to the background comparison result, and generating and sending a background pixel confirmation result;
and determining the unknown edge pixel as a foreground pixel according to the foreground comparison result, and generating and sending a foreground pixel confirmation result.
After the difference value of the current scene neighborhood pixels is compared with the difference value of the background neighborhood pixels, determining the pixel type of the unknown edge pixels according to the difference value comparison result, and when the difference value of the current scene neighborhood pixels is smaller than the difference value of the background neighborhood pixels, judging the unknown edge pixels as foreground pixels, generating and sending a foreground pixel confirmation result; and when the difference value of the pixels in the foreground neighborhood is greater than the difference value of the pixels in the background neighborhood, the unknown edge pixels are judged as background pixels, and a background pixel confirmation result is generated and sent.
Based on the first aspect, as shown in fig. 2, in some embodiments of the present invention, the official seal image segmentation method based on neighborhood pixel multi-weight decision further includes the following steps:
a1, judging whether the foreground neighborhood pixel difference value and the background neighborhood pixel difference value of each unknown edge pixel are the same, if so, entering the step A2; if not, generating and sending a comparison result;
and A2, acquiring pixels of the auxiliary adjacent area at m × m distance around each unknown edge pixel, wherein m is larger than n, and calculating the difference value of the foreground pixel and the background pixel of each unknown edge pixel and the auxiliary adjacent area until the pixel of each unknown edge pixel is determined.
And judging whether the foreground neighborhood pixel difference value and the background neighborhood pixel difference value of each unknown edge pixel are the same or similar, if the difference between the foreground neighborhood pixel difference value and the background neighborhood pixel difference value is not significant, selecting a larger adjacent area, and repeating the process until the unknown edge pixel can be judged.
As shown in fig. 3, in a second aspect, an embodiment of the present invention provides a official seal image segmentation system based on neighborhood pixel multi-weight decision, including an initial segmentation module 100, an edge labeling module 200, a neighborhood region module 300, a difference calculation module 400, a difference comparison module 500, a pixel confirmation module 600, and an image optimization module 700, where:
the initial segmentation module 100 is configured to obtain a official seal image, and segment the official seal image by using a watershed segmentation method to obtain an initial segmentation image;
an edge labeling module 200, configured to label an edge region of the initial segmented image to obtain a labeled image;
the adjacent region module 300 is configured to obtain each unknown edge pixel in the labeled image, and obtain an adjacent region around each unknown edge pixel by a distance of n × n, where n is a radius value of a region using an unknown edge pixel point as a dot, and n is greater than or equal to 1;
a difference value calculating module 400, configured to obtain a foreground pixel and a background pixel of each unknown edge pixel and its neighboring area, and calculate a difference value of the foreground pixel and a difference value of the background pixel of each unknown edge pixel and its neighboring area, so as to obtain a foreground neighborhood pixel difference value and a background neighborhood pixel difference value of each unknown edge pixel;
a difference comparison module 500, configured to compare a foreground neighborhood pixel difference value and a background neighborhood pixel difference value of each unknown edge pixel, and generate a comparison result;
a pixel confirmation module 600, configured to determine the pixel type of each unknown edge pixel according to the comparison result, generate and send a pixel confirmation result;
and the image optimization module 700 is configured to optimize the initial segmentation image according to the pixel confirmation result to obtain the target segmentation image.
When the official seal image is divided, multiple optimization is carried out so as to improve the accuracy of division and division. Firstly, obtaining a official seal image through an initial segmentation module 100, segmenting the official seal image by a watershed segmentation method to obtain a plurality of initial segmentation images, and labeling an edge region of each segmentation image through an edge labeling module 200 to obtain each labeled image; then, the unknown edge pixels in each marked image are distinguished so as to carry out optimization division on the image subsequently, an adjacent region with n × n distance around the unknown edge pixel is found out by the adjacent region module 300, then the foreground pixel and the background pixel of each unknown edge pixel and the adjacent region are obtained by the difference value calculating module 400, the difference value of the edge pixel and the neighborhood foreground pixel is calculated, the weighting is carried out by the inverse ratio of the distance to obtain the foreground neighborhood pixel difference value, the difference value of the edge pixel and the neighborhood background pixel is calculated, and the weighting is carried out by the inverse ratio of the distance to obtain the background neighborhood pixel difference value; then comparing the foreground neighborhood pixel difference value with the background neighborhood pixel difference value through a difference value comparison module 500 to generate a comparison result; determining the pixel category of each unknown edge pixel according to the comparison result through the pixel confirmation module 600, generating and sending a pixel confirmation result, and judging the unknown edge pixel as a foreground pixel when the difference value of the foreground neighborhood pixels is smaller than that of the background neighborhood pixels; when the difference value of the foreground neighborhood pixels is larger than the difference value of the background neighborhood pixels, the unknown edge pixels are judged as background pixels; repeating the above process until the unknown edge pixel can be judged; finally, the initial segmentation image is optimized according to the pixel confirmation result through the image optimization module 700 to obtain a final optimized segmentation result, so as to obtain the target segmentation image.
The system performs depth optimization on the segmentation result through a domain pixel multi-weight decision method, accurately and effectively divides the official seal image, and ensures the accuracy of the segmentation result.
Based on the second aspect, as shown in fig. 3, in some embodiments of the present invention, the difference calculation module 400 includes a foreground pixel sub-module 410 and a background pixel sub-module 420, wherein:
the foreground pixel submodule 410 is configured to calculate a difference value between each unknown edge pixel and a foreground pixel of an adjacent region of the unknown edge pixel, and weight the difference value by using an inverse ratio of distances to obtain a foreground neighborhood pixel difference value;
the background pixel submodule 420 is configured to calculate a difference value between each unknown edge pixel and a background pixel of an adjacent area of the unknown edge pixel, and weight the difference value by using an inverse ratio of distances to obtain a background neighborhood pixel difference value.
The foreground pixel sub-module 410 and the background pixel sub-module 420 respectively calculate a foreground neighborhood pixel difference value and a background neighborhood difference value so as to perform pixel judgment in the following, and judge unknown pixels in the edge area according to pixels of adjacent areas, so as to perform depth segmentation on the image.
Based on the second aspect, as shown in fig. 3, in some embodiments of the present invention, the difference comparing module 500 includes a difference determining sub-module 510, configured to compare a foreground neighborhood pixel difference value and a background neighborhood pixel difference value of each unknown edge pixel, determine whether the foreground neighborhood pixel difference value is greater than the background neighborhood pixel difference value, and if so, generate and send a background comparison result; and if not, generating and sending a foreground comparison result.
Comparing and judging the foreground neighborhood pixel difference value and the background neighborhood pixel difference value through the difference value judging submodule 510, judging unknown edge pixels as foreground pixels when the foreground neighborhood pixel difference value is smaller than the background neighborhood pixel difference value, and generating and sending a foreground comparison result; when the difference value of the pixels in the foreground neighborhood is greater than the difference value of the pixels in the background neighborhood, the unknown edge pixels are judged as background pixels, and a background comparison result is generated and sent.
Based on the second aspect, as shown in fig. 3, in some embodiments of the present invention, the pixel confirmation module 600 includes a background result sub-module 610 and a foreground result sub-module 620, wherein:
a background result sub-module 610, configured to determine the unknown edge pixel as a background pixel according to the background comparison result, and generate and send a background pixel confirmation result;
and the foreground result sub-module 620 is configured to determine the unknown edge pixel as a foreground pixel according to the foreground comparison result, and generate and send a foreground pixel confirmation result.
After the difference value of the current scene neighborhood pixel is compared with the difference value of the background neighborhood pixel, determining the pixels of the edge area of the unknown edge pixel according to the difference value comparison result, and when the difference value of the current scene neighborhood pixel is smaller than the difference value of the background neighborhood pixel, determining the unknown edge pixel as the foreground pixel, generating and sending a foreground pixel confirmation result; and when the difference value of the pixels in the foreground neighborhood is greater than the difference value of the pixels in the background neighborhood, the unknown edge pixels are judged as background pixels, and a background pixel confirmation result is generated and sent.
Based on the second aspect, as shown in fig. 3, in some embodiments of the present invention, the official seal image segmentation system based on neighborhood pixel multi-weight decision further includes an identity determination module 800 and a repetition determination module 900, wherein:
the identity determination module 800 is configured to determine whether a foreground neighborhood pixel difference value and a background neighborhood pixel difference value of each unknown edge pixel are the same, and if yes, repeat the operation of the determination module 900; if not, generating and sending a comparison result;
the repeated determining module 900 is configured to obtain pixels of the auxiliary neighboring area at a distance of m × m around each unknown edge pixel, where m is greater than n, and calculate a difference value between the foreground pixel and the background pixel of each unknown edge pixel and the auxiliary neighboring area until the pixel of each unknown edge pixel is determined.
And judging whether the foreground neighborhood pixel difference value and the background neighborhood pixel difference value of each unknown edge pixel are the same or similar, if the difference between the foreground neighborhood pixel difference value and the background neighborhood pixel difference value is not significant, selecting a larger adjacent area, and repeating the process until the unknown edge pixel can be judged.
The above is only a preferred embodiment of the present invention, and is not intended to limit the present invention, and various modifications and changes will occur to those skilled in the art. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
It will be evident to those skilled in the art that the present application is not limited to the details of the foregoing illustrative embodiments, and that the present application may be embodied in other specific forms without departing from the spirit or essential attributes thereof. The present embodiments are therefore to be considered in all respects as illustrative and not restrictive, the scope of the application being indicated by the appended claims rather than by the foregoing description, and all changes which come within the meaning and range of equivalency of the claims are therefore intended to be embraced therein. Any reference sign in a claim should not be construed as limiting the claim concerned.

Claims (10)

1. A official seal image segmentation method based on neighborhood pixel multi-weight decision is characterized by comprising the following steps:
obtaining a official seal image, and segmenting the official seal image by adopting a watershed segmentation method to obtain an initial segmentation image;
labeling the edge area of the initial segmentation image to obtain a labeled image;
acquiring each unknown edge pixel in the marked image, and acquiring an adjacent region with a distance of n x n around each unknown edge pixel, wherein n is a radius value of the region with the unknown edge pixel point as a dot, and n is more than or equal to 1;
acquiring a foreground pixel and a background pixel of each unknown edge pixel and an adjacent region of the unknown edge pixel, and calculating a difference value of the foreground pixel and a difference value of the background pixel of each unknown edge pixel and the adjacent region of the unknown edge pixel to obtain a foreground neighborhood pixel difference value and a background neighborhood pixel difference value of each unknown edge pixel;
comparing the foreground neighborhood pixel difference value and the background neighborhood pixel difference value of each unknown edge pixel to generate a comparison result;
determining the pixel type of each unknown edge pixel according to the comparison result, and generating and sending a pixel confirmation result;
and optimizing the initial segmentation image according to the pixel confirmation result to obtain a target segmentation image.
2. The official seal image segmentation method based on neighborhood pixel multi-weight decision as claimed in claim 1, wherein the method for calculating the difference value of the foreground pixel and the difference value of the background pixel of each unknown edge pixel and the adjacent region thereof to obtain the foreground neighborhood pixel difference value and the background neighborhood pixel difference value of each unknown edge pixel comprises the following steps:
calculating the difference value of each unknown edge pixel and the foreground pixel of the adjacent region of each unknown edge pixel, and weighting the difference value by adopting the inverse ratio of the distance to obtain the difference value of the foreground neighborhood pixels;
and calculating the difference value of each unknown edge pixel and the background pixel of the adjacent region of each unknown edge pixel, and weighting the difference value by adopting the inverse ratio of the distance to obtain the background neighborhood pixel difference value.
3. The official seal image segmentation method based on neighborhood pixel multi-weight decision as claimed in claim 1, wherein the method for comparing the foreground neighborhood pixel difference value and the background neighborhood pixel difference value of each unknown edge pixel to generate the comparison result comprises the following steps:
comparing the foreground neighborhood pixel difference value and the background neighborhood pixel difference value of each unknown edge pixel, judging whether the foreground neighborhood pixel difference value is larger than the background neighborhood pixel difference value or not, and if so, generating and sending a background comparison result; and if not, generating and sending a foreground comparison result.
4. The official seal image segmentation method based on neighborhood pixel multi-weight decision as claimed in claim 3, wherein the method for determining the pixel class of each unknown edge pixel according to the comparison result, generating and sending the pixel confirmation result comprises the following steps:
determining the unknown edge pixel as a background pixel according to the background comparison result, and generating and sending a background pixel confirmation result;
and determining the unknown edge pixel as a foreground pixel according to the foreground comparison result, and generating and sending a foreground pixel confirmation result.
5. The official seal image segmentation method based on neighborhood pixel multi-weight decision as claimed in claim 1, characterized by further comprising the steps of:
a1, judging whether the foreground neighborhood pixel difference value and the background neighborhood pixel difference value of each unknown edge pixel are the same, if so, entering the step A2; if not, generating and sending a comparison result;
and A2, acquiring pixels of an auxiliary adjacent area at a distance of m × m around each unknown edge pixel, wherein m is larger than n, and calculating the difference value of the foreground pixel and the background pixel of each unknown edge pixel and the auxiliary adjacent area until each unknown edge pixel is determined.
6. A official seal image segmentation system based on neighborhood pixel multi-weight decision is characterized by comprising an initial segmentation module, an edge labeling module, an adjacent region module, a difference value calculation module, a difference value comparison module, a pixel confirmation module and an image optimization module, wherein:
the initial segmentation module is used for acquiring a official seal image and segmenting the official seal image by adopting a watershed segmentation method to obtain an initial segmentation image;
the edge labeling module is used for labeling the edge area of the initial segmentation image to obtain a labeled image;
the adjacent region module is used for acquiring each unknown edge pixel in the marked image and acquiring an adjacent region with a distance of n x n around each unknown edge pixel, wherein n is a radius value of a region taking an unknown edge pixel point as a dot, and n is more than or equal to 1;
the difference value calculation module is used for acquiring a foreground pixel and a background pixel of each unknown edge pixel and an adjacent region of the unknown edge pixel, and calculating a difference value of the foreground pixel and a difference value of the background pixel of each unknown edge pixel and the adjacent region of the unknown edge pixel so as to obtain a foreground neighborhood pixel difference value and a background neighborhood pixel difference value of each unknown edge pixel;
the difference value comparison module is used for comparing the foreground neighborhood pixel difference value and the background neighborhood pixel difference value of each unknown edge pixel to generate a comparison result;
the pixel confirmation module is used for determining the pixel type of each unknown edge pixel according to the comparison result, and generating and sending a pixel confirmation result;
and the image optimization module is used for optimizing the initial segmentation image according to the pixel confirmation result so as to obtain the target segmentation image.
7. The official seal image segmentation system based on neighborhood pixel multi-weight decision as claimed in claim 6 wherein, the difference calculation module comprises a foreground pixel sub-module and a background pixel sub-module, wherein:
the foreground pixel submodule is used for calculating the difference value of each unknown edge pixel and the foreground pixel of the adjacent region of the unknown edge pixel, and weighting the difference value by adopting the inverse ratio of the distance to obtain the difference value of the foreground neighborhood pixels;
and the background pixel submodule is used for calculating the difference value of each unknown edge pixel and the background pixel of the adjacent region of the unknown edge pixel, and weighting the difference value by adopting the inverse ratio of the distance to obtain the background neighborhood pixel difference value.
8. The official seal image segmentation system based on neighborhood pixel multi-weight decision of claim 6 is characterized in that the difference comparison module comprises a difference judgment sub-module, and the difference judgment sub-module is used for comparing the foreground neighborhood pixel difference value and the background neighborhood pixel difference value of each unknown edge pixel, judging whether the foreground neighborhood pixel difference value is greater than the background neighborhood pixel difference value, and if so, generating and sending a background comparison result; and if not, generating and sending a foreground comparison result.
9. The official seal image segmentation system based on neighborhood pixel multi-weight decision as claimed in claim 8 wherein the pixel validation module comprises a background result sub-module and a foreground result sub-module, wherein:
the background result submodule is used for determining the unknown edge pixel as a background pixel according to a background comparison result, and generating and sending a background pixel confirmation result;
and the foreground result submodule is used for determining the unknown edge pixel as a foreground pixel according to the foreground comparison result, and generating and sending a foreground pixel confirmation result.
10. The official seal image segmentation system based on neighborhood pixel multi-weight decision as claimed in claim 6, further comprising an identity determination module and a repetition determination module, wherein:
the identity judging module is used for judging whether the foreground neighborhood pixel difference value and the background neighborhood pixel difference value of each unknown edge pixel are the same or not, and if so, the determining module is repeatedly operated; if not, generating and sending a comparison result;
and the repeated determining module is used for obtaining pixels of the auxiliary adjacent area at the distance of m × m around each unknown edge pixel, wherein m is larger than n, and calculating the difference value of the foreground pixel and the background pixel of each unknown edge pixel and the auxiliary adjacent area until the pixel of each unknown edge pixel is determined.
CN202110018876.9A 2021-01-07 2021-01-07 Official seal image segmentation method and system based on neighborhood pixel multi-weight decision Pending CN112862843A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110018876.9A CN112862843A (en) 2021-01-07 2021-01-07 Official seal image segmentation method and system based on neighborhood pixel multi-weight decision

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110018876.9A CN112862843A (en) 2021-01-07 2021-01-07 Official seal image segmentation method and system based on neighborhood pixel multi-weight decision

Publications (1)

Publication Number Publication Date
CN112862843A true CN112862843A (en) 2021-05-28

Family

ID=76004843

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110018876.9A Pending CN112862843A (en) 2021-01-07 2021-01-07 Official seal image segmentation method and system based on neighborhood pixel multi-weight decision

Country Status (1)

Country Link
CN (1) CN112862843A (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101170641A (en) * 2007-12-05 2008-04-30 北京航空航天大学 A method for image edge detection based on threshold sectioning
CN102609723A (en) * 2012-02-08 2012-07-25 清华大学 Image classification based method and device for automatically segmenting videos
CA2780710A1 (en) * 2012-06-11 2013-12-11 Minglun Gong Video segmentation method
JP2014006871A (en) * 2012-05-31 2014-01-16 Casio Comput Co Ltd Image region dividing device, method, and program

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101170641A (en) * 2007-12-05 2008-04-30 北京航空航天大学 A method for image edge detection based on threshold sectioning
CN102609723A (en) * 2012-02-08 2012-07-25 清华大学 Image classification based method and device for automatically segmenting videos
JP2014006871A (en) * 2012-05-31 2014-01-16 Casio Comput Co Ltd Image region dividing device, method, and program
CA2780710A1 (en) * 2012-06-11 2013-12-11 Minglun Gong Video segmentation method

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
梁旭东;武妍;: "基于邻域特征与聚类的图像分割方法", 计算机工程, no. 03 *
陈蓉;孙剑;徐宗本;: "彩色图像分割中基于图上半监督学习算法研究", 西安交通大学学报, no. 02 *

Similar Documents

Publication Publication Date Title
Sun et al. Template matching-based method for intelligent invoice information identification
CN110766008A (en) Text detection method facing any direction and shape
US20180137321A1 (en) Method and system for decoding two-dimensional code using weighted average gray-scale algorithm
CN110598609A (en) Weak supervision target detection method based on significance guidance
CN114092389A (en) Glass panel surface defect detection method based on small sample learning
CN108537816B (en) Salient object segmentation method based on superpixel and background connection prior
US11042986B2 (en) Method for thinning and connection in linear object extraction from an image
CN105957113B (en) Manhattan network-based horizontal inscribed rectangle algorithm and device for any connected domain
CN112819840B (en) High-precision image instance segmentation method integrating deep learning and traditional processing
CN113191358B (en) Metal part surface text detection method and system
CN109977959B (en) Train ticket character area segmentation method and device
CN108710881B (en) Neural network model, candidate target area generation method and model training method
Bhatia et al. A new measure of fuzzy directed divergence and its application in image segmentation
CN111274863B (en) Text prediction method based on text mountain probability density
CN112862843A (en) Official seal image segmentation method and system based on neighborhood pixel multi-weight decision
CN112308917A (en) Vision-based mobile robot positioning method
JP2019153235A (en) Object area identification apparatus, object area identification method, and program
CN114066788A (en) Balanced instance segmentation data synthesis method
CN113313700A (en) X-ray image interactive segmentation method based on deep learning
CN111260659A (en) Image interactive segmentation method based on initial annotation point guidance
Wu et al. Quick Response Code Binary Research Based on Basic Image Processing
Wang et al. Robust air-light estimation for a single hazy image using haze-lines in Plüker coordinates
Saxena et al. A comparative study on adversarial noise generation for single image classification
Smith Edge-based motion segmentation
Timchenko et al. Method of forecasting energy center positions of laser beam spot images using a parallel hierarchical network for optical communication systems

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