CN109754379A - Image processing method and device - Google Patents
Image processing method and device Download PDFInfo
- Publication number
- CN109754379A CN109754379A CN201811640194.6A CN201811640194A CN109754379A CN 109754379 A CN109754379 A CN 109754379A CN 201811640194 A CN201811640194 A CN 201811640194A CN 109754379 A CN109754379 A CN 109754379A
- Authority
- CN
- China
- Prior art keywords
- gray value
- pixel
- image
- processed
- pixels point
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000003672 processing method Methods 0.000 title claims abstract description 16
- 238000000034 method Methods 0.000 claims abstract description 17
- XLYOFNOQVPJJNP-UHFFFAOYSA-N water Substances O XLYOFNOQVPJJNP-UHFFFAOYSA-N 0.000 claims description 38
- 238000006243 chemical reaction Methods 0.000 claims description 33
- 238000001514 detection method Methods 0.000 claims description 4
- 238000004891 communication Methods 0.000 description 14
- 238000010586 diagram Methods 0.000 description 13
- 238000003860 storage Methods 0.000 description 7
- 238000004590 computer program Methods 0.000 description 6
- 230000008859 change Effects 0.000 description 5
- 230000008569 process Effects 0.000 description 3
- 239000002699 waste material Substances 0.000 description 3
- 239000003086 colorant Substances 0.000 description 2
- 238000001914 filtration Methods 0.000 description 2
- 230000002093 peripheral effect Effects 0.000 description 2
- 238000000802 evaporation-induced self-assembly Methods 0.000 description 1
- 230000006872 improvement Effects 0.000 description 1
- 238000004519 manufacturing process Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 238000002360 preparation method Methods 0.000 description 1
- 238000011946 reduction process Methods 0.000 description 1
- 230000000630 rising effect Effects 0.000 description 1
- 239000007787 solid Substances 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/10—Segmentation; Edge detection
- G06T7/136—Segmentation; Edge detection involving thresholding
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/10—Segmentation; Edge detection
- G06T7/11—Region-based segmentation
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/10—Segmentation; Edge detection
- G06T7/187—Segmentation; Edge detection involving region growing; involving region merging; involving connected component labelling
Landscapes
- Engineering & Computer Science (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Image Processing (AREA)
- Image Analysis (AREA)
Abstract
The embodiment of the application provides an image processing method and device, wherein the method comprises the following steps: and performing binarization processing on the image to be processed to obtain a binarized image to be processed, determining target pixel points through a flood filling algorithm based on the pixel points with the second gray value, and recording the target pixel points. According to the technical scheme provided by the embodiment of the application, the to-be-processed binary image is obtained after the to-be-processed image is subjected to binarization processing, the contour image area and the non-contour image area are distinguished through the first gray value and the second gray value in the to-be-processed binary image, for each non-contour image area, the target pixel points belonging to the same connected domain are determined and recorded through the flood filling algorithm, then the connected domain in the image can be identified under the condition that manual participation is not needed, and the human resources are saved.
Description
Technical field
This application involves technical field of image processing, more particularly to a kind of image processing method and device.
Background technique
Connected domain in image refers in image with image composed by the adjacent pixel of same grayscale value and position
Region, the identification of connected domain in image procossing using wide, such as Car license recognition, profile diagram used in picture mosaic class game
Deng.
Especially in picture mosaic class game, a large amount of using the profile diagram being made of white and black, player will be each in profile diagram
The white upper different color of connected domain filling, and then achieve the purpose that the profile diagram of black and white becoming solid fill with color figure.
However, profile diagram employed in picture mosaic class game is obtained according to the cromogram of actual photographed.Specifically,
Game making personnel obtain the profile diagram of black and white by manually knowing figure, and the connected domain boundary in Freehandhand-drawing cromogram.In this way
Manufacturing process it is not only time-consuming, but also waste of manpower resource.
Summary of the invention
The embodiment of the present application is designed to provide a kind of image processing method and device, to solve in manual identified image
The problem of connected domain is time-consuming and waste of manpower resource.Specific technical solution is as follows:
In a first aspect, the embodiment of the present application provides a kind of image processing method, which comprises
Binary conversion treatment is carried out to image to be processed, obtains binary image to be processed;Wherein, the binaryzation to be processed
Image includes: contour images region and non-contour images region, and the gray value of the pixel in the contour images region is the
One gray value, the gray value of the pixel in the non-contour images region are the second gray value;
Based on the pixel of second gray value, target pixel points are determined by unrestrained water filling algorithm;
Record the target pixel points.
Optionally, the pixel based on second gray value determines target pixel points by unrestrained water filling algorithm,
Include:
The pixel that second gray value is chosen from the binary image to be processed, as starting pixels point;
Since the starting pixels point, target pixel points are determined by unrestrained water filling algorithm, and by the object pixel
The gray value of point is set as default gray value.
Optionally, the method also includes:
First gray value is set by the gray value of the pixel of the default gray value;
Obtained image is determined as binary image to be processed, and it is described based on second gray value to return to execution
Pixel, the step of target pixel points are determined by unrestrained water filling algorithm.
Optionally, described since the starting pixels point, target pixel points are determined by unrestrained water filling algorithm, and by institute
The gray value for stating target pixel points is set as default gray value, comprising:
Default gray value is set by the gray value of the starting pixels point;
Detect whether the neighbor pixel point adjacent with the starting pixels point is second gray value;
If so, the default gray value is set by the neighbor pixel, using the neighbor pixel as starting
Pixel, and return and execute whether the detection neighbor pixel point adjacent with the starting pixels point is second gray value
The step of.
Optionally, the pixel that second gray value is chosen from the binary image to be processed, as rise
Beginning pixel, comprising:
According to preset order, the pixel in the binary image to be processed is traversed;
The pixel of second gray value traversed for the first time is determined as starting pixels point.
Optionally, described that binary conversion treatment is carried out to image to be processed, obtain binary image to be processed, comprising:
Image to be processed is subjected to binary conversion treatment;
The picture smooth treatment of preset times is carried out to the image to be processed after binary conversion treatment;
By in the image to be processed after picture smooth treatment, in addition to the second gray value described in first sum of the grayscale values
The pixel of other gray values is set as first gray value, and obtained image is determined as binary image to be processed.
Second aspect, the embodiment of the present application provide a kind of image processing apparatus, and described device includes:
Processing module obtains binary image to be processed for carrying out binary conversion treatment to image to be processed;Wherein, institute
Stating binary image to be processed includes: contour images region and non-contour images region, the pixel in the contour images region
The gray value of point is the first gray value, and the gray value of the pixel in the non-contour images region is the second gray value;
Determining module determines object pixel by unrestrained water filling algorithm for the pixel based on second gray value
Point;
Logging modle, for recording the target pixel points.
Optionally, the determining module is specifically used for:
The pixel that second gray value is chosen from the binary image to be processed, as starting pixels point;
Since the starting pixels point, target pixel points are determined by unrestrained water filling algorithm, and by the object pixel
The gray value of point is set as default gray value.
Optionally, described device further include:
Setup module, for setting first gray value for the gray value of the pixel of the default gray value;
Determining module for obtained image to be determined as binary image to be processed, and triggers the determining module
For executing the pixel based on second gray value, by overflowing the step of water filling algorithm determines target pixel points.
Optionally, the determining module is specifically used for:
Default gray value is set by the gray value of the starting pixels point;
Detect whether the neighbor pixel point adjacent with the starting pixels point is second gray value;
If so, the default gray value is set by the neighbor pixel, using the neighbor pixel as starting
Pixel, and return and execute whether the detection neighbor pixel point adjacent with the starting pixels point is second gray value
The step of.
Optionally, the determining module is specifically used for:
According to preset order, the pixel in the binary image to be processed is traversed;
The pixel of second gray value traversed for the first time is determined as starting pixels point.
Optionally, the processing module is specifically used for:
Image to be processed is subjected to binary conversion treatment;
The picture smooth treatment of preset times is carried out to the image to be processed after binary conversion treatment;
Will in the image to be processed after picture smooth treatment, except the second gray value described in first sum of the grayscale values with
The pixel of other outer gray values is set as first gray value, and obtained image is determined as binary picture to be processed
Picture.
The third aspect, the embodiment of the present application provide a kind of electronic equipment, including processor, communication interface, memory and
Communication bus, wherein processor, communication interface, memory complete mutual communication by communication bus;
Memory, for storing computer program;
Processor when for executing the program stored on memory, realizes any of the above-described image processing method
Step.
Fourth aspect, the embodiment of the present application provide a kind of machine readable storage medium, the machine readable storage medium
It is inside stored with computer program, the computer program realizes any of the above-described image processing method when being executed by processor
Step.
In technical solution provided by the embodiments of the present application, binary conversion treatment is carried out to image to be processed, obtains to be processed two
Value image determines target pixel points by unrestrained water filling algorithm, and record object pixel based on the pixel of the second gray value
Point.By technical solution provided by the embodiments of the present application, two-value to be processed is obtained after image to be processed is carried out binary conversion treatment
Change image, passes through first the second gray value of sum of the grayscale values in the binary image to be processed for contour images region and non-profile diagram
As region distinguishes, for each non-contour images region, same connected domain is belonged to determine by unrestrained water filling algorithm
Target pixel points simultaneously record, and then can identify to the connected domain in image in the case where not needing and manually participating in, and save
Human-saving resource.
Detailed description of the invention
In order to illustrate the technical solutions in the embodiments of the present application or in the prior art more clearly, to embodiment or will show below
There is attached drawing needed in technical description to be briefly described, it should be apparent that, the accompanying drawings in the following description is only this
Some embodiments of application for those of ordinary skill in the art without creative efforts, can be with
It obtains other drawings based on these drawings.
Fig. 1 is a kind of flow chart of image processing method provided by the embodiments of the present application;
Fig. 2 is a kind of structural schematic diagram of image processing apparatus provided by the embodiments of the present application;
Fig. 3 is a kind of structural schematic diagram of electronic equipment provided by the embodiments of the present application.
Specific embodiment
Below in conjunction with the attached drawing in the embodiment of the present application, technical solutions in the embodiments of the present application carries out clear, complete
Site preparation description, it is clear that described embodiments are only a part of embodiments of the present application, instead of all the embodiments.It is based on
Embodiment in the application, it is obtained by those of ordinary skill in the art without making creative efforts every other
Embodiment shall fall in the protection scope of this application.
In order to solve the problems, such as that and waste of manpower resource time-consuming by the connected domain in manual identified image, the application are implemented
Example provides a kind of image processing method and device, wherein the image processing method includes:
Binary conversion treatment is carried out to image to be processed, obtains binary image to be processed;Wherein, binary image to be processed
It include: contour images region and non-contour images region, the gray value of the pixel in contour images region is the first gray value,
The gray value of pixel in non-contour images region is the second gray value;
Based on the pixel of the second gray value, target pixel points are determined by unrestrained water filling algorithm;
Record target pixel points.
In technical solution provided by the embodiments of the present application, binary conversion treatment is carried out to image to be processed, obtains to be processed two
Value image determines target pixel points by unrestrained water filling algorithm, and record object pixel based on the pixel of the second gray value
Point.By technical solution provided by the embodiments of the present application, two-value to be processed is obtained after image to be processed is carried out binary conversion treatment
Change image, passes through first the second gray value of sum of the grayscale values in the binary image to be processed for contour images region and non-profile diagram
As region distinguishes, for each non-contour images region, same connected domain is belonged to determine by unrestrained water filling algorithm
Target pixel points simultaneously record, and then can identify to the connected domain in image in the case where not needing and manually participating in, and save
Human-saving resource.
A kind of image processing method provided by the embodiments of the present application is introduced first below.The embodiment of the present application provides
A kind of image processing method, as shown in Figure 1, include the following steps.
S101 carries out binary conversion treatment to image to be processed, obtains binary image to be processed.
Wherein, image to be processed can be any image such as cromogram, grayscale image, artwork master.When image to be processed is
In a kind of implementation when color image, colored image to be processed can be converted into single pass grayscale image, wherein turn
The mode changed can be to be converted by OpenCV.After obtaining grayscale image, grayscale image is subjected to binary conversion treatment, in turn
Available binary image only includes two kinds of colors of black and white in obtained binary image, i.e., only comprising gray value is 0 He
The pixel that gray value is 255.
In addition, after carrying out binary conversion treatment noise reduction process can be carried out to obtained binary image, to improve
The quality of binary image.
Wherein, binary image to be processed includes: contour images region and non-contour images region, in contour images region
The gray value of pixel be the first gray value, the gray value of the pixel in non-contour images region is the second gray value.
Contour images region is used to highlight the profile of the targets such as people, object in binary image to be processed, it is believed that wheel
Wide image-region is made of lines, and each lines combine to form the profile for highlighting target.Non- contour images region is to be processed two
Region in value image in addition to contour images region.
Based in binary image to be processed only comprising gray value is 0 and gray value is 255 pixel, for the first ash
Angle value and the second gray value, may include following two situation: the first situation, and the first gray value is 0, and the second gray value is
255;Second situation, the first gray value are 255, and the second gray value is 0.
For the first situation, non-contour images region is white, and contour images region is black, it can think, to
It handles in binary image using white as background color, the profile of target is highlighted with the lines of black.For second situation, non-profile
Image-region is black, and contour images region is white, it can think, using black as background color in binary image to be processed,
The profile of target is highlighted with the lines of white.
It is illustrated by taking the first situation as an example in the embodiment of the present application.
In a kind of embodiment, after carrying out binary conversion treatment to image to be processed, obtained image is binaryzation
Image, i.e., only comprising gray value is 0 and gray value is 255 pixel in obtained image.To after binary conversion treatment
Image to be processed carry out picture smooth treatment, the number for carrying out picture smooth treatment can be preset times, the preset times
It can be customized.
For example, then first carrying out a picture smooth treatment, available first time, treated when preset times are 3 times
Image, then treated image carries out picture smooth treatment for the first time to this obtains second treated image, finally right again
Should second treated that image carries out picture smooth treatment, obtain third time treated image, treated for the third time
Image is the image after picture smooth treatment three times.
Wherein, in a kind of implementation of picture smooth treatment, in the image to be processed after traversing through binary conversion treatment
Pixel, for each pixel, whether the gray value for detecting the neighbor pixel of the pixel identical, if not identical,
Calculate neighbor pixel gray value sum, by calculated and divided by neighbor pixel quantity, it can obtain mean value,
By the mean value or with gray value of the value as the pixel similar in the mean value.
For example, the neighbor pixel of a pixel includes pixel 1 and pixel 2, wherein the gray value of pixel 1
It is 0, the gray value of pixel 2 is 255, the gray value based on pixel 1 and pixel 2, and available mean value is 127.5, then
It can be by 128 gray value as pixel.
Other than above-mentioned implementation, picture smooth treatment can also pass through the modes such as gaussian filtering, median filtering reality
It is existing.
In the image to be processed after picture smooth treatment, other than gray value is 0 and 255 pixel, also
Pixel including other gray values.At this point it is possible to by other gray values in addition to first the second gray value of sum of the grayscale values
Pixel is set as the first gray value, only includes the pixel of first the second gray value of sum of the grayscale values in obtained image,
I.e. obtained image only includes the pixel of two kinds of colors of black and white, obtained image can be determined as binaryzation to be processed
Image.
For example, the first gray value is 0, the second gray value is 255, in the image to be processed after picture smooth treatment
It further include the pixel that gray value is 128, then it is 0 that the pixel that can be 128 by gray value, which is set as gray value, and by gained
To be only determined as binary image to be processed comprising the image of gray value 0 and 255.
S102 determines target pixel points by unrestrained water filling algorithm based on the pixel of the second gray value.
Wherein, overflowing water filling algorithm is other pixels in connected domain where finding the pixel since a pixel
Point, and then identify the connected domain.
In a kind of embodiment, the pixel of the second gray value is chosen from binary image to be processed, as starting picture
Vegetarian refreshments.
The pixel of second gray value is the pixel in non-contour images region, it can is thought, the picture of the second gray value
Vegetarian refreshments is the pixel in the connected domain of binary image to be processed.When in binary image to be processed include multiple connected domains
When, selected starting pixels point can be any pixel point in any connected domain.
In a kind of implementation, according to preset order, the pixel in binary image to be processed is traversed, and will
The pixel of the second gray value traversed for the first time is determined as starting pixels point.
Wherein, preset order can be customized setting, and preset order can be according to from left to right, from top to bottom
Sequentially, it can also be according to sequence from right to left, from top to bottom, certainly, preset order can also be that customized other are suitable
Sequence is not limited thereto.
The pixel in binary image to be processed is traversed according to preset order, it can be to avoid the picture for omitting the second gray value
Vegetarian refreshments, and then avoid omitting the connected domain in binary image to be processed, so that each connection in binary image to be processed
Domain can be identified.
After choosing starting pixels point in binary image to be processed, since starting pixels point, filled out by unrestrained water
It fills algorithm and determines target pixel points, and set default gray value for the gray value of the target pixel points.
Wherein, presetting gray value is other gray values other than first the second gray value of sum of the grayscale values, the default gray value
It can be customized setting.By setting the pixel traversed to the pixel of default gray value, to distinguish over other
The pixel not being traversed to.
For example, default gray value is 128, it is the picture of gray value 255 using the pixel that unrestrained water filling algorithm traverses
Vegetarian refreshments, it is 128 that the pixel that these are traversed, which is set as gray value, then obtained after completing unrestrained water filling algorithm
It include the pixel that gray value is 0,255 and 128 in image, wherein the pixel of gray value 128 is in same connected domain
Pixel.The pixel for recording gray value 128, that is, determine the connected domain where target pixel points.
In a kind of implementation, since starting pixels point, default gray value is set by the gray value of starting pixels point,
And detect whether the neighbor pixel point adjacent with the starting pixels point is the second gray value.
Wherein, the mode for searching for the neighbor pixel point adjacent with starting pixels point can be the mode that four-way is connected to, i.e., from
Starting pixels point sets out, and scans for respectively from upper and lower, left and right four direction.Can also be eight modes to connection, i.e., from
Starting pixels point sets out, and scans for respectively from eight upper and lower, left and right, upper left, lower-left, upper right, upper right directions.In addition to above-mentioned
Other than two ways, it can also be other ways of search, be not limited thereto.
If detecting, neighbor pixel point is the second gray value, can determine that the neighbor pixel point and starting pixels point belong to together
One connected domain, then can set the neighbor pixel to default gray value, and using the neighbor pixel as starting pixels point,
It returns to execute and the step of whether the neighbor pixel point adjacent with starting pixels point is the second gray value is detected, until detecting and rising
The adjacent neighbor pixel point of beginning pixel is not the second gray value.
If detecting, neighbor pixel point is not the second gray value, can determine that current target pixel points are and profile
The adjacent pixel of image-region has traversed the boundary of connected domain where to starting pixels point.
S103 records target pixel points.
The target pixel points recorded belong to same connected domain, that is to say, that the target pixel points recorded are one
Pixel in connected domain.
In a kind of implementation, the corresponding relationship of the mark of connected domain and the coordinate of pixel can recorde, wherein mark
One of them in pixel that the pixel of the coordinate is included for the connected domain of the mark is indicated with the corresponding relationship of coordinate
Pixel.Therefore, identifying with the corresponding relationship of coordinate is one-to-many corresponding relationship, i.e. a connected domain is comprising multiple pixels
Point.For example, mark 1 respective coordinates (1,1) and (1,2), the pixel of indicates coordinate (1,1) and the pixel of coordinate (1,2)
Belong to the connected domain of mark 1.
In a kind of embodiment, after completing unrestrained water filling algorithm, that is, the connection where starting pixels point has been traversed
All pixels point in domain, and the gray value of all pixels point in the connected domain is default gray value.That is, at this time
Image in preset gray value pixel belong to the pixel in same connected domain, to default gray value pixel note
After record, the first gray value is set by the gray value of the pixel of default gray value, for being identified to the connected domain, table
Show that the connected domain has been identified.
After setting the first gray value for the pixel of default gray value, still only comprising the first ash in obtained image
The image is determined as binary image to be processed by the pixel of angle value and the second gray value, and returns to execution based on the second ash
The pixel of angle value, by overflowing the step of water filling algorithm determines target pixel points, until not deposited in binary image to be processed
In the pixel of the second gray value.At this point, completing the identification to connected domain in image to be processed.
In technical solution provided by the embodiments of the present application, binary conversion treatment is carried out to image to be processed, obtains to be processed two
Value image determines target pixel points by unrestrained water filling algorithm, and record object pixel based on the pixel of the second gray value
Point.By technical solution provided by the embodiments of the present application, two-value to be processed is obtained after image to be processed is carried out binary conversion treatment
Change image, passes through first the second gray value of sum of the grayscale values in the binary image to be processed for contour images region and non-profile diagram
As region distinguishes, for each non-contour images region, same connected domain is belonged to determine by unrestrained water filling algorithm
Target pixel points simultaneously record, and then can identify to the connected domain in image in the case where not needing and manually participating in, and save
Human-saving resource.
Corresponding to above-mentioned image procossing mode embodiment, the embodiment of the present application also provides a kind of image processing apparatus implementation
Example, as shown in Fig. 2, the image processing apparatus includes:
Processing module 210 obtains binary image to be processed for carrying out binary conversion treatment to image to be processed;Wherein,
Binary image to be processed includes: contour images region and non-contour images region, the ash of the pixel in contour images region
Angle value is the first gray value, and the gray value of the pixel in non-contour images region is the second gray value;
Determining module 220 determines object pixel by unrestrained water filling algorithm for the pixel based on the second gray value
Point;
Logging modle 230, for recording target pixel points.
In a kind of embodiment, determining module 220 is specifically used for:
The pixel that the second gray value is chosen from binary image to be processed, as starting pixels point;
Since starting pixels point, target pixel points are determined by unrestrained water filling algorithm, and by the gray scale of target pixel points
Value is set as default gray value.
In a kind of embodiment, which can also include:
Setup module, for setting the first gray value for the gray value of the pixel of default gray value;
Determining module for obtained image to be determined as binary image to be processed, and triggers the use of determining module 220
In the step of executing the pixel based on the second gray value, determining target pixel points by unrestrained water filling algorithm.
In a kind of embodiment, determining module 220 is specifically used for:
Default gray value is set by the gray value of starting pixels point;
Detect whether the neighbor pixel point adjacent with starting pixels point is the second gray value;
If so, setting default gray value for neighbor pixel, using neighbor pixel as starting pixels point, and return
It executes and the step of whether the neighbor pixel point adjacent with starting pixels point is the second gray value is detected.
In a kind of embodiment, determining module 220 is specifically used for:
According to preset order, the pixel in binary image to be processed is traversed;
The pixel of the second gray value traversed for the first time is determined as starting pixels point.
In a kind of embodiment, processing module 210 is specifically used for:
Image to be processed is subjected to binary conversion treatment;
The picture smooth treatment of preset times is carried out to the image to be processed after binary conversion treatment;
By in the image to be processed after picture smooth treatment, other in addition to first the second gray value of sum of the grayscale values
The pixel of gray value is set as the first gray value, and obtained image is determined as binary image to be processed.
In technical solution provided by the embodiments of the present application, binary conversion treatment is carried out to image to be processed, obtains to be processed two
Value image determines target pixel points by unrestrained water filling algorithm, and record object pixel based on the pixel of the second gray value
Point.By technical solution provided by the embodiments of the present application, two-value to be processed is obtained after image to be processed is carried out binary conversion treatment
Change image, passes through first the second gray value of sum of the grayscale values in the binary image to be processed for contour images region and non-profile diagram
As region distinguishes, for each non-contour images region, same connected domain is belonged to determine by unrestrained water filling algorithm
Target pixel points simultaneously record, and then can identify to the connected domain in image in the case where not needing and manually participating in, and save
Human-saving resource.
Corresponding to above-mentioned image procossing mode embodiment, the embodiment of the present application also provides a kind of electronic equipment, such as Fig. 3 institute
Show, including processor 310, communication interface 320, memory 330 and communication bus 340, wherein processor 310, communication interface
320, memory 330 completes mutual communication by communication bus 340;
Memory 330, for storing computer program;
Processor 310 when for executing the program stored on memory 330, realizes following steps:
Binary conversion treatment is carried out to image to be processed, obtains binary image to be processed;Wherein, binary image to be processed
It include: contour images region and non-contour images region, the gray value of the pixel in contour images region is the first gray value,
The gray value of pixel in non-contour images region is the second gray value;
Based on the pixel of the second gray value, target pixel points are determined by unrestrained water filling algorithm;
Record target pixel points.
In technical solution provided by the embodiments of the present application, binary conversion treatment is carried out to image to be processed, obtains to be processed two
Value image determines target pixel points by unrestrained water filling algorithm, and record object pixel based on the pixel of the second gray value
Point.By technical solution provided by the embodiments of the present application, two-value to be processed is obtained after image to be processed is carried out binary conversion treatment
Change image, passes through first the second gray value of sum of the grayscale values in the binary image to be processed for contour images region and non-profile diagram
As region distinguishes, for each non-contour images region, same connected domain is belonged to determine by unrestrained water filling algorithm
Target pixel points simultaneously record, and then can identify to the connected domain in image in the case where not needing and manually participating in, and save
Human-saving resource.
The communication bus that above-mentioned electronic equipment is mentioned can be Peripheral Component Interconnect standard (Peripheral Component
Interconnect, PCI) bus or expanding the industrial standard structure (Extended Industry Standard
Architecture, EISA) bus etc..The communication bus can be divided into address bus, data/address bus, control bus etc..For just
It is only indicated with a thick line in expression, figure, it is not intended that an only bus or a type of bus.
Communication interface is for the communication between above-mentioned electronic equipment and other equipment.
Memory may include random access memory (Random Access Memory, RAM), also may include non-easy
The property lost memory (Non-Volatile Memory, NVM), for example, at least a magnetic disk storage.Optionally, memory may be used also
To be storage device that at least one is located remotely from aforementioned processor.
Above-mentioned processor can be general processor, including central processing unit (Central Processing Unit,
CPU), network processing unit (Network Processor, NP) etc.;It can also be digital signal processor (Digital Signal
Processing, DSP), it is specific integrated circuit (Application Specific Integrated Circuit, ASIC), existing
It is field programmable gate array (Field-Programmable Gate Array, FPGA) or other programmable logic device, discrete
Door or transistor logic, discrete hardware components.
Corresponding to above-mentioned image procossing mode embodiment, the embodiment of the present application also provides a kind of machine readable storage Jie
Matter is stored with computer program in the machine readable storage medium, realizes when the computer program is executed by processor
State any image processing method step.
It should be noted that, in this document, relational terms such as first and second and the like are used merely to a reality
Body or operation are distinguished with another entity or operation, are deposited without necessarily requiring or implying between these entities or operation
In any actual relationship or order or sequence.Moreover, the terms "include", "comprise" or its any other variant are intended to
Non-exclusive inclusion, so that the process, method, article or equipment including a series of elements is not only wanted including those
Element, but also including other elements that are not explicitly listed, or further include for this process, method, article or equipment
Intrinsic element.In the absence of more restrictions, the element limited by sentence "including a ...", it is not excluded that
There is also other identical elements in process, method, article or equipment including the element.
Each embodiment in this specification is all made of relevant mode and describes, same and similar portion between each embodiment
Dividing may refer to each other, and each embodiment focuses on the differences from other embodiments.At image
For managing device, electronic equipment and machine readable storage medium embodiment, since it is substantially similar to the method embodiment, so
It is described relatively simple, related place illustrates referring to the part of image processing method embodiment.
The foregoing is merely the preferred embodiments of the application, are not intended to limit the protection scope of the application.It is all
Any modification, equivalent replacement, improvement and so within spirit herein and principle are all contained in the protection scope of the application
It is interior.
Claims (10)
1. a kind of image processing method, which is characterized in that the described method includes:
Binary conversion treatment is carried out to image to be processed, obtains binary image to be processed;Wherein, the binary image to be processed
It include: contour images region and non-contour images region, the gray value of the pixel in the contour images region is the first ash
Angle value, the gray value of the pixel in the non-contour images region are the second gray value;
Based on the pixel of second gray value, target pixel points are determined by unrestrained water filling algorithm;
Record the target pixel points.
2. the method according to claim 1, wherein the pixel based on second gray value, passes through
Unrestrained water filling algorithm determines target pixel points, comprising:
The pixel that second gray value is chosen from the binary image to be processed, as starting pixels point;
Since the starting pixels point, target pixel points are determined by unrestrained water filling algorithm, and by the target pixel points
Gray value is set as default gray value.
3. according to the method described in claim 2, it is characterized in that, the method also includes:
First gray value is set by the gray value of the pixel of the default gray value;
Obtained image is determined as binary image to be processed, and returns to the execution picture based on second gray value
Vegetarian refreshments, by overflowing the step of water filling algorithm determines target pixel points.
4. according to the method described in claim 2, being filled out by unrestrained water it is characterized in that, described since the starting pixels point
It fills algorithm and determines target pixel points, and set default gray value for the gray value of the target pixel points, comprising:
Default gray value is set by the gray value of the starting pixels point;
Detect whether the neighbor pixel point adjacent with the starting pixels point is second gray value;
If so, the default gray value is set by the neighbor pixel, using the neighbor pixel as starting pixels
Point, and return execute the detection neighbor pixel point adjacent with the starting pixels point whether be second gray value step
Suddenly.
5. according to the method described in claim 2, it is characterized in that, it is described from the binary image to be processed choose described in
The pixel of second gray value, as starting pixels point, comprising:
According to preset order, the pixel in the binary image to be processed is traversed;
The pixel of second gray value traversed for the first time is determined as starting pixels point.
6. being obtained the method according to claim 1, wherein described carry out binary conversion treatment to image to be processed
Binary image to be processed, comprising:
Image to be processed is subjected to binary conversion treatment;
The picture smooth treatment of preset times is carried out to the image to be processed after binary conversion treatment;
By in the image to be processed after picture smooth treatment, other in addition to the second gray value described in first sum of the grayscale values
The pixel of gray value is set as first gray value, and obtained image is determined as binary image to be processed.
7. a kind of image processing apparatus, which is characterized in that described device includes:
Processing module obtains binary image to be processed for carrying out binary conversion treatment to image to be processed;Wherein, it is described to
Processing binary image includes: contour images region and non-contour images region, the pixel in the contour images region
Gray value is the first gray value, and the gray value of the pixel in the non-contour images region is the second gray value;
Determining module determines target pixel points by unrestrained water filling algorithm for the pixel based on second gray value;
Logging modle, for recording the target pixel points.
8. device according to claim 7, which is characterized in that the determining module is specifically used for:
The pixel that second gray value is chosen from the binary image to be processed, as starting pixels point;
Since the starting pixels point, target pixel points are determined by unrestrained water filling algorithm, and by the target pixel points
Gray value is set as default gray value.
9. device according to claim 8, which is characterized in that described device further include:
Setup module, for setting first gray value for the gray value of the pixel of the default gray value;
Determining module for obtained image to be determined as binary image to be processed, and triggers the determining module and is used for
The step of executing the pixel based on second gray value, target pixel points determined by unrestrained water filling algorithm.
10. device according to claim 8, which is characterized in that the determining module is specifically used for:
Default gray value is set by the gray value of the starting pixels point;
Detect whether the neighbor pixel point adjacent with the starting pixels point is second gray value;
If so, the default gray value is set by the neighbor pixel, using the neighbor pixel as starting pixels
Point, and return execute the detection neighbor pixel point adjacent with the starting pixels point whether be second gray value step
Suddenly.
Priority Applications (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811640194.6A CN109754379A (en) | 2018-12-29 | 2018-12-29 | Image processing method and device |
PCT/CN2019/124599 WO2020135056A1 (en) | 2018-12-29 | 2019-12-11 | Image processing method and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811640194.6A CN109754379A (en) | 2018-12-29 | 2018-12-29 | Image processing method and device |
Publications (1)
Publication Number | Publication Date |
---|---|
CN109754379A true CN109754379A (en) | 2019-05-14 |
Family
ID=66404424
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201811640194.6A Pending CN109754379A (en) | 2018-12-29 | 2018-12-29 | Image processing method and device |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN109754379A (en) |
WO (1) | WO2020135056A1 (en) |
Cited By (11)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110443820A (en) * | 2019-07-03 | 2019-11-12 | 平安科技(深圳)有限公司 | A kind of image processing method and device |
CN110969583A (en) * | 2019-09-11 | 2020-04-07 | 宁波江丰生物信息技术有限公司 | Image background processing method and system |
CN111260759A (en) * | 2020-01-10 | 2020-06-09 | 北京金山安全软件有限公司 | Path determination method and device |
WO2020135056A1 (en) * | 2018-12-29 | 2020-07-02 | 北京金山安全软件有限公司 | Image processing method and device |
CN111583157A (en) * | 2020-05-13 | 2020-08-25 | 杭州睿琪软件有限公司 | Image processing method, system and computer readable storage medium |
CN111753688A (en) * | 2020-06-12 | 2020-10-09 | 广州极飞科技有限公司 | Planting line center line determining method and device, electronic equipment and storage medium |
CN111767924A (en) * | 2020-07-03 | 2020-10-13 | 杭州睿琪软件有限公司 | Image processing method, image processing apparatus, electronic device, and storage medium |
CN111986277A (en) * | 2020-08-28 | 2020-11-24 | 计易数据科技(上海)有限公司 | Image local comparison method, device, equipment and medium based on gray value |
CN113688811A (en) * | 2021-10-26 | 2021-11-23 | 北京美摄网络科技有限公司 | Image processing method, image processing device, electronic equipment and storage medium |
CN115147442A (en) * | 2022-06-06 | 2022-10-04 | 浙江大华技术股份有限公司 | Grid pattern vectorization method, mobile terminal, electronic device, and medium |
CN118230939A (en) * | 2024-03-22 | 2024-06-21 | 陕西省结核病防治院(陕西省第五人民医院) | Method and system for constructing prediction model based on pulmonary tuberculosis ultrasonic contrast image |
Families Citing this family (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113506358A (en) * | 2021-07-15 | 2021-10-15 | 上海眼控科技股份有限公司 | Image annotation method, device, equipment and storage medium |
CN113888578A (en) * | 2021-09-26 | 2022-01-04 | 合肥高维数据技术有限公司 | Binarization method of self-adaptive weighted threshold value technology |
CN114549733A (en) * | 2022-02-08 | 2022-05-27 | 百果园技术(新加坡)有限公司 | Image processing method, device, equipment and medium |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102324020A (en) * | 2011-09-02 | 2012-01-18 | 北京新媒传信科技有限公司 | The recognition methods of area of skin color of human body and device |
CN103544469A (en) * | 2013-07-24 | 2014-01-29 | Tcl集团股份有限公司 | Fingertip detection method and device based on palm ranging |
CN104375175A (en) * | 2013-08-15 | 2015-02-25 | 中国石油天然气集团公司 | Automatic horizon tracking method adopting dip angle propagation method |
CN108694719A (en) * | 2017-04-05 | 2018-10-23 | 北京京东尚科信息技术有限公司 | image output method and device |
Family Cites Families (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101281112A (en) * | 2008-04-30 | 2008-10-08 | 浙江理工大学 | An image-based automatic analysis method for net-like sticky rice |
US8041139B2 (en) * | 2008-09-05 | 2011-10-18 | The Neat Company, Inc. | Method and apparatus for calculating the background color of an image |
CN108446706B (en) * | 2018-02-27 | 2021-01-19 | 西安交通大学 | Automatic abrasive grain material identification method based on principal component extraction of colors |
CN109754379A (en) * | 2018-12-29 | 2019-05-14 | 北京金山安全软件有限公司 | Image processing method and device |
-
2018
- 2018-12-29 CN CN201811640194.6A patent/CN109754379A/en active Pending
-
2019
- 2019-12-11 WO PCT/CN2019/124599 patent/WO2020135056A1/en active Application Filing
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102324020A (en) * | 2011-09-02 | 2012-01-18 | 北京新媒传信科技有限公司 | The recognition methods of area of skin color of human body and device |
CN103544469A (en) * | 2013-07-24 | 2014-01-29 | Tcl集团股份有限公司 | Fingertip detection method and device based on palm ranging |
CN104375175A (en) * | 2013-08-15 | 2015-02-25 | 中国石油天然气集团公司 | Automatic horizon tracking method adopting dip angle propagation method |
CN108694719A (en) * | 2017-04-05 | 2018-10-23 | 北京京东尚科信息技术有限公司 | image output method and device |
Cited By (17)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2020135056A1 (en) * | 2018-12-29 | 2020-07-02 | 北京金山安全软件有限公司 | Image processing method and device |
CN110443820A (en) * | 2019-07-03 | 2019-11-12 | 平安科技(深圳)有限公司 | A kind of image processing method and device |
CN110443820B (en) * | 2019-07-03 | 2023-07-14 | 平安科技(深圳)有限公司 | Image processing method and device |
CN110969583A (en) * | 2019-09-11 | 2020-04-07 | 宁波江丰生物信息技术有限公司 | Image background processing method and system |
CN111260759B (en) * | 2020-01-10 | 2023-02-24 | 北京金山安全软件有限公司 | Path determination method and device |
CN111260759A (en) * | 2020-01-10 | 2020-06-09 | 北京金山安全软件有限公司 | Path determination method and device |
CN111583157A (en) * | 2020-05-13 | 2020-08-25 | 杭州睿琪软件有限公司 | Image processing method, system and computer readable storage medium |
CN111583157B (en) * | 2020-05-13 | 2023-06-02 | 杭州睿琪软件有限公司 | Image processing method, system and computer readable storage medium |
CN111753688B (en) * | 2020-06-12 | 2022-03-18 | 广州极飞科技股份有限公司 | Planting line center line determining method and device, electronic equipment and storage medium |
CN111753688A (en) * | 2020-06-12 | 2020-10-09 | 广州极飞科技有限公司 | Planting line center line determining method and device, electronic equipment and storage medium |
CN111767924A (en) * | 2020-07-03 | 2020-10-13 | 杭州睿琪软件有限公司 | Image processing method, image processing apparatus, electronic device, and storage medium |
CN111767924B (en) * | 2020-07-03 | 2024-01-26 | 杭州睿琪软件有限公司 | Image processing method, image processing apparatus, electronic device, and storage medium |
CN111986277A (en) * | 2020-08-28 | 2020-11-24 | 计易数据科技(上海)有限公司 | Image local comparison method, device, equipment and medium based on gray value |
CN113688811A (en) * | 2021-10-26 | 2021-11-23 | 北京美摄网络科技有限公司 | Image processing method, image processing device, electronic equipment and storage medium |
CN113688811B (en) * | 2021-10-26 | 2022-04-08 | 北京美摄网络科技有限公司 | Image processing method, image processing device, electronic equipment and storage medium |
CN115147442A (en) * | 2022-06-06 | 2022-10-04 | 浙江大华技术股份有限公司 | Grid pattern vectorization method, mobile terminal, electronic device, and medium |
CN118230939A (en) * | 2024-03-22 | 2024-06-21 | 陕西省结核病防治院(陕西省第五人民医院) | Method and system for constructing prediction model based on pulmonary tuberculosis ultrasonic contrast image |
Also Published As
Publication number | Publication date |
---|---|
WO2020135056A1 (en) | 2020-07-02 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109754379A (en) | Image processing method and device | |
CN110060237B (en) | Fault detection method, device, equipment and system | |
EP3617938B1 (en) | Lane line processing method and device | |
US10872406B2 (en) | Hot spot defect detecting method and hot spot defect detecting system | |
Toh et al. | Automated fish counting using image processing | |
WO2018120038A1 (en) | Method and device for target detection | |
CN107622501B (en) | Boundary detection method for medical image | |
JP2016115331A (en) | Identifier generator, identifier generation method, quality determination apparatus, quality determination method and program | |
JP6811217B2 (en) | Crack identification method, crack identification device, crack identification system and program on concrete surface | |
CN104021553B (en) | A kind of sonar image object detection method based on pixel layering | |
CN115760820A (en) | Plastic part defect image identification method and application | |
CN113283439A (en) | Intelligent counting method, device and system based on image recognition | |
CN114299065B (en) | Method for detecting and grading defective appearance forming defects of silk ingots, storage medium and equipment | |
CN111354038A (en) | Anchor object detection method and device, electronic equipment and storage medium | |
CN113034447A (en) | Edge defect detection method and device | |
JP2020107290A (en) | Adhering matter detection device and adhering matter detection method | |
JP5264457B2 (en) | Object detection device | |
CN101750883B (en) | A method and device for detecting corner points of a hanging net image | |
JP2014126445A (en) | Alignment device, defect inspection device, alignment method and control program | |
JP2005165387A (en) | Screen streak defect detection method and apparatus, and display device | |
CN108229583A (en) | A kind of method and device of the fast Template Matching based on principal direction Differential Characteristics | |
CN113935927A (en) | Detection method, device and storage medium | |
CN116205835A (en) | Circuit board defect detection method, device and electronic equipment | |
JP2019087050A (en) | Structure maintenance management work support system | |
CN111695374B (en) | Method, system, medium and equipment for segmenting zebra crossing area in monitoring perspective |
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 | ||
TA01 | Transfer of patent application right | ||
TA01 | Transfer of patent application right |
Effective date of registration: 20200929 Address after: No.2202, 1st floor, building 2, No.7 Shixing street, Shijingshan District, Beijing 100041 (cluster registration) Applicant after: Super magic cube (Beijing) Technology Co.,Ltd. Address before: 100123 Building 8, Huitong Times Square, 1 South Road, Chaoyang District, Beijing. Applicant before: BEIJING KINGSOFT INTERNET SECURITY SOFTWARE Co.,Ltd. |
|
RJ01 | Rejection of invention patent application after publication | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20190514 |