CN108305261A - Picture segmentation method, apparatus, storage medium and computer equipment - Google Patents

Picture segmentation method, apparatus, storage medium and computer equipment Download PDF

Info

Publication number
CN108305261A
CN108305261A CN201710686692.3A CN201710686692A CN108305261A CN 108305261 A CN108305261 A CN 108305261A CN 201710686692 A CN201710686692 A CN 201710686692A CN 108305261 A CN108305261 A CN 108305261A
Authority
CN
China
Prior art keywords
picture
split
candidate
edge
pixel
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201710686692.3A
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.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen 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 Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN201710686692.3A priority Critical patent/CN108305261A/en
Publication of CN108305261A publication Critical patent/CN108305261A/en
Pending legal-status Critical Current

Links

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
    • G06T11/002D [Two Dimensional] image generation
    • G06T11/20Drawing from basic elements, e.g. lines or circles
    • G06T11/203Drawing of straight lines or curves
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/13Edge detection

Landscapes

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

Abstract

The present invention provides a kind of picture segmentation method, including:Obtain picture to be split, segmentation picture progress edge extracting is treated using convolution kernel and obtains corresponding edge feature figure, corresponding edge binary map is obtained according to edge feature figure, line analysis is carried out to edge binary map, the corresponding straight line analytic expression of edge binary map is obtained, is determined to form the candidate Straight Combination of candidate polygon according to straight line analytic expression;Candidate parameter information is calculated according to the geological information of the geological information of candidate polygon, picture to be split, matching screening target polygon is carried out according to candidate parameter information and standard parameter information;The corresponding target line combination of target polygon is obtained from candidate Straight Combination, the Target Segmentation region that corresponding target line analytic expression determines picture to be split is combined according to target line.By accurate edge extracting and geometrical analysis, the convenience of operation is improved, a kind of picture segmentation device, storage medium and computer equipment are also provided.

Description

