CN110223309A - Edge detection method, device, computer equipment and storage medium - Google Patents
Edge detection method, device, computer equipment and storage medium Download PDFInfo
- Publication number
- CN110223309A CN110223309A CN201910420584.0A CN201910420584A CN110223309A CN 110223309 A CN110223309 A CN 110223309A CN 201910420584 A CN201910420584 A CN 201910420584A CN 110223309 A CN110223309 A CN 110223309A
- Authority
- CN
- China
- Prior art keywords
- pixel
- target
- target image
- preset
- row
- 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.)
- Granted
Links
Classifications
-
- G—PHYSICS
- G01—MEASURING; TESTING
- G01N—INVESTIGATING OR ANALYSING MATERIALS BY DETERMINING THEIR CHEMICAL OR PHYSICAL PROPERTIES
- G01N21/00—Investigating or analysing materials by the use of optical means, i.e. using sub-millimetre waves, infrared, visible or ultraviolet light
- G01N21/84—Systems specially adapted for particular applications
- G01N21/88—Investigating the presence of flaws or contamination
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/0002—Inspection of images, e.g. flaw detection
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/10—Segmentation; Edge detection
- G06T7/13—Edge detection
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/10—Segmentation; Edge detection
- G06T7/136—Segmentation; Edge detection involving thresholding
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2207/00—Indexing scheme for image analysis or image enhancement
- G06T2207/10—Image acquisition modality
- G06T2207/10004—Still image; Photographic image
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2207/00—Indexing scheme for image analysis or image enhancement
- G06T2207/30—Subject of image; Context of image processing
- G06T2207/30108—Industrial image inspection
- G06T2207/30124—Fabrics; Textile; Paper
Landscapes
- Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Chemical & Material Sciences (AREA)
- Health & Medical Sciences (AREA)
- Life Sciences & Earth Sciences (AREA)
- Quality & Reliability (AREA)
- Analytical Chemistry (AREA)
- Biochemistry (AREA)
- General Health & Medical Sciences (AREA)
- Immunology (AREA)
- Pathology (AREA)
- Image Analysis (AREA)
- Image Processing (AREA)
Abstract
This application involves a kind of edge detection methods, this method comprises: obtaining target image to be detected, it include target subject in the target image, successively the pixel value of the pixel in the target image is counted according to pre-set sequence with behavior unit, acquisition counts obtained row pixel accumulated value every time, and the edge of target subject in the target image is determined according to the row pixel accumulated value and preset row pixel threshold.The edge detection method substantially increases the speed of edge detection.Furthermore, it is also proposed that a kind of edge detecting device, computer equipment and storage medium.
Description
Technical field
The present invention relates to field of computer technology, more particularly, to a kind of edge detection method, device, computer equipment and
Storage medium.
Background technique
The image that camera shoots target subject (i.e. object, for example, cloth) can generally compare target subject
Width it is big, in order to extract target subject from image, need to detect the edge of target subject.Tradition
The method that the edge of the target subject in image is detected, generally require complicated setting, and the speed of edge detection
Degree is slow.
Summary of the invention
Based on this, it is necessary to not need complicated setting in view of the above-mentioned problems, providing one kind and can be improved edge detection speed
Edge detection method, device, computer equipment and the storage medium of degree.
In a first aspect, the embodiment of the present invention provides a kind of edge detection method, which comprises
Target image to be detected is obtained, includes target subject in the target image;
It is successively united to the pixel value of the pixel in the target image with behavior unit according to pre-set sequence
Meter, acquisition count obtained row pixel accumulated value every time;
The side of target subject in the target image is determined according to the row pixel accumulated value and preset row pixel threshold
Edge.
In one of the embodiments, it is described with behavior unit according to pre-set sequence successively to the target image
In the pixel value of pixel counted, acquisition counts obtained row pixel accumulated value every time, comprising: from the target image
Edge is started ecto-entad and is counted with pixel value of the behavior unit to the pixel in target image, and it is corresponding to obtain current line
Current line pixel accumulated value;It is described to be determined in the target image according to the row pixel accumulated value and preset row pixel threshold
The edge of target subject, comprising: default when meeting between the current line pixel accumulated value and the preset row pixel threshold
Size relation when, stop statistics, determine the edge of target subject described in current behavior.
In one of the embodiments, it is described with behavior unit according to pre-set sequence successively to the target image
In the pixel value of pixel counted, acquisition counts obtained row pixel accumulated value every time, comprising: obtains preset pixel and adopts
Sample ratio;According to the object pixel for participating in statistics in the pixel sampling ratio-dependent corresponding line;Each object pixel is corresponding
Pixel value added up to obtain the corresponding row pixel accumulated value of corresponding line.
In one of the embodiments, it is described with behavior unit according to pre-set sequence successively to the target image
In the pixel value of pixel counted, acquisition counts obtained row pixel accumulated value every time, comprising: it is all to obtain preset pixel
Phase;Multiple target pictures that statistics is participated in corresponding line are determined according to preset first oversampling ratio as unit of the pixel period
Plain region, the size of the target pixel region are identical as the pixel period;Multiple target pixel regions that sampling is obtained
Area pixel value added up to obtain corresponding row pixel accumulated value.
In one of the embodiments, after the preset pixel period of acquisition, further includes: with the pixel period
For unit according to preset second oversampling ratio in the target image determine wait participate in statistics multiple target line regions, institute
The width for stating target line region is identical as the pixel period.
The target subject is cloth in one of the embodiments, and the pixel period is the line according to the cloth
Reason determination.
In one of the embodiments, it is described as unit of the pixel period according to preset second oversampling ratio in institute
State the multiple target line regions determined in target image wait participate in statistics, comprising: determine phase according to preset second oversampling ratio
The sampling interval answered;It is sampled to obtain multiple target line regions according to the sampling interval.
In one of the embodiments, the method also includes: according to the edge of determining target subject from the target
The image of target subject is extracted in image;Defects detection, the defect that will test are carried out to the image of the target subject
It is marked.
Second aspect, the embodiment of the present invention provide a kind of cloth edge detecting device, and described device includes:
Module is obtained, includes target subject in the target image for obtaining target image to be detected;
Pixels statistics module, for behavior unit according to pre-set sequence successively to the picture in the target image
The pixel value of element is counted, and acquisition counts obtained row pixel accumulated value every time;
Determining module, for determining target in the target image according to the pixel accumulated value and preset pixel threshold
The edge of main body.
The pixels statistics module is also used to since the edge of the target image by outer in one of the embodiments,
It is inwardly counted with pixel value of the behavior unit to the pixel in target image, it is tired to obtain the corresponding current line pixel of current line
It is value added;The determining module is also used to pre- when meeting between the current line pixel accumulated value and the preset row pixel threshold
If size relation when, stop statistics, determine the edge of target subject described in current behavior.
The pixels statistics module is also used to obtain preset pixel sampling ratio in one of the embodiments,;According to
The object pixel of statistics is participated in the pixel sampling ratio-dependent corresponding line;The corresponding pixel value of each object pixel is carried out
It is cumulative to obtain the corresponding row pixel accumulated value of corresponding line.
The pixels statistics module is also used to obtain preset pixel period in one of the embodiments,;With the picture
The plain period is that unit determines multiple target pixel regions that statistics is participated in corresponding line according to preset first oversampling ratio, described
The size of target pixel region is identical as the pixel period;The area pixel value for multiple target pixel regions that sampling is obtained
It is added up to obtain corresponding row pixel accumulated value.
The pixels statistics module is also used to as unit of the pixel period according to default in one of the embodiments,
The second oversampling ratio in the target image determine wait participate in statistics multiple target line regions, the target line region
Width is identical as the pixel period.
The target subject is cloth in one of the embodiments, and the pixel period is the line according to the cloth
Reason determination.
The pixels statistics module is also used to determine phase according to preset second oversampling ratio in one of the embodiments,
The sampling interval answered;It is sampled to obtain multiple target line regions according to the sampling interval.
Described device in one of the embodiments, further include: extraction module, for the side according to determining target subject
Edge extracts the image of target subject from the target image;Defects detection module, for the image to the target subject
Defects detection is carried out, the defect that will test is marked.
A kind of computer readable storage medium is stored with computer program, when the computer program is executed by processor,
So that the processor executes following steps:
Target image to be detected is obtained, includes target subject in the target image;
It is successively united to the pixel value of the pixel in the target image with behavior unit according to pre-set sequence
Meter, acquisition count obtained row pixel accumulated value every time;
The side of target subject in the target image is determined according to the row pixel accumulated value and preset row pixel threshold
Edge.
A kind of computer equipment, including memory and processor, the memory are stored with computer program, the calculating
When machine program is executed by the processor, so that the processor executes following steps:
Target image to be detected is obtained, includes target subject in the target image;
It is successively united to the pixel value of the pixel in the target image with behavior unit according to pre-set sequence
Meter, acquisition count obtained row pixel accumulated value every time;
The side of target subject in the target image is determined according to the row pixel accumulated value and preset row pixel threshold
Edge.
Above-mentioned edge detection method, device, computer equipment and storage medium, by with behavior unit according to setting in advance
The sequence set successively counts the pixel value of the pixel in the target image, and it is tired to obtain the row pixel for counting obtain every time
It is value added, the edge of target subject is then determined according to row pixel accumulated value and preset row pixel threshold.This method only needs pre-
If a row pixel threshold, it is compared by the row pixel accumulated value for obtaining statistics with row pixel threshold and is assured that mesh
The edge of main body is marked, it is not only simple and convenient, and substantially increase the speed of edge detection.
Detailed description of the invention
In order to more clearly explain the embodiment of the invention or the technical proposal in the existing technology, to embodiment or will show below
There is attached drawing needed in technical description to be briefly described, it should be apparent that, the accompanying drawings in the following description is only this
Some embodiments of invention for those of ordinary skill in the art without creative efforts, can be with
The structure shown according to these attached drawings obtains other attached drawings.
Fig. 1 is the flow chart of edge detection method in one embodiment;
Fig. 2 is the flow diagram handled in one embodiment target image;
Fig. 3 is that statistics obtains the flow chart of pixel accumulated value in one embodiment;
Fig. 4 is the schematic diagram of the target pixel region sampled in one embodiment;
Fig. 5 is the schematic diagram in the target line region sampled in one embodiment;
Fig. 6 is the schematic diagram that zoning is participated in one embodiment;
Fig. 7 is the flow chart of edge detection method in another embodiment;
Fig. 8 A is the schematic diagram that the target image before target subject is extracted in one embodiment;
Fig. 8 B is the schematic diagram of the target subject extracted in one embodiment;
Fig. 9 is the structural block diagram of edge detecting device in one embodiment;
Figure 10 is the structural block diagram of edge detecting device in another embodiment;
Figure 11 is the internal structure chart of computer equipment in one embodiment.
Specific embodiment
In order to make the objectives, technical solutions, and advantages of the present invention 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, proposing a kind of edge detection method, this method both can be used for terminal, also can be applied to take
Business device, the present embodiment are illustrated with being applied to terminal.The edge detection method specifically includes the following steps:
Step 102, target image to be detected is obtained, includes target subject in target image.
Wherein, target subject refers to the object at edge to be detected in target image.In one embodiment, target subject
Shape include multiple straight lines, for example, rectangle, diamond shape includes that there are four straight lines.Target image refers to include target
Image to be detected of main body.Target image can be color image, or gray image can also be binary image.
Target subject can be cloth, can also can also be glass etc. with film.The acquisition of target image can be by calling terminal
In camera target subject is shot in real time, be also possible to obtain from stored photograph album.
Step 104, with behavior unit according to pre-set sequence successively to the pixel value of the pixel in target image into
Row statistics, acquisition count obtained row pixel accumulated value every time.
Wherein, row is made of the pixel that can be drawn a straight line one by one.Row includes row, perpendicular row, diagonal, and one
As the line of horizontal direction is known as row, the line of vertical direction is known as perpendicular row, is referred to as " arranging ", inclined line is known as
Diagonal.The sequence of statistics customized can be arranged, for example, ecto-entad can be counted since the edge of target image,
It can also be counted from inside to outside since the centre of target image.
Row pixel accumulated value is by the way that the pixel value for each pixel for including is added up in corresponding line.Than
Such as, it is assumed that include 100 pixels in row, the pixel value of this 100 pixels is subjected to accumulation calculating and obtains corresponding row pixel
Accumulated value.In order to reduce calculation amount, pixel value can use gray value, i.e., the gray value of each pixel obtained statistics carries out
It is cumulative to obtain corresponding row pixel accumulated value.
Due to the relationship that the side of target subject and the edge of target image may not be parallel, in one embodiment, root
It according to the direction with target subject sides aligned parallel, is counted, and counted with pixel value of the behavior unit to the pixel in target image
Calculation counts obtained row pixel accumulated value every time.Target image can also be rotated, so that the edge and system of target subject
The line direction of meter is consistent.Target subject generally comprises multiple edges, in order to extract target subject from target image, needs really
The position at each edge of the main body that sets the goal, for example, if target subject there are four edges, needs to determine this 4 sides respectively
The position of edge.
What the pixel value that row pixel accumulated value can be one-row pixels was added up, it is also possible to the pixel of multiple rows
Pixel value added up.For example, the pixel value for the pixel for including in 2 rows can be counted every time, then carry out tired
Add to obtain corresponding row pixel accumulated value.
Step 106, the side of target subject in target image is determined according to row pixel accumulated value and preset row pixel threshold
Edge.
Wherein, preset row pixel threshold for measure statistical to row whether be target subject edge.General objectives
Main body and background colour are using two different colors.For example, target subject, if it is white, corresponding background colour is generally
Black.Be conducive to the edge for preferably detecting target subject using two kinds of dramatically different colors.According to target subject and background
The difference of pixel value between color can preset row pixel threshold.Obtained row pixel accumulated value will be counted every time and will be preset
Row pixel threshold be compared, if meeting corresponding condition, illustrate the edge of corresponding performance-based objective main body.
Above-mentioned edge detection method, by with behavior unit according to pre-set sequence successively to the target image
In the pixel value of pixel counted, acquisition counts obtained row pixel accumulated value every time, then according to row pixel accumulated value
The edge of target subject is determined with preset row pixel threshold.This method only needs to preset a row pixel threshold, by that will unite
It counts obtained row pixel accumulated value and is compared the edge for being assured that target subject with row pixel threshold, not only simple side
Just, and the speed of edge detection is substantially increased.
In one embodiment, it is described with behavior unit according to pre-set sequence successively in the target image
The pixel value of pixel is counted, and acquisition counts obtained row pixel accumulated value every time, comprising: from the edge of the target image
Start ecto-entad to count with pixel value of the behavior unit to the pixel in target image, it is corresponding current to obtain current line
Row pixel accumulated value;It is described that target in the target image is determined according to the row pixel accumulated value and preset row pixel threshold
The edge of main body, comprising: preset big when meeting between the current line pixel accumulated value and the preset row pixel threshold
When small relationship, stops statistics, determine the edge of target subject described in current behavior.
Wherein, current line refers to that the row of current statistic, current line pixel accumulated value refer to row pixel corresponding with current line
Accumulated value.In one embodiment, the pixel value of the pixel in target image is counted line by line with behavior unit, from target
The edge of image starts ecto-entad and is counted, every statistics a line, calculates the corresponding row pixel accumulated value of corresponding line.When current
When meeting preset size relation between the corresponding current line pixel accumulated value of row and preset row pixel threshold, illustrate current line
For the edge of target subject, do not need to be further continued for counting.In another embodiment, in order to improve the speed of detection, can between
It is counted every ground with behavior unit, it is primary every default row statistics, for example, 1 row can be counted every 5 rows.
In one embodiment, it is assumed that target subject is white, background colour is black, i.e. the pixel value of target subject compares
Greatly, the pixel value of background colour is smaller.It is counted from outside to inside, when the current pixel accumulated value that statistics obtains is no more than preset
When pixel threshold, then illustrate that current line is corresponding or background colour, continues to count next line;When the current pixel that statistics obtains is tired
It is value added when being greater than preset pixel threshold, then illustrate the edge of current behavior target subject, stops statistics, and carry out edge mark
Note extracts target subject according to edge labelling convenient for subsequent.
As shown in Fig. 2, in one embodiment, when target subject is cloth, process that target image is handled
Schematic diagram.Since cloth to be detected is very long, so including a left side for the target image of cloth after carrying out shooting photo to cloth
There are additional voids on right both sides, it is assumed that additional void is not present in the upper and lower of cloth, then only needing to the image for including cloth
Carry out the detection of left edge and right hand edge.Target image is counted from outside to inside since the left side line by line respectively, is counted
It is pre- when meeting between current line pixel accumulated value and preset row pixel threshold to the corresponding current line pixel accumulated value of current line
If size relation when, illustrate currently to be classified as the left edge of cloth.Similarly, since the right from outside to inside in target image
Counted line by line, statistics obtain the corresponding current line pixel accumulated value of current line, when current line pixel accumulated value with it is preset
When meeting preset size relation between row pixel threshold, illustrate the right hand edge of current behavior cloth.Detect the left side of cloth
After edge and right hand edge, cloth is extracted, that is, removes gap additional in target image.
In one embodiment, it is described with behavior unit according to pre-set sequence successively in the target image
The pixel value of pixel is counted, and acquisition counts obtained row pixel accumulated value every time, comprising: obtains preset pixel sampling ratio
Example;According to the object pixel for participating in statistics in the pixel sampling ratio-dependent corresponding line;By the corresponding picture of each object pixel
Plain value is added up to obtain the corresponding row pixel accumulated value of corresponding line.
Wherein, object pixel refers to the pixel for participating in statistics.In order to improve the speed of edge detection, according to the pixel of setting
Pixel in row is divided into object pixel and non-targeted pixel by oversampling ratio.The determination of object pixel and non-targeted pixel can be by
The plain oversampling ratio that takes pictures determines at random, for example, randomly selecting the pixel of presetted pixel ratio as object pixel, remaining is non-
Object pixel.It can also be chosen according to certain rule, for example, the pixel every predetermined number chooses one, for example, such as
Fruit pixel sampling ratio is 1:2, then can choose one every a pixel.Object pixel and non-targeted pixel is being determined
Afterwards, it is only necessary to add up by the pixel value of each object pixel, greatly reduce calculation amount.For example, it is assumed that as
Plain oversampling ratio is set as 1:2, the i.e. half of the total number of pixels of object pixel Zhan, it is assumed that and it include altogether 100 pixels in row,
It so participates in the object pixel that statistics calculates and there was only 50, calculation amount correspondingly reduces half, and corresponding calculating speed improves
One times.
As shown in figure 3, it is described with behavior unit according to pre-set sequence successively to the pixel in the target image
Pixel value counted, acquisition count obtained row pixel accumulated value every time, comprising:
Step 104A obtains preset pixel period.
Wherein, pixel period refers to the window size for being used to acquire pixel of setting.For example, can using 10 pixels as
One pixel period.If target subject is cloth, corresponding pixel period can be set according to the texture of cloth, for example,
Set pixel period to the integral multiple of cloth texture.
Step 104B is determined according to preset first oversampling ratio as unit of pixel period and is participated in statistics in corresponding line
The size of multiple target pixel regions, target pixel region is identical as pixel period;
Wherein, every a line can be divided into multiple pixel regions as unit of pixel period, the size of pixel region with
The size of pixel period is identical.For example, each pixel region includes 10 pictures if pixel period is 10 pixels
Element.It will participate in counting the pixel region calculated referred to as " target pixel region ", it is referred to as " non-to be not involved in the pixel region that statistics calculates
Target pixel region ".As shown in figure 4, in one embodiment, the target pixel region for including in corresponding line and non-targeted pixel
The schematic diagram in region, in figure, each grid represents a pixel period, and black lattice represents target pixel region, white lattice
The non-targeted pixel region of filial generation table.
First oversampling ratio is used to determine the ratio for participating in the target pixel region calculated in corresponding line.It can be using participation
Ratio between the target pixel region of calculating and the non-targeted pixel region for not participating in calculating indicates, can also use target
Ratio between pixel region and total pixel region indicates.
In order to improve the speed of edge detection, the part picture in the row is only selected when calculating the pixel accumulated value of every a line
Element participates in calculating.First oversampling ratio defines the ratio of target pixel region and non-targeted pixel region.According to the first sampling
Ratio selects multiple target pixel regions from pixel region.Only selectively participation corresponding row pixel in target pixel region is tired
Value added calculating.Such as, it is assumed that there are 100 pixels in a line, pixel period is 10 pixels, then being accordingly divided into 10
Pixel region.If the ratio between target pixel region and non-targeted pixel region is 1:1, only need from 10 pixels
The calculating of 5 participation row pixel accumulated values is selected in region.It can be according to pixel period and oversampling ratio when being sampled
It is sampled, can also be sampled according to certain rule at random, for example, being sampled according to preset interval.
In one embodiment, the corresponding sampling interval is determined according to preset first oversampling ratio, according to the sampling
Interval is sampled to obtain multiple target pixel regions.I.e. target pixel region and non-targeted pixel region carry out arranged in a crossed manner,
With reference to shown in Fig. 4.
Step 104C is added up the area pixel value for multiple target pixel regions that sampling obtains to obtain corresponding row
Pixel accumulated value.
Wherein, the area pixel value of each target pixel region is calculated separately, i.e., includes in calculating target pixel region
The sum of pixel value of pixel.Assuming that including 10 pixels in target pixel region, the pixel value of this 10 pixels is calculated separately,
Then it is added up to obtain the area pixel value of the target pixel region, then by the area pixel value of multiple target pixel regions
It is added up to obtain corresponding row pixel accumulated value.
In one embodiment, after the preset pixel period of acquisition, further includes: with the pixel period for singly
Position determines multiple target line regions wait participate in statistics, the mesh according to preset second oversampling ratio in the target image
The width for marking row region is identical as the pixel period.
Wherein, in order to further increase the speed of edge detection.Target image can be divided as unit of pixel period
Width for row region one by one, each row region is identical as pixel period.For example, if pixel period is 10 pixels, that
The width in each row region is 10 pixels.It will participate in the row region that statistics calculates and be known as " target line region ", be not involved in system
The row region that meter calculates is known as " non-targeted row region ".As shown in figure 5, for the mesh in one embodiment, including in target image
The schematic diagram in row region and non-targeted row region is marked, the width in row region and the size of pixel period are identical, in figure, target line area
Domain is black region, and non-targeted row region is white area.
In one embodiment, the target subject is cloth, and the pixel period is true according to the texture of the cloth
Fixed.
Wherein, target subject is cloth, and pixel period is determined according to the texture of cloth.Cloth is by identical texture
Composition, the corresponding pixel period of the different cloth of texture is also different.It can be using one or more textures as a pixel week
Phase is sampled convenient for subsequent according to pixel period, and edge detection speed is improved.
In one embodiment, it is described as unit of the pixel period according to preset second oversampling ratio in the mesh
Multiple target line regions wait participate in statistics are determined in logo image, comprising: determine according to preset second oversampling ratio corresponding
Sampling interval;It is sampled to obtain multiple target line regions according to the sampling interval.
Wherein, it in order to the speed of edge detection not only can be improved, but also can guarantee the accuracy of edge detection, get second
After oversampling ratio, the corresponding sampling interval is determined, corresponding target line region is then determined according to the sampling interval.That is target line area
Domain and non-targeted row region are arranged in a crossed manner.As shown in fig. 6, in one embodiment, in the first oversampling ratio (for example, 1:1) and
The object pixel calculated is participated in the row region of the participation calculating determined under second oversampling ratio (such as 1:1) and every a line
The schematic diagram in region.Wherein, it laterally indicates to carry out pixels statistics from outside to inside since right hand edge in figure, it is longitudinal to indicate corresponding
The cumulative direction of row pixel, direction at once.Black lattice indicates the pixel region for participating in calculating, and white grid expression is not involved in
The pixel region of calculating.
As shown in fig. 7, in one embodiment, above-mentioned edge detection method further include:
Step 108, the image of target subject is extracted from target image according to the edge of determining target subject.
Wherein, after detection obtains the edge of target subject, according to the position at the edge of target subject from target image
The image of target subject is extracted, i.e., is removed the image of the non-targeted main body in target image.It as shown in Figure 8 A, is one
In a embodiment, target image before extracting target subject, such as the image that Fig. 8 B is the target subject extracted.
Step 110, defects detection is carried out to the image of target subject, the defect that will test is marked.
Wherein, after obtaining the image of target subject, so that it may the image of target subject be carried out defects detection, then will
Obtained defect is detected to be marked.In one embodiment, target subject is cloth, is detected to the defects of cloth,
The defect of cloth is repaired in time convenient for subsequent, to be conducive to improve the quality of cloth.
As shown in figure 9, in one embodiment it is proposed that a kind of edge detecting device, the device include:
Module 902 is obtained, includes target subject in the target image for obtaining target image to be detected;
Pixels statistics module 904 is used for behavior unit according to pre-set sequence successively in the target image
The pixel value of pixel counted, acquisition counts obtained row pixel accumulated value every time;
Determining module 906, for being determined in the target image according to the pixel accumulated value and preset pixel threshold
The edge of target subject.
In one embodiment, the pixels statistics module is also used to the ecto-entad since the edge of the target image
It is counted with pixel value of the behavior unit to the pixel in target image, it is cumulative to obtain the corresponding current line pixel of current line
Value;The determining module is also used to default when meeting between the current line pixel accumulated value and the preset row pixel threshold
Size relation when, stop statistics, determine the edge of target subject described in current behavior.
In one embodiment, the pixels statistics module is also used to obtain preset pixel sampling ratio;According to described
The object pixel of statistics is participated in pixel sampling ratio-dependent corresponding line;The corresponding pixel value of each object pixel is added up
Obtain the corresponding row pixel accumulated value of corresponding line.
In one embodiment, the pixels statistics module is also used to obtain preset pixel period;With the pixel week
Phase is that unit determines multiple target pixel regions that statistics is participated in corresponding line, the target according to preset first oversampling ratio
The size of pixel region is identical as the pixel period;The area pixel value for multiple target pixel regions that sampling is obtained carries out
It is cumulative to obtain corresponding row pixel accumulated value.
In one embodiment, the pixels statistics module is also used to as unit of the pixel period according to preset
Two oversampling ratios determine multiple target line regions wait participate in statistics, the width in the target line region in the target image
It is identical as the pixel period.
In one embodiment, the target subject is cloth, and the pixel period is true according to the texture of the cloth
Fixed.
In one embodiment, the pixels statistics module is also used to determine according to preset second oversampling ratio corresponding
Sampling interval;It is sampled to obtain multiple target line regions according to the sampling interval.
As shown in Figure 10, in one embodiment, above-mentioned edge detecting device further include:
Extraction module 908, for extracting target master from the target image according to the edge of determining target subject
The image of body;
Defects detection module 910 carries out defects detection, the defect that will test for the image to the target subject
It is marked.
Figure 11 shows the internal structure chart of computer equipment in one embodiment.The computer equipment specifically can be clothes
Business device, is also possible to terminal.As shown in figure 11, which includes processor, the memory connected by system bus
And network interface.Wherein, memory includes non-volatile memory medium and built-in storage.The non-volatile of the computer equipment is deposited
Storage media is stored with operating system, can also be stored with computer program, when which is executed by processor, may make place
It manages device and realizes edge detection method.Computer program can also be stored in the built-in storage, which is held by processor
When row, processor may make to execute edge detection method.It will be understood by those skilled in the art that structure shown in Figure 11, only
It is only the block diagram of part-structure relevant to application scheme, does not constitute the computer being applied thereon to application scheme
The restriction of equipment, specific computer equipment may include than more or fewer components as shown in the figure, or the certain portions of combination
Part, or with different component layouts.
In one embodiment, edge detection method provided by the present application can be implemented as a kind of shape of computer program
Formula, computer program can be run in computer equipment as shown in figure 11.Composition can be stored in the memory of computer equipment
Each program module of the edge detecting device.For example, obtaining module 902, pixels statistics module 904 and determining module 906.
In one embodiment it is proposed that a kind of computer equipment, including memory and processor, the memory storage
There is computer program, when the computer program is executed by the processor, so that the processor executes following steps: obtaining
Target image to be detected includes target subject in the target image;With behavior unit according to pre-set sequence successively
The pixel value of pixel in the target image is counted, acquisition counts obtained row pixel accumulated value every time;According to institute
It states row pixel accumulated value and preset row pixel threshold determines the edge of target subject in the target image.
In one embodiment, it is described with behavior unit according to pre-set sequence successively in the target image
The pixel value of pixel is counted, and acquisition counts obtained row pixel accumulated value every time, comprising: from the edge of the target image
Start ecto-entad to count with pixel value of the behavior unit to the pixel in target image, it is corresponding current to obtain current line
Row pixel accumulated value;It is described that target in the target image is determined according to the row pixel accumulated value and preset row pixel threshold
The edge of main body, comprising: preset big when meeting between the current line pixel accumulated value and the preset row pixel threshold
When small relationship, stops statistics, determine the edge of target subject described in current behavior.
In one embodiment, it is described with behavior unit according to pre-set sequence successively in the target image
The pixel value of pixel is counted, and acquisition counts obtained row pixel accumulated value every time, comprising: obtains preset pixel sampling ratio
Example;According to the object pixel for participating in statistics in the pixel sampling ratio-dependent corresponding line;By the corresponding picture of each object pixel
Plain value is added up to obtain the corresponding row pixel accumulated value of corresponding line.
In one embodiment, it is described with behavior unit according to pre-set sequence successively in the target image
The pixel value of pixel is counted, and acquisition counts obtained row pixel accumulated value every time, comprising: obtains preset pixel period;
Multiple object pixels that statistics is participated in corresponding line are determined according to preset first oversampling ratio as unit of the pixel period
Region, the size of the target pixel region are identical as the pixel period;Multiple target pixel regions that sampling is obtained
Area pixel value is added up to obtain corresponding row pixel accumulated value.
In one embodiment, after the preset pixel period of acquisition, further includes: with the pixel period for singly
Position determines multiple target line regions wait participate in statistics, the mesh according to preset second oversampling ratio in the target image
The width for marking row region is identical as the pixel period.
In one embodiment, the target subject is cloth, and the pixel period is true according to the texture of the cloth
Fixed.
In one embodiment, it is described as unit of the pixel period according to preset second oversampling ratio in the mesh
Multiple target line regions wait participate in statistics are determined in logo image, comprising: determine according to preset second oversampling ratio corresponding
Sampling interval;It is sampled to obtain multiple target line regions according to the sampling interval.
In one embodiment, it is also used to perform the steps of root when the computer program is executed by the processor
The image of target subject is extracted from the target image according to the edge of determining target subject;To the figure of the target subject
As carrying out defects detection, the defect that will test is marked.
In one embodiment it is proposed that a kind of computer readable storage medium, is stored with computer program, the calculating
When machine program is executed by processor, so that the processor executes following steps: obtaining target image to be detected, the target
It include target subject in image;With behavior unit according to pre-set sequence successively to the picture of the pixel in the target image
Plain value is counted, and acquisition counts obtained row pixel accumulated value every time;According to the row pixel accumulated value and preset row picture
Plain threshold value determines the edge of target subject in the target image.
In one embodiment, it is described with behavior unit according to pre-set sequence successively in the target image
The pixel value of pixel is counted, and acquisition counts obtained row pixel accumulated value every time, comprising: from the edge of the target image
Start ecto-entad to count with pixel value of the behavior unit to the pixel in target image, it is corresponding current to obtain current line
Row pixel accumulated value;It is described that target in the target image is determined according to the row pixel accumulated value and preset row pixel threshold
The edge of main body, comprising: preset big when meeting between the current line pixel accumulated value and the preset row pixel threshold
When small relationship, stops statistics, determine the edge of target subject described in current behavior.
In one embodiment, it is described with behavior unit according to pre-set sequence successively in the target image
The pixel value of pixel is counted, and acquisition counts obtained row pixel accumulated value every time, comprising: obtains preset pixel sampling ratio
Example;According to the object pixel for participating in statistics in the pixel sampling ratio-dependent corresponding line;By the corresponding picture of each object pixel
Plain value is added up to obtain the corresponding row pixel accumulated value of corresponding line.
In one embodiment, it is described with behavior unit according to pre-set sequence successively in the target image
The pixel value of pixel is counted, and acquisition counts obtained row pixel accumulated value every time, comprising: obtains preset pixel period;
Multiple object pixels that statistics is participated in corresponding line are determined according to preset first oversampling ratio as unit of the pixel period
Region, the size of the target pixel region are identical as the pixel period;Multiple target pixel regions that sampling is obtained
Area pixel value is added up to obtain corresponding row pixel accumulated value.
In one embodiment, after the preset pixel period of acquisition, further includes: with the pixel period for singly
Position determines multiple target line regions wait participate in statistics, the mesh according to preset second oversampling ratio in the target image
The width for marking row region is identical as the pixel period.
In one embodiment, the target subject is cloth, and the pixel period is true according to the texture of the cloth
Fixed.
In one embodiment, it is described as unit of the pixel period according to preset second oversampling ratio in the mesh
Multiple target line regions wait participate in statistics are determined in logo image, comprising: determine according to preset second oversampling ratio corresponding
Sampling interval;It is sampled to obtain multiple target line regions according to the sampling interval.
In one embodiment, it is also used to perform the steps of root when the computer program is executed by the processor
The image of target subject is extracted from the target image according to the edge of determining target subject;To the figure of the target subject
As carrying out defects detection, the defect that will test is marked.
Those of ordinary skill in the art will appreciate that realizing all or part of the process 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 process of the embodiment of above-mentioned each method.Wherein, provided herein
Each embodiment used in any reference to memory, storage, database or other media, may each comprise non-volatile
And/or volatile memory.Nonvolatile memory may include that read-only memory (ROM), programming ROM (PROM), electricity can be compiled
Journey ROM (EPROM), electrically erasable ROM (EEPROM) or flash memory.Volatile memory may include random access memory
(RAM) or external cache.By way of illustration and not limitation, RAM is available in many forms, such as static state RAM
(SRAM), dynamic ram (DRAM), synchronous dram (SDRAM), double data rate sdram (DDRSDRAM), enhanced SDRAM
(ESDRAM), synchronization link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) directly RAM (RDRAM), straight
Connect memory bus dynamic ram (DRDRAM) and memory bus dynamic ram (RDRAM) etc..
Each technical characteristic of above embodiments can be combined arbitrarily, for simplicity of description, not to above-described embodiment
In each technical characteristic it is all possible combination be all described, as long as however, the combination of these technical characteristics be not present lance
Shield all should be considered as described in this specification.
The several embodiments of the application above described embodiment only expresses, the description thereof is more specific and detailed, but simultaneously
The limitation to the application the scope of the patents therefore cannot be interpreted as.It should be pointed out that for those of ordinary skill in the art
For, without departing from the concept of this application, various modifications and improvements can be made, these belong to the guarantor of the application
Protect range.Therefore, the scope of protection shall be subject to the appended claims for the application patent.
Claims (10)
1. a kind of edge detection method, which is characterized in that the described method includes:
Target image to be detected is obtained, includes target subject in the target image;
Successively the pixel value of the pixel in the target image is counted according to pre-set sequence with behavior unit, is obtained
Take the row pixel accumulated value for counting obtain every time;
The edge of target subject in the target image is determined according to the row pixel accumulated value and preset row pixel threshold.
2. the method according to claim 1, wherein it is described with behavior unit according to pre-set sequence successively
The pixel value of pixel in the target image is counted, acquisition counts obtained row pixel accumulated value every time, comprising:
Ecto-entad is carried out since the edge of the target image with pixel value of the behavior unit to the pixel in target image
Statistics obtains the corresponding current line pixel accumulated value of current line;
The side that target subject in the target image is determined according to the row pixel accumulated value and preset row pixel threshold
Edge, comprising:
When meeting preset size relation between the current line pixel accumulated value and the preset row pixel threshold, stop
Statistics, determines the edge of target subject described in current behavior.
3. the method according to claim 1, wherein it is described with behavior unit according to pre-set sequence successively
The pixel value of pixel in the target image is counted, acquisition counts obtained row pixel accumulated value every time, comprising:
Obtain preset pixel sampling ratio;
According to the object pixel for participating in statistics in the pixel sampling ratio-dependent corresponding line;
The corresponding pixel value of each object pixel is added up to obtain the corresponding row pixel accumulated value of corresponding line.
4. the method according to claim 1, wherein it is described with behavior unit according to pre-set sequence successively
The pixel value of pixel in the target image is counted, acquisition counts obtained row pixel accumulated value every time, comprising:
Obtain preset pixel period;
Multiple targets that statistics is participated in corresponding line are determined according to preset first oversampling ratio as unit of the pixel period
Pixel region, the size of the target pixel region are identical as the pixel period;
It is added up the area pixel value for multiple target pixel regions that sampling obtains to obtain corresponding row pixel accumulated value.
5. according to the method described in claim 4, it is characterized in that, after the preset pixel period of acquisition, further includes:
It is determined in the target image wait participate in counting as unit of the pixel period according to preset second oversampling ratio
Multiple target line regions, the width in the target line region is identical as the pixel period.
6. method according to claim 4 or 5, which is characterized in that the target subject is cloth, and the pixel period is
It is determined according to the texture of the cloth.
7. according to the method described in claim 5, it is characterized in that, it is described as unit of the pixel period according to preset
Two oversampling ratios determine multiple target line regions wait participate in statistics in the target image, comprising:
The corresponding sampling interval is determined according to preset second oversampling ratio;
It is sampled to obtain multiple target line regions according to the sampling interval.
8. a kind of edge detecting device, which is characterized in that described device includes:
Module is obtained, includes target subject in the target image for obtaining target image to be detected;
Pixels statistics module, for behavior unit according to pre-set sequence successively to the pixel in the target image
Pixel value is counted, and acquisition counts obtained row pixel accumulated value every time;
Determining module, for determining target subject in the target image according to the pixel accumulated value and preset pixel threshold
Edge.
9. a kind of computer readable storage medium, be stored with computer program makes when the computer program is executed by processor
The processor is obtained to execute such as the step of any one of claims 1 to 7 the method.
10. a kind of computer equipment, including memory and processor, the memory is stored with computer program, the calculating
When machine program is executed by the processor, so that the processor executes the step such as any one of claims 1 to 7 the method
Suddenly.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910420584.0A CN110223309B (en) | 2019-05-20 | 2019-05-20 | Edge detection method, edge detection device, computer equipment and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910420584.0A CN110223309B (en) | 2019-05-20 | 2019-05-20 | Edge detection method, edge detection device, computer equipment and storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN110223309A true CN110223309A (en) | 2019-09-10 |
CN110223309B CN110223309B (en) | 2021-07-06 |
Family
ID=67821458
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910420584.0A Active CN110223309B (en) | 2019-05-20 | 2019-05-20 | Edge detection method, edge detection device, computer equipment and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN110223309B (en) |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112669227A (en) * | 2020-12-16 | 2021-04-16 | Tcl华星光电技术有限公司 | Icon edge processing method and device and computer readable storage medium |
CN113034524A (en) * | 2019-12-25 | 2021-06-25 | 深圳怡化电脑股份有限公司 | Image edge detection method and device |
CN113758426A (en) * | 2021-08-17 | 2021-12-07 | 深圳新视智科技术有限公司 | Method and device for determining width of cloth, electronic equipment and readable storage medium |
Citations (12)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20080292188A1 (en) * | 2007-05-23 | 2008-11-27 | Rexee, Inc. | Method of geometric coarsening and segmenting of still images |
CN101996322A (en) * | 2010-11-09 | 2011-03-30 | 东华大学 | Method for extracting fractal detail feature for representing fabric texture |
CN102497488A (en) * | 2011-11-30 | 2012-06-13 | 广东威创视讯科技股份有限公司 | Method and device for removing image black margins |
CN103729856A (en) * | 2014-01-24 | 2014-04-16 | 浙江师范大学 | Method for cloth defect detection by utilizing S transformation signal extraction |
CN104778713A (en) * | 2015-04-27 | 2015-07-15 | 清华大学深圳研究生院 | Image processing method |
CN104794998A (en) * | 2015-05-12 | 2015-07-22 | 京东方科技集团股份有限公司 | Display drive method, device and display device |
CN104933719A (en) * | 2015-06-24 | 2015-09-23 | 辽宁工程技术大学 | Method for detecting image edge by integral image interblock distance |
CN105184290A (en) * | 2015-08-25 | 2015-12-23 | 深圳怡化电脑股份有限公司 | Target region extraction method and system |
CN105740861A (en) * | 2016-02-02 | 2016-07-06 | 大连楼兰科技股份有限公司 | Method for quickly making statistics on labeled connected domains in image |
CN105894521A (en) * | 2016-04-25 | 2016-08-24 | 中国电子科技集团公司第二十八研究所 | Sub-pixel edge detection method based on Gaussian fitting |
CN107808397A (en) * | 2017-11-10 | 2018-03-16 | 京东方科技集团股份有限公司 | Pupil positioning device, pupil positioning method and Eye-controlling focus equipment |
CN108734161A (en) * | 2017-04-13 | 2018-11-02 | 深圳怡化电脑股份有限公司 | Recognition methods, device, equipment and the storage medium in crown word number region |
-
2019
- 2019-05-20 CN CN201910420584.0A patent/CN110223309B/en active Active
Patent Citations (12)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20080292188A1 (en) * | 2007-05-23 | 2008-11-27 | Rexee, Inc. | Method of geometric coarsening and segmenting of still images |
CN101996322A (en) * | 2010-11-09 | 2011-03-30 | 东华大学 | Method for extracting fractal detail feature for representing fabric texture |
CN102497488A (en) * | 2011-11-30 | 2012-06-13 | 广东威创视讯科技股份有限公司 | Method and device for removing image black margins |
CN103729856A (en) * | 2014-01-24 | 2014-04-16 | 浙江师范大学 | Method for cloth defect detection by utilizing S transformation signal extraction |
CN104778713A (en) * | 2015-04-27 | 2015-07-15 | 清华大学深圳研究生院 | Image processing method |
CN104794998A (en) * | 2015-05-12 | 2015-07-22 | 京东方科技集团股份有限公司 | Display drive method, device and display device |
CN104933719A (en) * | 2015-06-24 | 2015-09-23 | 辽宁工程技术大学 | Method for detecting image edge by integral image interblock distance |
CN105184290A (en) * | 2015-08-25 | 2015-12-23 | 深圳怡化电脑股份有限公司 | Target region extraction method and system |
CN105740861A (en) * | 2016-02-02 | 2016-07-06 | 大连楼兰科技股份有限公司 | Method for quickly making statistics on labeled connected domains in image |
CN105894521A (en) * | 2016-04-25 | 2016-08-24 | 中国电子科技集团公司第二十八研究所 | Sub-pixel edge detection method based on Gaussian fitting |
CN108734161A (en) * | 2017-04-13 | 2018-11-02 | 深圳怡化电脑股份有限公司 | Recognition methods, device, equipment and the storage medium in crown word number region |
CN107808397A (en) * | 2017-11-10 | 2018-03-16 | 京东方科技集团股份有限公司 | Pupil positioning device, pupil positioning method and Eye-controlling focus equipment |
Non-Patent Citations (3)
Title |
---|
FAITH BOYACI, ZIYA TELATAR: "Motion Estimation in Video Sequences by Edge detection", 《PROCEEDINGS OF THE IEEE 12TH SIGNAL PROCESSING AND COMMUNICAITONS APPLITIONS CONFERENCE》 * |
布红刚: "基于混合特征向量和单分类检测器的植物瑕疵自动检测研究", 《中国博士学位论文全文数据库 信息科技辑》 * |
张剑: "车辆牌照识别中车牌定位的研究", 《信息技术》 * |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113034524A (en) * | 2019-12-25 | 2021-06-25 | 深圳怡化电脑股份有限公司 | Image edge detection method and device |
CN112669227A (en) * | 2020-12-16 | 2021-04-16 | Tcl华星光电技术有限公司 | Icon edge processing method and device and computer readable storage medium |
CN112669227B (en) * | 2020-12-16 | 2023-10-17 | Tcl华星光电技术有限公司 | Icon edge processing method, icon edge processing device and computer readable storage medium |
CN113758426A (en) * | 2021-08-17 | 2021-12-07 | 深圳新视智科技术有限公司 | Method and device for determining width of cloth, electronic equipment and readable storage medium |
Also Published As
Publication number | Publication date |
---|---|
CN110223309B (en) | 2021-07-06 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN108492262B (en) | No-ghost high-dynamic-range imaging method based on gradient structure similarity | |
US8144975B2 (en) | Method for using image depth information | |
CN104166983A (en) | Motion object real time extraction method of Vibe improvement algorithm based on combination of graph cut | |
CN110223309A (en) | Edge detection method, device, computer equipment and storage medium | |
TW200828982A (en) | Real-time detection method for bad pixel of image | |
CN104200475B (en) | Novel no-reference image blur degree estimation method | |
Jia et al. | Blind high dynamic range image quality assessment using deep learning | |
CN105828067A (en) | Terminal, method and device for determining whether two cameras are occluded | |
CN108470185A (en) | The atural object annotation equipment and method of satellite image | |
US20110176033A1 (en) | Camera and method for capturing and processing photos in camera | |
US11228723B2 (en) | Pixel correction | |
CN108520347A (en) | Panoptic visualization grid voltage quality methods of exhibiting, system and computer equipment | |
CN111406402B (en) | Photosensitive imaging system and apparatus | |
CN111062926B (en) | Video data processing method, device and storage medium | |
CN105704363B (en) | Image data processing method and device | |
Rovid et al. | Gradient based synthesized multiple exposure time HDR image | |
CN108898163A (en) | Information processing method and device, electronic equipment and computer readable storage medium | |
CN108257130B (en) | A kind of aviation orthography panorama sketch garland region rapid detection method | |
CN113744221A (en) | Shot object counting method and device, computer equipment and storage medium | |
CN111784635B (en) | Skin surface fluorescent spot detection and evaluation method based on image color space | |
CN115424062B (en) | Method, device, equipment and storage medium for automatically identifying diagonal network | |
CN111382615A (en) | Image detection method | |
Ajemba et al. | Stability-based validation of cellular segmentation algorithms | |
CN115830431B (en) | Neural network image preprocessing method based on light intensity analysis | |
CN116912429B (en) | Three-dimensional reconstruction method and system for high-definition video IG (inter-group) material |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |