[go: up one dir, main page]

CN114240988B - Image segmentation method based on nonlinear scale space - Google Patents

Image segmentation method based on nonlinear scale space Download PDF

Info

Publication number
CN114240988B
CN114240988B CN202111444114.1A CN202111444114A CN114240988B CN 114240988 B CN114240988 B CN 114240988B CN 202111444114 A CN202111444114 A CN 202111444114A CN 114240988 B CN114240988 B CN 114240988B
Authority
CN
China
Prior art keywords
image
threshold
value
scale space
gray
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
CN202111444114.1A
Other languages
Chinese (zh)
Other versions
CN114240988A (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.)
Nanjing University of Information Science and Technology
Original Assignee
Nanjing University of Information Science and Technology
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 Nanjing University of Information Science and Technology filed Critical Nanjing University of Information Science and Technology
Priority to CN202111444114.1A priority Critical patent/CN114240988B/en
Publication of CN114240988A publication Critical patent/CN114240988A/en
Application granted granted Critical
Publication of CN114240988B publication Critical patent/CN114240988B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/136Segmentation; Edge detection involving thresholding
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/40Image enhancement or restoration using histogram techniques
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/70Denoising; Smoothing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/194Segmentation; Edge detection involving foreground-background segmentation
    • 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/20024Filtering details
    • G06T2207/20028Bilateral filtering

Landscapes

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

Abstract

The invention discloses an image segmentation method based on a nonlinear scale space, which relates to the technical field of image segmentation, and is characterized in that the nonlinear scale space is constructed based on KAZE characteristics, an input image is subjected to nonlinear filtering through a KAZE algorithm, then a gradient histogram of the image is calculated, a contrast parameter k is obtained, all images in the nonlinear scale space are obtained through an additive molecular splitting algorithm according to a group of evolution time t, then the images are smoothed, an iteration algorithm is used for global threshold processing, then an edge improvement global threshold processing is used for carrying out primary segmentation on objects and backgrounds in the images based on the improved threshold, and when the contrast of the objects and the backgrounds are not uniform in the images, the threshold is obtained through a maximum inter-class variance method according to the local characteristics of the images, and the image segmentation is carried out. The invention solves the problem that uniform areas and edge areas cannot be effectively distinguished in a linear scale space, and a large amount of local details are lost under the same filtering scale condition.

Description