Picture segmentation method, apparatus, storage medium and computer equipment
Technical field
The present invention relates to image processing fields, more particularly to a kind of picture segmentation method, apparatus, storage medium and calculating Machine equipment.
Background technology
With the continuous development of science and technology, the function of mobile terminal is more and more perfect, can be carried out using mobile terminal Video, instant chat, shopping at network etc. are watched, during function each using mobile terminal, in order to obtain relevant information, It needs to acquire the partial information in picture, when such as carrying out authentication, identity card picture is shot first with video camera, it is then right Including the picture of identity card is split, target area of the identity card in picture is obtained, further identifies identity information.
When identifying pictorial information using mobile terminal, need first by camera acquisition picture or video flowing, it is then right The picture of acquisition is split.Traditional technology is poor to edge extractability, causes recognition accuracy relatively low, user is in shooting figure It needs target item being maintained at video camera fixed position when piece, ensures that cut zone is located at the specific position of picture, operation is not Just.
Invention content
Based on this, it is necessary in view of the above-mentioned problems, providing a kind of picture segmentation method, apparatus, storage medium and computer Equipment treats segmentation picture by using convolution kernel and carries out edge extracting, and carries out analyzing processing to the edge of extraction, improves The accuracy and picture segmentation accuracy of edge detection, improve the convenience of operation.
A kind of picture segmentation method, including:
Obtain picture to be split;
Edge extracting is carried out to the picture to be split using convolution kernel and obtains corresponding edge feature figure, according to the side Edge characteristic pattern obtains corresponding edge binary map;
Line analysis is carried out to the edge binary map, obtains the corresponding straight line analytic expression of the edge binary map, according to The straight line analytic expression is determined to form the candidate Straight Combination of candidate polygon;
Candidate parameter information is calculated according to the geological information of the geological information of candidate polygon, picture to be split, according to institute It states candidate parameter information and standard parameter information carries out matching screening target polygon;
The corresponding target line combination of the target polygon is obtained from the candidate Straight Combination, it is straight according to the target Line combines the Target Segmentation region that corresponding target line analytic expression determines the picture to be split.
The convolution kernel is equal value difference convolution kernel in one of the embodiments, described to be waited for point to described using convolution kernel Cutting the step of picture progress edge extracting obtains corresponding edge feature figure includes:
Obtain the corresponding equal value difference convolution kernel of preset all directions;
It is utilized respectively the corresponding equal value difference convolution kernel of all directions and each side is obtained to the picture progress convolution to be split To corresponding convolution characteristic pattern;
Obtain the pixel of the picture to be split corresponding convolution feature in the corresponding convolution characteristic pattern of all directions Point composition convolution set of characteristic points, obtain the corresponding convolution characteristic point of maximum pixel gray value in the convolution set of characteristic points As target convolution characteristic point;
Corresponding edge feature figure is generated according to the corresponding target convolution characteristic point of each pixel of picture to be split.
Described the step of obtaining corresponding edge binary map according to the edge feature figure, wraps in one of the embodiments, It includes:
According to default sliding window corresponding currently processed region is obtained from the edge feature figure;
The corresponding grey scale pixel value of each pixel in the currently processed region is obtained, and forms current pixel gray value Set, judges whether the corresponding grey scale pixel value of the currently processed regional center position pixel is the current grayvalue collection Maximum pixel gray value in conjunction;
If so, the grey scale pixel value of the center pixel is set to the first presetted pixel gray value, if it is not, then The grey scale pixel value of the center pixel is set to the second presetted pixel gray value, the first presetted pixel gray value More than the second presetted pixel gray value;
The default sliding window is slided to next region, using next region as currently processed region, into institute The step of obtaining the corresponding grey scale pixel value of each pixel in the currently processed region is stated, until traversing the edge feature Each pixel in figure generates corresponding edge binary map.
The grey scale pixel value by the center pixel is set to the first default picture in one of the embodiments, The step of plain gray value includes:
Judge whether the grey scale pixel value of the center pixel is more than predetermined threshold value;
If so, the grey scale pixel value of the center pixel is set to the first presetted pixel gray value;
If it is not, the grey scale pixel value of the center pixel is then set to the second presetted pixel gray value.
It is described respectively by the corresponding equal value difference convolution kernel of all directions to the figure to be split in one of the embodiments, Piece carries out convolution the step of obtaining corresponding convolution characteristic pattern and includes:
Corresponding convolution will be obtained to the convolution of the picture to be split using the corresponding equal value difference convolution kernel of all directions The operation of characteristic pattern executes side by side;
Or
Convolution is carried out to the picture to be split using the equal value difference convolution kernel of preset direction, according to working as picture to be split The corresponding convolution characteristic point of adjacent processed pixel of the corresponding original pixels gray value of preceding pixel point, the current pixel point Grey scale pixel value the grey scale pixel value of the corresponding convolution characteristic point of the current pixel point is calculated;
The corresponding next pixel of the current pixel point is obtained as current pixel point, into described according to be split The corresponding volume of adjacent processed pixel of the corresponding original pixels gray value of current pixel point of picture, the current pixel point The step of grey scale pixel value of the corresponding convolution characteristic point of the current pixel point is calculated in the grey scale pixel value of product characteristic point, Until traversing the pixel of the picture to be split, the corresponding convolution characteristic pattern of the preset direction, the preset direction are obtained Including horizontal direction and/or vertical direction.
It is described in one of the embodiments, to be determined to form the candidate of candidate polygon according to the straight line analytic expression The step of Straight Combination includes:
The parameter in the straight line analytic expression of arbitrary two line correspondences is obtained successively, according to the parameter and two included angle of straight line The angle of arbitrary two line correspondences is calculated in calculation formula;
Two straight lines that the angle is less than the first default angle threshold value are put into parallel lines set as one group of parallel lines In;
Arbitrary two groups of parallel lines in the parallel lines set are obtained, the corresponding average angle of every group of parallel lines is calculated separately Degree, will be corresponding when detecting that the absolute value of difference of the corresponding average angle of two groups of parallel lines is in preset threshold range Two groups of parallel lines are determined as the candidate Straight Combination.
The standard parameter information includes preset area ratio and default length of side ratio in one of the embodiments,;Institute The geological information calculating candidate parameter information for stating the geological information according to candidate polygon, picture to be split, according to the candidate Parameter information and standard parameter information carry out matching the step of screening target polygon:
The area ratio that corresponding candidate polygon and the picture to be split are calculated according to the candidate Straight Combination, is obtained The area ratio is taken to be more than the candidate polygon of the preset area ratio, the candidate polygon set of composition first;
The minimum candidate of length of side ratio in described first candidate polygon set and the default length of side ratio gap is more Side shape is determined as target polygon.
It is described in one of the embodiments, that institute is determined according to the corresponding target line analytic expression of target line combination The step of Target Segmentation region for stating picture to be split includes:
Standard peak coordinate is determined according to the standard parameter information, and the mesh is determined according to the target line analytic expression Mark the apex coordinate of polygon;
The apex coordinate that the target polygon is corrected according to the standard peak coordinate, determines representative points coordinate, root The Target Segmentation region of the picture to be split is determined according to the representative points coordinate.
A kind of picture segmentation device, described device include:
First acquisition module, for obtaining picture to be split;
First edge extraction module, it is corresponding for being obtained to the picture progress edge extracting to be split using convolution kernel Edge feature figure obtains corresponding edge binary map according to the edge feature figure;
First edge analysis module obtains the edge binary map for carrying out line analysis to the edge binary map Corresponding straight line analytic expression is determined to form the candidate Straight Combination of candidate polygon according to the straight line analytic expression;
First geometrical analysis module, based on according to the geological information of candidate polygon, the geological information of picture to be split Candidate parameter information is calculated, matching screening target polygon is carried out according to the candidate parameter information and standard parameter information;
First object cut zone determining module is corresponded to for obtaining the target polygon from the candidate Straight Combination Target line combine the mesh that corresponding target line analytic expression determines the picture to be split combined according to the target line Mark cut zone.
The convolution kernel is equal value difference convolution kernel in one of the embodiments, and the first edge extraction module includes:
Convolution module is utilized respectively all directions pair for obtaining the corresponding equal value difference convolution kernel of preset all directions The equal value difference convolution kernel answered carries out convolution to the picture to be split and obtains the corresponding convolution characteristic pattern of all directions;
Edge feature figure generation module, for obtaining the pixel of picture to be split in the corresponding convolution of all directions Corresponding convolution feature point group obtains the maximum pixel in the convolution set of characteristic points at convolution set of characteristic points in characteristic pattern The corresponding convolution characteristic point of gray value is as target convolution characteristic point, according to the corresponding target of each pixel of picture to be split Convolution characteristic point generates corresponding edge feature figure.
The first edge extraction module further includes in one of the embodiments,:
Processing module, for according to sliding window is preset from the corresponding currently processed region of edge feature figure acquisition, obtaining The corresponding grey scale pixel value of each pixel in the currently processed region, and form current pixel gray scale value set;
Judgment module, for judge the corresponding grey scale pixel value of the currently processed regional center position pixel whether be Maximum pixel gray value in the current gray level value set;
Setup module, for if so, the grey scale pixel value of the center pixel is set to the first presetted pixel Gray value, if it is not, the grey scale pixel value of the center pixel is then set to the second presetted pixel gray value, described first Presetted pixel gray value is more than the second presetted pixel gray value;
Loop module, for sliding the default sliding window to next region, using next region as current place Region is managed, into the processing module, until each pixel traversed in the edge feature figure generates corresponding edge two Value figure.
The setup module is additionally operable to judge the pixel grey scale of the center pixel in one of the embodiments, Whether value is more than predetermined threshold value;If so, the grey scale pixel value of the center pixel is set to the described first default picture Plain gray value;If it is not, the grey scale pixel value of the center pixel is then set to the second presetted pixel gray value.
The convolution module is additionally operable to that the corresponding equal value difference convolution kernel of all directions will be utilized in one of the embodiments, The operation that corresponding convolution characteristic pattern is obtained to the convolution of the picture to be split executes side by side;
Or
Convolution is carried out to the picture to be split using the equal value difference convolution kernel of preset direction, according to working as picture to be split The corresponding convolution characteristic point of adjacent processed pixel of the corresponding original pixels gray value of preceding pixel point, the current pixel point Grey scale pixel value the grey scale pixel value of the corresponding convolution characteristic point of the current pixel point is calculated;Obtain the current picture The corresponding next pixel of vegetarian refreshments is corresponding into the current pixel point according to picture to be split as current pixel point Original pixels gray value, the current pixel point the corresponding convolution characteristic point of adjacent processed pixel grey scale pixel value meter The step of calculation obtains the grey scale pixel value of the corresponding convolution characteristic point of the current pixel point, until traversing the picture to be split Pixel, obtain the corresponding convolution characteristic pattern of the preset direction, the preset direction includes horizontal direction and/or Vertical Square To.
The first edge analysis module includes in one of the embodiments,:
Computing module, the parameter in straight line analytic expression for obtaining arbitrary two line correspondences successively, according to the ginseng The angle of arbitrary two line correspondences is calculated in number and two included angle of straight line calculation formula;
Parallel lines determining module, two straight lines for the angle to be less than to the first default angle threshold value are put down as one group Line is put into parallel lines set;
Candidate Straight Combination determining module is counted respectively for obtaining arbitrary two groups of parallel lines in the parallel lines set The corresponding average angle of every group of parallel lines is calculated, when the absolute value for the difference for detecting the corresponding average angle of two groups of parallel lines is pre- If when in threshold range, corresponding two groups of parallel lines are determined as the candidate Straight Combination.
The standard parameter information includes preset area ratio and default length of side ratio in one of the embodiments,;Institute State the first geometrical analysis module be additionally operable to according to the candidate Straight Combination calculate corresponding candidate polygon with it is described to be split The area ratio of picture, obtains the candidate polygon that the area ratio is more than the preset area ratio, and composition first is candidate Polygon set;By the candidate of length of side ratio and the default length of side ratio gap minimum in the described first candidate polygon set Polygon is determined as target polygon.
The first object cut zone determining module is additionally operable to according to the standard parameter in one of the embodiments, Information determines standard peak coordinate, and the apex coordinate of the target polygon is determined according to the target line analytic expression;According to The standard peak coordinate corrects the apex coordinate of the target polygon, determines representative points coordinate, according to the target top Point coordinates determines the Target Segmentation region of the picture to be split.
A kind of computer readable storage medium, for storing, computer is executable to be referred to the computer readable storage medium It enables, when the computer executable instructions are executed by processor so that the processor executes following steps:Obtain figure to be split Piece;Edge extracting is carried out to the picture to be split using convolution kernel and obtains corresponding edge feature figure, according to edge spy Sign figure obtains corresponding edge binary map;Line analysis is carried out to the edge binary map, the edge binary map is obtained and corresponds to Straight line analytic expression, be determined to form the candidate Straight Combination of candidate polygon according to the straight line analytic expression;According to candidate The geological information of polygon, picture to be split geological information calculate candidate parameter information, according to the candidate parameter information and Standard parameter information carries out matching screening target polygon;It is corresponding that the target polygon is obtained from the candidate Straight Combination Target line combines, and the target that corresponding target line analytic expression determines the picture to be split is combined according to the target line Cut zone.
When the computer executable instructions are executed by processor in one of the embodiments, also so that the processing Device executes following steps:Obtain the corresponding equal value difference convolution kernel of preset all directions;It is corresponding to be utilized respectively all directions Value difference convolution kernel carries out convolution to the picture to be split and obtains the corresponding convolution characteristic pattern of all directions;Obtain picture to be split Pixel in the corresponding convolution characteristic pattern of all directions corresponding convolution feature point group obtained at convolution set of characteristic points Take the corresponding convolution characteristic point of maximum pixel gray value in the convolution set of characteristic points as target convolution characteristic point;According to The corresponding target convolution characteristic point of each pixel of picture to be split generates corresponding edge feature figure.
When the computer executable instructions are executed by processor in one of the embodiments, also so that the processing Device executes following steps:According to default sliding window corresponding currently processed region is obtained from the edge feature figure;Work as described in acquisition The corresponding grey scale pixel value of each pixel in pre-treatment region, and current pixel gray scale value set is formed, judge described current The corresponding grey scale pixel value of processing region center pixel whether be in the current gray level value set maximum pixel ash Angle value;If so, the grey scale pixel value of the center pixel is set to the first presetted pixel gray value, if it is not, then will The grey scale pixel value of the center pixel is set to the second presetted pixel gray value, and the first presetted pixel gray value is big In the second presetted pixel gray value;The default sliding window is slided to next region, using next region as working as The step of pre-treatment region, grey scale pixel value corresponding into each pixel in the acquisition currently processed region, directly Corresponding edge binary map is generated to each pixel traversed in the edge feature figure.
When the computer executable instructions are executed by processor in one of the embodiments, also so that the processing Device executes following steps:Judge whether the grey scale pixel value of the center pixel is more than predetermined threshold value;If so, by institute The grey scale pixel value for stating center pixel is set to the first presetted pixel gray value;If it is not, then by the center The grey scale pixel value of pixel is set to the second presetted pixel gray value.
When the computer executable instructions are executed by processor in one of the embodiments, also so that the processing Device executes following steps:The convolution of the picture to be split will be corresponded to using the corresponding equal value difference convolution kernel of all directions The operation of convolution characteristic pattern execute side by side;Or the picture to be split is rolled up using the equal value difference convolution kernel of preset direction Product, according to the corresponding original pixels gray value of the current pixel point of picture to be split, the current pixel point it is adjacent processed The picture of the corresponding convolution characteristic point of the current pixel point is calculated in the grey scale pixel value of the corresponding convolution characteristic point of pixel Plain gray value;The corresponding next pixel of the current pixel point is obtained as current pixel point, is waited for point into the basis The corresponding original pixels gray value of current pixel point, the adjacent processed pixel of the current pixel point for cutting picture are corresponding The step of the grey scale pixel value of the corresponding convolution characteristic point of the current pixel point is calculated in the grey scale pixel value of convolution characteristic point Suddenly, until traversing the pixel of the picture to be split, the corresponding convolution characteristic pattern of the preset direction, the default side are obtained To including horizontal direction and/or vertical direction.
When the computer executable instructions are executed by processor in one of the embodiments, also so that the processing Device executes following steps:The parameter in the straight line analytic expression of arbitrary two line correspondences is obtained successively, according to the parameter and two The angle of arbitrary two line correspondences is calculated in included angle of straight line calculation formula;The angle is less than the first default angle threshold value Two straight lines as one group of parallel lines, be put into parallel lines set;Arbitrary two groups obtained in the parallel lines set are parallel Line calculates separately the corresponding average angle of every group of parallel lines, when the difference for detecting the corresponding average angle of two groups of parallel lines When absolute value is in preset threshold range, corresponding two groups of parallel lines are determined as the candidate Straight Combination.
When the computer executable instructions are executed by processor in one of the embodiments, also so that the processing Device executes following steps:The area of corresponding candidate polygon and the picture to be split is calculated according to the candidate Straight Combination Ratio obtains the candidate polygon that the area ratio is more than the preset area ratio, the first candidate polygon set of composition; The candidate polygon of length of side ratio and the default length of side ratio gap minimum in described first candidate polygon set is determined For target polygon.
When the computer executable instructions are executed by processor in one of the embodiments, also so that the processing Device executes following steps:Standard peak coordinate is determined according to the standard parameter information, it is true according to the target line analytic expression The apex coordinate of the fixed target polygon;The apex coordinate of the target polygon is corrected according to the standard peak coordinate, It determines representative points coordinate, the Target Segmentation region of the picture to be split is determined according to the representative points coordinate.
A kind of computer equipment, including memory and processor, the memory is for storing computer-readable instruction, institute When stating computer-readable instruction and being executed by the processor so that the processor executes following steps:Obtain picture to be split; Edge extracting is carried out to the picture to be split using convolution kernel and obtains corresponding edge feature figure, according to the edge feature figure Obtain corresponding edge binary map;Line analysis is carried out to the edge binary map, it is corresponding straight to obtain the edge binary map Line analytic expression is determined to form the candidate Straight Combination of candidate polygon according to the straight line analytic expression;According to candidate polygon The geological information calculating candidate parameter information of the geological information of shape, picture to be split, according to the candidate parameter information and standard Parameter information carries out matching screening target polygon;The corresponding target of the target polygon is obtained from the candidate Straight Combination Straight Combination combines the Target Segmentation that corresponding target line analytic expression determines the picture to be split according to the target line Region.
When the computer-readable instruction is executed by processor in one of the embodiments, also so that the processor Execute following steps:Obtain the corresponding equal value difference convolution kernel of preset all directions;It is utilized respectively the corresponding mean value of all directions Poor convolution kernel carries out convolution to the picture to be split and obtains the corresponding convolution characteristic pattern of all directions;Obtain picture to be split Pixel corresponding convolution feature point group in the corresponding convolution characteristic pattern of all directions is obtained at convolution set of characteristic points The corresponding convolution characteristic point of maximum pixel gray value in the convolution set of characteristic points is as target convolution characteristic point;According to waiting for The corresponding target convolution characteristic point of each pixel for dividing picture generates corresponding edge feature figure.
When the computer-readable instruction is executed by processor in one of the embodiments, also so that the processor Execute following steps:According to default sliding window corresponding currently processed region is obtained from the edge feature figure;It obtains described current The corresponding grey scale pixel value of each pixel in processing region, and current pixel gray scale value set is formed, judge the current place Whether pixel corresponding grey scale pixel value in reason regional center position is maximum pixel gray scale in the current gray level value set Value;If so, the grey scale pixel value of the center pixel is set to the first presetted pixel gray value, if it is not, then by institute The grey scale pixel value for stating center pixel is set to the second presetted pixel gray value, and the first presetted pixel gray value is more than The second presetted pixel gray value;The default sliding window is slided to next region, using next region as current The step of processing region, grey scale pixel value corresponding into each pixel in the acquisition currently processed region, until The each pixel traversed in the edge feature figure generates corresponding edge binary map.
When the computer-readable instruction is executed by processor in one of the embodiments, also so that the processor Execute following steps:Judge whether the grey scale pixel value of the center pixel is more than predetermined threshold value;If so, will be described The grey scale pixel value of center pixel is set to the first presetted pixel gray value;If it is not, then by the center picture The grey scale pixel value of vegetarian refreshments is set to the second presetted pixel gray value.
When the computer-readable instruction is executed by processor in one of the embodiments, also so that the processor Execute following steps:The convolution of the picture to be split will be obtained using the corresponding equal value difference convolution kernel of all directions corresponding The operation of convolution characteristic pattern executes side by side;Or the picture to be split is rolled up using the equal value difference convolution kernel of preset direction Product, according to the corresponding original pixels gray value of the current pixel point of picture to be split, the current pixel point it is adjacent processed The picture of the corresponding convolution characteristic point of the current pixel point is calculated in the grey scale pixel value of the corresponding convolution characteristic point of pixel Plain gray value;The corresponding next pixel of the current pixel point is obtained as current pixel point, is waited for point into the basis The corresponding original pixels gray value of current pixel point, the adjacent processed pixel of the current pixel point for cutting picture are corresponding The step of the grey scale pixel value of the corresponding convolution characteristic point of the current pixel point is calculated in the grey scale pixel value of convolution characteristic point Suddenly, until traversing the pixel of the picture to be split, the corresponding convolution characteristic pattern of the preset direction, the default side are obtained To including horizontal direction and/or vertical direction.
When the computer-readable instruction is executed by processor in one of the embodiments, also so that the processor Execute following steps:The parameter in the straight line analytic expression of arbitrary two line correspondences is obtained successively, it is straight according to the parameter and two The angle of arbitrary two line correspondences is calculated in wire clamp angle calculation formula;The angle is less than the first default angle threshold value Two straight lines are put into as one group of parallel lines in parallel lines set;Arbitrary two groups of parallel lines in the parallel lines set are obtained, The corresponding average angle of every group of parallel lines is calculated separately, it is absolute when the difference for detecting the corresponding average angle of two groups of parallel lines When value is in preset threshold range, corresponding two groups of parallel lines are determined as the candidate Straight Combination.
When the computer-readable instruction is executed by processor in one of the embodiments, also so that the processor Execute following steps:The area ratio of corresponding candidate polygon and the picture to be split is calculated according to the candidate Straight Combination Example obtains the candidate polygon that the area ratio is more than the preset area ratio, the first candidate polygon set of composition;It will The candidate polygon of length of side ratio and the default length of side ratio gap minimum is determined as in described first candidate polygon set Target polygon.
When the computer-readable instruction is executed by processor in one of the embodiments, also so that the processor Execute following steps:Standard peak coordinate is determined according to the standard parameter information, is determined according to the target line analytic expression The apex coordinate of the target polygon;The apex coordinate of the target polygon is corrected according to the standard peak coordinate, really Set the goal apex coordinate, and the Target Segmentation region of the picture to be split is determined according to the representative points coordinate.
Above-mentioned picture segmentation method, apparatus, storage medium and computer equipment are treated segmentation picture using convolution kernel and are carried out Edge extracting obtains corresponding edge binary map, and further carries out line analysis to edge binary map and obtain corresponding straight line Analytic expression carries out geometrical analysis to straight line analytic expression and obtains candidate Straight Combination, believed according to candidate Straight Combination and standard parameter Breath determines Target Segmentation region.Segmentation picture is treated using convolution kernel and carries out convolution, improves the accuracy of image edge extraction, And by determining candidate polygon to the line analysis of edge binary map, target polygon is determined according to preset standard parameter information And then determine Target Segmentation region, by the analyzing processing to edge binary map, simultaneously combined standard parameter information can accurately really Set the goal cut zone, can determine that determination need not be incited somebody to action positioned at the Target Segmentation region of any position in picture to be split Target Segmentation region is arranged in specific position, need not video camera be maintained at fixed position when shooting picture, improve behaviour The convenience of work.
A kind of picture segmentation method, the method includes:
Obtain picture to be split;
Edge extracting is carried out to the picture to be split using convolution kernel and obtains corresponding edge feature figure, according to the side Edge characteristic pattern obtains corresponding edge binary map;
Tracing analysis is carried out to the edge binary map, obtains the corresponding circle of the edge binary map or oval analytic expression, Candidate circle or elliptical geological information are determined according to the circle or oval analytic expression;
Candidate parameter information is calculated according to the geological information of the candidate circle or elliptical geological information, picture to be split, Matching screening target circle or ellipse are carried out according to the candidate parameter information and standard parameter information;
According to the target circle or the oval Target Segmentation region for determining the picture to be split.
A kind of image segmentation device, described device include:
Second acquisition module, for obtaining picture to be split;
Second edge extraction module, it is corresponding for being obtained to the picture progress edge extracting to be split using convolution kernel Edge feature figure obtains corresponding edge binary map according to the edge feature figure;
Second edge analysis module obtains the edge binary map for carrying out tracing analysis to the edge binary map Corresponding circle or oval analytic expression determine candidate circle or elliptical geological information according to the circle or oval analytic expression;
Second geometrical analysis module, for the geometry according to the candidate circle or elliptical geological information, picture to be split Information calculates candidate parameter information, according to the candidate parameter information and standard parameter information match and screens target circle or ellipse Circle;
Second Target Segmentation area determination module, for determining the picture to be split according to the target circle or ellipse Target Segmentation region.
A kind of computer readable storage medium, for storing, computer is executable to be referred to the computer readable storage medium It enables, when the computer executable instructions are executed by processor so that the processor executes following steps:Obtain figure to be split Piece;Edge extracting is carried out to the picture to be split using convolution kernel and obtains corresponding edge feature figure, according to edge spy Sign figure obtains corresponding edge binary map;Tracing analysis is carried out to the edge binary map, the edge binary map is obtained and corresponds to Circle or oval analytic expression, candidate circle or elliptical geological information are determined according to the circle or oval analytic expression;According to the time The geological information of choosing circle or elliptical geological information, picture to be split calculates candidate parameter information, is believed according to the candidate parameter Breath and standard parameter information carry out matching screening target circle or ellipse;According to the target circle or the oval determining figure to be split The Target Segmentation region of piece.
A kind of computer equipment, including memory and processor, the memory is for storing computer-readable instruction, institute When stating computer-readable instruction and being executed by the processor so that the processor executes following steps:Obtain picture to be split; Edge extracting is carried out to the picture to be split using convolution kernel and obtains corresponding edge feature figure, according to the edge feature figure Obtain corresponding edge binary map;Tracing analysis is carried out to the edge binary map, obtains the corresponding circle of the edge binary map Or oval analytic expression, candidate circle or elliptical geological information are determined according to the circle or oval analytic expression;According to the candidate circle Or the geological information of elliptical geological information, picture to be split calculates candidate parameter information, according to the candidate parameter information and Standard parameter information carries out matching screening target circle or ellipse;The picture to be split is determined according to the target circle or ellipse Target Segmentation region.
Method, apparatus, storage medium and the computer equipment of above-mentioned segmentation picture, using convolution kernel treat segmentation picture into Row edge extracting obtains corresponding edge binary map, further to edge binary map carry out tracing analysis obtain corresponding circle or Elliptical analytic expression and geological information determine target circle according to the geological information of circle or elliptical geological information, picture to be split Or it is oval, so that it is determined that the Target Segmentation region of picture to be split.Segmentation picture is treated using convolution kernel and carries out edge extracting, is carried The high accuracy of edge extracting, and by the tracing analysis to edge binary map, justified according to standard parameter information and candidate Shape or ellipse determine Target Segmentation region, can determine and are determined positioned at the Target Segmentation area of any position in picture to be split Target Segmentation region need not be arranged in specific position, need not video camera fixed bit be maintained at when shooting picture by domain It sets, improves the convenience of operation.
Description of the drawings
Fig. 1 is the flow chart of picture segmentation method in one embodiment;
Fig. 2 is the method flow diagram that edge feature figure is generated in one embodiment;
Fig. 2A is the design sketch of the edge feature figure generated in Fig. 2;
Fig. 3 is the method flow diagram that edge binary map is generated in one embodiment;
Fig. 3 A are the method schematic diagram that edge binary map is generated in one embodiment;
The method schematic diagram of edge binary map is generated in another embodiment of Fig. 3 B;
Fig. 4 is the schematic diagram of convolution algorithm in one embodiment;
Fig. 5 is the method flow diagram that line analysis is carried out in one embodiment;
Fig. 6 is the flow chart of picture segmentation method in another embodiment;
Fig. 7 is the flow chart of picture segmentation method in a specific embodiment;
Fig. 8 is picture segmentation effect diagram in one embodiment;
Fig. 9 is the structure diagram of picture segmentation device in one embodiment;
Figure 10 is the structure diagram of first edge extraction module in one embodiment;
Figure 11 is the structure diagram of first edge extraction module in another embodiment;
Figure 12 is the structure diagram of first edge analysis module in one embodiment;
Figure 13 is the structure diagram of picture segmentation device in another embodiment;
Figure 14 is the internal structure chart of one embodiment Computer equipment.
Specific implementation mode
In order to make the purpose , technical scheme and advantage of the present invention be clearer, with reference to the accompanying drawings and embodiments, right The present invention is further elaborated.It should be appreciated that the specific embodiments described herein are merely illustrative of the present invention, and It is not used in the restriction present invention.
As shown in Figure 1, in one embodiment, providing a kind of picture segmentation method, including the following contents:
Step S110 obtains picture to be split.
Specifically, picture to be split refers to the picture for including Target Segmentation region, and Target Segmentation region refers to needing to carry out The region of identification.Picture to be split can be using video camera current shooting picture, can be history picture in photograph album, can Can also be the picture intercepted from video flowing to be the picture for receiving or uploading.
Further, it after obtaining picture to be split, treats segmentation picture and is pre-processed, as utilization index function will wait for point The gray value for cutting each pixel in picture is mapped as another gray value, since the value of exponential function independent variable is got over Greatly, the amplitude of variation of dependent variable is bigger, therefore can be by the larger pixel of grey scale pixel value and the smaller picture of grey scale pixel value The difference of grey scale pixel value between vegetarian refreshments increases, and enhances the contrast between each pixel of picture to be split.
Step S120 treats segmentation picture progress edge extracting using convolution kernel and obtains corresponding edge feature figure, according to Edge feature figure obtains corresponding edge binary map.
Wherein, the power used when convolution kernel refers to convolution, is indicated with matrix.When handling image, to using volume Product verification input picture is handled, and the gray value for exporting each pixel in image is in input picture in corresponding region The weighted average of pixel, the size and weights of corresponding region are defined by convolution kernel.
Edge extracting refers to the processing for picture profile in Digital Image Processing.Variation of image grayscale rate is maximum Place is defined as edge, and marginal information includes the direction at pixel coordinate and edge.Binary map refers to by each picture on image For element only there are two types of possible value or tonal gradation state, edge binary map refers to treating after segmentation picture carries out edge extracting, The corresponding pixel in the edge of extraction is indicated with two kinds of possible tonal gradation states.
Specifically, segmentation picture is treated by using different types of convolution kernel and carries out edge extracting, such as use equal value difference Convolution kernel treats segmentation picture and carries out edge extracting, and equal value difference convolution kernel can realize the grey scale pixel value treated in segmentation picture Corresponding grey scale pixel value after being worth to convolution is made the difference after averaging.Further, equal value difference convolution kernel includes multi-direction structure Convolution kernel, Gaussian kernel, haar feature cores.Different convolution kernels treats segmentation picture and carries out the convolution characteristic pattern that edge extracting obtains Difference such as treats segmentation picture using multi-direction structure convolution kernel and carries out edge extracting, and the convolution kernel of different directions extracts to obtain Convolution characteristic pattern it is different, the corresponding edge feature figure of picture to be split is obtained according to the convolution characteristic pattern of all directions, according to Certain rule handles edge characteristic pattern to obtain corresponding edge binary map, such as gray scale to each pixel in characteristic pattern Value locally carry out non-maxima suppression, obtain corresponding edge binary map, such as by the gray value of each pixel be set as 0 or 255 generate the edge binary map of corresponding table.
Step S130 carries out line analysis to edge binary map, obtains the corresponding straight line analytic expression of edge binary map, according to Straight line analytic expression is determined to form the candidate Straight Combination of candidate polygon.
Wherein, polygon refers to being sequentially connected with formed planar graph by three or three or more line segment head and the tail, such as Triangle, rectangle etc..Candidate polygon is consistent with the graphical information that the edge in Target Segmentation region is constituted, such as from picture to be split Middle segmentation identity card pictorial information, since the edge of identity card is rectangle, candidate polygon is rectangle.
Specifically, when Target Segmentation region is polygon, edge binary map is carried out using Hough (Hough) transformation straight Line analysis, Hough transformation can identify geometry from picture, can be detached from image several with certain same characteristic features What shape, such as straight line.The basic principle of Hough transformation is the duality with line using point, and the lines of image space are become parameter The accumulation point in space, to detect the curve that given image whether there is Given Properties.Straight line point such as is carried out to edge binary map Analysis, according to Hough transformation, if by y=kx+b is set as in the expression formula of image coordinate system cathetus, on this line one Point (x0, y0) corresponds to the straight line b=-kx0+y0 in parameter space, therefore, in image coordinate system on same straight line Point intersects at a point (k, b) in parameter space, and the value of coordinate (k, b) can be obtained in parameter space using the method for statistics, defeated Go out corresponding angle and intercept, obtains the straight line analytic expression y=kx+b in image coordinate system.
Specifically, the target pixel points for obtaining the characteristics of image that edge binary map can be represented in edge binary map, such as picture The pixel that plain gray value is 255 obtains the corresponding coordinate of target pixel points in the image coordinate system of edge binary map, will The corresponding coordinate of target pixel points is mapped in parameter coordinate system, corresponding in parameter coordinate system according to each target pixel points Straight line obtain corresponding slope and intercept, determine corresponding straight line analytic expression in edge feature figure, wherein slope can with Angle between abscissa in image coordinate system indicates.Further, there are a plurality of straight lines in edge binary map, can obtain Multiple and different straight line analytic expressions.
Further, removal non-rectilinear and air line distance are less than in advance during carrying out line analysis to edge binary map If the short-term section of length.Specifically, obtain can determine after corresponding straight line analytic expression whether is pixel in edge binary map On straight line, the length of corresponding straightway can also be determined according to the coordinate at straight line analytic expression midpoint, straight length is low It is deleted in the straightway of preset length value, improves the accuracy of line analysis, be more advantageous to obtain the candidate straight line of the condition of satisfaction Combination.
It in other embodiments, can also be by the innovatory algorithm of Hough transformation, such as probability Hough transformation or other algorithms Line analysis is carried out to edge binary map.
After obtaining corresponding straight line analytic expression according to line analysis, according to the graphic feature of target candidate polygon, such as square The graphic feature of shape is that adjacent side is mutually perpendicular to, opposite side is mutually parallel, the angle of the graphic feature of regular pentagon between each side For 108 degree, each length of side it is equal, the graphic feature of equilateral triangle is that the angle on three sides is 60 degree, the figure of right angled triangle Shape is characterized as that two sides are mutually perpendicular to, another a line and the angle on orthogonal both sides are respectively 30 degree and 60 degree etc..According to The graphic feature of angle formulae and candidate polygon between straight line is determined to form the Straight Combination of candidate polygon.
Step S140 calculates candidate parameter letter according to the geological information of the geological information of candidate polygon, picture to be split Breath carries out matching screening target polygon according to candidate parameter information and standard parameter information.
Wherein, geological information refers to the information such as the attribute information of geometric figure, including the length of side of polygon, angle.Standard Parameter information refers to the parameter information in preset Target Segmentation region, if the corresponding geometric figure in Target Segmentation region is to be split The shared corresponding length of side ratio of area ratio and/or Target Segmentation region or angle ratio etc. in picture.Candidate parameter is believed Breath refers to the actual parameter information being calculated according to the geological information of candidate polygon.
Specifically, as standard parameter information defines the corresponding geometric figure in Target Segmentation region institute in picture to be split The default length of side ratio of the corresponding geometric figure of preset area proportion threshold value and Target Segmentation region accounted for, then according to candidate polygon The geological information of shape calculates the ratio between the area and each length of side of each candidate polygon, according to the several of picture to be split What information calculates the area of picture to be split, and the areal calculation according to the area and picture to be split of each candidate polygon is each Area ratio of the candidate polygon in picture to be split obtains the candidate polygon that area ratio is more than area ratio threshold value, The candidate that corresponding side ratio and default length of side ratio gap minimum are obtained from the candidate polygon for meeting area ratio is polygon Shape.Matching screening obtains target candidate polygon.
Step S150 obtains the corresponding target line combination of target polygon, according to target line from candidate Straight Combination Combine the Target Segmentation region that corresponding target line analytic expression determines picture to be split.
Specifically, it after determining target polygon according to standard parameter information and the candidate parameter information being calculated, obtains The straight line for forming target polygon, corresponding Target Segmentation region is determined according to the corresponding straight line analytic expression of each target line. The intersecting point coordinate that target line is such as calculated by the corresponding straight line analytic expression of each target line, determines according to each intersecting point coordinate Target Segmentation region or the region intersection that is formed according to each straight line are as Target Segmentation region, according to Target Segmentation region from waiting for The picture being partitioned into segmentation picture in Target Segmentation region.
The picture segmentation method provided in the present embodiment treats segmentation picture using convolution kernel and carries out edge extracting obtaining pair The edge binary map answered, and line analysis further is carried out to edge binary map and obtains corresponding straight line analytic expression, to straight line Analytic expression carries out geometrical analysis and obtains candidate Straight Combination, and Target Segmentation is determined according to candidate Straight Combination and standard parameter information Region.Segmentation picture is treated using convolution kernel and carries out convolution, improves the accuracy of image edge extraction, and by edge two The line analysis for being worth figure determines candidate polygon, determines target polygon according to preset standard parameter information and then determines target point Region is cut, Target Segmentation area can accurately be determined by the analyzing processing to edge binary map and combined standard parameter information Domain can determine the Target Segmentation region for being determined in picture to be split and being located at any position, need not be by Target Segmentation region It is arranged in specific position, video camera need not be maintained at fixed position when shooting picture, improve the convenience of operation.
As shown in Fig. 2, in one embodiment, convolution kernel is mean value convolution kernel, step S120 includes:
Step S121 obtains the corresponding equal value difference convolution kernel of preset all directions.
Specifically, equal value difference convolution kernel refers to realize when converting image using convolution, Neng Gouji Calculate the matrix of the gray average of image pixel area to be split.The corresponding matrix of equal value difference convolution kernel of different directions is different, can Equal value difference convolution kernel to obtain multiple and different directions is treated segmentation picture and is converted.Particularly, a side can be obtained To equal value difference convolution kernel treat segmentation picture converted.
For example, defining vertical direction, horizontal direction or the convolution kernel in other directions as needed, it is assumed that convolution kernel is all The square formation of (2n+1) * (2n+1).As follows, fv、fh、fd1、fd2Vertical direction, horizontal direction, 45 degree of directions are indicated respectively, The convolution kernel of 135 degree of direction four directions.The convolution kernel in other directions can also be set according to actual needs.
Step S122, be utilized respectively the corresponding equal value difference convolution kernel of all directions treat segmentation picture carry out convolution obtain respectively The corresponding convolution characteristic pattern in a direction.
Specifically, the corresponding equal value difference convolution kernel of all directions is treated into segmentation picture and carries out convolution, obtain all directions Corresponding convolution characteristic pattern.Such as use fv、fh、fd1、fd2Convolution is carried out with image to be split obtain corresponding convolution feature respectively Scheme img_v, img_h, img_d1, img_d2.Further, with vertical direction convolution kernel fvFor, img_v=img_src*fv/ (n × (2n+1)), according to the definition of convolution, obtains:
Wherein, n≤i < img_src.cols-n, n≤j < img_src.rows-n, img_src.cols indicate to be split Width, the img_src.rows of picture indicate the height of picture to be split.Img_ is can be seen that according to the expression formula of above-mentioned img_v V is the average value treated segmentation figure piece top half and lower half portion and seek grey scale pixel value respectively, then calculating difference.
Step S123 obtains the pixel of picture to be split corresponding convolution in corresponding convolution characteristic pattern in all directions Feature point group obtains the corresponding convolution characteristic point of maximum pixel gray value in convolution set of characteristic points at convolution set of characteristic points As target convolution characteristic point.
Wherein, convolution characteristic point refers to treating segmentation picture using convolution kernel to carry out in the convolution characteristic pattern obtained after convolution Each pixel.
Specifically, the convolution kernel for being utilized respectively all directions treats segmentation picture and carries out convolution to obtain all directions corresponding Convolution characteristic pattern, since the convolution kernel size of all directions is identical, the square formation as being all (2n+1) * (2n+1), therefore each side Identical to corresponding convolution characteristic pattern size, corresponding pixel number is identical in each convolution characteristic pattern, in picture to be split Pixel in each convolution characteristic pattern a corresponding convolution characteristic point.The convolution kernel of all directions is treated segmentation picture and is carried out What the convolution characteristic pattern that convolution obtains extracted is the edge feature that can most reflect the direction, as the convolution kernel of vertical direction is treated The vertical direction convolution characteristic pattern that segmentation picture obtained after convolution can most reflect vertical direction edge feature information, therefore, In order to comprehensively characterize the characteristic information of picture to be split, the feature in the convolution characteristic pattern according to all directions is needed to believe Breath obtains corresponding edge feature figure.
The pixel of the picture to be split corresponding convolution characteristic point in each convolution characteristic pattern is obtained, convolution feature is formed Point set, the grey scale pixel value of the same pixel corresponding convolution characteristic point in different convolution characteristic patterns of picture to be split Difference, the grey scale pixel value the big more can reflect characteristics of image, therefore, it is maximum that grey scale pixel value is obtained from convolution set of characteristic points Pixel corresponding target convolution characteristic point of the convolution characteristic point as picture to be split.It obtains successively each in picture to be split The corresponding target convolution characteristic point of a pixel.
Particularly, the convolution feature in a direction can be used to check picture to be split as needed and carries out process of convolution, Obtain corresponding edge feature figure.
Step S124 generates corresponding edge according to the corresponding target convolution characteristic point of each pixel of picture to be split Characteristic pattern.
Specifically, treat segmentation picture each pixel corresponding convolution characteristic point is compared acquisition in all directions To target convolution characteristic point, target convolution characteristic point can preferably reflect picture to be split in the feature of corresponding pixel points, root Corresponding edge feature figure is generated according to the position of target convolution characteristic point and grey scale pixel value, and edge feature figure, which can reflect, to be waited for point Cut the edge feature information of picture.
Further, as shown in Figure 2 A, it is utilized respectively vertical direction convolution kernel fvAnd horizontal direction convolution kernel fhIt treats point It cuts the progress of picture 200 convolution and obtains corresponding vertical direction convolution characteristic pattern 200A and horizontal direction convolution characteristic pattern 200B, it will Picture 200 to be split is corresponded in vertical direction convolution characteristic pattern 200A and horizontal direction convolution characteristic pattern 200B same positions respectively Pixel convolution characteristic point, obtain convolution characteristic point in grey scale pixel value it is maximum point be used as target convolution characteristic point, such as Obtain a1 point and horizontal direction convolution characteristic pattern 200B of a points in picture to be split in vertical direction convolution characteristic pattern 200A In a2 points, compare the grey scale pixel value of a1 points and a2 points, pass through vertical direction convolution characteristic pattern 200A and horizontal direction convolution It is more clear that characteristic pattern 200B can be seen that a1 points, can more show the edge feature of a points, therefore, is corresponded to a1 points as a points Target convolution characteristic point, treat segmentation picture 200 in each pixel do same treatment, obtain edge feature Figure 200 C. Particularly, the convolution feature core that can also define other directions is handled, and multiple convolution characteristic patterns are compared to obtain more For accurate convolution characteristic pattern.
In the present embodiment, segmentation picture is treated respectively using the equal value difference convolution kernel of all directions and carries out convolution operation, is obtained To picture to be split in the corresponding convolution characteristic pattern of different directions, by choosing grey scale pixel value maximum in each convolution characteristic pattern Convolution characteristic point, generate corresponding edge feature figure.Segmentation picture subregion is treated using mean difference convolution kernel to calculate The difference between the mean value of each region is sought after value, can effectively utilize the nuance of area grayscale mean value to protrude contrast very Weak edge improves the robustness to texture and noise jamming, while can effectively avoid office by solving mean value and difference The small non-straight edges in portion, the linear edge for effectively extracting all directions further pass through the convolution feature of all directions Figure compares the maximum convolution characteristic point of selected pixels gray value, improves the clarity of the edge feature extracted.
As shown in figure 3, in one embodiment, step S120 further includes:
Step S125 obtains corresponding currently processed region according to default sliding window from edge feature figure.
Specifically, currently processed region refers to the position of current sliding window and the lap region of edge feature figure.It is default Sliding window is odd matrix, such as the matrix of 3*3.Edge feature figure is indicated using the corresponding grey scale pixel value matrix of each pixel.
As shown in Figure 3A, using the matrix of 3*3 as default sliding window 300, by sliding window 300 in the corresponding square of edge feature figure It is slided in battle array 300A, corresponding currently processed region 300B is obtained according to the current location of default sliding window 300.
Step S126 obtains the corresponding grey scale pixel value of each pixel in currently processed region, and forms current pixel Gray scale value set.
Specifically, each pixel corresponding pixel grey scale of the edge feature figure in currently processed region 300B is obtained Value.
Step S127 judges whether pixel corresponding grey scale pixel value in currently processed regional center position is current gray level Maximum pixel gray value in value set, if so, S128 is thened follow the steps, if it is not, thening follow the steps S129.
Wherein, currently processed regional center position pixel refers to center of the default sliding window matrix in current position The pixel of corresponding edge feature figure.
Specifically, as shown in Figure 3A, pixel 300C in Current central position is the corresponding pixel of dash area.By center Pixel 300C corresponding grey scale pixel values in position are compared with other grey scale pixel values in currently processed region 300B, in judgement Whether heart position pixel 300C is maximum pixel gray value in currently processed region 300B.If so, S128 is thened follow the steps, if It is no, then follow the steps S129.
The grey scale pixel value of center pixel is set to the first presetted pixel gray value by step S128.
Specifically, it if pixel corresponding grey scale pixel value in center is the maximum in currently processed region, says Light staining center position pixel can characterize the corresponding local feature of current region, in order to make edge feature be more clear, by center Pixel corresponding grey scale pixel value in position is set to the first presetted pixel gray value, is such as set as the maximum value of grey scale pixel value 255, so that center pixel is preferably characterized the characteristic information in currently processed region.
The grey scale pixel value of center pixel is set to the second presetted pixel gray value by step S129, and first is default Grey scale pixel value is more than the second presetted pixel gray value.
Specifically, if pixel corresponding grey scale pixel value in center is not the maximum in currently processed region, Illustrate that center pixel cannot characterize the corresponding local feature of current region well, in order to protrude local feature information, The center pixel that will be unable to characterize area characteristic information very well is set to the second presetted pixel gray value, the second presetted pixel Gray value sets the second presetted pixel gray value to for projecting edge characteristic information less than the first presetted pixel gray value Minimum pixel gray value 0.
Step S120A is slided and is preset sliding window to next region, using next region as currently processed region, entrance Step S126, until each pixel in traversal edge feature figure generates corresponding edge binary map.
As shown in Figure 3A, it slides and presets sliding window 300 from currently processed region 300A to next region 300D, by region 300C enters step S126 as currently processed region, according in the grey scale pixel value setting of each pixel in the 300D of region The corresponding presetted pixel gray values of heart position pixel 300E.Constantly sliding window 300 is preset in sliding, until each in edge feature figure A pixel is treated as the center pixel of corresponding region.Particularly, for being in edge feature figure pair The pixel for the grey scale pixel value matrix edge answered, as shown in Figure 3B, by the centre bit of 300 corresponding sliding window matrix of default sliding window It is seated in edge feature figure corresponding grey scale pixel value matrix edge position, for the region except pixel grey scale value matrix Each grey scale pixel value in 300F can be arranged as required to, and be such as filled with 0 or replicated corresponding pixel grey scale value matrix The pixel value at edge.
By the way that the grey scale pixel value of each pixel in edge feature figure is arranged, by each pixel in edge feature figure Grey scale pixel value indicated with one in two grey scale pixel values, generate corresponding edge binary map.
In the present embodiment, it is arranged and presets sliding window, obtain edge feature figure according to the current location of default sliding window locates currently The corresponding grey scale pixel value of pixel in region is managed, and by locating pixel corresponding grey scale pixel value in center with current The grey scale pixel value of pixel in reason region compares, and the corresponding grey scale pixel value of setting center pixel traverses edge Each pixel in characteristic pattern generates corresponding edge binary map.By setting preset sliding window edge feature figure is divided into it is multiple Region obtains the maximum point in each region using the method for non-maxima suppression, and according to the selection result that region is very big Value point is set as larger presetted pixel gray value, non-maximum point is set to smaller presetted pixel gray value, by setting Set grey scale pixel value outburst area maximum point so that the edge feature that edge extracting obtains is more prominent, further improves The accuracy of edge extracting.
In one embodiment, the grey scale pixel value of center pixel is set to the step of the first presetted pixel gray value Suddenly include:Judge whether the grey scale pixel value of center pixel is more than predetermined threshold value, if so, by center pixel Grey scale pixel value be set to the first presetted pixel gray value;If it is not, the grey scale pixel value of center pixel is then set to Two presetted pixel gray values.
Specifically, predetermined threshold value can rule of thumb or actual needs setting, be more than predetermined threshold value grey scale pixel value Corresponding pixel can more embody the characteristic information of picture to be split.
It is pixel ash in currently processed region in the grey scale pixel value of the corresponding center pixel in currently processed region The maximum of angle value then further judges whether center pixel is more than predetermined threshold value, if so, thinking the centre bit It is marginal point to set pixel, and by the center, pixel is set as the first presetted pixel gray value, if not, then it is assumed that the center Position pixel is not marginal point, and by the center, pixel is set as the second presetted pixel gray value.
In the present embodiment, by the predetermined threshold value of grey scale pixel value to the pixel of currently processed regional center position pixel Gray value further judges, marginal point is extracted according to judging result, by the spy that grey scale pixel value projecting edge pixel is arranged Sign, further increases the clarity of edge feature and the accuracy of edge extracting.
In one embodiment, step S122 includes:The corresponding equal value difference convolution kernel of all directions will be utilized to be split The operation that the convolution of picture obtains corresponding convolution characteristic pattern executes side by side.
Specifically, by the parallel processing in different processors respectively of the corresponding convolution kernel of all directions, multinuclear is such as used Processor handles the convolution operation of all directions respectively, accelerates convolutional calculation speed to improve the efficiency of edge extracting.
In one embodiment, step S122 includes:Using the equal value difference convolution kernel of preset direction treat segmentation picture into Row convolution, according to the corresponding original pixels gray value of the current pixel point of picture to be split, current pixel point it is adjacent processed The pixel ash of the corresponding convolution characteristic point of current pixel point is calculated in the grey scale pixel value of the corresponding convolution characteristic point of pixel Angle value;The corresponding next pixel of current pixel point is obtained as current pixel point, into according to the current of picture to be split The corresponding original pixels gray value of pixel, current pixel point the corresponding convolution characteristic point of adjacent processed pixel pixel The step of grey scale pixel value of the corresponding convolution characteristic point of current pixel point is calculated in gray value, until traversing picture to be split Pixel, obtain the corresponding convolution characteristic pattern of preset direction, preset direction includes horizontal direction and/or vertical direction.
Specifically, it is exactly to pass through meter to treat segmentation picture to carry out the process of convolution using the equal value difference convolution kernel of preset direction Calculate the process averaged after the integral of the grey scale pixel value of picture to be split in the corresponding region in convolution kernel current location.Default side To including horizontally and vertically.
Calculate the corresponding grey scale pixel value of some pixel, obtain centered on the pixel position and with convolution kernel size The corresponding grey scale pixel value of pixel in the region of identical image to be split, and the grey scale pixel value of acquisition is corresponding with convolution kernel The numerical value of position is multiplied, and read group total mean value obtains the pixel of the pixel corresponding convolution characteristic point in convolution characteristic pattern Gray value.It calculates the corresponding convolution characteristic point of each pixel and is required to traversal all pixels point progress mean operation.It uses Integrogram method simplifies the process that segmentation picture carries out convolution algorithm for the treatment of.It is corresponded to by the convolution characteristic point that convolution algorithm obtains Grey scale pixel value store into preset group, as shown in figure 4, in the corresponding picture element matrix of image to be split 400, pixel M, n, y and x are adjacent, and corresponding grey scale pixel value is respectively m1, n1, y1 and x1, it is assumed that m, n point, y points are in corresponding convolution The grey scale pixel value of the m0 of the corresponding convolution characteristic points of characteristic pattern matrix 400A, n0, y0 distinguish m2, and n2, y2 are stored to pre- If in array, obtaining original pixels gray value x1 of the x points in picture to be split, then the picture of the corresponding convolution characteristic point x0 of x points Plain gray value=x1+m2+n2-y2 preserves the grey scale pixel value of obtained convolution characteristic point x0 into preset group, based on Calculate the grey scale pixel value of the corresponding convolution characteristic point of later pixel point.The corresponding convolution feature of each pixel of picture to be split The grey scale pixel value for the convolution characteristic point that the grey scale pixel value of point has calculated before can utilizing obtains, and need not weigh Convolution algorithm is carried out again.
In the present embodiment, the corresponding pixel of convolution characteristic point calculated is vertically or horizontally being utilized Gray value calculates the grey scale pixel value of the corresponding convolution characteristic point of current pixel point, need not repeat to roll up each pixel Product operation, simplifies the calculating process of edge extracting, improves the efficiency of edge extracting.
As shown in figure 5, in one embodiment, step S130 includes:
Step S131 obtains the parameter in the straight line analytic expression of arbitrary two line correspondences successively, straight according to parameter and two The angle of arbitrary two line correspondences is calculated in wire clamp angle calculation formula.
Specifically, the parameter in straight line analytic expression refers to that the parameter of linear feature is indicated in linear equation, oblique such as straight line Rate, intercept etc..It can determine the relationship to be formed between each straight line of target polygon according to the geometric properties of target polygon, If the geometric properties of rectangle are mutually parallel for opposite side, adjacent side is mutually perpendicular to.It can be true by the angled relationships calculated between straight line Surely meet the straight line to form rectangle condition.
Further, the angle of two straight lines is calculated using the angle formulae of straight line, the angle of such as two straight lines is respectively K1 and k2, then according to following formula:
Tan α=| k2-k111+k1k2 | it is found that the angle of two straight lines is α=arctan | k2-k1/1+k1k2 |.
In other embodiments, other included angle of straight line formula can also be utilized to calculate the angle between two straight lines, Huo Zhegen Inner product, which is calculated, according to the direction vector of straight line obtains the correspondence of two straight lines.
Step S132, two straight lines that angle is less than the first default angle threshold value are put into parallel as one group of parallel lines In line set.
Wherein, the first default angle threshold value is the value for being infinitely close to zero.When the angle between two straight lines is less than first When default angle threshold value, illustrate that the angle of two straight lines is infinitely close to zero, according to the relationship between parallel lines, it is believed that two straight Line is mutually parallel.
Specifically, the angle between two parallel lines is 0 degree or 180 degree, and arbitrary two straight line l are calculatedi∈List < Line > and lj∈ List < Line > angles are αi,j, α is worked as when ε is a sufficiently small value according to mathematical definitioni,j When < ε, it is believed that liAnd ljFor two parallel lines, forms one group of parallel lines combination and be put into parallel lines set List_para_line.
Step S133 obtains arbitrary two groups of parallel lines in parallel lines set, and it is corresponding flat to calculate separately every group of parallel lines Equal angle will be right when detecting that the absolute value of difference of the corresponding average angle of two groups of parallel lines is in preset threshold range The two groups of parallel lines answered are determined as candidate Straight Combination.
Wherein, average angle refers to the average value of the angle of two straight lines in every group of parallel lines, and the angle of straight line refers to Angle between image coordinate system cathetus and abscissa.Preset threshold range is the threshold range of 90 degree of infinite approach.
Specifically, the difference between two groups of parallel lines is calculated according to the average angle of the straight line in every group of parallel lines, if two When organizing 90 degree of the absolute value infinite approach of difference or being 90 degree, it is believed that two groups of parallel lines are mutually perpendicular to, two groups of parallel lines Rectangle is can make up, using the corresponding Straight Combination of two groups of parallel lines as candidate Straight Combination.
For example, any two parallel segment combines lp in List_para_linei、lpj, calculate separately lpi、lpjBe averaged AngleWithAccording to the vertical definition of two straight lines, whether the angle for calculating two straight lines is pi/2. Since there are errors during feature extraction, it is thus possible to which two straight lines will not be completely vertical, according to following formula:
Wherein, abs represents absolute value, and γ is a sufficiently small value, according to mathematical definition, as long as between two groups of parallel lines Angle meets the inequality, then illustrates that two parallel segments combine lpi、lpjIt can be mutually perpendicular to, form rectangle.
In other embodiments, different relationships can be defined according to the geometrical relationship of candidate polygon, screened Corresponding target line combination.
In the present embodiment, by taking straight line is constituted rectangle as an example, it is mutually parallel adjacent side mutually orthogonal relationship using rectangle opposite side, Geometrical relationship formula is defined, qualified target line is screened by geometrical relationship formula.According to the geometric properties of candidate polygon Target line is screened with geometrical relationship formula, what can more quickly be prepared gets what target line and target line were formed Candidate polygon improves the accuracy in Target Segmentation region.
In one embodiment, standard parameter information includes preset area ratio and default length of side ratio;Step S140 packets It includes:The area ratio that corresponding candidate polygon and picture to be split are calculated according to candidate Straight Combination, it is big to obtain area ratio In the candidate polygon of preset area ratio, the candidate polygon set of composition first;By the length of side in the first candidate polygon set The candidate polygon of ratio and default length of side ratio gap minimum is determined as target polygon.
Specifically, preset area ratio is the ratio of the area of target polygon and the area of picture to be split, presets face Product ratio is rule of thumb arranged.Due to during carrying out edge extracting, it is possible that more polygon, in order to reduce Distracter, setting preset area ratio screen the polygon of formation, determine that candidate's polygon, composition first are candidate polygon Shape set.Further, due to when shooting picture to be split, the be taken distance of article of video camera distance can influence to be taken Area ratio of the article in the picture taken, the preset area ratio being rule of thumb arranged as area ratio standard, when When less than the area ratio standard, illustrate that corresponding polygon can not possibly meet the condition in Target Segmentation region.
Obtained according to preset area ratio and meet the candidate polygon of condition, further, the area of polygon it is identical but Geometric properties, such as length of side ratio may be different, in order to uniquely determine candidate polygonal region, by the way that length of side ratio is arranged from the Target polygon is screened in one candidate polygon set, obtains the candidate for presetting side ratio determination and default side ratio gap minimum For polygon as target polygon, the region where target polygon determines Target Segmentation region.
Such as, target polygon is rectangle, and preset area ratio is the area ratio of rectangle and picture to be split, presets the length of side Ratio is the ratio of width to height of rectangle.The area for calculating each rectangle obtained by line analysis first obtains each rectangle and is waiting for Divide area ratio shared in picture, the rectangle using area ratio more than preset area ratio is as candidate rectangle, from candidate The rectangle of acquisition the ratio of width to height and default the ratio of width to height gap minimum is as target rectangle in rectangle, the region conduct where target rectangle Target Segmentation region.
In the present embodiment, screened by the way that the polygon that standard parameter information forms Straight Combination is arranged, it is logical first It crosses preset area ratio to screen polygon, reduces interference, target polygon is then determined according to default side ratio, is used Accurate ratio screens target polygon, improves the accuracy in the Target Segmentation region detected.
In one embodiment, step S150 includes:Standard peak coordinate is determined according to standard parameter information, according to target Straight line analytic expression determines the apex coordinate of target polygon;The apex coordinate of target polygon is corrected according to standard peak coordinate, It determines representative points coordinate, the Target Segmentation region of picture to be split is determined according to representative points coordinate.
Specifically, according to the area ratio in standard parameter information, can determine standard target cut zone position and Area can get the length of each length of side so that it is determined that corresponding standard peak is sat according to corresponding length of side percent information Mark.After getting target polygon, according to each straight line analytic expression for forming target polygon, each straight line analytic expression is calculated Intersecting point coordinate, the intersecting point coordinate of each target line are the apex coordinate of target polygon.Since each straight line carries at edge During taking, the target polygon that extraction obtains is caused not necessarily to meet due to picture shooting angle etc. completely vertical Condition, it is therefore desirable to which each apex coordinate of target polygon is adjusted.
The apex coordinate for the target polygon being calculated is mapped to standard peak coordinate, according to standard peak coordinate tune The whole apex coordinate being calculated, determines representative points coordinate, and Target Segmentation area to be split is determined according to representative points coordinate Domain.
In the present embodiment, the apex coordinate for the target polygon being calculated according to standard peak coordinate pair is adjusted, Optimization aim polygon improves the accuracy in Target Segmentation region.
As shown in fig. 6, in one embodiment, a kind of picture segmentation method is provided, including:
Step S210 obtains picture to be split.
Specifically, picture to be split refers to the picture for including Target Segmentation region, and Target Segmentation region refers to needing to carry out The region of identification.Picture to be split can be using video camera current shooting picture, can be history picture in photograph album, can Can also be the picture intercepted from video flowing to be the picture for receiving or uploading.
Further, it after obtaining picture to be split, treats segmentation picture and is pre-processed, as utilization index function will wait for point The gray value for cutting each pixel in picture is mapped as another gray value, since the value of exponential function independent variable is got over Greatly, the amplitude of variation of dependent variable is bigger, therefore can be by the larger pixel of grey scale pixel value and the smaller picture of grey scale pixel value The difference of grey scale pixel value between vegetarian refreshments increases, and enhances the contrast between each pixel of picture to be split.
Step S220 treats segmentation picture progress edge extracting using convolution kernel and obtains corresponding edge feature figure, according to Edge feature figure obtains corresponding edge binary map.
Wherein, the power used when convolution kernel refers to convolution, is indicated with matrix.When handling image, to using volume Product verification input picture is handled, and the gray value for exporting each pixel in image is in input picture in corresponding region The weighted average of pixel, the size and weights of corresponding region are defined by convolution kernel.
Edge extracting refers to the processing for picture profile in Digital Image Processing.Variation of image grayscale rate is maximum Place is defined as edge, and marginal information includes the direction at pixel coordinate and edge.Binary map refers to by each picture on image For element only there are two types of possible value or tonal gradation state, edge binary map refers to treating after segmentation picture carries out edge extracting, The corresponding pixel in the edge of extraction is indicated with two kinds of possible tonal gradation states.
Specifically, segmentation picture is treated by using different types of convolution kernel and carries out edge extracting, such as use equal value difference Convolution kernel treats segmentation picture and carries out edge extracting, and equal value difference convolution kernel can realize the grey scale pixel value treated in segmentation picture Corresponding grey scale pixel value after being worth to convolution is made the difference after averaging.Further, equal value difference convolution kernel includes multi-direction structure Convolution kernel, Gaussian kernel, haar feature cores.Different convolution kernels treats segmentation picture and carries out the convolution characteristic pattern that edge extracting obtains Difference such as treats segmentation picture using multi-direction structure convolution kernel and carries out edge extracting, and the convolution kernel of different directions extracts to obtain Convolution characteristic pattern it is different, the corresponding edge feature figure of picture to be split is obtained according to the convolution characteristic pattern of all directions, according to Certain rule handles edge characteristic pattern to obtain corresponding edge binary map, such as gray scale to each pixel in characteristic pattern Value locally carry out non-maxima suppression, obtain corresponding edge binary map, such as by the gray value of each pixel be set as 0 or 255 generate the edge binary map of corresponding table.
Step S230 carries out tracing analysis to edge binary map, obtains the corresponding circle of edge binary map or oval analytic expression, Candidate circle or elliptical geological information are determined according to circle or oval analytic expression.
Specifically, treating segmentation picture and carrying out the obtained edge of edge extracting may be linear feature is also likely to be curve spy Sign, it is different according to the edge in the region to be split in picture to be split, different analyses is carried out to the edge binary map extracted. Such as edge binary map is analyzed using Hough transformation, the basic principle of Hough transformation is the duality using point with line, will The lines of image space become the accumulation point of parameter space, to detect the curve that given image whether there is Given Properties.It needs It is determined according to the marginal information of the figure in region to be split it is noted that determining Target Segmentation region is circle or ellipse, Circle or oval is detected in edge binary map as needed.
Further, if the fringe region in region to be split is border circular areas, using Hough transformation to edge binary map Carry out tracing analysis.In image coordinate system, round analytic expression is (x-a)2+(y-b)2=r2, wherein (a, b) indicates that the center of circle is sat Mark, r indicate the radius of circle, determine that the value of parameter a, b, r are that can determine the table analytic expression of circle in image coordinate system.By edge two-value The corresponding coordinate of each pixel in figure is mapped in parameter coordinate system (a, b, r), each pixel is mapped to parameter A corresponding circular cone in coordinate system, according to the intersection point of each circular cone disc, you can determine the parsing of the circle where corresponding pixel points Formula.
The corresponding parameter information of round analytic expression is obtained according to Hough transformation, central coordinate of circle and half are determined according to parameter information The area information of diameter and circle.
According to analytic expression of the ellipse in image coordinate system, using randomized hough transform by the pixel in edge binary map Coordinate be mapped in the corresponding parameter coordinate system of elliptic parameter and determine the corresponding oval analytic expression of each edge pixel point.
Further, when being detected to circle and ellipse, polar form can be used to indicate circle or elliptical equation, And it is mapped to corresponding parameter coordinate system and obtains corresponding expression formula.It is possible to further using generalised Hough transform, it is random suddenly Husband converts or other algorithms carry out tracing analysis to edge binary map.
Step S240 calculates candidate parameter according to the geological information of candidate circle or elliptical geological information, picture to be split Information carries out matching screening target circle or ellipse according to candidate parameter information and standard parameter information.
Wherein, geological information refers to the attribute information of geometric figure, including round central coordinate of circle and radius information, elliptical Long axis, short axle information, elliptical center point information etc..Standard parameter information refers to the parameter information in preset Target Segmentation region, The area ratio shared in picture to be split such as the corresponding geometric figure in Target Segmentation region.Candidate parameter information refers to basis The actual parameter information that the geological information of candidate circles or ellipse is calculated.
Specifically, circle or elliptical area are calculated separately according to circle or elliptical geological information, and are calculated to be split The ratio of the area of picture is as candidate parameter information, or calculates round radius length or elliptical long axis length and figure to be split The ratio of the correspondence length of side of piece is as candidate parameter information.It obtains from the candidate parameter information being calculated and joins closest to standard The circle of number information is oval as targeted graphical.
Step S250, according to target circle or the oval Target Segmentation region for determining picture to be split.
Specifically, the analytic expression or elliptical analytic expression of the circle obtained according to screening determine corresponding Target Segmentation region.
In the present embodiment, a kind of picture segmentation method is provided, treating segmentation picture progress edge extracting using convolution kernel obtains To corresponding edge binary map, tracing analysis further is carried out to edge binary map and obtains corresponding circle or elliptical analytic expression And geological information, target circle or ellipse are determined according to the geological information of circle or elliptical geological information, picture to be split, to really The Target Segmentation region of fixed picture to be split.Segmentation picture is treated using convolution kernel and carries out edge extracting, improves edge extracting Accuracy, and by the tracing analysis to edge binary map, really according to standard parameter information and candidate circles or ellipse Set the goal cut zone, can determine that determination need not be incited somebody to action positioned at the Target Segmentation region of any position in picture to be split Target Segmentation region is arranged in specific position, need not video camera be maintained at fixed position when shooting picture, improve behaviour The convenience of work.
As shown in fig. 7, in a specific embodiment, providing a kind of picture segmentation method, including the following contents:
Step S301 obtains picture to be split.
Step S302 obtains the corresponding equal value difference convolution kernel of preset all directions, it is corresponding to be utilized respectively all directions Equal value difference convolution kernel treats segmentation picture progress convolution and obtains the corresponding convolution characteristic pattern of all directions.
Step S303 obtains the pixel of picture to be split corresponding convolution in corresponding convolution characteristic pattern in all directions Feature point group is at convolution set of characteristic points.
Step S304 obtains the corresponding convolution characteristic point of maximum pixel gray value in convolution set of characteristic points as target Convolution characteristic point generates corresponding edge feature according to the corresponding target convolution characteristic point of each pixel of picture to be split Figure.
Step S305 obtains corresponding currently processed region from edge feature figure according to default sliding window, obtains currently processed The corresponding grey scale pixel value of each pixel in region, and form current pixel gray scale value set.
Step S306 judges whether pixel corresponding grey scale pixel value in currently processed regional center position is current gray level Maximum pixel gray value in value set, if so, S307 is thened follow the steps, if it is not, thening follow the steps S309.
Step S307, judges whether the grey scale pixel value of center pixel is more than predetermined threshold value, if so, executing step Rapid S308, if it is not, thening follow the steps S309.
The grey scale pixel value of center pixel is set to the first presetted pixel gray value by step S308.
The grey scale pixel value of center pixel is set to the second presetted pixel gray value by step S309, and first is default Grey scale pixel value is more than the second presetted pixel gray value.
Step S310 is slided and is preset sliding window to next region, using next region as currently processed region, into step Rapid S305, until each pixel in traversal edge feature figure generates corresponding edge binary map.
Step S311 carries out line analysis to edge binary map, obtains the corresponding straight line analytic expression of edge binary map, according to Straight line analytic expression is determined to form the candidate Straight Combination of candidate polygon.
Step S312 calculates candidate parameter letter according to the geological information of the geological information of candidate polygon, picture to be split Breath carries out matching screening target polygon according to candidate parameter information and standard parameter information.
Step S313 obtains the corresponding target line combination of target polygon, according to target line from candidate Straight Combination Analytic expression determines the apex coordinate of target polygon.
Step S314 determines standard peak coordinate according to standard parameter information, and it is more to correct target according to standard peak coordinate The apex coordinate of side shape determines representative points coordinate.
Step S315 determines the Target Segmentation region of picture to be split according to representative points coordinate.
In the present embodiment, provide a kind of picture segmentation method, using multi-direction mean difference convolution kernel to segmentation picture into Row edge extracting obtains corresponding edge feature figure, and carrying out non-maxima suppression to edge characteristic pattern obtains corresponding edge two-value Figure, and line analysis is carried out to edge binary map, and determine that target is straight according to the geometric properties at preset standard edge to be split Line combines, and carries out revising determining Target Segmentation region to target line combination.It is treated point using multi-direction equal value difference convolution kernel It cuts picture to be split, can be treated using mean difference convolution kernel after segmentation picture subregion calculates mean value and ask each region equal Difference between value can effectively utilize the nuance of area grayscale mean value to protrude the very weak edge of contrast, improve To the robustness of texture and noise jamming, improve the clarity of edge feature, in the edge binary map of higher resolution into Row line analysis, and choose corresponding target line combination according to the geometric properties of standard target polygon and determine Target Segmentation area Domain can determine the Target Segmentation region for being determined in picture to be split and being located at any position, need not be by Target Segmentation region It is arranged in specific position, video camera need not be maintained at fixed position when shooting picture, improve the convenience of operation.
The corresponding Target Segmentation areas identity card picture 800A are obtained as shown in figure 8, treating segmentation picture 800 and being split Domain treats segmentation picture 800 and carries out edge extracting and analyzed edge binary map to obtain Figure 80 0B, first according to standard body The edge feature of part card picture screens corresponding candidate rectangle, corresponding object candidate area 800C is determined, according to standard identity The geological information correction object candidate area of the edge feature of card determines 4 vertex 0,1,2,3 of Target Segmentation region 800D, root Segmentation picture is treated according to the vertex position in Target Segmentation region to be split to obtain corresponding Target Segmentation picture 800E.
As shown in figure 9, in one embodiment, a kind of picture segmentation device is provided, including:
First acquisition module 910, for obtaining picture to be split.
First edge extraction module 920, for using convolution kernel treat segmentation picture carry out edge extracting obtain it is corresponding Edge feature figure obtains corresponding edge binary map according to edge feature figure.
It is corresponding to obtain edge binary map for carrying out line analysis to edge binary map for first edge analysis module 930 Straight line analytic expression is determined to form the candidate Straight Combination of candidate polygon according to straight line analytic expression.
First geometrical analysis module 940, for the geological information according to the geological information of candidate polygon, picture to be split Candidate parameter information is calculated, matching screening target polygon is carried out according to candidate parameter information and standard parameter information.
First object cut zone determining module 950, for obtaining the corresponding mesh of target polygon from candidate Straight Combination Mark Straight Combination combines the Target Segmentation region that corresponding target line analytic expression determines picture to be split according to target line.
In the present embodiment, a kind of picture segmentation device is provided, treating segmentation picture progress edge extracting using convolution kernel obtains To corresponding edge binary map, and line analysis further is carried out to edge binary map and obtains corresponding straight line analytic expression, it is right Straight line analytic expression carries out geometrical analysis and obtains candidate Straight Combination, and target is determined according to candidate Straight Combination and standard parameter information Cut zone.Segmentation picture is treated using convolution kernel and carries out convolution, improves the accuracy of image edge extraction, and pass through opposite side The line analysis of edge binary map determines candidate polygon, determines target polygon according to preset standard parameter information and then determines mesh Cut zone is marked, Target Segmentation can accurately be determined by the analyzing processing to edge binary map and combined standard parameter information Region can determine the Target Segmentation region for being determined in picture to be split and being located at any position, need not be by Target Segmentation area Domain is arranged in specific position, need not video camera be maintained at fixed position when shooting picture, improve the convenience of operation.
As shown in Figure 10, in one embodiment, convolution kernel is equal value difference convolution kernel, and first edge extraction module 920 wraps It includes:
Convolution module 921 is utilized respectively all directions for obtaining the corresponding equal value difference convolution kernel of preset all directions Corresponding equal value difference convolution kernel treats segmentation picture progress convolution and obtains the corresponding convolution characteristic pattern of all directions.
Edge feature figure generation module 922, for obtaining the pixel of picture to be split corresponding convolution in all directions Corresponding convolution feature point group obtains the maximum pixel gray scale in convolution set of characteristic points at convolution set of characteristic points in characteristic pattern It is worth corresponding convolution characteristic point as target convolution characteristic point, according to the corresponding target convolution of each pixel of picture to be split Characteristic point generates corresponding edge feature figure.
As shown in figure 11, in one embodiment, first edge extraction module 920 further includes:
Processing module 923, for according to sliding window is preset from the corresponding currently processed region of edge feature figure acquisition, acquisition to be worked as The corresponding grey scale pixel value of each pixel in pre-treatment region, and form current pixel gray scale value set.
Judgment module 924, for judge the corresponding grey scale pixel value of currently processed regional center position pixel whether be Maximum pixel gray value in current gray level value set.
Setup module 925, for if so, the grey scale pixel value of center pixel is set to the first presetted pixel ash Angle value, if it is not, the grey scale pixel value of center pixel is then set to the second presetted pixel gray value, the first presetted pixel ash Angle value is more than the second presetted pixel gray value.
Loop module 926, for sliding default sliding window to next region, using next region as currently processed area Domain, into processing module 923, until each pixel in traversal edge feature figure generates corresponding edge binary map.
In one embodiment, setup module 925 is additionally operable to judge whether the grey scale pixel value of center pixel is big In predetermined threshold value, if so, the grey scale pixel value of center pixel is set to the first presetted pixel gray value, if it is not, then The grey scale pixel value of center pixel is set to the second presetted pixel gray value.
In one embodiment, convolution module 921 is additionally operable to treat using the corresponding equal value difference convolution kernel of all directions The operation that the convolution of segmentation picture obtains corresponding convolution characteristic pattern executes side by side.
Or
Segmentation picture is treated using the equal value difference convolution kernel of preset direction and carries out convolution, according to the current picture of picture to be split The corresponding original pixels gray value of vegetarian refreshments, current pixel point the corresponding convolution characteristic point of adjacent processed pixel pixel ash The grey scale pixel value of the corresponding convolution characteristic point of current pixel point is calculated in angle value.It is corresponding next to obtain current pixel point Pixel is as current pixel point, into the corresponding original pixels gray value of current pixel point, current according to picture to be split It is corresponding that current pixel point is calculated in the grey scale pixel value of the corresponding convolution characteristic point of adjacent processed pixel of pixel The step of grey scale pixel value of convolution characteristic point, obtains the corresponding volume of preset direction until traversing the pixel of picture to be split Product characteristic pattern, preset direction includes horizontal direction and/or vertical direction.
As shown in figure 12, in one embodiment, first edge analysis module 930 includes:
Computing module 931, the parameter in straight line analytic expression for obtaining arbitrary two line correspondences successively, according to parameter The angle of arbitrary two line correspondences is calculated with two included angle of straight line calculation formula.
Parallel lines determining module 932, two straight lines for angle to be less than to the first default angle threshold value are put down as one group Line is put into parallel lines set.
Candidate Straight Combination determining module 933 is calculated separately for obtaining arbitrary two groups of parallel lines in parallel lines set The corresponding average angle of every group of parallel lines, when the absolute value for the difference for detecting the corresponding average angle of two groups of parallel lines is default When in threshold range, corresponding two groups of parallel lines are determined as candidate Straight Combination.
In one embodiment, standard parameter information includes preset area ratio and default length of side ratio.First geometry point Analysis module 940 is additionally operable to calculate the area ratio of corresponding candidate polygon and picture to be split according to candidate Straight Combination, obtains Area ratio is taken to be more than the candidate polygon of preset area ratio, the candidate polygon set of composition first is candidate polygon by first The candidate polygon of length of side ratio and default length of side ratio gap minimum is determined as target polygon in shape set.
In one embodiment, first object cut zone determining module 950 is additionally operable to be determined according to standard parameter information Standard peak coordinate determines the apex coordinate of target polygon according to target line analytic expression.It is corrected according to standard peak coordinate The apex coordinate of target polygon determines representative points coordinate, and the target point of picture to be split is determined according to representative points coordinate Cut region.
As shown in figure 13, in one embodiment, a kind of picture segmentation device is provided, including:
Second acquisition module 1010, for obtaining picture to be split.
Second edge extraction module 1020, for using convolution kernel treat segmentation picture carry out edge extracting obtain it is corresponding Edge feature figure obtains corresponding edge binary map according to edge feature figure.
Second edge analysis module 1030 obtains edge binary map and corresponds to for carrying out tracing analysis to edge binary map Circle or oval analytic expression, candidate circle or elliptical geological information are determined according to circle or oval analytic expression.
Second geometrical analysis module 1040, for the geometry according to candidate circle or elliptical geological information, picture to be split Information calculates candidate parameter information, and matching screening target circle or ellipse are carried out according to candidate parameter information and standard parameter information.
Second Target Segmentation area determination module 1050, for according to target circle or the oval target for determining picture to be split Cut zone.
In the present embodiment, a kind of picture segmentation device is provided, treating segmentation picture progress edge extracting using convolution kernel obtains To corresponding edge binary map, tracing analysis further is carried out to edge binary map and obtains corresponding circle or elliptical analytic expression And geological information, target circle or ellipse are determined according to the geological information of circle or elliptical geological information, picture to be split, to really The Target Segmentation region of fixed picture to be split.Segmentation picture is treated using convolution kernel and carries out edge extracting, improves edge extracting Accuracy, and by the tracing analysis to edge binary map, really according to standard parameter information and candidate circles or ellipse Set the goal cut zone, can determine that determination need not be incited somebody to action positioned at the Target Segmentation region of any position in picture to be split Target Segmentation region is arranged in specific position, need not video camera be maintained at fixed position when shooting picture, improve behaviour The convenience of work.
As shown in figure 14, it is the internal structure chart of one embodiment Computer equipment, which passes through system Connect bus couple processor, non-volatile memory medium, built-in storage and network interface.Wherein, the computer equipment is non- Volatile storage medium can storage program area and computer-readable instruction, which is performed, may make Processor executes a kind of picture segmentation method.For the processor of the computer equipment for providing calculating and control ability, support is whole The operation of a computer equipment.Computer-readable instruction can be stored in the built-in storage, which is handled When device executes, processor may make to execute a kind of picture segmentation method.The network interface of computer equipment is logical for carrying out network Letter such as receives image to be detected, image to be detected picture segmentation result etc..The computer equipment can be server, server It can be realized with the server cluster of the either multiple server compositions of independent server.Computer equipment can also be end End, the display screen of terminal can be liquid crystal display or electric ink display screen, and the input unit of computer equipment can be The touch layer covered on display screen, can also be the button being arranged on computer equipment shell, trace ball or Trackpad, can be with It is external keyboard, Trackpad or mouse etc..Touch layer and display screen constitute touch screen.
It will be understood by those skilled in the art that structure shown in Figure 14, only with the relevant part of application scheme The block diagram of structure, does not constitute the restriction for the computer equipment being applied thereon to application scheme, and specific computer is set Standby may include either combining certain components than more or fewer components as shown in the figure or being arranged with different components.
In one embodiment, picture segmentation device provided by the present application can be implemented as a kind of shape of computer program Formula, computer program can be run on computer equipment as shown in figure 14, and the non-volatile memory medium of computer equipment can Storage forms each program module of the picture segmentation device, such as the first acquisition module 910 in Fig. 9, first edge extraction Module 920, first edge analysis module 930, the first geometrical analysis module 940, first object cut zone determining module 950. Each program module includes computer-readable instruction, and computer-readable instruction is for making computer equipment execute in this specification Step in the picture segmentation method of each embodiment of the application of description, the processor in computer equipment can call calculating Each program module of the picture segmentation device stored in the non-volatile memory medium of machine equipment runs corresponding readable finger It enables, realizes the corresponding function of modules of picture segmentation device in this specification.For example, computer equipment can be by such as scheming The first acquisition module 910 in picture segmentation device shown in 9 obtains picture to be split, passes through first edge extraction module 920 Segmentation picture progress edge extracting is treated using convolution kernel and obtains corresponding edge feature figure, is corresponded to according to edge feature figure Edge binary map, by first edge analysis module 930 to edge binary map carry out line analysis, obtain edge binary map pair The straight line analytic expression answered is determined to form the candidate Straight Combination of candidate polygon according to straight line analytic expression, by more than the first What analysis module 940 calculates candidate parameter information, root according to the geological information of candidate polygon, the geological information of picture to be split Matching screening target polygon is carried out according to candidate parameter information and standard parameter information, and is determined by first object cut zone Module 950 obtains the corresponding target line combination of target polygon from candidate Straight Combination and combines corresponding mesh according to target line Mark straight line analytic expression determines the Target Segmentation region of picture to be split.Computer equipment can also pass through picture as shown in fig. 13 that The second acquisition module 1010 in segmenting device obtains picture to be split, and convolution kernel is used by second edge extraction module 1020 It treats segmentation picture progress edge extracting and obtains corresponding edge feature figure, corresponding edge two-value is obtained according to edge feature figure Figure, by second edge analysis module 1030 to edge binary map carry out tracing analysis, obtain the corresponding circle of edge binary map or Oval analytic expression determines candidate circle or elliptical geological information according to circle or oval analytic expression, passes through the second geometrical analysis module 1040 calculate candidate parameter information according to the geological information of candidate circle or elliptical geological information, picture to be split, according to candidate Parameter information and standard parameter information carry out matching screening target circle or ellipse, pass through the second Target Segmentation area determination module 1050 according to target circle or the oval Target Segmentation region for determining picture to be split.
In one embodiment, a kind of computer readable storage medium is provided, computer readable storage medium is for storing Computer executable instructions, when computer executable instructions are executed by processor so that processor executes following steps:Acquisition waits for Divide picture;Segmentation picture progress edge extracting is treated using convolution kernel and obtains corresponding edge feature figure, according to edge feature Figure obtains corresponding edge binary map;Line analysis is carried out to edge binary map, obtains the corresponding straight line parsing of edge binary map Formula is determined to form the candidate Straight Combination of candidate polygon according to straight line analytic expression;Believed according to the geometry of candidate polygon The geological information calculating candidate parameter information of breath, picture to be split, according to candidate parameter information and the progress of standard parameter information With screening target polygon;The corresponding target line combination of target polygon is obtained from candidate Straight Combination, according to target line Combine the Target Segmentation region that corresponding target line analytic expression determines picture to be split.
In one embodiment, when computer executable instructions are executed by processor, also so that processor executes following step Suddenly:Obtain the corresponding equal value difference convolution kernel of preset all directions;It is utilized respectively the corresponding equal value difference convolution kernel pair of all directions Picture to be split carries out convolution and obtains the corresponding convolution characteristic pattern of all directions;The pixel of picture to be split is obtained in each side Into corresponding convolution characteristic pattern, corresponding convolution feature point group is obtained at convolution set of characteristic points in convolution set of characteristic points The corresponding convolution characteristic point of maximum pixel gray value is as target convolution characteristic point;According to each pixel pair of picture to be split The target convolution characteristic point answered generates corresponding edge feature figure.
In one embodiment, when computer executable instructions are executed by processor, also so that processor executes following step Suddenly:According to default sliding window corresponding currently processed region is obtained from edge feature figure;Obtain each pixel in currently processed region The corresponding grey scale pixel value of point, and current pixel gray scale value set is formed, judge currently processed regional center position pixel pair Whether the grey scale pixel value answered is maximum pixel gray value in current gray level value set;If so, by center pixel Grey scale pixel value be set to the first presetted pixel gray value, if it is not, the grey scale pixel value of center pixel is then set to Two presetted pixel gray values, the first presetted pixel gray value are more than the second presetted pixel gray value;Sliding presets sliding window to next A region, using next region as currently processed region, into the corresponding picture of each pixel in the currently processed region of acquisition The step of plain gray value, until each pixel in traversal edge feature figure generates corresponding edge binary map.
In one embodiment, when computer executable instructions are executed by processor, also so that processor executes following step Suddenly:Judge whether the grey scale pixel value of center pixel is more than predetermined threshold value;If so, by the picture of center pixel Plain gray value is set to the first presetted pixel gray value;If it is not, it is pre- that the grey scale pixel value of center pixel is then set to second If grey scale pixel value.
In one embodiment, when computer executable instructions are executed by processor, also so that processor executes following step Suddenly:The convolution that segmentation picture is treated using the corresponding equal value difference convolution kernel of all directions is obtained into the behaviour of corresponding convolution characteristic pattern Make to execute side by side;Or segmentation picture progress convolution is treated using the equal value difference convolution kernel of preset direction, according to picture to be split The adjacent processed pixel corresponding convolution characteristic point of the corresponding original pixels gray value of current pixel point, current pixel point The grey scale pixel value of the corresponding convolution characteristic point of current pixel point is calculated in grey scale pixel value;It is corresponding to obtain current pixel point Next pixel is as current pixel point, into the corresponding original pixels gray scale of current pixel point according to picture to be split Value, the corresponding convolution characteristic point of adjacent processed pixel of current pixel point grey scale pixel value current pixel point is calculated The step of grey scale pixel value of corresponding convolution characteristic point, obtains preset direction pair until traversing the pixel of picture to be split The convolution characteristic pattern answered, preset direction include horizontal direction and/or vertical direction.
In one embodiment, when computer executable instructions are executed by processor, also so that processor executes following step Suddenly:The parameter in the straight line analytic expression of arbitrary two line correspondences is obtained successively, according to parameter and two included angle of straight line calculation formula The angle of arbitrary two line correspondences is calculated;Two straight lines that angle is less than to the first default angle threshold value are put down as one group Line is put into parallel lines set;Arbitrary two groups of parallel lines in parallel lines set are obtained, every group of parallel lines is calculated separately and corresponds to Average angle, when detecting that the absolute value of difference of the corresponding average angle of two groups of parallel lines is in preset threshold range, Corresponding two groups of parallel lines are determined as candidate Straight Combination.
In one embodiment, when computer executable instructions are executed by processor, also so that processor executes following step Suddenly:The area ratio that corresponding candidate polygon and picture to be split are calculated according to candidate Straight Combination, it is big to obtain area ratio In the candidate polygon of preset area ratio, the candidate polygon set of composition first;By the length of side in the first candidate polygon set The candidate polygon of ratio and default length of side ratio gap minimum is determined as target polygon.
In one embodiment, when computer executable instructions are executed by processor, also so that processor executes following step Suddenly:Standard peak coordinate is determined according to standard parameter information, determines that the vertex of target polygon is sat according to target line analytic expression Mark;The apex coordinate that target polygon is corrected according to standard peak coordinate, determines representative points coordinate, according to representative points coordinate Determine the Target Segmentation region of picture to be split.
In one embodiment, a kind of computer equipment, including memory and processor are provided, memory is based on storing Calculation machine readable instruction, when computer-readable instruction is executed by processor so that processor executes following steps:Obtain figure to be split Piece;Segmentation picture progress edge extracting is treated using convolution kernel and obtains corresponding edge feature figure, is obtained according to edge feature figure Corresponding edge binary map;Line analysis is carried out to edge binary map, obtains the corresponding straight line analytic expression of edge binary map, according to Straight line analytic expression is determined to form the candidate Straight Combination of candidate polygon;According to the geological information of candidate polygon, wait for point The geological information for cutting picture calculates candidate parameter information, and matching screening mesh is carried out according to candidate parameter information and standard parameter information Mark polygon;The corresponding target line combination of target polygon is obtained from candidate Straight Combination, is combined and is corresponded to according to target line Target line analytic expression determine the Target Segmentation region of picture to be split.
In one embodiment, when computer executable instructions are executed by processor, also so that processor executes following step Suddenly:Obtain the corresponding equal value difference convolution kernel of preset all directions;It is utilized respectively the corresponding equal value difference convolution kernel pair of all directions Picture to be split carries out convolution and obtains the corresponding convolution characteristic pattern of all directions;The pixel of picture to be split is obtained in each side Into corresponding convolution characteristic pattern, corresponding convolution feature point group is obtained at convolution set of characteristic points in convolution set of characteristic points The corresponding convolution characteristic point of maximum pixel gray value is as target convolution characteristic point;According to each pixel pair of picture to be split The target convolution characteristic point answered generates corresponding edge feature figure.
In one embodiment, when computer executable instructions are executed by processor, also so that processor executes following step Suddenly:According to default sliding window corresponding currently processed region is obtained from edge feature figure;Obtain each pixel in currently processed region The corresponding grey scale pixel value of point, and current pixel gray scale value set is formed, judge currently processed regional center position pixel pair Whether the grey scale pixel value answered is maximum pixel gray value in current gray level value set;If so, by center pixel Grey scale pixel value be set to the first presetted pixel gray value, if it is not, the grey scale pixel value of center pixel is then set to Two presetted pixel gray values, the first presetted pixel gray value are more than the second presetted pixel gray value;Sliding presets sliding window to next A region, using next region as currently processed region, into the corresponding picture of each pixel in the currently processed region of acquisition The step of plain gray value, until each pixel in traversal edge feature figure generates corresponding edge binary map.
In one embodiment, when computer executable instructions are executed by processor, also so that processor executes following step Suddenly:Judge whether the grey scale pixel value of center pixel is more than predetermined threshold value;If so, by the picture of center pixel Plain gray value is set to the first presetted pixel gray value;If it is not, it is pre- that the grey scale pixel value of center pixel is then set to second If grey scale pixel value.
In one embodiment, when computer executable instructions are executed by processor, also so that processor executes following step Suddenly:The convolution that segmentation picture is treated using the corresponding equal value difference convolution kernel of all directions is obtained into the behaviour of corresponding convolution characteristic pattern Make to execute side by side;Or segmentation picture progress convolution is treated using the equal value difference convolution kernel of preset direction, according to picture to be split The adjacent processed pixel corresponding convolution characteristic point of the corresponding original pixels gray value of current pixel point, current pixel point The grey scale pixel value of the corresponding convolution characteristic point of current pixel point is calculated in grey scale pixel value;It is corresponding to obtain current pixel point Next pixel is as current pixel point, into the corresponding original pixels gray scale of current pixel point according to picture to be split Value, the corresponding convolution characteristic point of adjacent processed pixel of current pixel point grey scale pixel value current pixel point is calculated The step of grey scale pixel value of corresponding convolution characteristic point, obtains preset direction pair until traversing the pixel of picture to be split The convolution characteristic pattern answered, preset direction include horizontal direction and/or vertical direction.
In one embodiment, when computer executable instructions are executed by processor, also so that processor executes following step Suddenly:The parameter in the straight line analytic expression of arbitrary two line correspondences is obtained successively, according to parameter and two included angle of straight line calculation formula The angle of arbitrary two line correspondences is calculated;Two straight lines that angle is less than to the first default angle threshold value are put down as one group Line is put into parallel lines set;Arbitrary two groups of parallel lines in parallel lines set are obtained, every group of parallel lines is calculated separately and corresponds to Average angle, when detecting that the absolute value of difference of the corresponding average angle of two groups of parallel lines is in preset threshold range, Corresponding two groups of parallel lines are determined as candidate Straight Combination.
In one embodiment, when computer executable instructions are executed by processor, also so that processor executes following step Suddenly:The area ratio that corresponding candidate polygon and picture to be split are calculated according to candidate Straight Combination, it is big to obtain area ratio In the candidate polygon of preset area ratio, the candidate polygon set of composition first;By the length of side in the first candidate polygon set The candidate polygon of ratio and default length of side ratio gap minimum is determined as target polygon.
In one embodiment, when computer executable instructions are executed by processor, also so that processor executes following step Suddenly:Standard peak coordinate is determined according to standard parameter information, determines that the vertex of target polygon is sat according to target line analytic expression Mark;The apex coordinate that target polygon is corrected according to standard peak coordinate, determines representative points coordinate, according to representative points coordinate Determine the Target Segmentation region of picture to be split.
In one embodiment, a kind of computer readable storage medium is provided, computer readable storage medium is for storing Computer executable instructions, when computer executable instructions are executed by processor so that processor executes following steps:Acquisition waits for Divide picture;Segmentation picture progress edge extracting is treated using convolution kernel and obtains corresponding edge feature figure, according to edge feature Figure obtains corresponding edge binary map;Tracing analysis is carried out to edge binary map, obtains the corresponding circle of edge binary map or ellipse Analytic expression determines candidate circle or elliptical geological information according to circle or oval analytic expression;According to candidate's circle or elliptical geometry letter The geological information calculating candidate parameter information of breath, picture to be split, according to candidate parameter information and the progress of standard parameter information With screening target circle or ellipse;According to target circle or the oval Target Segmentation region for determining picture to be split.
In one embodiment, a kind of computer equipment, including memory and processor are provided, memory is based on storing Calculation machine readable instruction, when computer-readable instruction is executed by processor so that processor executes following steps:Obtain figure to be split Piece;Segmentation picture progress edge extracting is treated using convolution kernel and obtains corresponding edge feature figure, is obtained according to edge feature figure Corresponding edge binary map;Tracing analysis is carried out to edge binary map, obtains the corresponding circle of edge binary map or oval analytic expression, Candidate circle or elliptical geological information are determined according to circle or oval analytic expression;According to candidate's circle or elliptical geological information, wait for point The geological information for cutting picture calculates candidate parameter information, and matching screening mesh is carried out according to candidate parameter information and standard parameter information Mark circle is oval;According to target circle or the oval Target Segmentation region for determining picture to be split.
One of ordinary skill in the art will appreciate that realizing all or part of flow in above-described embodiment method, being can be with Relevant hardware is instructed to complete by computer program, the program can be stored in a non-volatile computer and can be read In storage medium, the program is when being executed, it may include such as the flow of the embodiment of above-mentioned each method.Wherein, the storage is situated between Matter can be magnetic disc, CD, read-only memory (Read-Only Memory, ROM) etc..
Several embodiments of the invention above described embodiment only expresses, the description thereof is more specific and detailed, but simultaneously Cannot the limitation to the scope of the claims of the present invention therefore be interpreted as.It should be pointed out that for those of ordinary skill in the art For, without departing from the inventive concept of the premise, various modifications and improvements can be made, these belong to the guarantor of the present invention Protect range.Therefore, the protection domain of patent of the present invention should be determined by the appended claims.

