CN108446697B - Image processing method, electronic device and storage medium - Google Patents
Image processing method, electronic device and storage medium Download PDFInfo
- Publication number
- CN108446697B CN108446697B CN201810183143.9A CN201810183143A CN108446697B CN 108446697 B CN108446697 B CN 108446697B CN 201810183143 A CN201810183143 A CN 201810183143A CN 108446697 B CN108446697 B CN 108446697B
- Authority
- CN
- China
- Prior art keywords
- indicia framing
- original image
- picture
- pictures
- value
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N20/00—Machine learning
- G06N20/10—Machine learning using kernel methods, e.g. support vector machines [SVM]
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F18/00—Pattern recognition
- G06F18/20—Analysing
- G06F18/21—Design or setup of recognition systems or techniques; Extraction of features in feature space; Blind source separation
- G06F18/214—Generating training patterns; Bootstrap methods, e.g. bagging or boosting
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F18/00—Pattern recognition
- G06F18/20—Analysing
- G06F18/24—Classification techniques
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/04—Architecture, e.g. interconnection topology
- G06N3/045—Combinations of networks
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/08—Learning methods
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V10/00—Arrangements for image or video recognition or understanding
- G06V10/20—Image preprocessing
- G06V10/24—Aligning, centring, orientation detection or correction of the image
- G06V10/245—Aligning, centring, orientation detection or correction of the image by locating a pattern; Special marks for positioning
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V10/00—Arrangements for image or video recognition or understanding
- G06V10/20—Image preprocessing
- G06V10/25—Determination of region of interest [ROI] or a volume of interest [VOI]
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V10/00—Arrangements for image or video recognition or understanding
- G06V10/20—Image preprocessing
- G06V10/28—Quantising the image, e.g. histogram thresholding for discrimination between background and foreground patterns
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V10/00—Arrangements for image or video recognition or understanding
- G06V10/40—Extraction of image or video features
- G06V10/44—Local feature extraction by analysis of parts of the pattern, e.g. by detecting edges, contours, loops, corners, strokes or intersections; Connectivity analysis, e.g. of connected components
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V10/00—Arrangements for image or video recognition or understanding
- G06V10/40—Extraction of image or video features
- G06V10/56—Extraction of image or video features relating to colour
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V10/00—Arrangements for image or video recognition or understanding
- G06V10/70—Arrangements for image or video recognition or understanding using pattern recognition or machine learning
- G06V10/82—Arrangements for image or video recognition or understanding using pattern recognition or machine learning using neural networks
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Multimedia (AREA)
- Evolutionary Computation (AREA)
- Artificial Intelligence (AREA)
- Software Systems (AREA)
- Data Mining & Analysis (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Computing Systems (AREA)
- General Engineering & Computer Science (AREA)
- Life Sciences & Earth Sciences (AREA)
- General Health & Medical Sciences (AREA)
- Health & Medical Sciences (AREA)
- Mathematical Physics (AREA)
- Biomedical Technology (AREA)
- Molecular Biology (AREA)
- Biophysics (AREA)
- Computational Linguistics (AREA)
- Medical Informatics (AREA)
- Databases & Information Systems (AREA)
- Bioinformatics & Cheminformatics (AREA)
- Bioinformatics & Computational Biology (AREA)
- Evolutionary Biology (AREA)
- Image Analysis (AREA)
Abstract
The present invention provides a kind of image processing methods, comprising: is trained to sample graph valut, obtains the classification function of the samples pictures with indicia framing and the samples pictures without indicia framing;Based on the classification value for sorting out function calculating original image, if the classification value meets the first preset condition, determine to include the indicia framing drawn using the pre-set color in the original image;Original image is transformed into HSV space from rgb space, obtains HSV picture;According to value range of the pre-set color in HSV space, binarization threshold is set, binary conversion treatment is carried out to pixel each in the HSV picture, obtains binaryzation picture;The location information of objective contour is extracted from binaryzation picture, original image is cut to obtain the corresponding local picture of indicia framing according to the positional information.The present invention also provides a kind of electronic device and storage mediums.The corresponding local picture of indicia framing can be rapidly and accurately cut out from the original image using the present invention.
Description
Technical field
The present invention relates to field of computer technology more particularly to a kind of image processing methods, electronic device and storage medium.
Background technique
With the development of internet technology, disparate networks resource is very rich, greatly facilitates user and obtains to resource
It takes.For example, having the scenery picture of magnanimity high definition on network, so that user is it is not necessary that shooting may also find required figure on the spot in person
Piece.Wherein, in order to mark the local content for needing to pay close attention in picture, some pictures have the label drawn using a certain color
In frame, such as the photo of traffic monitoring shooting, people or the vehicle etc. of violation have been marked in photo with red frame, and these offices
Portion's content is exactly the content that user wishes to find.Therefore, user not only wishes to find required original image, prefers to obtain
Take the corresponding local picture of indicia framing in original image.However, for such original image for having had indicia framing, due to label
The location information of frame can not be extracted directly, to be difficult to carry out accurately cutting to original image corresponding to obtain the indicia framing
Local picture.In the biggish situation of original image quantity, automatic quickly mode is more needed to realize the local picture
It extracts.
Summary of the invention
For these reasons, it is necessary to a kind of image processing method, electronic device and storage medium are provided, can identify band
There is the original image of indicia framing, and extracts the location information of the indicia framing, root from the original image with indicia framing automatically
The corresponding local picture of indicia framing is rapidly and accurately cut out from the original image to realize according to the location information.
To achieve the above object, the present invention provides a kind of image processing method, this method comprises: sample training step: obtaining
Sample this picture library, the sample graph valut includes multiple samples pictures with indicia framing and corresponding multiple without mark
The samples pictures for remembering frame, are trained the sample graph valut, obtain samples pictures with indicia framing and described right
The classification function for the samples pictures without indicia framing answered, the indicia framing are the closure wire drawn using pre-set color;
Sort out judgment step: obtaining original image to be processed, the original image to be processed is calculated based on the classification function
Classification value determines to include drawing in the original image using the pre-set color if the classification value meets the first preset condition
Indicia framing;Space conversion step: if it is determined that including the indicia framing drawn using the pre-set color in the original image, then will
The original image including indicia framing is transformed into HSV space from rgb space, and each pixel in the original image is divided
Solution is at coloration H, saturation degree S and brightness V value, to obtain HSV picture;Binary conversion treatment step: existed according to the pre-set color
Value range in HSV space sets binarization threshold using the binarization threshold and judges each picture in the HSV picture
Whether coloration H, the saturation degree S and brightness V value of vegetarian refreshments meet the binarization threshold, according to judging result to the HSV picture
In each pixel carry out binary conversion treatment, obtain the corresponding binaryzation picture of the HSV picture;Contour detecting step: pass through wheel
Wide detection algorithm detects objective contour from the binaryzation picture, and extracts the location information conduct of the objective contour
The corresponding location information of indicia framing in the original image according to the positional information carries out the original image to be processed
It cuts, obtains the corresponding local picture of indicia framing in original image.
Optionally, described that the sample graph valut is trained, obtain the samples pictures with indicia framing and institute
The classification function for stating the corresponding samples pictures without indicia framing includes: building convolutional neural networks, passes through the convolution mind
The sample graph valut is trained through network, obtains the corresponding convolutional neural networks model of the sample graph valut;According to
Whether each picture has the remark information of the indicia framing in sample graph valut, and the sample graph valut is divided into containing indicia framing
Pictures and unmarked frame pictures, the pictures containing indicia framing include the multiple samples pictures with indicia framing, institute
Stating unmarked frame pictures includes corresponding multiple samples pictures without indicia framing;It will the pictures containing indicia framing
The convolutional neural networks model is inputted respectively with the unmarked frame pictures, passes through the volume of the convolutional neural networks model
Product nuclear convolution obtains the corresponding feature value vector collection of pictures containing indicia framing and the unmarked frame pictures are corresponding
Feature value vector collection;By algorithm of support vector machine to the corresponding feature value vector collection of the pictures containing indicia framing and the nothing
The corresponding feature value vector collection of indicia framing pictures is calculated, and the pictures containing indicia framing and the unmarked block diagram are obtained
The classification function of piece collection.
Optionally, described to obtain original image to be processed, it is calculated based on the classification function described to be processed original
The classification value of picture determines to include using the default face in the original image if the classification value meets the first preset condition
The indicia framing that color is drawn includes: to obtain original image to be processed, and the original image to be processed is inputted the convolution mind
Through network model, the corresponding feature vector of original image to be processed is obtained;Feature vector corresponding to the original image
The classification value of the original image to be processed is calculated based on the classification function, and judges whether the classification value is greater than default threshold
Value determines to include the mark drawn using the pre-set color in the original image if the classification value is greater than the preset threshold
Remember frame.
Optionally, the classification function representation is as follows: f (x)=wx+b;Wherein, w for by algorithm of support vector machine to institute
The parameter obtained after the corresponding feature value vector collection of pictures containing indicia framing is calculated is stated, b is to pass through algorithm of support vector machine
The parameter obtained after calculating the corresponding feature value vector collection of the unmarked frame pictures, x indicate described to be processed
The corresponding feature vector of original image.
Optionally, described by contour detecting algorithm, detect that objective contour includes: to pass through from the binaryzation picture
Contour detecting algorithm detects one or more candidate contours from the binaryzation picture;It calculates separately one or more
The size of a candidate contours, and calculated result and the second preset condition are compared, corresponding calculated result is met into institute
The candidate contours of the second preset condition are stated as objective contour.
Optionally, the location information for extracting the objective contour includes: to judge the shape of the objective contour for circle
One of shape, ellipse, square, rectangle;When the shape of the objective contour is round, the circle of the objective contour is extracted
Heart location information and radius length information;When the shape of the objective contour is ellipse, the two of the objective contour are extracted
A focal position information, four vertex location information, and the preset quantity sampled point up-sampled in objective contour
Location information;When the shape of the objective contour is square or when rectangle, extracts the vertex of the objective contour
Location information.
To achieve the above object, the present invention also provides a kind of electronic device, which includes memory and processor,
It include picture processing program in the memory, which realizes following steps when being executed by the processor: obtaining
Sample this picture library, the sample graph valut includes multiple samples pictures with indicia framing and corresponding multiple without mark
The samples pictures for remembering frame, are trained the sample graph valut, obtain samples pictures with indicia framing and described right
The classification function for the samples pictures without indicia framing answered, the indicia framing are the closure wire drawn using pre-set color;
Sort out judgment step: obtaining original image to be processed, the original image to be processed is calculated based on the classification function
Classification value determines to include drawing in the original image using the pre-set color if the classification value meets the first preset condition
Indicia framing;Space conversion step: if it is determined that including the indicia framing drawn using the pre-set color in the original image, then will
The original image including indicia framing is transformed into HSV space from rgb space, and each pixel in the original image is divided
Solution is at coloration H, saturation degree S and brightness V value, to obtain HSV picture;Binary conversion treatment step: existed according to the pre-set color
Value range in HSV space sets binarization threshold using the binarization threshold and judges each picture in the HSV picture
Whether coloration H, the saturation degree S and brightness V value of vegetarian refreshments meet the binarization threshold, according to judging result to the HSV picture
In each pixel carry out binary conversion treatment, obtain the corresponding binaryzation picture of the HSV picture;Contour detecting step: pass through wheel
Wide detection algorithm detects objective contour from the binaryzation picture, and extracts the location information conduct of the objective contour
The corresponding location information of indicia framing in the original image according to the positional information carries out the original image to be processed
It cuts, obtains the corresponding local picture of indicia framing in original image.
Optionally, described that the sample graph valut is trained, obtain the samples pictures with indicia framing and institute
The classification function for stating the corresponding samples pictures without indicia framing includes: building convolutional neural networks, passes through the convolution mind
The sample graph valut is trained through network, obtains the corresponding convolutional neural networks model of the sample graph valut;According to
Whether each picture has the remark information of the indicia framing in sample graph valut, and the sample graph valut is divided into containing indicia framing
Pictures and unmarked frame pictures, the pictures containing indicia framing include the multiple samples pictures with indicia framing, institute
Stating unmarked frame pictures includes corresponding multiple samples pictures without indicia framing;It will the pictures containing indicia framing
The convolutional neural networks model is inputted respectively with the unmarked frame pictures, passes through the volume of the convolutional neural networks model
Product nuclear convolution obtains the corresponding feature value vector collection of pictures containing indicia framing and the unmarked frame pictures are corresponding
Feature value vector collection;By algorithm of support vector machine to the corresponding feature value vector collection of the pictures containing indicia framing and the nothing
The corresponding feature value vector collection of indicia framing pictures is calculated, and the pictures containing indicia framing and the unmarked block diagram are obtained
The classification function of piece collection.
Optionally, described to obtain original image to be processed, it is calculated based on the classification function described to be processed original
The classification value of picture determines to include using the default face in the original image if the classification value meets the first preset condition
The indicia framing that color is drawn includes: to obtain original image to be processed, and the original image to be processed is inputted the convolution mind
Through network model, the corresponding feature vector of original image to be processed is obtained;Feature vector corresponding to the original image
The classification value of the original image to be processed is calculated based on the classification function, and judges whether the classification value is greater than default threshold
Value determines to include the mark drawn using the pre-set color in the original image if the classification value is greater than the preset threshold
Remember frame.
Optionally, the classification function representation is as follows: f (x)=wx+b;Wherein, w for by algorithm of support vector machine to institute
The parameter obtained after the corresponding feature value vector collection of pictures containing indicia framing is calculated is stated, b is to pass through algorithm of support vector machine
The parameter obtained after calculating the corresponding feature value vector collection of the unmarked frame pictures, x indicate described to be processed
The corresponding feature vector of original image.
Optionally, described by contour detecting algorithm, detect that objective contour includes: to pass through from the binaryzation picture
Contour detecting algorithm detects one or more candidate contours from the binaryzation picture;It calculates separately one or more
The size of a candidate contours, and calculated result and the second preset condition are compared, corresponding calculated result is met into institute
The candidate contours of the second preset condition are stated as objective contour.
Optionally, the location information for extracting the objective contour includes: to judge the shape of the objective contour for circle
One of shape, ellipse, square, rectangle;When the shape of the objective contour is round, the circle of the objective contour is extracted
Heart location information and radius length information;When the shape of the objective contour is ellipse, the two of the objective contour are extracted
A focal position information, four vertex location information, and the preset quantity sampled point up-sampled in objective contour
Location information;When the shape of the objective contour is square or when rectangle, extracts the vertex of the objective contour
Location information.
In addition, to achieve the above object, it is described computer-readable the present invention also provides a kind of computer readable storage medium
Include picture processing program in storage medium, when which is executed by processor, realizes at picture as described above
The arbitrary steps of reason method.
Image processing method, electronic device and storage medium proposed by the present invention, by being trained to sample graph valut
The classification function of samples pictures and the corresponding samples pictures without indicia framing with indicia framing is obtained, and is returned based on described
Class function calculates the classification value of original image to be processed, if the classification value meets the first preset condition, determines the original graph
It include the indicia framing drawn using the pre-set color in piece, then by the original image including indicia framing from rgb space
It is transformed into HSV space, each pixel in the original image is resolved into coloration H, saturation degree S and brightness V value, thus
To HSV picture, and the value range according to the pre-set color in HSV space, binarization threshold is set, the two-value is used
Change threshold value, judges whether the coloration H of each pixel, saturation degree S and brightness V value meet the binaryzation in the HSV picture
Threshold value carries out binary conversion treatment to pixel each in the HSV picture according to judging result, it is corresponding to obtain the HSV picture
Binaryzation picture detects objective contour finally by contour detecting algorithm from the binaryzation picture, and extracts the mesh
The location information of profile is marked as the corresponding location information of indicia framing in the original image, according to the positional information to described
Original image to be processed is cut, and the corresponding local picture of indicia framing in original image is obtained, so as to quick and precisely
Ground cuts out the corresponding local picture of indicia framing from the original image.
Detailed description of the invention
Fig. 1 is the running environment schematic diagram of electronic device preferred embodiment of the present invention;
Fig. 2 is the interaction schematic diagram of electronic device of the present invention and client preferred embodiment;
Fig. 3 is the flow chart of image processing method preferred embodiment of the present invention;
Fig. 4 is the exemplary diagram of original image.
Fig. 5 is the exemplary diagram of HSV picture.
Fig. 6 is the exemplary diagram of binaryzation picture.
Fig. 7 is the exemplary diagram of the corresponding local picture of indicia framing.
Fig. 8 is the Program modual graph of picture processing program in Fig. 1.
The embodiments will be further described with reference to the accompanying drawings for the realization, the function and the advantages of the object of the present invention.
Specific embodiment
The principle and spirit of the invention are described below with reference to several specific embodiments.It should be appreciated that described herein
Specific embodiment be only used to explain the present invention, be not intended to limit the present invention.
It will be apparent to one skilled in the art that embodiments of the present invention can be implemented as a kind of method, apparatus, equipment, be
System or computer program product.Therefore, the present invention can be implemented as complete hardware, complete software (including firmware, is stayed
Stay software, microcode etc.) or hardware and software combine form.
According to an embodiment of the invention, proposing a kind of image processing method, electronic device and storage medium.
It is the running environment schematic diagram of 1 preferred embodiment of electronic device of the present invention shown in referring to Fig.1.
The electronic device 1, which can be server, portable computer, desktop PC etc., has storage and calculation function
Terminal device.
The electronic device 1 includes memory 11, processor 12, network interface 13 and communication bus 14.The network interface
13 optionally may include the wireline interface and wireless interface (such as WI-FI interface) of standard.Communication bus 14 is for realizing above-mentioned
Connection communication between component.
Memory 11 includes the readable storage medium storing program for executing of at least one type.The readable storage medium storing program for executing of at least one type
It can be the non-volatile memory medium of such as flash memory, hard disk, multimedia card, card-type memory.In some embodiments, described can
Reading storage medium can be the internal storage unit of the electronic device 1, such as the hard disk of the electronic device 1.In other realities
It applies in example, the readable storage medium storing program for executing is also possible to the external memory 11 of the electronic device 1, such as the electronic device 1
The plug-in type hard disk of upper outfit, intelligent memory card (Smart Media Card, SMC), secure digital (Secure Digital,
SD) block, flash card (Flash Card) etc..
In the present embodiment, the readable storage medium storing program for executing of the memory 11 is installed on the electronic device commonly used in storage
1 picture processing program 10 and the database 4 for being stored with sample graph valut etc..The memory 11 can be also used for temporarily depositing
Store up the data that has exported or will export.
Processor 12 can be in some embodiments a central processing unit (Central Processing Unit,
CPU), microprocessor or other data processing chips, program code or processing data for being stored in run memory 11, example
Such as execute picture processing program 10.
Fig. 1 illustrates only the electronic device 1 with component 11-14 and picture processing program 10, it should be understood that
It is not required for implementing all components shown, the implementation that can be substituted is more or less component.
Optionally, which can also include user interface, and user interface may include input unit such as keyboard
(Keyboard), speech input device such as microphone (microphone) etc. has the equipment of speech identifying function, voice defeated
Device such as sound equipment, earphone etc. out.Optionally, user interface can also include standard wireline interface and wireless interface.
Optionally, which can also include display, and display is referred to as display screen or display unit.
It can be light-emitting diode display, liquid crystal display, touch-control liquid crystal display and Organic Light Emitting Diode in some embodiments
(Organic Light-Emitting Diode, OLED) display etc..Display is used to show and handle in the electronic apparatus 1
Information and for showing visual user interface.
Optionally, which further includes touch sensor.It is touched provided by the touch sensor for user
The region for touching operation is known as touch area.In addition, touch sensor described here can be resistive touch sensor, capacitor
Formula touch sensor etc..Moreover, the touch sensor not only includes the touch sensor of contact, proximity may also comprise
Touch sensor etc..In addition, the touch sensor can be single sensor, or such as multiple biographies of array arrangement
Sensor.User can start picture processing program 10 by touching the touch area.
In addition, the area of the display of the electronic device 1 can be identical as the area of the touch sensor, it can also not
Together.Optionally, display and touch sensor stacking are arranged, to form touch display screen.The device is based on touching aobvious
Display screen detects the touch control operation of user's triggering.
The electronic device 1 can also include radio frequency (Radio Frequency, RF) circuit, sensor and voicefrequency circuit etc.
Deng details are not described herein.
As shown in fig.2, for the interaction schematic diagram of electronic device 1 and 2 preferred embodiment of client of the present invention.The picture
Processing routine 10 is run in electronic device 1, and the preferred embodiment of electronic device 1 described in Fig. 2 is server.The electronics
Device 1 is communicated to connect by network 3 and client 2.The client 2 can be run in all kinds of terminal devices, such as intelligently
Mobile phone, portable computer etc..After user logs on to the electronic device 1 by client 2, pass through the picture processing side
Method, picture processing program 10 can receive and identify the original image with indicia framing, and automatically from original with indicia framing
The location information of the indicia framing is extracted in picture, according to the positional information to realize rapidly and accurately from the original graph
The corresponding local picture of indicia framing is cut out in piece, and the local picture is back to client 2.The picture processing program
10 can be realized by Python programming language.
As shown in fig.3, being the flow chart of image processing method preferred embodiment of the present invention.The processor of electronic device 1
The following steps of image processing method are realized when the picture processing program 10 stored in 12 execution memories 11:
Step S1, obtain sample graph valut, the sample graph valut include multiple samples pictures with indicia framing and
Corresponding multiple samples pictures without indicia framing, are trained the sample graph valut, obtain described with indicia framing
Samples pictures and the corresponding samples pictures without indicia framing classification function, the indicia framing is using default face
The closure wire that color is drawn.
Specifically, the sample graph valut can store in the database 4.The sample graph valut includes user day
What is often acquired has confirmed that the samples pictures for whether having the indicia framing of the pre-set color.Since user would generally be existed using red
The local content for needing to pay close attention to is marked in picture, such as draws a red frame in picture, is needed with marking in several buildings
A building being paid close attention to, therefore the pre-set color can be red.Each of sample graph valut samples pictures
Remark information is all had, the remark information is used to indicate the label whether corresponding samples pictures have pre-set color
Frame.
It is described that the sample graph valut is trained, obtain samples pictures with indicia framing and described corresponding
It can be for example accomplished by the following way without the classification function of the samples pictures of indicia framing:
Convolutional neural networks are constructed, the sample graph valut is trained by the convolutional neural networks, obtains institute
State the corresponding convolutional neural networks model of sample graph valut;
The remark information that the indicia framing whether is had according to picture each in sample graph valut, by the sample graph valut
It is divided into pictures containing indicia framing and unmarked frame pictures, the pictures containing indicia framing include the multiple with indicia framing
Samples pictures, the unmarked frame pictures include corresponding multiple samples pictures without indicia framing;
The pictures containing indicia framing and the unmarked frame pictures are inputted into the convolutional neural networks model respectively,
The corresponding feature value vector collection of the pictures containing indicia framing is obtained by the convolution nuclear convolution of the convolutional neural networks model,
And the corresponding feature value vector collection of the unmarked frame pictures;
It is corresponding to the pictures containing indicia framing by support vector machines (Support Vector Machine) algorithm
Feature value vector collection and the corresponding feature value vector collection of the unmarked frame pictures are calculated, and the block diagram containing label is obtained
The classification function of piece collection and the unmarked frame pictures.
The algorithm of support vector machine is a kind of subsumption algorithm, it is solving small sample, the identification of non-linear and high dimensional pattern
In there is advantage, and in the other machines problem concerning study such as can promote the use of Function Fitting, generally, support vector machines is calculated
Method can solve the problem of classification and classification standard of complex transaction.It will the corresponding feature value vector of the pictures containing indicia framing
It is available after collection feature value vector collection corresponding with the unmarked frame pictures is calculated by algorithm of support vector machine
It is divided into the class condition of the picture with indicia framing and the picture these two types picture without indicia framing, the class condition can
With with the classification function representation.
In one embodiment, if the class condition be linear classification, the classification function for example can by with
Minor function formula indicates:
F (x)=wx+b;
Wherein, w is to be carried out by algorithm of support vector machine to the corresponding feature value vector collection of the pictures containing indicia framing
The parameter obtained after calculating, b are by algorithm of support vector machine to the corresponding feature value vector collection of the unmarked frame pictures
The parameter obtained after being calculated, x indicate the corresponding feature vector of original image to be processed, i.e., the described x is the change of unknown number
Amount.
Step S2 obtains original image to be processed, calculates the original image to be processed based on the classification function
Classification value determine to include drawing using the pre-set color in the original image if the classification value meets the first preset condition
The indicia framing of system.
Specifically, step S2, can be first by the original graph to be processed after obtaining the original image to be processed
The convolutional neural networks model of piece input step S1 building, obtains the corresponding feature vector of original image to be processed,
The i.e. described variable x.
Then, step S2 can to the corresponding feature vector of the original image be based on the classifications function calculate described in
The classification value of the original image of processing, and judge whether the classification value is greater than preset threshold, if the classification value is greater than described preset
Threshold value then determines to include the indicia framing drawn using the pre-set color in the original image.In the present embodiment, described first
Preset condition is that the classification value is greater than the preset threshold.
Step S3, if it is determined that including the indicia framing drawn using the pre-set color in the original image, then by the packet
The original image for including indicia framing is transformed into HSV space from rgb space, and each pixel in the original image is decomposed quality
H, saturation degree S and brightness V value are spent, to obtain HSV picture.
Specifically, the picture that usual user uses or sees is rgb format, therefore can set the original image as RGB
The picture of format.Such as Fig. 4 show a rgb format original image (for adapt to Patent Law requirement, change into grayscale image exhibition
Show), 3 kittens have been marked respectively with 3 red square marks frames in the original image.
Since (R) red in the picture of rgb format, green (G), the value range of blue (B) three Color Channels are wider, be 0~
255, although color distinction is very big from naked eyes, from difference in RGB value range and little, value range is mutually had
Overlapping relation, therefore it is difficult to judge the RGB value range of the red area of red square marks frame in Fig. 4.And HSV color is empty
Between be not only related to red green blue tricolor composition, further account for the number of tone (H), saturation degree (S), brightness (V) color parameter
Value, therefore be more convenient for extracting designated color using HSV color space.
Step S3 needs to carry out HSV transformation to the original image as a result,.In the present embodiment, step S3 can be used
Cv2.COLOR_RGB2HLS function in cross-platform computer vision library openCV realizes the HSV transformation, by will be described
Each pixel in original image resolves into coloration (H), saturation degree (S) and brightness (V) value, and original image is transformed into HSV
In color space, to obtain the HSV picture, such as shown in Fig. 5.As can be seen that the visual effect of indicia framing becomes in Fig. 5
It is more prominent.
Step S4 sets binarization threshold, using described according to value range of the pre-set color in HSV space
Binarization threshold, judges whether the coloration (H), saturation degree (S) and brightness (V) value of each pixel in the HSV picture meet
The binarization threshold carries out binary conversion treatment to pixel each in the HSV picture according to judging result, obtains the HSV
The corresponding binaryzation picture of picture.
Specifically, value range of the pre-set color in HSV space, i.e. pre-set color are corresponding in HSV space
Tone (H), saturation degree (S), the value range of brightness (V) parameter.By taking Fig. 5 as an example, in the HSV picture of openCV, coloration H's
Value range is 0~180, and the value range of saturation degree S is 0~255, and the value range of brightness V is 0~255.Wherein, red
The value range of coloration H be about (0~10) ∪ (156~180), the value range of red saturation degree S is about 43~
255, the value range of red brightness V is about 46~255.Meanwhile when saturation degree S is lower than threshold value (reference value 80)
Grey is then presented, when brightness V is too low, black is presented, V brightness is excessively high, and white is presented.On this basis, due to frame red in Fig. 5
Is drawn using PC Tools, saturation degree S can generally compare mechanical uniform, therefore in Fig. 5 indicia framing it is red corresponding
Value range can be determining it is more narrow, such as H:0~1, S:155~255, V:170~255 can be determined as.According to
Identified value range can set the binarization threshold.
According to the binarization threshold, step S4 carries out binary conversion treatment to the HSV picture.Specifically, step S4 can
To judge whether the coloration (H), saturation degree (S) and brightness (V) value of each pixel in the HSV picture meet the binaryzation
Threshold value, if meeting the binarization threshold, the pixel value of corresponding pixel is set as the first specified numerical value, such as 255;If
It is unsatisfactory for the binarization threshold, then sets the second specified numerical value, such as 0 for the pixel value of corresponding pixel, it is final to obtain
To the binaryzation picture.
Red value range in conjunction with indicia framing in above-mentioned Fig. 5 is coloration H:0~1, saturation degree S:155~255, brightness
V:170~255, for Fig. 5 setting the binarization threshold can with for coloration H:0~1, saturation degree S:155~
255, brightness V:170~255.According to the binarization threshold for Fig. 5 setting, step S4 carries out two to the HSV picture
Value processing, specifically, it can detect whether each pixel in Fig. 5 meets H:0~1, S:155~255, V for step S4:
170~255, if satisfied, then step S4 by the pixel value of respective pixel point in Fig. 5 sets 255, it is rendered as white, if discontented
Foot, then step S4 sets 0 for the pixel value of respective pixel point in Fig. 5, is rendered as black, obtained binaryzation picture such as Fig. 6
It is shown.
Step S5 detects objective contour by contour detecting algorithm from the binaryzation picture, and extracts the mesh
The location information of profile is marked as the corresponding location information of indicia framing in the original image, according to the positional information to described
Original image to be processed is cut, and the corresponding local picture of indicia framing in original image is obtained.
Due in original image there may be the field color other than some indicia framings and the case where indicia framing solid colour,
Therefore, there may be some noises in the binaryzation picture obtained by step S4, i.e., by the pixel of non-marked frame region
Pixel value be arranged to it is identical as the pixel value of indicia framing pixel, in order to avoid the interference of non-marked frame region location information, because
This needs to carry out Denoising disposal.Since theoretically size is smaller for the pixels of these non-marked frame regions, and usually not at
Specific shape, so step S5 can exclude size and be unsatisfactory for second by carrying out contour detecting to the binaryzation picture
The profile of preset condition is as the Denoising disposal.
Step S5 detects that objective contour may include: from the binaryzation picture by contour detecting algorithm as a result,
By contour detecting algorithm, one or more candidate contours are detected from the binaryzation picture;
Calculate separately the size of one or more of candidate contours, and by calculated result and the second preset condition into
Corresponding calculated result is met the candidate contours of second preset condition as objective contour by row comparison.
Second preset condition for example can need separately or concurrently big Mr. Yu's numerical value for profile width and height.In conjunction with
Shown in Fig. 6, according to size of the kitten in Fig. 4, step S5 can set profile width for second preset condition
10 need to be simultaneously greater than with height.The cv2.findContours letter in OpenCV can be used for example in the method for the contour detecting
Number.
In one embodiment, the shape of the indicia framing used according to general user, the objective contour may for it is round,
Ellipse, square and rectangle, thus step S5 extracts the location information of the objective contour and for example may include:
Judge the shape of the objective contour for one of round, ellipse, square, rectangle;
When the shape of the objective contour is round, the center location information and radius length of the objective contour are extracted
Information;
When the shape of the objective contour is ellipse, two focal position information, four of the objective contour are extracted
The location information on a vertex, and the location information of preset quantity sampled point up-sampled in objective contour;
When the shape of the objective contour is square or when rectangle, extracts the vertex position of the objective contour
Information.
After step S5 extracts the location information of the objective contour, according to the positional information to described to be processed original
Picture is cut, and the corresponding local picture of indicia framing in original image is obtained.Such as the position according to extracted indicia framing
Information, step S5 can cut Fig. 4, obtain indicia framing corresponding part picture in Fig. 4, as shown in Figure 7.
In conclusion according to image processing method provided in this embodiment, by being trained to obtain to sample graph valut
The classification function of samples pictures and the corresponding samples pictures without indicia framing with indicia framing, and it is based on the classification letter
Number calculates the classification value of original image to be processed, if the classification value meets the first preset condition, determines in the original image
Including the indicia framing drawn using the pre-set color, then the original image including indicia framing is converted from rgb space
To HSV space, each pixel in the original image is resolved into coloration H, saturation degree S and brightness V value, to obtain
HSV picture, and the value range according to the pre-set color in HSV space set binarization threshold, use the binaryzation
Threshold value judges whether the coloration H of each pixel, saturation degree S and brightness V value meet the binaryzation threshold in the HSV picture
Value carries out binary conversion treatment to pixel each in the HSV picture according to judging result, obtains the HSV picture corresponding two
Value picture detects objective contour finally by contour detecting algorithm from the binaryzation picture, and extracts the target
The location information of profile as the corresponding location information of indicia framing in the original image, according to the positional information to it is described to
The original image of processing is cut, and the corresponding local picture of indicia framing in original image is obtained.It provides through this embodiment
Image processing method can identify the original image with indicia framing, and extract institute from the original image with indicia framing automatically
The location information of indicia framing is stated, rapidly and accurately cuts bid from the original image to realize according to the positional information
Remember the corresponding local picture of frame.
As shown in fig.8, for the Program modual graph of picture processing program 10 in Fig. 1.In the present embodiment, picture handles journey
Sequence 10 is divided into multiple modules, and multiple module is stored in memory 11, and is executed by processor 12, to complete this hair
It is bright.The so-called module of the present invention is the series of computation machine program instruction section for referring to complete specific function.
The picture processing program 10 can be divided into: sample training module 110 sorts out judgment module 120, space turn
Change the mold block 130, binary processing module 140 and profile detection module 150.
Sample training module 110, for obtaining sample graph valut, the sample graph valut includes multiple with indicia framing
Samples pictures and corresponding multiple samples pictures without indicia framing, are trained the sample graph valut, obtain institute
State the classification function of samples pictures and the corresponding samples pictures without indicia framing with indicia framing, the indicia framing
For the closure wire drawn using pre-set color.
Specifically, described that the sample graph valut is trained, obtain the samples pictures with indicia framing and institute
The classification function for stating the corresponding samples pictures without indicia framing includes:
Sample training module 110 constructs convolutional neural networks, by the convolutional neural networks to the sample graph valut
It is trained, obtains the corresponding convolutional neural networks model of the sample graph valut;
Whether sample training module 110 has the remark information of the indicia framing according to picture each in sample graph valut,
The sample graph valut is divided into pictures containing indicia framing and unmarked frame pictures, the pictures containing indicia framing include described
Multiple samples pictures with indicia framing, the unmarked frame pictures include corresponding multiple samples without indicia framing
This picture;
The pictures containing indicia framing and the unmarked frame pictures are inputted the volume by sample training module 110 respectively
It is corresponding to obtain the pictures containing indicia framing by the convolution nuclear convolution of the convolutional neural networks model for product neural network model
Feature value vector collection and the corresponding feature value vector collection of the unmarked frame pictures;
Sample training module 110 is by algorithm of support vector machine to the corresponding feature value vector of the pictures containing indicia framing
Collection and the corresponding feature value vector collection of the unmarked frame pictures are calculated, obtain described in pictures containing indicia framing and described
The classification function of unmarked frame pictures.
Sort out judgment module 120, for obtaining original image to be processed, is calculated based on the classification function described wait locate
The classification value of the original image of reason determines to include using institute in the original image if the classification value meets the first preset condition
State the indicia framing of pre-set color drafting.
Wherein, described to obtain original image to be processed, the original graph to be processed is calculated based on the classification function
The classification value of piece determines to include using the pre-set color in the original image if the classification value meets the first preset condition
The indicia framing of drafting includes:
Original image to be processed is obtained, the original image to be processed is inputted into the convolutional neural networks model,
Obtain the corresponding feature vector of original image to be processed;
The original image to be processed is calculated based on the classification function to the corresponding feature vector of the original image
Classification value, and judge whether the classification value is greater than preset threshold, if the classification value is greater than the preset threshold, determine the original
It include the indicia framing drawn using the pre-set color in beginning picture.
Based on the corresponding feature vector of the original image, the classification function can be for example expressed as follows:
F (x)=wx+b;
Wherein, w is to be carried out by algorithm of support vector machine to the corresponding feature value vector collection of the pictures containing indicia framing
The parameter obtained after calculating, b are by algorithm of support vector machine to the corresponding feature value vector collection of the unmarked frame pictures
The parameter obtained after being calculated, x indicate the corresponding feature vector of the original image to be processed.
Space conversion module 130, for if it is determined that including the label drawn using the pre-set color in the original image
The original image including indicia framing is then transformed into HSV space from rgb space by frame, by each of described original image
Pixel all resolves into coloration H, saturation degree S and brightness V value, to obtain HSV picture.
Binary processing module 140 sets two-value for the value range according to the pre-set color in HSV space
Change threshold value and judges the coloration H of each pixel, saturation degree S and brightness V value in the HSV picture using the binarization threshold
Whether meet the binarization threshold, binary conversion treatment is carried out to pixel each in the HSV picture according to judging result, is obtained
The corresponding binaryzation picture of the HSV picture.
Profile detection module 150, for detecting target wheel from the binaryzation picture by contour detecting algorithm
Exterior feature, and the location information of the objective contour is extracted as the corresponding location information of indicia framing in the original image, according to institute
It states location information to cut the original image to be processed, obtains the corresponding local picture of indicia framing in original image.
Wherein, described by contour detecting algorithm, detect that objective contour includes: from the binaryzation picture
By contour detecting algorithm, one or more candidate contours are detected from the binaryzation picture;
Calculate separately the size of one or more of candidate contours, and by calculated result and the second preset condition into
Corresponding calculated result is met the candidate contours of second preset condition as objective contour by row comparison.
Specifically, the location information for extracting the objective contour for example may include:
Judge the shape of the objective contour for one of round, ellipse, square, rectangle;
When the shape of the objective contour is round, the center location information and radius length of the objective contour are extracted
Information;
When the shape of the objective contour is ellipse, two focal position information, four of the objective contour are extracted
The location information on a vertex, and the location information of preset quantity sampled point up-sampled in objective contour;
When the shape of the objective contour is square or when rectangle, extracts the vertex position of the objective contour
Information.
In the running environment schematic diagram of 1 preferred embodiment of electronic device shown in Fig. 1, depositing comprising readable storage medium storing program for executing
It may include operating system, picture processing program 10 and database 4 in reservoir 11.It is stored in the execution memory 11 of processor 12
Following steps are realized when picture processing program 10:
Sample training step: sample graph valut is obtained, the sample graph valut includes multiple sample graphs with indicia framing
Piece and corresponding multiple samples pictures without indicia framing, are trained the sample graph valut, obtain described have
The classification function of the samples pictures of indicia framing and the corresponding samples pictures without indicia framing, the indicia framing are to use
The closure wire that pre-set color is drawn;
Sort out judgment step: obtaining original image to be processed, the original to be processed is calculated based on the classification function
The classification value of beginning picture determines to include using described default in the original image if the classification value meets the first preset condition
The indicia framing that color is drawn;
Space conversion step: if it is determined that including the indicia framing drawn using the pre-set color in the original image, then will
The original image including indicia framing is transformed into HSV space from rgb space, and each pixel in the original image is divided
Solution is at coloration H, saturation degree S and brightness V value, to obtain HSV picture;
Binary conversion treatment step: according to value range of the pre-set color in HSV space, setting binarization threshold,
Using the binarization threshold, judge whether the coloration H of each pixel, saturation degree S and brightness V value are full in the HSV picture
The foot binarization threshold carries out binary conversion treatment to pixel each in the HSV picture according to judging result, obtains described
The corresponding binaryzation picture of HSV picture;
Contour detecting step: by contour detecting algorithm, objective contour is detected from the binaryzation picture, and is extracted
The location information of the objective contour is as the corresponding location information of indicia framing in the original image, according to the positional information
The original image to be processed is cut, the corresponding local picture of indicia framing in original image is obtained.
It is described that the sample graph valut is trained, obtain samples pictures with indicia framing and described corresponding
Classification function without the samples pictures of indicia framing includes:
Convolutional neural networks are constructed, the sample graph valut is trained by the convolutional neural networks, obtains institute
State the corresponding convolutional neural networks model of sample graph valut;
The remark information that the indicia framing whether is had according to picture each in sample graph valut, by the sample graph valut
It is divided into pictures containing indicia framing and unmarked frame pictures, the pictures containing indicia framing include the multiple with indicia framing
Samples pictures, the unmarked frame pictures include corresponding multiple samples pictures without indicia framing;
The pictures containing indicia framing and the unmarked frame pictures are inputted into the convolutional neural networks model respectively,
The corresponding feature value vector collection of the pictures containing indicia framing is obtained by the convolution nuclear convolution of the convolutional neural networks model,
And the corresponding feature value vector collection of the unmarked frame pictures;
By algorithm of support vector machine to the corresponding feature value vector collection of the pictures containing indicia framing and described unmarked
The corresponding feature value vector collection of frame pictures is calculated, and the pictures containing indicia framing and the unmarked frame pictures are obtained
Classification function.
It is described to obtain original image to be processed, returning for the original image to be processed is calculated based on the classification function
Class value determines to include drawing in the original image using the pre-set color if the classification value meets the first preset condition
Indicia framing includes:
Original image to be processed is obtained, the original image to be processed is inputted into the convolutional neural networks model,
Obtain the corresponding feature vector of original image to be processed;
The original image to be processed is calculated based on the classification function to the corresponding feature vector of the original image
Classification value, and judge whether the classification value is greater than preset threshold, if the classification value is greater than the preset threshold, determine the original
It include the indicia framing drawn using the pre-set color in beginning picture.
The classification function representation is as follows:
F (x)=wx+b;
Wherein, w is to be carried out by algorithm of support vector machine to the corresponding feature value vector collection of the pictures containing indicia framing
The parameter obtained after calculating, b are by algorithm of support vector machine to the corresponding feature value vector collection of the unmarked frame pictures
The parameter obtained after being calculated, x indicate the corresponding feature vector of the original image to be processed.
It is described by contour detecting algorithm, detect that objective contour includes: from the binaryzation picture
By contour detecting algorithm, one or more candidate contours are detected from the binaryzation picture;
Calculate separately the size of one or more of candidate contours, and by calculated result and the second preset condition into
Corresponding calculated result is met the candidate contours of second preset condition as objective contour by row comparison.
The location information for extracting the objective contour includes:
Judge the shape of the objective contour for one of round, ellipse, square, rectangle;
When the shape of the objective contour is round, the center location information and radius length of the objective contour are extracted
Information;
When the shape of the objective contour is ellipse, two focal position information, four of the objective contour are extracted
The location information on a vertex, and the location information of preset quantity sampled point up-sampled in objective contour;
When the shape of the objective contour is square or when rectangle, extracts the vertex position of the objective contour
Information.
Concrete principle please refers to above-mentioned Fig. 8 and handles about the Program modual graph and Fig. 3 of picture processing program 10 about picture
The introduction of the flow chart of method preferred embodiment.
In addition, the embodiment of the present invention also proposes a kind of computer readable storage medium, the computer readable storage medium
It can be hard disk, multimedia card, SD card, flash card, SMC, read-only memory (ROM), Erasable Programmable Read Only Memory EPROM
(EPROM), any one in portable compact disc read-only memory (CD-ROM), USB storage etc. or several timess
Meaning combination.It include the database 4 and picture processing journey for being stored with the sample graph valut in the computer readable storage medium
Sequence 10 etc. realizes following operation when the picture processing program 10 is executed by the processor 12:
Sample training step: sample graph valut is obtained, the sample graph valut includes multiple sample graphs with indicia framing
Piece and corresponding multiple samples pictures without indicia framing, are trained the sample graph valut, obtain described have
The classification function of the samples pictures of indicia framing and the corresponding samples pictures without indicia framing, the indicia framing are to use
The closure wire that pre-set color is drawn;
Sort out judgment step: obtaining original image to be processed, the original to be processed is calculated based on the classification function
The classification value of beginning picture determines to include using described default in the original image if the classification value meets the first preset condition
The indicia framing that color is drawn;
Space conversion step: if it is determined that including the indicia framing drawn using the pre-set color in the original image, then will
The original image including indicia framing is transformed into HSV space from rgb space, and each pixel in the original image is divided
Solution is at coloration H, saturation degree S and brightness V value, to obtain HSV picture;
Binary conversion treatment step: according to value range of the pre-set color in HSV space, setting binarization threshold,
Using the binarization threshold, judge whether the coloration H of each pixel, saturation degree S and brightness V value are full in the HSV picture
The foot binarization threshold carries out binary conversion treatment to pixel each in the HSV picture according to judging result, obtains described
The corresponding binaryzation picture of HSV picture;
Contour detecting step: by contour detecting algorithm, objective contour is detected from the binaryzation picture, and is extracted
The location information of the objective contour is as the corresponding location information of indicia framing in the original image, according to the positional information
The original image to be processed is cut, the corresponding local picture of indicia framing in original image is obtained.
It is described that the sample graph valut is trained, obtain samples pictures with indicia framing and described corresponding
Classification function without the samples pictures of indicia framing includes:
Convolutional neural networks are constructed, the sample graph valut is trained by the convolutional neural networks, obtains institute
State the corresponding convolutional neural networks model of sample graph valut;
The remark information that the indicia framing whether is had according to picture each in sample graph valut, by the sample graph valut
It is divided into pictures containing indicia framing and unmarked frame pictures, the pictures containing indicia framing include the multiple with indicia framing
Samples pictures, the unmarked frame pictures include corresponding multiple samples pictures without indicia framing;
The pictures containing indicia framing and the unmarked frame pictures are inputted into the convolutional neural networks model respectively,
The corresponding feature value vector collection of the pictures containing indicia framing is obtained by the convolution nuclear convolution of the convolutional neural networks model,
And the corresponding feature value vector collection of the unmarked frame pictures;
By algorithm of support vector machine to the corresponding feature value vector collection of the pictures containing indicia framing and described unmarked
The corresponding feature value vector collection of frame pictures is calculated, and the pictures containing indicia framing and the unmarked frame pictures are obtained
Classification function.
It is described to obtain original image to be processed, returning for the original image to be processed is calculated based on the classification function
Class value determines to include drawing in the original image using the pre-set color if the classification value meets the first preset condition
Indicia framing includes:
Original image to be processed is obtained, the original image to be processed is inputted into the convolutional neural networks model,
Obtain the corresponding feature vector of original image to be processed;
The original image to be processed is calculated based on the classification function to the corresponding feature vector of the original image
Classification value, and judge whether the classification value is greater than preset threshold, if the classification value is greater than the preset threshold, determine the original
It include the indicia framing drawn using the pre-set color in beginning picture.
The classification function representation is as follows:
F (x)=wx+b;
Wherein, w is to be carried out by algorithm of support vector machine to the corresponding feature value vector collection of the pictures containing indicia framing
The parameter obtained after calculating, b are by algorithm of support vector machine to the corresponding feature value vector collection of the unmarked frame pictures
The parameter obtained after being calculated, x indicate the corresponding feature vector of the original image to be processed.
It is described by contour detecting algorithm, detect that objective contour includes: from the binaryzation picture
By contour detecting algorithm, one or more candidate contours are detected from the binaryzation picture;
Calculate separately the size of one or more of candidate contours, and by calculated result and the second preset condition into
Corresponding calculated result is met the candidate contours of second preset condition as objective contour by row comparison.
The location information for extracting the objective contour includes:
Judge the shape of the objective contour for one of round, ellipse, square, rectangle;
When the shape of the objective contour is round, the center location information and radius length of the objective contour are extracted
Information;
When the shape of the objective contour is ellipse, two focal position information, four of the objective contour are extracted
The location information on a vertex, and the location information of preset quantity sampled point up-sampled in objective contour;
When the shape of the objective contour is square or when rectangle, extracts the vertex position of the objective contour
Information.
The specific embodiment of the computer readable storage medium of the present invention and above-mentioned image processing method and electronics fill
Set 1 specific embodiment it is roughly the same, details are not described herein.
It should be noted that, in this document, the terms "include", "comprise" or its any other variant are intended to non-row
His property includes, so that the process, device, article or the method that include a series of elements not only include those elements, and
And further include other elements that are not explicitly listed, or further include for this process, device, article or method institute it is intrinsic
Element.In the absence of more restrictions, the element limited by sentence "including a ...", it is not excluded that including being somebody's turn to do
There is also other identical elements in the process, device of element, article or method.
Through the above description of the embodiments, those skilled in the art can be understood that above-described embodiment side
Method can be realized by means of software and necessary general hardware platform, naturally it is also possible to by hardware, but in many cases
The former is more preferably embodiment.Based on this understanding, technical solution of the present invention substantially in other words does the prior art
The part contributed out can be embodied in the form of software products, which is stored in one as described above
In storage medium, including some instructions are used so that a terminal device (can be mobile phone, computer, server or network
Equipment etc.) execute method described in each embodiment of the present invention.
The above is only a preferred embodiment of the present invention, is not intended to limit the scope of the invention, all to utilize this hair
Equivalent structure or equivalent flow shift made by bright specification and accompanying drawing content is applied directly or indirectly in other relevant skills
Art field, is included within the scope of the present invention.
Claims (10)
1. a kind of image processing method, which is characterized in that method includes the following steps:
Sample training step: obtaining sample graph valut, the sample graph valut include multiple samples pictures with indicia framing with
And corresponding multiple samples pictures without indicia framing, the sample graph valut is trained, is obtained described with label
The classification function of the samples pictures of frame and the corresponding samples pictures without indicia framing, the indicia framing are using default
The closure wire that color is drawn;
Sort out judgment step: obtaining original image to be processed, the original graph to be processed is calculated based on the classification function
The classification value of piece determines to include using the pre-set color in the original image if the classification value meets the first preset condition
The indicia framing of drafting;
Space conversion step: if it is determined that include the indicia framing drawn using the pre-set color in the original image, then it will be described
Original image including indicia framing is transformed into HSV space from rgb space, and each pixel in the original image is resolved into
Coloration H, saturation degree S and brightness V value, to obtain HSV picture;
Binary conversion treatment step: according to value range of the pre-set color in HSV space, binarization threshold is set, is used
The binarization threshold judges whether the coloration H of each pixel, saturation degree S and brightness V value meet institute in the HSV picture
Binarization threshold is stated, binary conversion treatment is carried out to pixel each in the HSV picture according to judging result, obtains the HSV figure
The corresponding binaryzation picture of piece;
Contour detecting step: by contour detecting algorithm, objective contour is detected from the binaryzation picture, and described in extraction
The location information of objective contour is as the corresponding location information of indicia framing in the original image, according to the positional information to institute
It states original image to be processed to be cut, obtains the corresponding local picture of indicia framing in original image.
2. image processing method as described in claim 1, which is characterized in that it is described that the sample graph valut is trained,
The classification function for obtaining the samples pictures with indicia framing and the corresponding samples pictures without indicia framing includes:
Convolutional neural networks are constructed, the sample graph valut is trained by the convolutional neural networks, obtains the sample
The corresponding convolutional neural networks model of this picture library;
The sample graph valut is divided by the remark information that the indicia framing whether is had according to picture each in sample graph valut
Pictures containing indicia framing and unmarked frame pictures, the pictures containing indicia framing include the multiple sample with indicia framing
Picture, the unmarked frame pictures include corresponding multiple samples pictures without indicia framing;
The pictures containing indicia framing and the unmarked frame pictures are inputted into the convolutional neural networks model respectively, are passed through
The convolution nuclear convolution of the convolutional neural networks model obtains the corresponding feature value vector collection of the pictures containing indicia framing, and
The corresponding feature value vector collection of the unmarked frame pictures;
By algorithm of support vector machine to the corresponding feature value vector collection of the pictures containing indicia framing and the unmarked block diagram
The corresponding feature value vector collection of piece collection is calculated, and returning for the pictures containing indicia framing and the unmarked frame pictures is obtained
Class function.
3. image processing method as claimed in claim 2, which is characterized in that it is described to obtain original image to be processed, it is based on
The classification value sorted out function and calculate the original image to be processed is sentenced if the classification value meets the first preset condition
It include including: using the indicia framing that the pre-set color is drawn in the fixed original image
Original image to be processed is obtained, the original image to be processed is inputted into the convolutional neural networks model, is obtained
The corresponding feature vector of original image to be processed;
Returning for the original image to be processed is calculated based on the classification function to the corresponding feature vector of the original image
Class value, and judge whether the classification value is greater than preset threshold, if the classification value is greater than the preset threshold, determine the original graph
It include the indicia framing drawn using the pre-set color in piece.
4. image processing method as claimed in claim 3, which is characterized in that the classification function representation is as follows:
F (x)=wx+b;
Wherein, w is to be calculated by algorithm of support vector machine the corresponding feature value vector collection of the pictures containing indicia framing
The parameter obtained afterwards, b are to be carried out by algorithm of support vector machine to the corresponding feature value vector collection of the unmarked frame pictures
The parameter obtained after calculating, x indicate the corresponding feature vector of the original image to be processed.
5. image processing method as described in claim 1, which is characterized in that it is described by contour detecting algorithm, from described two
Detect that objective contour includes: in value picture
By contour detecting algorithm, one or more candidate contours are detected from the binaryzation picture;
It calculates separately the size of one or more of candidate contours, and calculated result and the second preset condition is carried out pair
Than corresponding calculated result is met the candidate contours of second preset condition as objective contour.
6. image processing method as described in claim 1, which is characterized in that the location information for extracting the objective contour
Include:
Judge the shape of the objective contour for one of round, ellipse, square, rectangle;
When the shape of the objective contour is round, the center location information and radius length letter of the objective contour are extracted
Breath;
When the shape of the objective contour be ellipse when, extract the objective contour two focal position information, four top
The location information of point, and the location information of preset quantity sampled point up-sampled in objective contour;
When the shape of the objective contour is square or when rectangle, extracts the vertex position letter of the objective contour
Breath.
7. a kind of electronic device, including memory and processor, which is characterized in that include that picture handles journey in the memory
Sequence, the picture processing program realize following steps when being executed by the processor:
Sample training step: obtaining sample graph valut, the sample graph valut include multiple samples pictures with indicia framing with
And corresponding multiple samples pictures without indicia framing, the sample graph valut is trained, is obtained described with label
The classification function of the samples pictures of frame and the corresponding samples pictures without indicia framing, the indicia framing are using default
The closure wire that color is drawn;
Sort out judgment step: obtaining original image to be processed, the original graph to be processed is calculated based on the classification function
The classification value of piece determines to include using the pre-set color in the original image if the classification value meets the first preset condition
The indicia framing of drafting;
Space conversion step: if it is determined that include the indicia framing drawn using the pre-set color in the original image, then it will be described
Original image including indicia framing is transformed into HSV space from rgb space, and each pixel in the original image is resolved into
Coloration H, saturation degree S and brightness V value, to obtain HSV picture;
Binary conversion treatment step: according to value range of the pre-set color in HSV space, binarization threshold is set, is used
The binarization threshold judges whether the coloration H of each pixel, saturation degree S and brightness V value meet institute in the HSV picture
Binarization threshold is stated, binary conversion treatment is carried out to pixel each in the HSV picture according to judging result, obtains the HSV figure
The corresponding binaryzation picture of piece;
Contour detecting step: by contour detecting algorithm, objective contour is detected from the binaryzation picture, and described in extraction
The location information of objective contour is as the corresponding location information of indicia framing in the original image, according to the positional information to institute
It states original image to be processed to be cut, obtains the corresponding local picture of indicia framing in original image.
8. electronic device as claimed in claim 7, which is characterized in that it is described that the sample graph valut is trained, it obtains
The classification function of the samples pictures with indicia framing and the corresponding samples pictures without indicia framing includes:
Convolutional neural networks are constructed, the sample graph valut is trained by the convolutional neural networks, obtains the sample
The corresponding convolutional neural networks model of this picture library;
The sample graph valut is divided by the remark information that the indicia framing whether is had according to picture each in sample graph valut
Pictures containing indicia framing and unmarked frame pictures, the pictures containing indicia framing include the multiple sample with indicia framing
Picture, the unmarked frame pictures include corresponding multiple samples pictures without indicia framing;
The pictures containing indicia framing and the unmarked frame pictures are inputted into the convolutional neural networks model respectively, are passed through
The convolution nuclear convolution of the convolutional neural networks model obtains the corresponding feature value vector collection of the pictures containing indicia framing, and
The corresponding feature value vector collection of the unmarked frame pictures;
By algorithm of support vector machine to the corresponding feature value vector collection of the pictures containing indicia framing and the unmarked block diagram
The corresponding feature value vector collection of piece collection is calculated, and returning for the pictures containing indicia framing and the unmarked frame pictures is obtained
Class function.
9. electronic device as claimed in claim 8, which is characterized in that it is described to obtain original image to be processed, based on described
Sort out the classification value that function calculates the original image to be processed, if the classification value meets the first preset condition, determining should
It include including: in original image using the indicia framing that the pre-set color is drawn
Original image to be processed is obtained, the original image to be processed is inputted into the convolutional neural networks model, is obtained
The corresponding feature vector of original image to be processed;
Returning for the original image to be processed is calculated based on the classification function to the corresponding feature vector of the original image
Class value, and judge whether the classification value is greater than preset threshold, if the classification value is greater than the preset threshold, determine the original graph
It include the indicia framing drawn using the pre-set color in piece.
10. a kind of computer readable storage medium, which is characterized in that include that picture is handled in the computer readable storage medium
Program when the picture processing program is executed by processor, realizes that picture described in any one of claims 1 to 6 such as is handled
The step of method.
Priority Applications (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810183143.9A CN108446697B (en) | 2018-03-06 | 2018-03-06 | Image processing method, electronic device and storage medium |
PCT/CN2018/089881 WO2019169772A1 (en) | 2018-03-06 | 2018-06-05 | Picture processing method, electronic apparatus, and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810183143.9A CN108446697B (en) | 2018-03-06 | 2018-03-06 | Image processing method, electronic device and storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN108446697A CN108446697A (en) | 2018-08-24 |
CN108446697B true CN108446697B (en) | 2019-11-12 |
Family
ID=63193729
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201810183143.9A Active CN108446697B (en) | 2018-03-06 | 2018-03-06 | Image processing method, electronic device and storage medium |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN108446697B (en) |
WO (1) | WO2019169772A1 (en) |
Families Citing this family (22)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109447895B (en) | 2018-09-03 | 2021-06-08 | 腾讯科技(武汉)有限公司 | Picture generation method and device, storage medium and electronic device |
CN109522898A (en) * | 2018-09-18 | 2019-03-26 | 平安科技(深圳)有限公司 | Handwriting samples picture mask method, device, computer equipment and storage medium |
CN110110750B (en) * | 2019-03-29 | 2021-03-05 | 广州思德医疗科技有限公司 | Original picture classification method and device |
CN110084132B (en) * | 2019-04-03 | 2020-02-28 | 杭州深数科技有限公司 | Method, system and device for acquiring timber information of timber goods yard based on unmanned aerial vehicle |
CN110220480A (en) * | 2019-05-07 | 2019-09-10 | 上海理工大学 | A kind of measurement method of eye glass frame top rake |
CN110162649B (en) * | 2019-05-24 | 2021-06-18 | 北京百度网讯科技有限公司 | Sample data acquisition method, acquisition system, server and computer readable medium |
CN110889882B (en) * | 2019-11-11 | 2023-05-30 | 北京皮尔布莱尼软件有限公司 | Picture synthesis method and computing device |
CN111061933A (en) * | 2019-11-21 | 2020-04-24 | 深圳壹账通智能科技有限公司 | Picture sample library construction method and device, readable storage medium and terminal equipment |
CN113093556A (en) * | 2020-01-08 | 2021-07-09 | 佛山市云米电器科技有限公司 | Clothing collection reminding method, clothes hanger, system and storage medium |
CN111209922B (en) * | 2020-01-14 | 2023-09-01 | 深圳市彬讯科技有限公司 | Image color system style marking method, device, equipment and medium based on svm and opencv |
CN113496139B (en) * | 2020-03-18 | 2024-02-13 | 北京京东乾石科技有限公司 | Method and apparatus for detecting objects from images and training object detection models |
CN113538450B (en) * | 2020-04-21 | 2023-07-21 | 百度在线网络技术(北京)有限公司 | Method and device for generating image |
CN112183554B (en) * | 2020-09-01 | 2024-06-07 | 国交空间信息技术(北京)有限公司 | Automatic road boundary contour extraction method |
CN114385256B (en) * | 2020-10-22 | 2024-06-11 | 华为云计算技术有限公司 | Configuration method and configuration device of system parameters |
CN112481839B (en) * | 2020-11-27 | 2022-08-02 | 杭州数迈科技有限公司 | Fabric sewing method, system, equipment and storage medium |
CN112508016B (en) * | 2020-12-15 | 2024-04-16 | 深圳万兴软件有限公司 | Image processing method, device, computer equipment and storage medium |
CN112686265A (en) * | 2021-01-07 | 2021-04-20 | 南京大学 | Hierarchic contour extraction-based pictograph segmentation method |
CN112966786A (en) * | 2021-04-15 | 2021-06-15 | 宁波九寰适创科技有限公司 | Automatic marking method for convolutional neural network training data |
CN114092456A (en) * | 2021-11-26 | 2022-02-25 | 上海申挚医疗科技有限公司 | Cell fluorescence image distinguishing method and system |
CN114399617B (en) * | 2021-12-23 | 2023-08-04 | 北京百度网讯科技有限公司 | Method, device, equipment and medium for identifying shielding pattern |
CN114781846A (en) * | 2022-04-13 | 2022-07-22 | 国家电网有限公司技术学院分公司 | Evaluation method and system for overhead transmission line defect identification training |
CN116469025B (en) * | 2022-12-30 | 2023-11-24 | 以萨技术股份有限公司 | Processing method for identifying task, electronic equipment and storage medium |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101877126A (en) * | 2009-11-19 | 2010-11-03 | 东软集团股份有限公司 | Method and device for splitting license plate candidate area |
CN103093181A (en) * | 2011-11-01 | 2013-05-08 | 青岛海信网络科技股份有限公司 | License plate image locating method and device |
CN103617422A (en) * | 2013-10-29 | 2014-03-05 | 浙江工业大学 | A social relation management method based on business card recognition |
Family Cites Families (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP6582472B2 (en) * | 2015-03-19 | 2019-10-02 | 富士ゼロックス株式会社 | Image processing apparatus, image processing system, and program |
CN104732220B (en) * | 2015-04-03 | 2017-12-22 | 中国人民解放军国防科学技术大学 | A kind of particular color human body detecting method towards monitor video |
CN105678756A (en) * | 2015-12-30 | 2016-06-15 | 天津盛购科技发展有限公司 | Storage location positioning system based on colors |
EP3223237B1 (en) * | 2016-03-22 | 2020-05-27 | Tata Consultancy Services Limited | Systems and methods for detecting and tracking a marker |
-
2018
- 2018-03-06 CN CN201810183143.9A patent/CN108446697B/en active Active
- 2018-06-05 WO PCT/CN2018/089881 patent/WO2019169772A1/en active Application Filing
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101877126A (en) * | 2009-11-19 | 2010-11-03 | 东软集团股份有限公司 | Method and device for splitting license plate candidate area |
CN103093181A (en) * | 2011-11-01 | 2013-05-08 | 青岛海信网络科技股份有限公司 | License plate image locating method and device |
CN103617422A (en) * | 2013-10-29 | 2014-03-05 | 浙江工业大学 | A social relation management method based on business card recognition |
Non-Patent Citations (1)
Title |
---|
基于颜色规格化和轮廓多边形的;李贺等;《铁路计算机应用》;20130228;全文 * |
Also Published As
Publication number | Publication date |
---|---|
CN108446697A (en) | 2018-08-24 |
WO2019169772A1 (en) | 2019-09-12 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN108446697B (en) | Image processing method, electronic device and storage medium | |
US10635946B2 (en) | Eyeglass positioning method, apparatus and storage medium | |
CN108961279A (en) | Image processing method, device and mobile terminal | |
WO2021051601A1 (en) | Method and system for selecting detection box using mask r-cnn, and electronic device and storage medium | |
CN110348439B (en) | Method, computer readable medium and system for automatically identifying price tags | |
CN103699532B (en) | Image color retrieval method and system | |
CN106777177A (en) | Search method and device | |
CN110675940A (en) | Pathological image labeling method and device, computer equipment and storage medium | |
CN108090511B (en) | Image classification method and device, electronic equipment and readable storage medium | |
KR102002024B1 (en) | Method for processing labeling of object and object management server | |
CN109636825A (en) | Seal graphics dividing method, device and computer readable storage medium | |
CN111178355B (en) | Seal identification method, device and storage medium | |
CN110197238B (en) | Font type identification method, system and terminal equipment | |
CN110415212A (en) | Abnormal cell detection method, device and computer readable storage medium | |
JPWO2015064107A1 (en) | Management system, list creation device, data structure and print label | |
CN109918984A (en) | Insurance policy number identification method, device, electronic equipment and storage medium | |
CN106372624A (en) | Human face recognition method and human face recognition system | |
CN111144372A (en) | Vehicle detection method, device, computer equipment and storage medium | |
CN109800747A (en) | Medical invoice recognition methods, user equipment, storage medium and device | |
CN111507324A (en) | Card frame identification method, device, equipment and computer storage medium | |
CN111784665A (en) | OCT image quality assessment method, system and device based on Fourier transform | |
CN112036304A (en) | Medical bill layout identification method and device and computer equipment | |
CN108877030B (en) | Image processing method, device, terminal and computer readable storage medium | |
CN110737687A (en) | Data query method, device, equipment and storage medium | |
CN107168635A (en) | Information demonstrating method and device |
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 |