Image segmentation method based on nonlinear scale space
Technical Field
The invention relates to the technical field of image segmentation, in particular to an image segmentation method based on a nonlinear scale space.
Background
In a real situation, the distance between the object and the position of the observer shows different expressions, for example, the human eyes observe that the object experiences different scales, and when the distance is far, the main outline area is observed, and more detail information is observed at a short distance. In the case of large scale parameters, the loss of high frequency information is serious, and rough contour information is mainly displayed, and the high frequency detail is called as a remarkable feature in an image. The high-frequency information is easy to find and identify in the field of vision, and can be applied to tasks such as feature extraction and target identification. The method is an effect brought by different scales, the basic idea that the multi-scale technology in computer vision wants to express is that the image blurring outline shape is the sampling of the image outline shape under the condition of a large scale and the image blurring outline shape under the condition of a small scale, and the scale space can well simulate the condition that the human eyes observe things, so that the method is well applied to the field of computer vision. The methods for constructing the scale space are mainly divided into two types: the linear scale space and the nonlinear scale space construct a scale space.
The main difference between linear and nonlinear scale spaces is the difference between the filter kernel functions. The linear scale space principal kernel function is a gaussian kernel function: the method is simple and efficient in calculation, and meanwhile, the Gaussian kernel function is the only scale-invariant kernel function, but the Gaussian function has the main defect that a uniform area and an edge area cannot be effectively distinguished and are the same in filtering scale, so that a large amount of local details are lost.
Disclosure of Invention
Aiming at the defects of the prior art, the invention provides an image segmentation method based on a nonlinear scale space, which has the advantage of effectively segmenting images and solves the problem that the images cannot be effectively resolved.
In order to achieve the purpose of effectively dividing an image, the invention provides the following technical scheme, namely an image dividing method based on a nonlinear scale space, which comprises the following steps:
S1: constructing a nonlinear scale space based on the KAZE features;
s2: carrying out nonlinear filtering on an input picture through a KAZE algorithm, then calculating a gradient histogram of the picture to obtain a contrast parameter k, and obtaining all pictures in a nonlinear scale space by utilizing an additive molecular splitting algorithm according to a group of evolution time t;
S3: performing smoothing processing on the image acquired in the step S2, performing global threshold processing by using an iterative algorithm, performing edge improvement global threshold processing, and performing primary segmentation on objects and backgrounds in the image based on the improved threshold;
s4: and comparing the object with the background, and when the contrast of the object and the background is not uniform in the image, obtaining a threshold value according to the local characteristics of the image and dividing the image by using a maximum inter-class variance method.
In the step S3, as an optimization, the iterative algorithm performs global thresholding, and the steps are as follows:
S301: counting the gray level histogram of the image, calculating the maximum gray level value and the minimum gray level value of the image, respectively marking the maximum gray level value and the minimum gray level value as Z MAX and Z MIN, and enabling the initial threshold value T 0=(ZMAX+ZMIN)/2, wherein the iteration number K=1;
S302: dividing the image into foreground and background according to the K-th iteration threshold T K, calculating the average value Z A of all gray scales smaller than T 0 and the average value Z B of all gray scales larger than T 0;
s303: solving a new threshold T K+1=(ZA+ZB)/2;
S304: if the difference between T K and T K+1 is smaller than the predefined parameter Δt, the obtained T K+1 is the iteration final threshold, otherwise the iteration number K is increased by 1, and the iteration calculation is continued in S302.
As an optimization, in the step S3, the global thresholding is improved by using edges, and the steps are as follows:
s311: calculating an edge image of f (x, y) by adopting a feature detection method; wherein f (x, y) represents an image after KAZE feature processing;
S312: setting a threshold T t;
s313: thresholding the image in S311 with the threshold in S312 to produce a binary image g T (x, y);
s314: the histogram is calculated using only pixels in f (x, y) that correspond to positions in g T (x, y) where the pixel value is 1.
Further, in the step S4, the threshold is obtained by a maximum inter-class variance method, which specifically includes:
Calculating a normalized histogram of the input image, using p i, i=0, 1,2, …, L-1 representing the individual components of the histogram, p i representing the probability that the gray level of the pixel is i, L representing L different gray levels; calculating a cumulative sum P i (k) of the components, and a cumulative mean m (k); calculating a global gray value m G, and calculating an inter-class variance sigma 2 B (k);
The gray level k maximizing the inter-class variance sigma 2 B (k) is Otsu threshold k *, and if the maximum value is not unique, the average value of each maximum value k is used to obtain k *; the separability metric η * is calculated at k *.
Further, setting MxN pixels in the input image, L different gray levels, n i representing the number of pixels with gray level i; the total number of pixels MN in the image is mn=n 0+n1+n2+…+nL-1; the histogram components satisfy:
normalized histogram components p i=ni/MN.
Further, in the step S4, a threshold k *,0<k* < L-1 is obtained by a maximum inter-class variance method, and the image processed in the step S3 is thresholded into two types of C 1 and C 2 by using the threshold, wherein C 1 is composed of all pixels in the image with gray values in the range [0, k * ], and C2 is composed of all pixels with gray values in the range [ k * +1, L-1 ].
Further, in S4, the calculation formula of the inter-class variance is:
Where σ 2 B is the inter-class variance and P 1 is the probability that the pixels of histogram component P 1 are classified into class C 1; p 2 is the probability that the pixel of histogram component P 2 is classified into class C 2; m 1 is the average gray value assigned to the pixels of class C 1; m 2 is the average gray value assigned to the pixels of class C 2; m g is the average gray value of the whole image.
Further, in S4, the expression of the separation image is:
Where f (x, y) represents the image after KAZE feature processing.
The beneficial effects of the invention are as follows: the nonlinear filtering kernel function is mainly bilateral filtering, nonlinear diffusion filtering and the like when the nonlinear scale space is constructed, the nonlinear filtering kernel function mainly solves the problem that Gaussian filtering used when the linear scale space is constructed cannot effectively distinguish uniform and edge judgment, so that the nonlinear filtering kernel function can retain more high-frequency edge information and simultaneously can filter uniform areas, the problem that a large amount of local details cannot be effectively distinguished in the linear scale space, and the problem that the uniform areas and the edge areas are lost under the same filtering scale condition can be solved, the accuracy of picture identification can be effectively increased, and more detailed gray value comparison is provided when the image segmentation is carried out, so that the image segmentation is facilitated.
Drawings
FIG. 1 is a schematic flow chart of the present invention.
Detailed Description
The following description of the embodiments of the present invention will be made clearly and completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments of the present invention, but not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
The image segmentation method based on the nonlinear scale space, as shown in fig. 1, comprises the following steps:
s1: based on KAZE features, a nonlinear scale space is constructed.
S2: and carrying out nonlinear filtering on an input picture by a KAZE algorithm, then calculating a gradient histogram of the image, obtaining a contrast parameter k, and obtaining all images of a nonlinear scale space by utilizing an additive molecular splitting (AOS) algorithm according to a group of evolution time t.
S3: and (3) carrying out smoothing processing on the image acquired in the step (S2), carrying out global threshold processing by using an iterative algorithm, and carrying out initial segmentation on objects and backgrounds in the image based on the improved threshold by using edge improved global threshold processing.
The iterative algorithm performs global thresholding as follows:
S301: counting the gray level histogram of the image, calculating the maximum gray level value and the minimum gray level value of the image, respectively marking the maximum gray level value and the minimum gray level value as Z MAX and Z MIN, and enabling the initial threshold value T 0=(ZMAX+ZMIN)/2, wherein the iteration number K=1;
S302: dividing the image into foreground and background according to the K-th iteration threshold T K, calculating the average value Z A of all gray scales smaller than T 0 and the average value Z B of all gray scales larger than T 0;
s303: solving a new threshold T K+1=(ZA+ZB)/2;
S304: if the difference between T K and T K+1 is smaller than the predefined parameter Δt, the obtained T K+1 is the iteration final threshold, otherwise the iteration number K is increased by 1, and the iteration calculation is continued in S302.
The global thresholding with edge improvement is as follows:
s311: calculating an edge image of f (x, y) by adopting a feature detection method; wherein f (x, y) represents an image after KAZE feature processing;
S312: setting a threshold T t;
s313: thresholding the image in S311 with the threshold in S312 to produce a binary image g T (x, y);
s314: the histogram is calculated using only pixels in f (x, y) that correspond to positions in g T (x, y) where the pixel value is 1.
The smoothed and segmented image may cause distortion of the boundary between the object and the background due to blurring of the boundary, the more smoothed an image, the greater the boundary error in the segmented result.
S4: and comparing the object with the background, and when the contrast of the object and the background is not uniform in the image, obtaining a threshold value according to the local characteristics of the image and dividing the image by using a maximum inter-class variance method (Otsu method).
The threshold value is obtained through a maximum inter-class variance method, and the method specifically comprises the following steps:
Calculating a normalized histogram of the input image, using p i, i=0, 1,2, …, L-1 representing the individual components of the histogram, p i representing the probability that the gray level of the pixel is i, L representing L different gray levels; calculating a cumulative sum P i (k) of the components, and a cumulative mean m (k); calculating a global gray value m G, and calculating an inter-class variance sigma 2 B (k);
The gray level k maximizing the inter-class variance sigma 2 B (k) is Otsu threshold k *, and if the maximum value is not unique, the average value of each maximum value k is used to obtain k *; the separability metric η * is calculated at k *.
Setting MxN pixels in an input image, L different gray levels, wherein n i represents the number of pixels with the gray level of i; the total number of pixels MN in the image is mn=n 0+n1+n2+…+nL-1; the histogram components satisfy:
normalized histogram components p i=ni/MN.
The threshold k *,0<k* < L-1 is obtained by the maximum inter-class variance method, and the threshold is used for thresholding the S3 processed image into two classes C 1 and C 2, wherein C 1 consists of all pixels in the image with gray values in the range [0, k * ], and C2 consists of all pixels with gray values in the range [ k * +1, L-1 ].
The calculation formula of the inter-class variance is:
In the middle of As the inter-class variance, P 1 is the probability that the pixel of the histogram component P 1 is classified into class C 1; p 2 is the probability that the pixel of histogram component P 2 is classified into class C 2; m 1 is the average gray value assigned to the pixels of class C 1; m 2 is the average gray value assigned to the pixels of class C 2; m g is the average gray value of the whole image.
The separate image expression is:
Where f (x, y) represents the image after KAZE feature processing.
The nonlinear filtering kernel function is mainly bilateral filtering, nonlinear diffusion filtering and the like when the nonlinear scale space is constructed, the nonlinear filtering kernel function mainly solves the problem that Gaussian filtering used when the linear scale space is constructed cannot effectively distinguish uniform and edge judgment, so that the nonlinear filtering kernel function can retain more high-frequency edge information and simultaneously can filter uniform areas, the problem that a large amount of local details cannot be effectively distinguished in the linear scale space, and the problem that the uniform areas and the edge areas are lost under the same filtering scale condition can be solved, the accuracy of picture identification can be effectively increased, and more detailed gray value comparison is provided when the image segmentation is carried out, so that the image segmentation is facilitated.
The present invention is not limited to the above-mentioned embodiments, and any person skilled in the art, based on the technical solution of the present invention and the inventive concept thereof, can be replaced or changed within the scope of the present invention.