Claims (15)

1. a kind of picture segmentation method, the method includes:
Obtain picture to be split;
Edge extracting is carried out to the picture to be split using convolution kernel and obtains corresponding edge feature figure, according to edge spy Sign figure obtains corresponding edge binary map;
Line analysis is carried out to the edge binary map, the corresponding straight line analytic expression of the edge binary map is obtained, according to described Straight line analytic expression is determined to form the candidate Straight Combination of candidate polygon;
Candidate parameter information is calculated according to the geological information of the geological information of candidate polygon, picture to be split, according to the time Parameter information and standard parameter information is selected to carry out matching screening target polygon;
The corresponding target line combination of the target polygon is obtained from the candidate Straight Combination, according to the target line group Close the Target Segmentation region that corresponding target line analytic expression determines the picture to be split.
2. according to the method described in claim 1, it is characterized in that, the convolution kernel is equal value difference convolution kernel, described use is rolled up The product verification picture to be split carries out the step of edge extracting obtains corresponding edge feature figure and includes:
Obtain the corresponding equal value difference convolution kernel of preset all directions;
It is utilized respectively all directions corresponding equal value difference convolution kernel and all directions pair is obtained to the picture progress convolution to be split The convolution characteristic pattern answered;
Obtain the pixel of the picture to be split corresponding convolution feature point group in the corresponding convolution characteristic pattern of all directions At convolution set of characteristic points, the corresponding convolution characteristic point conduct of maximum pixel gray value in the convolution set of characteristic points is obtained Target convolution characteristic point;
Corresponding edge feature figure is generated according to the corresponding target convolution characteristic point of each pixel of picture to be split.
3. according to the method described in claim 2, it is characterized in that, described obtain corresponding edge according to the edge feature figure The step of binary map includes:
According to default sliding window corresponding currently processed region is obtained from the edge feature figure;
The corresponding grey scale pixel value of each pixel in the currently processed region is obtained, and forms current pixel gray value collection It closes, judges whether the corresponding grey scale pixel value of the currently processed regional center position pixel is the current gray level value set In maximum pixel gray value;
If so, the grey scale pixel value of the center pixel is set to the first presetted pixel gray value, if it is not, then by institute The grey scale pixel value for stating center pixel is set to the second presetted pixel gray value, and the first presetted pixel gray value is more than The second presetted pixel gray value;
The default sliding window is slided to obtain into described using next region as currently processed region to next region The step of taking in the currently processed region each pixel corresponding grey scale pixel value, until traversing in the edge feature figure Each pixel generate corresponding edge binary map.
4. according to the method described in claim 3, it is characterized in that, the grey scale pixel value by the center pixel The step of being set to the first presetted pixel gray value include:
Judge whether the grey scale pixel value of the center pixel is more than predetermined threshold value;
If so, the grey scale pixel value of the center pixel is set to the first presetted pixel gray value;
If it is not, the grey scale pixel value of the center pixel is then set to the second presetted pixel gray value.
5. according to the method described in claim 2, it is characterized in that, described respectively by the corresponding equal value difference convolution kernel of all directions Carrying out the step of convolution obtains corresponding convolution characteristic pattern to the picture to be split includes:
Corresponding convolution feature will be obtained to the convolution of the picture to be split using the corresponding equal value difference convolution kernel of all directions The operation of figure executes side by side;
Or
Convolution is carried out to the picture to be split using the equal value difference convolution kernel of preset direction, according to the current picture of picture to be split The corresponding original pixels gray value of vegetarian refreshments, the current pixel point the corresponding convolution characteristic point of adjacent processed pixel picture The grey scale pixel value of the corresponding convolution characteristic point of the current pixel point is calculated in plain gray value;
The corresponding next pixel of the current pixel point is obtained as current pixel point, into described according to picture to be split The corresponding original pixels gray value of current pixel point, the corresponding convolution of adjacent processed pixel of the current pixel point it is special The step of grey scale pixel value of the corresponding convolution characteristic point of the current pixel point is calculated in the grey scale pixel value of sign point, until The pixel for traversing the picture to be split, obtains the corresponding convolution characteristic pattern of the preset direction, and the preset direction includes Horizontal direction and/or vertical direction.
6. according to the method described in claim 1, it is characterized in that, described be determined to form time according to the straight line analytic expression The step of candidate Straight Combination for selecting polygon includes:
The parameter in the straight line analytic expression of arbitrary two line correspondences is obtained successively, is calculated according to the parameter and two included angle of straight line The angle of arbitrary two line correspondences is calculated in formula;
Two straight lines that the angle is less than the first default angle threshold value are put into as one group of parallel lines in parallel lines set;
Arbitrary two groups of parallel lines in the parallel lines set are obtained, the corresponding average angle of every group of parallel lines is calculated separately, when When detecting that the absolute value of the difference of the corresponding average angle of two groups of parallel lines is in preset threshold range, corresponding two groups are put down Line is determined as the candidate Straight Combination.
7. according to the method described in claim 1, it is characterized in that, the standard parameter information includes preset area ratio and pre- If length of side ratio;It is described that candidate parameter information is calculated according to the geological information of candidate polygon, the geological information of picture to be split, Carrying out the step of target polygon is screened in matching according to the candidate parameter information and standard parameter information includes:
The area ratio that corresponding candidate polygon and the picture to be split are calculated according to the candidate Straight Combination, obtains institute State the candidate polygon that area ratio is more than the preset area ratio, the first candidate polygon set of composition;
By the candidate polygon of length of side ratio and the default length of side ratio gap minimum in the described first candidate polygon set It is determined as target polygon.
8. according to the method described in claim 1, it is characterized in that, described straight according to the corresponding target of target line combination Line analytic expression determines that the step of Target Segmentation region of the picture to be split includes:
Standard peak coordinate is determined according to the standard parameter information, determines that the target is more according to the target line analytic expression The apex coordinate of side shape;
The apex coordinate that the target polygon is corrected according to the standard peak coordinate, determines representative points coordinate, according to institute State the Target Segmentation region that representative points coordinate determines the picture to be split.
9. a kind of picture segmentation method, which is characterized in that the method includes:
Obtain picture to be split;
Edge extracting is carried out to the picture to be split using convolution kernel and obtains corresponding edge feature figure, according to edge spy Sign figure obtains corresponding edge binary map;
Tracing analysis is carried out to the edge binary map, obtains the corresponding circle of the edge binary map or oval analytic expression, according to The circle or oval analytic expression determine candidate circle or elliptical geological information;
Candidate parameter information is calculated according to the geological information of the candidate circle or elliptical geological information, picture to be split, according to The candidate parameter information and standard parameter information carry out matching screening target circle or ellipse;
According to the target circle or the oval Target Segmentation region for determining the picture to be split.
10. a kind of picture segmentation device, which is characterized in that described device includes:
First acquisition module, for obtaining picture to be split;
First edge extraction module obtains corresponding edge for carrying out edge extracting to the picture to be split using convolution kernel Characteristic pattern obtains corresponding edge binary map according to the edge feature figure;
First edge analysis module obtains the edge binary map and corresponds to for carrying out line analysis to the edge binary map Straight line analytic expression, be determined to form the candidate Straight Combination of candidate polygon according to the straight line analytic expression;
First geometrical analysis module, for calculating and waiting according to the geological information of candidate polygon, the geological information of picture to be split Parameter information is selected, matching screening target polygon is carried out according to the candidate parameter information and standard parameter information;
First object cut zone determining module, for obtaining the corresponding mesh of the target polygon from the candidate Straight Combination Mark Straight Combination combines the target point that corresponding target line analytic expression determines the picture to be split according to the target line Cut region.
11. a kind of picture segmentation device, which is characterized in that described device includes:
Second acquisition module, for obtaining picture to be split;
Second edge extraction module obtains corresponding edge for carrying out edge extracting to the picture to be split using convolution kernel Characteristic pattern obtains corresponding edge binary map according to the edge feature figure;
Second edge analysis module obtains the edge binary map and corresponds to for carrying out tracing analysis to the edge binary map Circle or oval analytic expression, candidate circle or elliptical geological information are determined according to the circle or oval analytic expression;
Second geometrical analysis module, for the geological information according to the candidate circle or elliptical geological information, picture to be split Candidate parameter information is calculated, matching screening target circle or ellipse are carried out according to the candidate parameter information and standard parameter information;
Second Target Segmentation area determination module, for according to the target circle or the oval target for determining the picture to be split Cut zone.
12. a kind of computer readable storage medium, which is characterized in that the computer readable storage medium is for storing computer Executable instruction, when the computer executable instructions are executed by processor so that the processor executes following steps:It obtains Picture to be split;Edge extracting is carried out to the picture to be split using convolution kernel and obtains corresponding edge feature figure, according to institute It states edge feature figure and obtains corresponding edge binary map;Line analysis is carried out to the edge binary map, obtains the edge two Value schemes corresponding straight line analytic expression, is determined to form the candidate Straight Combination of candidate polygon according to the straight line analytic expression; Candidate parameter information is calculated according to the geological information of the geological information of candidate polygon, picture to be split, according to the candidate ginseng Number information and standard parameter information carry out matching screening target polygon;It is polygon that the target is obtained from the candidate Straight Combination The corresponding target line combination of shape, combines corresponding target line analytic expression according to the target line and determines the figure to be split The Target Segmentation region of piece.
13. a kind of computer equipment, which is characterized in that including memory and processor, the memory is for storing computer Readable instruction, when the computer-readable instruction is executed by the processor so that the processor executes following steps:It obtains Picture to be split;Edge extracting is carried out to the picture to be split using convolution kernel and obtains corresponding edge feature figure, according to institute It states edge feature figure and obtains corresponding edge binary map;Line analysis is carried out to the edge binary map, obtains the edge two Value schemes corresponding straight line analytic expression, is determined to form the candidate Straight Combination of candidate polygon according to the straight line analytic expression; Candidate parameter information is calculated according to the geological information of the geological information of candidate polygon, picture to be split, according to the candidate ginseng Number information and standard parameter information carry out matching screening target polygon;It is polygon that the target is obtained from the candidate Straight Combination The corresponding target line combination of shape, combines corresponding target line analytic expression according to the target line and determines the figure to be split The Target Segmentation region of piece.
14. a kind of computer readable storage medium, which is characterized in that the computer readable storage medium is for storing computer Executable instruction, when the computer executable instructions are executed by processor so that the processor executes following steps:It obtains Picture to be split;Edge extracting is carried out to the picture to be split using convolution kernel and obtains corresponding edge feature figure, according to institute It states edge feature figure and obtains corresponding edge binary map;Tracing analysis is carried out to the edge binary map, obtains the edge two Value schemes corresponding circle or oval analytic expression, and candidate circle or elliptical geological information are determined according to the circle or oval analytic expression;Root Candidate parameter information is calculated according to the geological information of the candidate circle or elliptical geological information, picture to be split, according to the time Parameter information and standard parameter information is selected to carry out matching screening target circle or ellipse;According to the target circle or oval determination The Target Segmentation region of picture to be split.
15. a kind of computer equipment, which is characterized in that including memory and processor, the memory is for storing computer Readable instruction, when the computer-readable instruction is executed by the processor so that the processor executes following steps:It obtains Picture to be split;Edge extracting is carried out to the picture to be split using convolution kernel and obtains corresponding edge feature figure, according to institute It states edge feature figure and obtains corresponding edge binary map;Tracing analysis is carried out to the edge binary map, obtains the edge two Value schemes corresponding circle or oval analytic expression, and candidate circle or elliptical geological information are determined according to the circle or oval analytic expression;Root Candidate parameter information is calculated according to the geological information of the candidate circle or elliptical geological information, picture to be split, according to the time Parameter information and standard parameter information is selected to carry out matching screening target circle or ellipse;According to the target circle or oval determination The Target Segmentation region of picture to be split.
CN201710686692.3A 2017-08-11 2017-08-11 Picture segmentation method, apparatus, storage medium and computer equipment Pending CN108305261A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710686692.3A CN108305261A (en) 2017-08-11 2017-08-11 Picture segmentation method, apparatus, storage medium and computer equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710686692.3A CN108305261A (en) 2017-08-11 2017-08-11 Picture segmentation method, apparatus, storage medium and computer equipment

Publications (1)

Publication Number Publication Date
CN108305261A true CN108305261A (en) 2018-07-20

Family

ID=62869230

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710686692.3A Pending CN108305261A (en) 2017-08-11 2017-08-11 Picture segmentation method, apparatus, storage medium and computer equipment

Country Status (1)

Country Link
CN (1) CN108305261A (en)

Cited By (15)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109269544A (en) * 2018-09-27 2019-01-25 中国人民解放军国防科技大学 Inspection system for suspension sensor of medium-low speed magnetic suspension vehicle
CN109858618A (en) * 2019-03-07 2019-06-07 电子科技大学 The neural network and image classification method of a kind of convolutional Neural cell block, composition
CN109858325A (en) * 2018-12-11 2019-06-07 科大讯飞股份有限公司 A kind of table detection method and device
CN109948644A (en) * 2019-01-21 2019-06-28 深圳壹账通智能科技有限公司 A kind of similar source of houses data detection method, device and terminal device
CN110916608A (en) * 2019-12-19 2020-03-27 北京九辰智能医疗设备有限公司 Diopter detection device
CN111179337A (en) * 2018-10-24 2020-05-19 中国科学院自动化研究所 Spatial straight line orientation measuring method and device, computer equipment and storage medium
CN111368573A (en) * 2020-03-02 2020-07-03 凌云光技术集团有限责任公司 Positioning method based on geometric feature constraint
CN112308056A (en) * 2019-07-26 2021-02-02 深圳怡化电脑股份有限公司 Method, device and equipment for acquiring note characteristic region and storage medium
CN112541853A (en) * 2019-09-23 2021-03-23 阿里巴巴集团控股有限公司 Data processing method, device and equipment
CN113132705A (en) * 2021-04-20 2021-07-16 Oppo广东移动通信有限公司 Image color edge correction method, correction device, electronic device and storage medium
CN113297401A (en) * 2020-08-14 2021-08-24 躺平设计家(上海)科技有限公司 Half-edge data structure generation method, data processing method, device and equipment
CN113538574A (en) * 2021-01-04 2021-10-22 腾讯科技(深圳)有限公司 Pose positioning method, device and equipment and computer readable storage medium
CN113610205A (en) * 2021-07-15 2021-11-05 深圳宇晰科技有限公司 Two-dimensional code generation method and device based on machine vision and storage medium
CN114240990A (en) * 2021-12-07 2022-03-25 电子科技大学 SAR image point target segmentation method
CN116320467A (en) * 2023-05-19 2023-06-23 山东中科冶金矿山机械有限公司 Geological survey data compression storage method

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6577991B1 (en) * 1999-01-29 2003-06-10 Shinko Electric Industries Co., Ltd. Recordable method of processing figure
CN101662581A (en) * 2009-09-09 2010-03-03 谭洪舟 Multifunctional certificate information collection system
CN102289810A (en) * 2011-08-05 2011-12-21 上海交通大学 Quick rectangle detection method of images high resolution and high order of magnitude
CN102855619A (en) * 2012-07-11 2013-01-02 北京京北方信息技术有限公司 Rectangle detecting method and device for stamp images
CN103213404A (en) * 2012-01-17 2013-07-24 株式会社理光 Information processing apparatus, information processing method, and system
CN103425984A (en) * 2013-08-15 2013-12-04 北京京北方信息技术有限公司 Method and device for detecting regular polygonal seal in bill
CN106570857A (en) * 2016-09-11 2017-04-19 西南交通大学 High-speed railway overhead contact system lateral conductor fixation hook nut falling bad state detection method based on HOG features

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6577991B1 (en) * 1999-01-29 2003-06-10 Shinko Electric Industries Co., Ltd. Recordable method of processing figure
CN101662581A (en) * 2009-09-09 2010-03-03 谭洪舟 Multifunctional certificate information collection system
CN102289810A (en) * 2011-08-05 2011-12-21 上海交通大学 Quick rectangle detection method of images high resolution and high order of magnitude
CN103213404A (en) * 2012-01-17 2013-07-24 株式会社理光 Information processing apparatus, information processing method, and system
CN102855619A (en) * 2012-07-11 2013-01-02 北京京北方信息技术有限公司 Rectangle detecting method and device for stamp images
CN103425984A (en) * 2013-08-15 2013-12-04 北京京北方信息技术有限公司 Method and device for detecting regular polygonal seal in bill
CN106570857A (en) * 2016-09-11 2017-04-19 西南交通大学 High-speed railway overhead contact system lateral conductor fixation hook nut falling bad state detection method based on HOG features

