CN107123127A - A kind of image subject extracting method and device - Google Patents
A kind of image subject extracting method and device Download PDFInfo
- Publication number
- CN107123127A CN107123127A CN201710287405.1A CN201710287405A CN107123127A CN 107123127 A CN107123127 A CN 107123127A CN 201710287405 A CN201710287405 A CN 201710287405A CN 107123127 A CN107123127 A CN 107123127A
- Authority
- CN
- China
- Prior art keywords
- image
- sliding window
- detection
- pixel
- pending
- 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
Links
Classifications
-
- 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
Landscapes
- Engineering & Computer Science (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Image Analysis (AREA)
Abstract
The invention discloses a kind of image subject extracting method and device, it is related to image processing field, wherein method includes:Edge detection process is carried out to pending image based on edge detection operator, the image after rim detection is obtained;Generation detection sliding window, using progress sliding window detection in image of the detection sliding window after rim detection;Carry out image subject extracted region processing according in the image after rim detection of pixel quantity and image subject recognition rule in detection sliding window, using the image extracted as pending image main part.The image subject extracting method and device of the present invention, the treatment effeciency for detecting, extracting to image subject can be greatly improved, and foreground and background seed point need not be accurately set, carry out image pure color detection, accuracy rate for image subject detection, the extraction of solid-color image is high, makes the image subject extracted accurate, reliable.
Description
Technical field
The present invention relates to technical field of image processing, more particularly to a kind of image subject extracting method and device.
Background technology
Net purchase platform achieves significant progress in recent years, and net purchase platform have accumulated substantial amounts of commodity image information how
More effectively realize the tissue to commodity image information, analysis, retrieval and become particularly significant to consumer's displaying.Commodity
The content of image includes commodity body and background, when user uploads a width commodity image and it is expected that search is same or similar with the figure
Commodity when, user more focused on commodity in itself, therefore, extract commodity image in commodity body turn into very important one
Work.At present, image subject extracting method is typically based on Graph cuts algorithms, the main working process of Graph cuts algorithms
For:Background seed point is set on four angles of image, Graph cuts algorithms is performed and obtains main body mask, entered using sliding window
Row detection, obtains the back gauge of image subject and obtains cutting rectangle outside main body.But, Graph cuts algorithms are split by pixel, hold
Line efficiency is low, also, be fixedly installed background seed point way so that main body account for whole picture it is larger and with background seed point weight
Can not successful division when folded.
The content of the invention
In view of this, the invention solves the problems that a technical problem be to provide a kind of image subject extracting method and device.
According to an aspect of the present invention there is provided a kind of image subject extracting method, including:Based on edge detection operator pair
Pending image carries out edge detection process, obtains the image after rim detection;Generation detection sliding window, using the detection sliding window
Sliding window detection is carried out in image after the rim detection;According to the pixel quantity in the detection sliding window and image master
In image of the body recognition rule after the rim detection carry out image subject extracted region processing, using the image extracted as
The main part of the pending image.
Alternatively, the color value of the pixel included in the pending image is obtained, according to the color of the pixel
Value and image pure color judgment rule determine whether the pending image is solid-color image;If it is, based on the edge
Detective operators carry out edge detection process to the pending image;If it is not, then terminating the processing to the pending image.
Alternatively, the color value for obtaining the pixel included in the pending image, according to the pixel
Color value and image pure color judgment rule determine whether the pending image is that solid-color image includes:In the pending figure
The periphery of picture sets detection boundary, determines the image detection region in the detection boundary;Obtain in described image detection zone
Comprising pixel color value, the pixel whole that in described image detection zone includes of the statistics with same color value
Accounting in pixel;The accounting highest color value and accounting value are obtained, judges whether the accounting value is higher than accounting
Threshold value;If it is, determining that the pending image is solid-color image.
Alternatively, the generation detects sliding window, using progress in the image for detecting sliding window after the rim detection
Sliding window detection includes:The edge of image after the rim detection sets horizontal sliding window and vertical sliding window respectively;Control institute
Horizontal sliding window, the vertical sliding window are stated respectively to the central slide of the image after the rim detection, to determine described image
The border of body region.
Alternatively, the height pixel count of the horizontal sliding window is the width pixel count of the image after the rim detection, institute
The width pixel count for stating horizontal sliding window is t1;The width pixel count of the vertical sliding window be the rim detection after image length
Pixel count is spent, the height pixel count of the vertical sliding window is t2;Wherein, the horizontal sliding window, the vertical sliding window difference are controlled
With central slide from step-length t1 and t1 to the image after the rim detection.
Alternatively, when the edge of the image after the rim detection sets the horizontal sliding window, the vertical sliding window,
Interference region is removed in the horizontal sliding window, the vertical sliding window, wherein, the interference region includes:Trade mark region.
Alternatively, the pixel quantity and image subject recognition rule according in the detection sliding window is on the side
The processing of image subject extracted region is carried out in image after edge detection to be included:In the horizontal sliding window, the vertical sliding window to institute
During the central slide for stating the image after rim detection, obtain wrapped in the horizontal sliding window, the vertical sliding window respectively
The difference of the pixel count contained and the pixel count included in the horizontal sliding window of a upper sliding position, the vertical sliding window
D1 and d2;Two d1 continuously acquired difference dk1 is calculated, when it is determined that dk1 is more than the first pixel threshold, then stops the water
Smoothing windows are slided and determine the vertical boundary of described image body region;Two d2 continuously acquired difference dk2 is calculated, when true
When determining dk2 more than the second pixel threshold, then stop the vertical sliding window and slide and determine the horizontal sides of described image body region
Boundary.
Alternatively, before edge detection process is carried out to the pending image based on the edge detection operator, adopt
With smoothing filter to being filtered processing to the pending image;Wherein, the edge detection operator includes:Canny is calculated
Son.
According to another aspect of the invention there is provided a kind of image subject extraction element, including:Edge detection module, is used for
Edge detection process is carried out to pending image based on edge detection operator, the image after rim detection is obtained;Sliding window detects mould
Block, for generating detection sliding window, using progress sliding window detection in image of the detection sliding window after the rim detection;Main body
Extraction module, for according to it is described detection sliding window in pixel quantity and image subject recognition rule in the rim detection
In image afterwards carry out image subject extracted region processing, using the image extracted as the pending image main part
Point.
Alternatively, pure color determining module, the color value for obtaining the pixel included in the pending image, according to
The color value and image pure color judgment rule of the pixel determine whether the pending image is solid-color image;If institute
State pure color determining module and determine that the pending image is solid-color image, then the edge detection module is based on the rim detection
Operator carries out edge detection process to the pending image;If the pure color determining module determines the pending image not
For solid-color image, then terminate the processing to the pending image.
Alternatively, the pure color determining module, is additionally operable to set detection boundary in the periphery of the pending image, it is determined that
Image detection region in the detection boundary;Obtain the color value of the pixel included in described image detection zone, statistics
Accounting in whole pixels that pixel with same color value is included in described image detection zone;Accounted for described in obtaining
Than highest color value and accounting value, judge whether the accounting value is higher than accounting threshold value;If it is, waiting to locate described in determining
Reason image is solid-color image.
Alternatively, the sliding window detection module, the edge for the image being additionally operable to after the rim detection is set respectively
Horizontal sliding window and vertical sliding window, control the horizontal sliding window, the vertical sliding window respectively to the image after the rim detection
Central slide, the border to determine described image body region.
Alternatively, the height pixel count of the horizontal sliding window is the width pixel count of the image after the rim detection, institute
The width pixel count for stating horizontal sliding window is t1;The width pixel count of the vertical sliding window be the rim detection after image length
Pixel count is spent, the height pixel count of the vertical sliding window is t2;The sliding window detection module, is additionally operable to control the level to slide
Window, the vertical sliding window respectively with central slide from step-length t1 and t1 to the image after the rim detection.
Alternatively, the sliding window detection module, the edge for the image being additionally operable to after the rim detection sets described
When horizontal sliding window, the vertical sliding window, interference region is removed in the horizontal sliding window, the vertical sliding window, wherein, it is described dry
Disturbing region includes:Trade mark region.
Alternatively, the main body extraction module, is additionally operable to examine to the edge in the horizontal sliding window, the vertical sliding window
During the central slide of image after survey, the horizontal sliding window, the pixel included in the vertical sliding window are obtained respectively
Count the difference d1 and d2 with the pixel count included in the horizontal sliding window of a upper sliding position, the vertical sliding window;
Two d1 continuously acquired difference dk1 is calculated, when it is determined that dk1 is more than the first pixel threshold, then stops the horizontal sliding window
Slide and determine the vertical boundary of described image body region;Two d2 continuously acquired difference dk2 is calculated, when it is determined that dk2
During more than the second pixel threshold, then stop the vertical sliding window and slide and determine the horizontal boundary of described image body region.
Alternatively, the edge detection module, for entering based on the edge detection operator to the pending image
Before row edge detection process, using smoothing filter to being filtered processing to the pending image;Wherein, the edge
Detective operators include:Canny operators.
According to another aspect of the invention there is provided a kind of image subject extraction element, including:Memory;And be coupled to
The processor of the memory, the processor is configured as, based on the instruction being stored in the memory, performing as above institute
The image subject extracting method stated.
In accordance with a further aspect of the present invention there is provided a kind of computer-readable recording medium, the computer-readable storage medium
Matter is stored with computer instruction, and the instruction realizes that the image subject described in any one as described above is extracted when being executed by processor
Method.
The image subject extracting method and device of the present invention, edge detection process is carried out based on edge detection operator to image
And image subject is extracted by way of sliding window is detected, the treatment effeciency for detecting, extracting to image subject is greatly improved, and
The limitation of foreground and background seed point need not be accurately set, image subject detection, the accuracy rate extracted for solid-color image
Height, makes the image subject extracted accurate, reliable.
Brief description of the drawings
In order to illustrate more clearly about the embodiment of the present invention or technical scheme of the prior art, below will be to embodiment or existing
There is the accompanying drawing used required in technology description to be briefly described, it should be apparent that, drawings in the following description are only
Some embodiments of the present invention, for those of ordinary skill in the art, without having to pay creative labor, also
Other accompanying drawings can be obtained according to these accompanying drawings.
Fig. 1 is the schematic flow sheet of one embodiment of the image subject extracting method according to the present invention;
Fig. 2 is the schematic flow sheet of another embodiment of the image subject extracting method according to the present invention;
Fig. 3 shows for the setting pure color detection zone in one embodiment of the image subject extracting method according to the present invention
It is intended to;
Fig. 4 A to 4E determine to scheme for the sliding window that passes through in one embodiment according to image subject extracting method of the invention
As the schematic diagram on body region border;
Fig. 5 is the module diagram of one embodiment of the image subject extraction element according to the present invention;
Fig. 6 is the module diagram of another embodiment of the image subject extraction element according to the present invention.
Embodiment
The present invention is described more fully with reference to the accompanying drawings, wherein illustrating the exemplary embodiment of the present invention.Under
The accompanying drawing that face will be combined in the embodiment of the present invention, the technical scheme in the embodiment of the present invention is clearly and completely described, and shows
So, described embodiment is only a part of embodiment of the invention, rather than whole embodiments.Based on the reality in the present invention
Example is applied, the every other embodiment that those of ordinary skill in the art are obtained under the premise of creative work is not made all belongs to
In the scope of protection of the invention.Many descriptions are carried out to technical scheme with reference to each figure and embodiment.
" first ", " second " hereinafter etc. is only used for distinguishing in description, not other special implications.
Fig. 1 is the schematic flow sheet of one embodiment of the image subject extracting method according to the present invention, as shown in Figure 1:
Step 101, edge detection process is carried out to pending image based on edge detection operator, obtained after rim detection
Image.
Pending image can be commodity image etc., and form can include:Bmp, jpeg, png etc..Edge detection operator can
With using a variety of, such as Laplace operator, Canny operators.In order to ensure the reliability of edge detection process, based on side
Edge detective operators are carried out to pending image before edge detection process, using smoothing filter to being filtered to pending image
Ripple processing.
A variety of smoothing filters can be used, for example with Gaussian filter, based on Gaussian function and filter scales σ
Gaussian filtering template is generated, convolution algorithm is carried out to pending image using gaussian filtering template, pending figure can suppressed
While image surface picture noise, make the edge of pending image sharper keen.
Step 102, generation detection sliding window, using progress sliding window detection in image of the detection sliding window after rim detection.
Step 103, according to the pixel quantity and image subject recognition rule in detection sliding window after rim detection
In image carry out image subject extracted region processing, using the image extracted as pending image main part.
Image subject extracting method and device that above-described embodiment is provided, edge is carried out based on edge detection operator to image
Detection process simultaneously extracts image subject by way of sliding window is detected, it is not necessary to the seed point of accurate setting foreground and background, carries
Detection, the treatment effeciency extracted are risen.
Fig. 2 is the schematic flow sheet of another embodiment of the image subject extracting method according to the present invention, such as Fig. 2 institutes
Show:
Step 201, pure color detection is carried out to pending image.
Pure color detection can use a variety of methods.For example, obtaining the color value of the pixel included in pending image, root
Determine whether pending image is solid-color image according to the color value and image pure color judgment rule of pixel.Pending image
Trade mark, introduction, address often occurs in the outer of (such as actuals image), need to exclude trade mark, introduction etc. in the detection
Interference, set detection zone to improve the accuracy of detection with this.
As shown in figure 3, being inwardly indented the pixel specified from the most outer of image, image detection region 32 and clear area are formed
Domain 31, it is in order to avoid positioned at the dry of the trade mark on image periphery, introduction, address etc. that the most outer sideline of image, which is inwardly indented,
Disturb.The pixel that the most outer of image is inwardly shunk can be configured according to different images, for example, 10 pixels etc., represent image
Outermost sideline be retracted 10 pixels inside.
In one embodiment, detection boundary is set in the periphery of pending image, it is determined that the image inspection in detection boundary
Survey region.The color value of the pixel included in image detection region is obtained, pixel of the statistics with same color value is in figure
As the accounting in whole pixels for being included in detection zone, accounting highest color value and accounting value are obtained, accounting is judged
Whether value is higher than accounting threshold value, if it is, determining that pending image is solid-color image.
For example, the pixel that traversal image detection region 32 is included, builds 256 color histograms (256 buckets, color
The scope of value is [0-255]), there is the pixel of same color value, each histogram is represented in statistical picture detection zone 32
With a kind of pixel quantity of color.After statistics is completed, by histogrammic height, (each histogrammic height, which is represented, to be had
Have the sum of the pixel of color corresponding to histogram) sequence, obtain highest histogram.
For example, No. 0 histogram highest (pixel value 0 represents black), then it represents that have black in image detection region 32
Pixel at most, according to all histogrammic altimeters calculate in image detection region 32 for black pixel in image detection
The shared ratio in all pixels point in region 32.Accounting threshold value R can be pre-set, and for example, 80% etc..
If in all pixels point of the pixel in image detection region 32 of black in image detection region 32
Quantity accounting value is more than 80%, then it represents that pending image is solid-color image, i.e., the characteristics of pending image has background pure color.
If the characteristics of image has background pure color, the degree of accuracy of image subject is extracted using the image subject extracting method of the present invention
It is high.
Step 202, whether be solid-color image, if it is, into step 204, if it is not, then entering if determining pending image
Enter step 203, exit operation, terminate the processing to pending image.
Step 204, edge detection process is carried out to pending image based on Canny operators.
Canny operators, which are one, has filtering, enhancing, the multistage Optimizing operator of detection function.Before processing is being carried out,
Canny operators are using Gaussian filter come smoothed image with except denoising.Canny partitioning algorithms are had using single order local derviation
Limit difference to calculate gradient magnitude and direction, non-maxima suppression is carried out to gradient magnitude, detected and connected with dual threashold value-based algorithm
Edge, searches for the edge of pending image.The border of regions of different colours is taken turns using the edge detection algorithm of Canny operators
Profile bar is exported, and the edge contour lines of pending image can be shown in the image after rim detection, using Canny operators
Edge detection algorithm can export the boundary between main body and background (regions of different colours) with lines of outline.
Step 205, the edge of the image after rim detection sets horizontal sliding window and vertical sliding window respectively.
Four side edges of the image after rim detection take four sliding windows with fixed size respectively.Horizontal sliding window be
The sliding window slided in horizontal direction, vertical sliding window is the sliding window slided in vertical direction.It is high that the height of horizontal sliding window rounds figure
Degree, width takes fixed size (according to the threshold value t1 of setting), and the height pixel count of horizontal sliding window is the image after rim detection
Width pixel count, the width pixel count of horizontal sliding window is t1.The height of vertical sliding window rounds figure width, highly takes fixed size
(according to the threshold value t2 of setting).The width pixel count of vertical sliding window is the length pixel count of the image after rim detection, is vertically slided
The height pixel count of window is t2.
In one embodiment, when the edge of the image after rim detection sets horizontal sliding window, vertical sliding window, it is necessary to
Interference region, interference region bag are removed in horizontal sliding window, vertical sliding window
Include:Trade mark region, introduce region etc..The purpose for removing interference region is to reduce the wheel due to this interference region
It is inaccurate that the image subject that profile bar (edge detection results) causes is detected.
For example, trade mark often occurs in the upper left corner of the commodity image of electric business, height is about commodity image a quarter height,
Width is about the width of commodity image 1/3rd.The interference of upper left corner trade mark position is excluded to be unified, in four sliding windows of above-mentioned setting
In, certain altitude (the height pixel count of cutting can be set) is cut on the top positioned at the horizontal sliding window on the left side, positioned at upper
The left side of the vertical sliding window of side cuts one fixed width (the width pixel count of cutting can be set).
Step 206, controlled level sliding window, vertical sliding window are respectively to the central slide of the image after rim detection, according to cunning
Pixel count and pixel threshold included in window determine the border in image subject region.
Image subject recognition rule can have multiple rule.For example, controlled level sliding window, vertical sliding window are respectively with step-length t1
With central slide from t1 to the image after rim detection.In horizontal sliding window, vertical sliding window to the center of the image after rim detection
During slip, horizontal sliding window, the pixel count included in vertical sliding window and the water in a upper sliding position are obtained respectively
The difference d1 and d2 of pixel count included in smoothing windows, vertical sliding window.
Two d1 continuously acquired difference dk1 is calculated, when it is determined that dk1 is more than the first pixel threshold, then stops level
Sliding window is slided and determines the vertical boundary in image subject region.Two d2 continuously acquired difference dk2 is calculated, when it is determined that dk2
During more than the second pixel threshold, then stop the horizontal boundary that vertical sliding window is slided and determines image subject region.
As shown in Figure 4 A, the horizontal sliding window positioned at the left side can be considered as one using picture altitude as height, and fixed width is 2 pictures
The slip rectangular area of element.Slided by 2 pixels of step-length, horizontal sliding window upper left comer horizontal coordinate is 0 in the position at the first moment,
Subsequent time horizontal coordinate position is 2.Often cunning moves a step horizontal sliding window, the level of pixel count and previous step in calculated level sliding window
The poor d of pixel count in sliding window.
For example, due to after edge detection algorithm has been performed, image to be detected is changed into only body edge along lines of outline
The image of display, line color therein for white, then in calculated level sliding window white pixel number and previous step horizontal sliding window
The poor d of interior white pixel number.
Dk is designated as nearest double d difference, when judging dk>Threshold value a, then stop sliding, calculated level sliding window is slided
Distance, obtain image subject outer section of rectangle left side to image border distance.Arrow show determination dk>Threshold value a's
4 steps are slided in position, i.e. horizontal sliding window, if step-length is 2 pixels, then outer section of rectangle left of image subject while to image border while
Away from for 8 pixels.
As shown in Figure 4 B, arrow show determination dk>Threshold value a position, i.e., vertical sliding window slides 3 steps, if step-length is 2 pictures
Element, then outer section of rectangle upper side edge of image subject to image border back gauge be 6 pixels.As shown in Figure 4 C, arrow is shown really
Determine dk>Threshold value a position, i.e., horizontal sliding window slides 3 steps, if step-length is 2 pixels, then outer section of rectangle right edge of image subject is arrived
The back gauge of image border is 6 pixels.As shown in Figure 4 D, arrow show determination dk>Threshold value a position, i.e., vertical sliding window slides 3
Step, if step-length is 2 pixels, then the back gauge of outer section of rectangle base of image subject to image border is 6 pixels.As shown in Figure 4 E,
Obtain and the image subject region that rectangular edges are surrounded is cut outside four of image subject, the image that will go out from image subject extracted region
It is used as the main part of pending image.
Shown according to experiment, image subject detection, the efficiency extracted are carried out using the image subject extracting method of the present invention
Greatly promote.For example, by taking 400x400 commodity image as an example, in Mac OSX, 2.6GHz Intel Core i5, single thread
Under experiment condition, carrying out Graph cuts segmentations needs about 1869 milliseconds, and uses the present invention's under identical experiment condition
Image subject extracting method, image subject detection, extraction are carried out to same image and needs only to about 35 milliseconds.
Image subject extracting method and device that above-described embodiment is provided, greatly improve to image subject detection, extract
Treatment effeciency, also, do not relied on interaction by existing Graph Cuts algorithms and need accurate to set foreground and background seed point
Limitation, image subject detection for solid-color image, the accuracy rate extracted are high.
In one embodiment, as shown in figure 5, the present invention provides a kind of image subject extraction element 50, including:Examine at edge
Survey module 51, sliding window detection module 52, main body extraction module 53 and pure color determining module 54.
Edge detection module 51 is based on edge detection operator and carries out edge detection process to pending image, obtains edge inspection
Image after survey.Edge detection module 51 based on edge detection operator to pending image carry out edge detection process before,
Using smoothing filter to being filtered processing to pending image;Wherein, edge detection operator includes:Canny operators etc..
The generation detection sliding window of sliding window detection module 52, using progress sliding window inspection in image of the detection sliding window after rim detection
Survey.Main body extraction module 53 is according to the pixel quantity and image subject recognition rule in detection sliding window after rim detection
In image carry out image subject extracted region processing, using the image extracted as pending image main part.
Pure color determining module 54 obtains the color value of the pixel included in pending image, according to the color value of pixel
And image pure color judgment rule determines whether pending image is solid-color image.If pure color determining module 54 determines pending
Image is solid-color image, then edge detection module 51 is based on edge detection operator and carries out edge detection process to pending image.
If pure color determining module 54 determines that pending image is not solid-color image, terminate the processing to pending image.
Pure color determining module 54 sets detection boundary in the periphery of pending image, it is determined that the image detection in detection boundary
Region.Pure color determining module 54 obtains the color value of the pixel included in image detection region, and statistics has same color value
Whole pixels for being included in image detection region of pixel in accounting.Pure color determining module 54 obtains accounting highest
Color value and accounting value, judge whether accounting value is higher than accounting threshold value, if it is, determining that pending image is pure color figure
Picture.
The edge of image of the sliding window detection module 52 after rim detection sets horizontal sliding window and vertical sliding window respectively, control
Horizontal sliding window, vertical sliding window are made respectively to the central slide of the image after rim detection, the side to determine image subject region
Boundary.The height pixel count of horizontal sliding window is the width pixel count of the image after rim detection, and the width pixel count of horizontal sliding window is
t1.The width pixel count of vertical sliding window is the length pixel count of the image after rim detection, and the height pixel count of vertical sliding window is
t2。
When the edge of image of the sliding window detection module 52 after rim detection sets horizontal sliding window, vertical sliding window, in water
Interference region is removed in smoothing windows, vertical sliding window, wherein, interference region includes:Trade mark region.Sliding window detection module 52 controls water
Smoothing windows, vertical sliding window respectively with central slide from step-length t1 and t1 to the image after rim detection.
Main body extraction module 53 horizontal sliding window, process from vertical sliding window to the central slide of the image after rim detection
In, horizontal sliding window, the pixel count included in vertical sliding window and the horizontal sliding window in a upper sliding position are obtained respectively, vertical
The difference d1 and d2 of pixel count included in sliding window.Main body extraction module 53 calculates two d1 continuously acquired difference dk1,
When it is determined that dk1 is more than the first pixel threshold, then stop the vertical boundary that horizontal sliding window is slided and determines image subject region.It is main
Body extraction module 53 calculates two d2 continuously acquired difference dk2, when it is determined that dk2 is more than the second pixel threshold, then stops
Vertical sliding window is slided and determines the horizontal boundary in image subject region.
Fig. 6 is the module diagram of another embodiment of the image subject extraction element according to the present invention.Such as Fig. 6 institutes
Show, the device may include memory 61, processor 62, communication interface 63 and bus 64.Memory 61 is used for store instruction, place
Reason device 62 is coupled to memory 61, and above-mentioned image is realized in the instruction execution that processor 62 is configured as storing based on memory 61
Main body extracting method.
Memory 61 can be high-speed RAM memory, nonvolatile memory (non-volatile memory) etc., deposit
Reservoir 61 can also be memory array.Memory 61 is also possible to by piecemeal, and block can be combined into virtually by certain rule
Volume.Processor 62 can be central processor CPU, or application-specific integrated circuit ASIC (Application Specific
Integrated Circuit), or it is arranged to implement one or more collection of the image subject extracting method of the present invention
Into circuit.
In one embodiment, the present invention provides a kind of computer-readable recording medium, and computer-readable recording medium is deposited
Computer instruction is contained, the image subject extracting method in as above any one embodiment is realized when instruction is executed by processor.
Image subject extracting method and device that above-described embodiment is provided, edge is carried out based on edge detection operator to image
Detection process simultaneously extracts image subject by way of sliding window is detected, greatly improves the processing for detecting, extracting to image subject
Efficiency, also, not relied on interaction by existing Graph Cuts algorithms needs accurate setting foreground and background seed point to be limited,
Image pure color detection is carried out, the accuracy rate for image subject detection, the extraction of solid-color image is higher, makes the image master extracted
Body is accurate, reliable.
The method and system of the present invention may be achieved in many ways.For example, can by software, hardware, firmware or
Software, hardware, firmware any combinations come realize the present invention method and system.The said sequence of the step of for method is only
Order described in detail above is not limited in order to illustrate, the step of method of the invention, is especially said unless otherwise
It is bright.In addition, in certain embodiments, the present invention can be also embodied as recording to program in the recording medium, these programs include
Machine readable instructions for realizing the method according to the invention.Thus, the present invention also covering storage is used to perform according to this hair
The recording medium of the program of bright method.
Description of the invention is provided for the sake of example and description, and is not exhaustively or by the present invention
It is limited to disclosed form.Many modifications and variations are obvious for the ordinary skill in the art.Select and retouch
State embodiment and be more preferably to illustrate the principle and practical application of the present invention, and one of ordinary skill in the art is managed
The solution present invention is so as to design the various embodiments with various modifications suitable for special-purpose.
Claims (18)
1. a kind of image subject extracting method, it is characterised in that including:
Edge detection process is carried out to pending image based on edge detection operator, the image after rim detection is obtained;
Generation detection sliding window, using progress sliding window detection in image of the detection sliding window after the rim detection;
According to image of the pixel quantity and image subject recognition rule in the detection sliding window after the rim detection
It is middle progress image subject extracted region processing, using the image extracted as the pending image main part.
2. the method as described in claim 1, it is characterised in that also include:
The color value of the pixel included in the pending image is obtained, it is pure according to the color value and image of the pixel
Color judgment rule determines whether the pending image is solid-color image;
If it is, carrying out edge detection process to the pending image based on the edge detection operator;If it is not, then knot
Processing of the beam to the pending image.
3. method as claimed in claim 2, it is characterised in that the pixel included in the acquisition pending image
Color value, the color value according to the pixel and image pure color judgment rule determine whether the pending image is pure color
Image includes:
Detection boundary is set in the periphery of the pending image, the image detection region in the detection boundary is determined;
The color value of the pixel included in described image detection zone is obtained, pixel of the statistics with same color value is in institute
State the accounting in the whole pixels included in image detection region;
The accounting highest color value and accounting value are obtained, judges whether the accounting value is higher than accounting threshold value;
If it is, determining that the pending image is solid-color image.
4. the method as described in claim 1, it is characterised in that the generation detects sliding window, using the detection sliding window in institute
Stating progress sliding window detection in the image after rim detection includes:
The edge of image after the rim detection sets horizontal sliding window and vertical sliding window respectively;
The horizontal sliding window, the vertical sliding window are controlled respectively to the central slide of the image after the rim detection, to true
Determine the border of described image body region.
5. method as claimed in claim 4, it is characterised in that also include:
The height pixel count of the horizontal sliding window be the rim detection after image width pixel count, the horizontal sliding window
Width pixel count is t1;
The width pixel count of the vertical sliding window be the rim detection after image length pixel count, the vertical sliding window
Height pixel count is t2;
Wherein, the horizontal sliding window, the vertical sliding window are controlled respectively with step-length t1 and t1 to the image after the rim detection
Central slide.
6. method as claimed in claim 4, it is characterised in that also include:
When the edge of image after the rim detection sets the horizontal sliding window, the vertical sliding window, in the level
Interference region is removed in sliding window, the vertical sliding window, wherein, the interference region includes:Trade mark region.
7. method as claimed in claim 5, it is characterised in that the pixel quantity according in the detection sliding window and
The processing of image subject extracted region is carried out in image of the image subject recognition rule after the rim detection to be included:
The horizontal sliding window, central slide from the vertical sliding window to the image after the rim detection during, respectively
The horizontal sliding window, the pixel count included in the vertical sliding window is obtained to slide with the level in a upper sliding position
The difference d1 and d2 of pixel count included in window, the vertical sliding window;
Two d1 continuously acquired difference dk1 is calculated, when it is determined that dk1 is more than the first pixel threshold, then stops the level
Sliding window is slided and determines the vertical boundary of described image body region;
Two d2 continuously acquired difference dk2 is calculated, when it is determined that dk2 is more than the second pixel threshold, is then stopped described vertical
Sliding window is slided and determines the horizontal boundary of described image body region.
8. the method as described in claim 1, it is characterised in that also include:
Before edge detection process is carried out to the pending image based on the edge detection operator, using smoothing filter
To being filtered processing to the pending image;
Wherein, the edge detection operator includes:Canny operators.
9. a kind of image subject extraction element, it is characterised in that including:
Edge detection module, for carrying out edge detection process to pending image based on edge detection operator, obtains edge inspection
Image after survey;
Sliding window detection module, for generating detection sliding window, using entering in the image of the detection sliding window after the rim detection
Row sliding window is detected;
Main body extraction module, for according to it is described detection sliding window in pixel quantity and image subject recognition rule described
Image subject extracted region processing is carried out in image after rim detection, the image extracted is regard as the pending image
Main part.
10. device as claimed in claim 9, it is characterised in that
Pure color determining module, the color value for obtaining the pixel included in the pending image, according to the pixel
Color value and image pure color judgment rule determine whether the pending image is solid-color image;
If the pure color determining module determines that the pending image is solid-color image, the edge detection module is based on institute
State edge detection operator and edge detection process is carried out to the pending image;If the pure color determining module is treated described in determining
It is not solid-color image to handle image, then terminates the processing to the pending image.
11. device as claimed in claim 10, it is characterised in that
The pure color determining module, is additionally operable to set detection boundary in the periphery of the pending image, determines detection circle
Image detection region in limit;The color value of the pixel included in described image detection zone is obtained, statistics has identical face
Accounting in whole pixels that the pixel of colour is included in described image detection zone;Obtain the accounting highest face
Colour and accounting value, judge whether the accounting value is higher than accounting threshold value;If it is, determining that the pending image is pure
Color image.
12. device as claimed in claim 9, it is characterised in that
The horizontal sliding window of setting and hang down respectively the sliding window detection module, the edge of the image being additionally operable to after the rim detection
Straight sliding window, controls the horizontal sliding window, the vertical sliding window respectively to the central slide of the image after the rim detection, is used to
Determine the border of described image body region.
13. device as claimed in claim 12, it is characterised in that the height pixel count of the horizontal sliding window is examined for the edge
The width pixel count of image after survey, the width pixel count of the horizontal sliding window is t1;The width pixel count of the vertical sliding window
For the length pixel count of the image after the rim detection, the height pixel count of the vertical sliding window is t2;
The sliding window detection module, is additionally operable to the control horizontal sliding window, the vertical sliding window respectively with step-length t1 and t1 to institute
State the central slide of the image after rim detection.
14. device as claimed in claim 12, it is characterised in that
The sliding window detection module, the edge for the image being additionally operable to after the rim detection sets the horizontal sliding window, institute
When stating vertical sliding window, interference region is removed in the horizontal sliding window, the vertical sliding window, wherein, the interference region includes:
Trade mark region.
15. device as claimed in claim 13, it is characterised in that
The main body extraction module, is additionally operable in the horizontal sliding window, the vertical sliding window to the image after the rim detection
Central slide during, obtain respectively the horizontal sliding window, the pixel count included in the vertical sliding window with upper one
The difference d1 and d2 of pixel count included in the horizontal sliding window of individual sliding position, the vertical sliding window;Calculating is continuously obtained
Two d1 taken difference dk1, when it is determined that dk1 is more than the first pixel threshold, then stops the horizontal sliding window and slides and determine
The vertical boundary of described image body region;Two d2 continuously acquired difference dk2 is calculated, when it is determined that dk2 is more than the second picture
During plain threshold value, then stop the vertical sliding window and slide and determine the horizontal boundary of described image body region.
16. device as claimed in claim 9, it is characterised in that also include:
The edge detection module, for being carried out based on the edge detection operator to the pending image at rim detection
Before reason, using smoothing filter to being filtered processing to the pending image;
Wherein, the edge detection operator includes:Canny operators.
17. a kind of image subject extraction element, it is characterised in that including:
Memory;And
The processor of the memory is coupled to, the processor is configured as based on the instruction being stored in the memory,
Perform the image subject extracting method as any one of claim 1 to 8.
18. a kind of computer-readable recording medium, it is characterised in that the computer-readable recording medium storage has computer to refer to
The image subject extracting method as any one of claim 1 to 8 is realized in order, the instruction when being executed by processor.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710287405.1A CN107123127A (en) | 2017-04-27 | 2017-04-27 | A kind of image subject extracting method and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710287405.1A CN107123127A (en) | 2017-04-27 | 2017-04-27 | A kind of image subject extracting method and device |
Publications (1)
Publication Number | Publication Date |
---|---|
CN107123127A true CN107123127A (en) | 2017-09-01 |
Family
ID=59726475
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201710287405.1A Pending CN107123127A (en) | 2017-04-27 | 2017-04-27 | A kind of image subject extracting method and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN107123127A (en) |
Cited By (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108322788A (en) * | 2018-02-09 | 2018-07-24 | 武汉斗鱼网络科技有限公司 | Advertisement demonstration method and device in a kind of net cast |
CN110472578A (en) * | 2019-08-15 | 2019-11-19 | 宁波中车时代传感技术有限公司 | Lane line keeping method based on lane curvature |
CN111539913A (en) * | 2020-03-24 | 2020-08-14 | 上海交通大学 | Mobile device photographing definition quality evaluation method, system and terminal |
CN112153373A (en) * | 2020-09-23 | 2020-12-29 | 平安国际智慧城市科技股份有限公司 | Fault identification method and device for bright kitchen range equipment and storage medium |
CN115841478A (en) * | 2022-12-16 | 2023-03-24 | 浙江科达利实业有限公司 | Quality detection system applied to vehicle-mounted air conditioner hose production management and control |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101799922A (en) * | 2009-02-09 | 2010-08-11 | 北京新岸线网络技术有限公司 | Method and device for detecting strokes of characters, method and device for locating lines of characters, and method and device for judging repeat of subtitles |
CN105096330A (en) * | 2015-08-20 | 2015-11-25 | 厦门美图之家科技有限公司 | Image processing method capable of automatically recognizing pure-color borders, system and a photographing terminal |
US20160267675A1 (en) * | 2014-06-23 | 2016-09-15 | Boe Technology Group Co., Ltd. | Image edge detection method and apparatus thereof, image target identification method and apparatus thereof |
-
2017
- 2017-04-27 CN CN201710287405.1A patent/CN107123127A/en active Pending
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101799922A (en) * | 2009-02-09 | 2010-08-11 | 北京新岸线网络技术有限公司 | Method and device for detecting strokes of characters, method and device for locating lines of characters, and method and device for judging repeat of subtitles |
US20160267675A1 (en) * | 2014-06-23 | 2016-09-15 | Boe Technology Group Co., Ltd. | Image edge detection method and apparatus thereof, image target identification method and apparatus thereof |
CN105096330A (en) * | 2015-08-20 | 2015-11-25 | 厦门美图之家科技有限公司 | Image processing method capable of automatically recognizing pure-color borders, system and a photographing terminal |
Non-Patent Citations (1)
Title |
---|
宁书年等编著: "《遥感图像处理与应用》", 30 June 1995, 地震出版社 * |
Cited By (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108322788A (en) * | 2018-02-09 | 2018-07-24 | 武汉斗鱼网络科技有限公司 | Advertisement demonstration method and device in a kind of net cast |
CN108322788B (en) * | 2018-02-09 | 2021-03-16 | 武汉斗鱼网络科技有限公司 | Advertisement display method and device in live video |
CN110472578A (en) * | 2019-08-15 | 2019-11-19 | 宁波中车时代传感技术有限公司 | Lane line keeping method based on lane curvature |
CN111539913A (en) * | 2020-03-24 | 2020-08-14 | 上海交通大学 | Mobile device photographing definition quality evaluation method, system and terminal |
CN111539913B (en) * | 2020-03-24 | 2022-12-20 | 上海交通大学 | Mobile device photographing definition quality evaluation method, system and terminal |
CN112153373A (en) * | 2020-09-23 | 2020-12-29 | 平安国际智慧城市科技股份有限公司 | Fault identification method and device for bright kitchen range equipment and storage medium |
CN115841478A (en) * | 2022-12-16 | 2023-03-24 | 浙江科达利实业有限公司 | Quality detection system applied to vehicle-mounted air conditioner hose production management and control |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN107123127A (en) | A kind of image subject extracting method and device | |
CA2975035C (en) | System and method for image segmentation | |
JP6660313B2 (en) | Detection of nuclear edges using image analysis | |
CN104835164B (en) | A kind of processing method and processing device of binocular camera depth image | |
CN108416789A (en) | Method for detecting image edge and system | |
CN113781402A (en) | Method and device for detecting chip surface scratch defects and computer equipment | |
CN106846344A (en) | A kind of image segmentation optimal identification method based on the complete degree in edge | |
EP2811423A1 (en) | Method and apparatus for detecting target | |
CN107871319B (en) | Method and device for detecting beam limiter area, X-ray system and storage medium | |
WO2021109697A1 (en) | Character segmentation method and apparatus, and computer-readable storage medium | |
AU2013206597A1 (en) | Depth constrained superpixel-based depth map refinement | |
CN104021419B (en) | A kind of method and apparatus for counting paper number | |
WO2009120264A1 (en) | System and method for identifying complex tokens in an image | |
CN111768450A (en) | Automatic detection method and device for line deviation of structured light camera based on speckle pattern | |
US20170178341A1 (en) | Single Parameter Segmentation of Images | |
JP2016505185A (en) | Image processor having edge selection function | |
CN108663382A (en) | The method and device of the paper surface defects detection of view-based access control model conspicuousness | |
Phoulady et al. | An approach for overlapping cell segmentation in multi-layer cervical cell volumes | |
CN111951196A (en) | Progressive point cloud down-sampling method and device based on graph | |
JP2015197376A (en) | Device, method, and program for abrasion detection | |
CN113160245A (en) | CT brain parenchyma segmentation system, method and device based on block region growing method | |
CN107274424A (en) | The dividing method and device of a kind of coloured image | |
EP3293672A1 (en) | Particle boundary identification | |
Daoudi et al. | Automatic segmentation of the left atrium on CT images | |
WO2017220868A1 (en) | Visual cardiomyocyte analysis |
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 | ||
REG | Reference to a national code |
Ref country code: HK Ref legal event code: DE Ref document number: 1237974 Country of ref document: HK |
|
RJ01 | Rejection of invention patent application after publication | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20170901 |