Claims (6)

1. An image segmentation method based on a nonlinear scale space is characterized by comprising the following steps:
S1: constructing a nonlinear scale space based on the KAZE features;
s2: carrying out nonlinear filtering on an input picture through a KAZE algorithm, then calculating a gradient histogram of the picture to obtain a contrast parameter k, and obtaining all pictures in a nonlinear scale space by utilizing an additive molecular splitting algorithm according to a group of evolution time t;
S3: performing smoothing processing on the image acquired in the step S2, performing global threshold processing by using an iterative algorithm, performing edge improvement global threshold processing, and performing primary segmentation on objects and backgrounds in the image based on the improved threshold;
the global thresholding is performed using an iterative algorithm, as follows:
S301: counting the gray level histogram of the image, calculating the maximum gray level value and the minimum gray level value of the image, respectively marking the maximum gray level value and the minimum gray level value as Z MAX and Z MIN, and enabling the initial threshold value T 0=(ZMAX+ZMIN)/2, wherein the iteration number K=1;
S302: dividing the image into foreground and background according to the K-th iteration threshold T K, calculating the average value Z A of all gray scales smaller than T 0 and the average value Z B of all gray scales larger than T 0;
s303: solving a new threshold T K+1=(ZA+ZB)/2;
S304: if the difference between T K and T K+1 is smaller than the predefined parameter DeltaT, the obtained T K+1 is the final iteration threshold, otherwise, the iteration number K is increased by 1, and the process goes to S302, and the iteration calculation is continued;
the global thresholding with edge improvement is as follows:
s311: calculating an edge image of f (x, y) by adopting a feature detection method; wherein f (x, y) represents an image after KAZE feature processing;
S312: setting a threshold T t;
s313: thresholding the image in S311 with the threshold in S312 to produce a binary image g T (x, y);
S314: calculating a histogram using only pixels in f (x, y) corresponding to a position in g T (x, y) where the pixel value is 1;
s4: and comparing the object with the background, and when the contrast of the object and the background is not uniform in the image, obtaining a threshold value according to the local characteristics of the image and dividing the image by using a maximum inter-class variance method.
2. The nonlinear scale space-based image segmentation method as set forth in claim 1, wherein: in the step S4, the threshold is obtained by a maximum inter-class variance method, which specifically includes:
Calculating a normalized histogram of the input image, using p i, i=0, 1,2, …, L-1 representing the individual components of the histogram, p i representing the probability that the gray level of the pixel is i, L representing L different gray levels; calculating a cumulative sum P i (k) of the components, and a cumulative mean m (k); calculating a global gray value m G, and calculating an inter-class variance sigma 2 B (k);
The gray level k maximizing the inter-class variance sigma 2 B (k) is Otsu threshold k *, and if the maximum value is not unique, the average value of each maximum value k is used to obtain k *; the separability metric η * is calculated at k *.
3. The nonlinear scale space-based image segmentation method as set forth in claim 2, wherein: setting MxN pixels in an input image, L different gray levels, wherein n i represents the number of pixels with the gray level of i;
the total number of pixels MN in the image is mn=n 0+n1+n2+…+nL-1; the histogram components satisfy:
normalized histogram components p i=ni/MN.
4. A method of image segmentation based on nonlinear scale space according to claim 3, characterized in that: in the step S4, a threshold k *,0<k* < L-1 is obtained through a maximum inter-class variance method, and the threshold is used for thresholding the image processed in the step S3 into two types C 1 and C 2, wherein C 1 consists of all pixels in the image, the gray value of which is in the range [0, k * ], and C2 consists of all pixels in the gray value of which is in the range [ k * +1, L-1 ].
5. The nonlinear scale space based image segmentation method as set forth in claim 4, wherein: in the step S4, the calculation formula of the inter-class variance is:
Where σ 2 B is the inter-class variance and P 1 is the probability that the pixels of histogram component P 1 are classified into class C 1; p 2 is the probability that the pixel of histogram component P 2 is classified into class C 2; m 1 is the average gray value assigned to the pixels of class C 1; m 2 is the average gray value assigned to the pixels of class C 2; m g is the average gray value of the whole image.
6. The nonlinear scale space based image segmentation method as set forth in claim 5, wherein: in S4, the expression of the separation image is:
Where f (x, y) represents the image after KAZE feature processing.
CN202111444114.1A 2021-11-30 2021-11-30 Image segmentation method based on nonlinear scale space Active CN114240988B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111444114.1A CN114240988B (en) 2021-11-30 2021-11-30 Image segmentation method based on nonlinear scale space

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111444114.1A CN114240988B (en) 2021-11-30 2021-11-30 Image segmentation method based on nonlinear scale space