Non-Patent Citations (8)

* Cited by examiner, † Cited by third party
Title
侯宏花 编著: "《数字图像处理与分析》", 30 September 2011, 北京理工大学出版社 *
常梅 主编: "《初中数学助计助学助考宝典》", 31 January 2011, 广西民族出版社 *
毛晓洁: "于Android平台的手势识别技术的研究与应用", 《中国优秀硕士学位论文全文数据库信息科技辑》 *
温阳 等: "基于视觉注意的全参考彩色图像质量评价方法", 《计算机测量与控制》 *
罗庆生 等著: "《智能作战机器人》", 30 November 2010, 北京理工大学出版社 *
郝向阳: "《地图信息识别与提取技术》", 30 June 2001, 北京:测绘出版社 *
郭宝龙 等主编: "《数字图像处理系统工程导论》", 31 July 2012, 西安电子科技大学出版社 *
黄思俞 著: "《光电子技术》", 30 April 2016, 厦门大学出版社 *

Cited By (22)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109269544A (en) * 2018-09-27 2019-01-25 中国人民解放军国防科技大学 Inspection system for suspension sensor of medium-low speed magnetic suspension vehicle
CN109269544B (en) * 2018-09-27 2021-01-29 中国人民解放军国防科技大学 Inspection system for suspension sensor of medium-low speed magnetic suspension vehicle
CN111179337A (en) * 2018-10-24 2020-05-19 中国科学院自动化研究所 Spatial straight line orientation measuring method and device, computer equipment and storage medium
CN111179337B (en) * 2018-10-24 2024-02-02 中国科学院自动化研究所 Method, device, computer equipment and storage medium for measuring spatial linear orientation
CN109858325B (en) * 2018-12-11 2021-07-02 科大讯飞股份有限公司 Table detection method and device
CN109858325A (en) * 2018-12-11 2019-06-07 科大讯飞股份有限公司 A kind of table detection method and device
CN109948644A (en) * 2019-01-21 2019-06-28 深圳壹账通智能科技有限公司 A kind of similar source of houses data detection method, device and terminal device
CN109858618A (en) * 2019-03-07 2019-06-07 电子科技大学 The neural network and image classification method of a kind of convolutional Neural cell block, composition
CN112308056A (en) * 2019-07-26 2021-02-02 深圳怡化电脑股份有限公司 Method, device and equipment for acquiring note characteristic region and storage medium
CN112541853A (en) * 2019-09-23 2021-03-23 阿里巴巴集团控股有限公司 Data processing method, device and equipment
CN110916608B (en) * 2019-12-19 2022-02-18 北京九辰智能医疗设备有限公司 Diopter detection device
CN110916608A (en) * 2019-12-19 2020-03-27 北京九辰智能医疗设备有限公司 Diopter detection device
CN111368573A (en) * 2020-03-02 2020-07-03 凌云光技术集团有限责任公司 Positioning method based on geometric feature constraint
CN113297401B (en) * 2020-08-14 2024-02-02 每平每屋(上海)科技有限公司 Half data structure generation method, data processing method, device and equipment
CN113297401A (en) * 2020-08-14 2021-08-24 躺平设计家(上海)科技有限公司 Half-edge data structure generation method, data processing method, device and equipment
CN113538574A (en) * 2021-01-04 2021-10-22 腾讯科技(深圳)有限公司 Pose positioning method, device and equipment and computer readable storage medium
CN113132705A (en) * 2021-04-20 2021-07-16 Oppo广东移动通信有限公司 Image color edge correction method, correction device, electronic device and storage medium
CN113610205A (en) * 2021-07-15 2021-11-05 深圳宇晰科技有限公司 Two-dimensional code generation method and device based on machine vision and storage medium
CN114240990A (en) * 2021-12-07 2022-03-25 电子科技大学 SAR image point target segmentation method
CN114240990B (en) * 2021-12-07 2023-04-28 电子科技大学 SAR image point target segmentation method
CN116320467A (en) * 2023-05-19 2023-06-23 山东中科冶金矿山机械有限公司 Geological survey data compression storage method
CN116320467B (en) * 2023-05-19 2023-07-25 山东中科冶金矿山机械有限公司 Geological survey data compression storage method