Publications (2)

Publication Number Publication Date
CN114240988A CN114240988A (en) 2022-03-25
CN114240988B true CN114240988B (en) 2024-09-06

Family

ID=80752181

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111444114.1A Active CN114240988B (en) 2021-11-30 2021-11-30 Image segmentation method based on nonlinear scale space

Country Status (1)

Country Link
CN (1) CN114240988B (en)

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103198484A (en) * 2013-04-07 2013-07-10 山东师范大学 Iris image segmentation algorithm based on nonlinear dimension space
CN106203448A (en) * 2016-07-08 2016-12-07 南京信息工程大学 A kind of scene classification method based on Nonlinear Scale Space Theory

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108470343A (en) * 2017-02-23 2018-08-31 南宁市富久信息技术有限公司 A kind of improved method for detecting image edge
CN111709964B (en) * 2020-06-22 2023-04-25 重庆理工大学 PCBA target edge detection method
CN112967304A (en) * 2021-03-24 2021-06-15 内蒙古师范大学 Edge detection algorithm for multi-edge window collaborative filtering

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103198484A (en) * 2013-04-07 2013-07-10 山东师范大学 Iris image segmentation algorithm based on nonlinear dimension space
CN106203448A (en) * 2016-07-08 2016-12-07 南京信息工程大学 A kind of scene classification method based on Nonlinear Scale Space Theory

Also Published As

Publication number Publication date
CN114240988A (en) 2022-03-25

Similar Documents

Publication Publication Date Title
CN111833306B (en) Defect detection method and model training method for defect detection
CN109961049B (en) Cigarette brand identification method under complex scene
CN111145209B (en) Medical image segmentation method, device, equipment and storage medium
CN109242791B (en) Batch repair method for damaged plant leaves
CN111680690B (en) Character recognition method and device
CN109934224B (en) Small target detection method based on Markov random field and visual contrast mechanism
CN109948625A (en) Definition of text images appraisal procedure and system, computer readable storage medium
CN109241973B (en) A fully automatic soft segmentation method of characters under texture background
CN109685045A (en) A kind of Moving Targets Based on Video Streams tracking and system
CN115063421A (en) Pole piece region detection method, system and device, medium and defect detection method
CN107154044B (en) Chinese food image segmentation method
CN117853510A (en) Canny edge detection method based on bilateral filtering and self-adaptive threshold
CN110570442A (en) Contour detection method under complex background, terminal device and storage medium
CN114298985B (en) Defect detection method, device, equipment and storage medium
CN113780110A (en) Method and device for detecting weak and small targets in image sequence in real time
Srinivas et al. Remote sensing image segmentation using OTSU algorithm
CN110807763A (en) Method and system for detecting ceramic tile surface bulge
CN117094975A (en) Method and device for detecting surface defects of steel and electronic equipment
CN117911338A (en) Image definition evaluation method, device, computer equipment and storage medium
CN117853722A (en) Steel metallographic structure segmentation method integrating superpixel information
CN117392066A (en) Defect detection method, device, equipment and storage medium
CN104268845A (en) Self-adaptive double local reinforcement method of extreme-value temperature difference short wave infrared image
CN110473222A (en) Image-element extracting method and device
CN110276260B (en) A product detection method based on depth camera
CN114240988B (en) Image segmentation method based on nonlinear scale space

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