Similar Documents

Publication Publication Date Title
CN108305261A (en) Picture segmentation method, apparatus, storage medium and computer equipment
Chetverikov et al. Finding defects in texture using regularity and local orientation
Patraucean et al. Detection of mirror-symmetric image patches
CN116168026B (en) Water quality detection method and system based on computer vision
CN108846319A (en) Iris image Enhancement Method, device, equipment and storage medium based on histogram
CN105354578B (en) A kind of multiple target object image matching method
CN109272016B (en) Target detection method, device, terminal equipment and computer readable storage medium
US11308710B2 (en) Polygonal region detection
CN116664559B (en) Machine vision-based memory bank damage rapid detection method
CN104732207B (en) High-precision positions the method and device of pcb board Mark points with high noise immunity
CN104077560B (en) Fingerprint comparison method
CN105404868B (en) The rapid detection method of text in a kind of complex background based on interaction platform
CN110232390B (en) Method for extracting image features under changed illumination
CN108664983A (en) A kind of scale and the adaptive SURF characteristic point matching methods of characteristic strength
CN108205657A (en) Method, storage medium and the mobile terminal of video lens segmentation
CN111783885A (en) Millimeter wave image quality classification model construction method based on local enhancement
CN116071790A (en) Palm vein image quality evaluation method, device, equipment and storage medium
CN110956078B (en) Power line detection method and device
CN114724218A (en) Video detection method, device, equipment and medium
CN109035285B (en) Image boundary determining method and device, terminal and storage medium
CN108764121A (en) Method, computing device and readable storage medium storing program for executing for detecting live subject
Tralic et al. Copy-move forgery detection using cellular automata
CN104732238B (en) The method of gray level image texture feature extraction based on orientation selectivity
CN111612083A (en) Finger vein identification method, device and equipment
CN108615041A (en) A kind of angular-point detection method

Legal Events

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