CN110147765A - A kind of image processing method and device - Google Patents

A kind of image processing method and device Download PDF

Info

Publication number
CN110147765A
CN110147765A CN201910425235.8A CN201910425235A CN110147765A CN 110147765 A CN110147765 A CN 110147765A CN 201910425235 A CN201910425235 A CN 201910425235A CN 110147765 A CN110147765 A CN 110147765A
Authority
CN
China
Prior art keywords
pixel
gray value
length
pixels
reference 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.)
Granted
Application number
CN201910425235.8A
Other languages
Chinese (zh)
Other versions
CN110147765B (en
Inventor
璐轰匠
贺佳
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
New H3C Security Technologies Co Ltd
Original Assignee
New H3C Security Technologies Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by New H3C Security Technologies Co Ltd filed Critical New H3C Security Technologies Co Ltd
Priority to CN201910425235.8A priority Critical patent/CN110147765B/en
Publication of CN110147765A publication Critical patent/CN110147765A/en
Application granted granted Critical
Publication of CN110147765B publication Critical patent/CN110147765B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/20Image preprocessing
    • G06V10/30Noise filtering
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V30/00Character recognition; Recognising digital ink; Document-oriented image-based pattern recognition
    • G06V30/40Document-oriented image-based pattern recognition
    • G06V30/41Analysis of document content
    • G06V30/413Classification of content, e.g. text, photographs or tables
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V30/00Character recognition; Recognising digital ink; Document-oriented image-based pattern recognition
    • G06V30/10Character recognition

Landscapes

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

Abstract

This application provides a kind of image processing method and devices, are related to technical field of image processing, the method to simplify the table in removal picture.The application includes: to carry out gray proces to picture to be processed, obtains the corresponding gray scale picture of picture to be processed, gray scale picture includes multiple first pixels.When during the first pixel is expert at or in column, the gray value of the gray value reference point corresponding no more than each pixel of each pixel in continuous multiple pixels, and when continuously the first length in pixels of multiple pixels formation is not less than minimum straight-line detection length, the gray value of each pixel in continuous multiple pixels is respectively set to the gray value of the corresponding reference point of each pixel.Wherein, continuous multiple pixels include the first pixel, and the corresponding reference point of each pixel is the pixel with pixel apart from presetted pixel length.

Description

A kind of image processing method and device
Technical field
This application involves technical field of image processing, more particularly to a kind of image processing method and device.
Background technique
Optical character identification (Optical Character Recognition, OCR) technology can identify the text in image Word, and editable format is converted by the text in image.And the dry of table in picture is frequently encountered in OCR identification process It disturbs, the straight line using in Hough (hough) algorithm detection table general at present, and the straight line that will test removes, to reach Remove the purpose of the table in picture.
The straight line in picture can be effectively detected in this way, but the computational complexity being related to is higher, realize It is complex.
Summary of the invention
In view of this, the embodiment of the present application provides a kind of image processing method and device, to simplify the table in removal picture The method of lattice.Specific technical solution is as follows:
In a first aspect, the application provides a kind of image processing method, this method comprises:
Gray proces are carried out to picture to be processed, obtain the corresponding gray scale picture of picture to be processed, gray scale picture includes more A first pixel;
The gray value of each pixel is not during first pixel is expert at or in column, in continuous multiple pixels The gray value of reference point corresponding greater than each pixel, and the first length in pixels that continuous multiple pixels are formed is not less than most When small straight-line detection length, it is corresponding that the gray value of each pixel in continuous multiple pixels is respectively set to each pixel Reference point gray value;
Wherein, continuous multiple pixels include the first pixel, the corresponding reference point of each pixel be and pixel away from Pixel from presetted pixel length.
In one possible implementation, the gray value of each pixel in continuous multiple pixels is respectively set to The gray value of the corresponding reference point of each pixel, comprising:
According to specified sequence, to the first pixel be expert at or column in each pixel execute following default behaviour Make:
The gray value of the gray value of pixel reference point corresponding with pixel is compared;
If the gray value of pixel is not more than the gray value of the corresponding reference point of pixel, the first length in pixels is increased Preset value;
Judge whether the first length in pixels is not less than minimum straight-line detection length;
If the first length in pixels is not less than minimum straight-line detection length, continuous multiple pictures of the first length in pixels will be constituted In vegetarian refreshments, the gray value of each pixel is respectively set to the gray value of the corresponding reference point of each pixel.
In one possible implementation, by the gray value of the gray value of pixel reference point corresponding with pixel After being compared, this method further include:
If the gray value of pixel is greater than the gray value of the corresponding reference point of pixel, set the first length in pixels to Initial value, and according to specified sequence, to the first pixel be expert in or column in next pixel execute default behaviour Make.
In one possible implementation, judge the first length in pixels whether be not less than minimum detection straight length it Afterwards, this method further include:
It is expert at according to specified sequence to the first pixel if the first length in pixels is less than minimum straight-line detection length In or column in next pixel execute predetermined registration operation.
In one possible implementation, judge the first length in pixels whether be not less than minimum straight-line detection length it Before, this method further include:
The gray value of pixel binarization threshold corresponding with gray scale picture is compared;
If the gray value of pixel is not more than the gray value of the corresponding reference point of pixel, the first length in pixels is increased Preset value, comprising:
If the gray value of pixel is less than binarization threshold, and the gray value of pixel is not more than the corresponding reference of pixel First length in pixels is then increased preset value by the gray value of point.
Second aspect, the application provide a kind of image processing apparatus, which includes:
Gradation processing module obtains the corresponding grayscale image of picture to be processed for carrying out gray proces to picture to be processed Piece, gray scale picture include multiple first pixels;
Setup module, for during the first pixel is expert at or in column, continuous each pixel in multiple pixels The gray value of the gray value reference point corresponding no more than each pixel of point, and the first picture that continuous multiple pixels are formed When plain length is not less than minimum straight-line detection length, the gray value of each pixel in continuous multiple pixels is respectively set to The gray value of the corresponding reference point of each pixel;
Wherein, continuous multiple pixels include the first pixel, the corresponding reference point of each pixel be and pixel away from Pixel from presetted pixel length.
In one possible implementation, setup module is specifically used for:
According to specified sequence, to the first pixel be expert at or column in each pixel execute following default behaviour Make:
The gray value of the gray value of pixel reference point corresponding with pixel is compared;
If the gray value of pixel is not more than the gray value of the corresponding reference point of pixel, the first length in pixels is increased Preset value;
Judge whether the first length in pixels is not less than minimum straight-line detection length;
If the first length in pixels is not less than minimum straight-line detection length, continuous multiple pictures of the first length in pixels will be constituted In vegetarian refreshments, the gray value of each pixel is respectively set to the gray value of the corresponding reference point of each pixel.
In one possible implementation, setup module, if the gray value for being also used to pixel is corresponding greater than pixel Reference point gray value, then initial value is set by the first length in pixels, and according to specified sequence, to where the first pixel Next pixel in row or in column executes predetermined registration operation.
In one possible implementation, setup module, if being also used to the first length in pixels is less than minimum straight-line detection Length, then according to specified sequence, to the first pixel be expert in or column in next pixel execute predetermined registration operation.
In one possible implementation, setup module is also used to the gray value of pixel is corresponding with gray scale picture Binarization threshold be compared;
Setup module, if the gray value for being specifically also used to pixel is less than binarization threshold, and the gray value of pixel is not First length in pixels is then increased preset value by the gray value of reference point corresponding greater than pixel.
The third aspect, the application provide a kind of electronic equipment, which includes: that processor and machine readable storage are situated between Matter, the machine readable storage medium are stored with the machine-executable instruction that can be executed by the processor, the processor Promoted by the machine-executable instruction: realizing image processing method described in first aspect.
Fourth aspect, present invention also provides a kind of computer readable storage medium, in the computer readable storage medium It is stored with computer program, image processing method described in first aspect is realized when the computer program is executed by processor Method.
5th aspect, present invention also provides a kind of computer program products comprising instruction, when it is transported on computers When row, so that computer executes image processing method described in above-mentioned first aspect.
Therefore, using image processing method provided by the present application, electronic equipment carries out gray proces to picture to be processed, obtains It include multiple first pixels in gray scale picture to the corresponding gray scale picture of picture to be processed.Then, where the first pixel In capable or column, the gray value reference point corresponding no more than each pixel of each pixel in continuous multiple pixels Gray value, and when the first length in pixels for being formed of continuous multiple pixels is not less than minimum straight-line detection length, electronic equipment The gray value of each pixel in continuous multiple pixels is respectively set to the gray value of the corresponding reference point of each pixel.
As it can be seen that if in continuous multiple pixels each pixel gray value reference corresponding no more than each pixel The gray value of point illustrates that the color of continuous multiple pixels is deeper than the color of corresponding reference point;And continuous multiple pictures The first length in pixels that vegetarian refreshments is formed is not less than minimum straight-line detection length, illustrates that continuous multiple pixels form straight line. Therefore, by the way that the gray value of each pixel in continuous multiple pixels is respectively set to the corresponding reference point of each pixel Gray value, can be realized to continuous multiple groups of samples at straight line removal.In the process, only pass through simple gray scale Value size relation compares and the removal of straight line can be realized in the setting of gray value, and compared with the prior art, the application is not used Complicated algorithm simplifies the method removed to the table in picture.
Certainly, implement the application any product or method it is not absolutely required to and meanwhile reach all the above excellent Point.
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 illustrative diagram of gray scale picture provided by the embodiments of the present application;
Fig. 3 is a kind of structural schematic diagram of image processing apparatus provided by the embodiments of the present application;
Fig. 4 is the structural schematic diagram of a kind 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 remove the table in picture, the embodiment of the present application provides a kind of image processing method, as shown in Figure 1, the party Method is applied to electronic equipment, the equipment which can have image processing function for mobile phone, computer etc., this method packet It includes:
S101, gray proces are carried out to picture to be processed, obtains the corresponding gray scale picture of picture to be processed.
It optionally, include horizontal line, vertical line or the table formed by vertical and horizontal line in picture to be processed.
Wherein, picture to be processed may be color image, and the color of each pixel in color image is usually by RGB (red green blue, RGB) is indicated, the method for carrying out gray proces to color image is the gray value that each pixel is arranged, It also is understood as pixel original R, G, B being disposed as identical gray value.Maximum value process, mean value method can specifically be passed through Each pixel is converted gray scale by scheduling algorithm.
Wherein, maximum value process refers to gray value Gray of the maximum value in R, G, B of capture vegetarian refreshments as pixel.It is average Value method refers to the gray value Gray=(R+G+B)/3 for calculating pixel.
After determining the Gray of the pixel by above-mentioned algorithm, R, G, B of the pixel are replaced with into Gray.
Gray scale picture is typically shown as the gray scale from most furvous to most brilliant white, be included in gray scale picture black with it is white Multistage color depth between color.Color depth can indicate that wherein the gray value of the pixel of black is 0 with gray value, The gray value of white pixel point is 255, and the gray value of the pixel for the grey for including in gray scale picture is between 0 to 255.
It include multiple first pixels in gray scale picture in the embodiment of the present application, the first pixel is certain in gray scale picture The pixel for including in a line or a certain column.
Specifically, electronic equipment can carry out gray proces to picture to be processed, obtain prospect as dark color, background is light Gray scale picture, then the binarization threshold that maximum variance between clusters (OSTU) calculate the gray scale picture can be used in electronic equipment.
Wherein, binarization threshold is used to distinguish the prospect and background of gray scale picture, and in gray scale picture, gray value is less than two-value The pixel for changing threshold value is the prospect of gray scale picture, and the pixel that gray value is greater than binarization threshold is the background of gray scale picture.
S102, during the first pixel is expert at or in column, the gray scale of each pixel in continuous multiple pixels It is worth the gray value of reference point corresponding no more than each pixel, and the first length in pixels that continuous multiple pixels are formed is not When less than minimum straight-line detection length, the gray value of each pixel in continuous multiple pixels is respectively set to each pixel The gray value of the corresponding reference point of point.
Wherein, continuous multiple pixels include above-mentioned first pixel.The corresponding reference point of each pixel is and the picture Point of the vegetarian refreshments apart from presetted pixel length.
Presetted pixel length is pre-set minimum detection linear width, such as is represented by MIN_W, as an example, Its value is 2 pixels.
Specifically, electronic equipment is according to specified sequence, to the first pixel be expert at or column in each pixel Execute following predetermined registration operation:
The gray value of the gray value of pixel reference point corresponding with pixel is compared by step 1.
For example, as shown in Fig. 2, the first pixel be expert in a pixel (x3, y) and corresponding reference point is (x3, Y-MIN_W), the first pixel be expert in one other pixel point (x13, y) and corresponding reference point is (x13, y-MIN_W).
For another example pixel (x, a y in another the first pixel column3) corresponding reference point is (x- MIN_W, y3), one other pixel point (x, y in one other pixel point column13) corresponding reference point is (x-MIN_W, y13)。
It should be noted that the stain in Fig. 2 is used to indicate the position of pixel and reference point, it is practical in gray scale picture There is no the stains in Fig. 2.
With the first pixel be expert in a pixel (x3, y) and the corresponding reference point (x of the pixel3, y- MIN_W for), electronic equipment can be by (x3, y) gray value G (x3, y) and (x3, y-MIN_W) gray value G (x3, y-MIN_ W it) is compared.
If the gray value of step 2, pixel is not more than the gray value of the corresponding reference point of pixel, and the first pixel is long Degree increases preset value.
For example, if G (x1, y) and≤G (x1, y-MIN_W), then the first length in pixels is increased into preset value.
Wherein, the initial value of the first preset length is 0 pixel, and electronic equipment often detects the gray value of a pixel not First length in pixels is then increased preset value by the gray value of reference point corresponding greater than the pixel, such as preset value is 1 picture Element.
Optionally, in another embodiment, if the gray value of the pixel is greater than the corresponding reference point of the pixel Gray value, then set initial value for the first length in pixels, and according to specified sequence to the first pixel be expert in or institute Next pixel in column executes the predetermined registration operation, i.e., executes step 1 to step 4 to next pixel.
Wherein, if the gray value of a certain pixel is greater than the gray value of the corresponding reference point of the pixel, illustrate the pixel There is breakpoint, set initial for the first length in pixels at this time in the line segment that point is not belonging in gray scale picture, that is, the line segment detected Value, continues to test since next sampled point with the presence or absence of line segment.Wherein, initial value is 0 pixel.
If such as G (x1, y) and≤G (x1, y-MIN_W), G (x2, y) and≤G (x2, y-MIN_W) and G (x3, y) and≤G (x3, y- MIN_W), (x1, y), (x2, y), (x3, y) and the first length in pixels for constituting is 30 pixels, but G (x4, y) and > G (x4, y-MIN_ W), then 0 pixel is set by the first length in pixels.
Step 3 judges whether the first length in pixels is not less than minimum straight-line detection length.
In the embodiment of the present application, electronic equipment is every increases preset value for the first length in pixels, judges that the first pixel is long Whether degree is not less than minimum straight-line detection length.
Minimum straight-line detection length is used to indicate the minimum length of straight line, and the purpose that minimum straight-line detection length is arranged is to keep away Exempt to remove the stroke in text, i.e., minimum straight-line detection length is greater than the maximum length of stroke in text.
As an example, minimum straight-line detection length is 50 pixels.
If step 4, the first length in pixels are not less than minimum straight-line detection length, the continuous of the first length in pixels will be constituted In multiple pixels, the gray value of each pixel is respectively set to the gray value of the corresponding reference point of each pixel.
Wherein, if the first length in pixels is not less than minimum straight-line detection length, the company for constituting the first length in pixels is represented Continuing multiple sampled points is a line segment in gray scale picture, which may belong to certain a line or certain in the table of gray scale picture One column, so the line segment can be removed.
In order to remove the line segment, electronic equipment is by the continuous multiple pixels for constituting the first length in pixels, each pixel The gray value of point is respectively set to the gray value of the corresponding reference point of each pixel.
For example, if from (x1, y) start to detect, when detecting (x5, y) when, it determines that the first length in pixels is 50 pixels, then may be used Determine (x1, y) and to (x5, y) and one line segment of composition, then by G (x1, y) and it is set as G (x1, y-MIN_W), by G (x2, y) and it is set as G (x2, y-MIN_W), by G (x3, y) and it is set as G (x3, y-MIN_W), by G (x4, y) and it is set as G (x4, y-MIN_W), by G (x5, Y) it is set as G (x5, y-MIN_W).
It is understood that by G (x5, y) and it is set as G (x5, y-MIN_W) after, if subsequent detection is to G (x6, y) and≤G (x6, y-MIN_W), illustrate (x1, y) and to (x6, y) and it is continuous line segment, and (x1, y) and to (x5, y) and it has been removed, so at this time will G(x6, y) and it is set as G (x6, y-MIN_W), by (x6, y) and it removes.
Optionally, in another embodiment, if the first length in pixels is less than minimum straight-line detection length, according to finger Fixed sequence to the first pixel be expert in or column in next pixel execution predetermined registration operation, i.e., to next Pixel executes step 1 to step 4.
For example, if from (x1, y) start to detect, when detecting (x3, y) when, determine that the first length in pixels is 30 pixels, still First length in pixels is less than minimum 50 pixel of straight-line detection length, then can continue to (x4, y) execute step 1 to step 4 behaviour Make.
By above step as it can be seen that using image processing method provided by the embodiments of the present application, electronic equipment is to figure to be processed Piece carries out gray proces, obtains the corresponding gray scale picture of picture to be processed, includes multiple first pixels in gray scale picture.So Afterwards, when the first pixel is expert at or column in, the gray value of each pixel is no more than every in continuous multiple pixels The gray value of the corresponding reference point of a pixel, and the first length in pixels that continuous multiple pixels are formed is not less than minimum straight line When detecting length, the gray value of each pixel in continuous multiple pixels is respectively set to each pixel pair by electronic equipment The gray value for the reference point answered.
As it can be seen that if in continuous multiple pixels each pixel gray value reference corresponding no more than each pixel The gray value of point illustrates that the color of continuous multiple pixels is deeper than the color of corresponding reference point;And continuous multiple pictures The first length in pixels that vegetarian refreshments is formed is not less than minimum straight-line detection length, illustrates that continuous multiple pixels form straight line. Therefore, by the way that the gray value of each pixel in continuous multiple pixels is respectively set to the corresponding reference point of each pixel Gray value, can be realized to continuous multiple groups of samples at straight line removal.In the process, only pass through simple gray scale Value size relation compares and the removal of straight line can be realized in the setting of gray value, and compared with the prior art, the application is not used Complicated algorithm simplifies the method removed to the table in picture.
Optionally, in another embodiment, electronic equipment can also be by each pixel in continuous multiple pixels Gray value be compared with the binarization threshold of gray scale picture.
I.e. when meeting following three conditions, the gray value of each pixel in continuous multiple pixels is respectively set to The gray value of the corresponding reference point of each pixel.
The gray value of each pixel is respectively less than binarization threshold in condition 1, continuous multiple pixels.
The gray value of each pixel is corresponding no more than each pixel in condition 2, continuous multiple pixels The gray value of reference point.
The first length in pixels that condition 3, continuous multiple pixels are formed is not less than minimum straight-line detection length.
Wherein, condition 2 and condition 3 have been described above, and details are not described herein again.
For condition 1, before executing above-mentioned steps 3, electronic equipment is also by the gray value of pixel and gray scale picture pair The binarization threshold answered is compared.Correspondingly, in step 2, if the gray value of pixel is less than binarization threshold, and pixel The gray value of point is not more than the gray value of the corresponding reference point of pixel, then the first length in pixels is increased preset value.
I.e. compared to above step 2, electronic equipment also needs whether the gray value for judging pixel is less than binaryzation threshold Value is determining that the pixel belongs to prospect to judge whether pixel belongs to prospect, and the gray value of the pixel was no more than should In the case where the gray value of the corresponding reference point of pixel, the pixel that the pixel may belong in straight line just can determine Point.
For example, if the binarization threshold of the gray scale picture is G, in G (x1, y) and < G, and G (x1, y) and≤G (x1, y-MIN_ W in the case where), the first length in pixels is increased into preset value.
As it can be seen that illustrating that the pixel is gray scale if the gray value of pixel is less than the corresponding binarization threshold of gray scale picture The prospect of picture.If the gray value of the pixel is not more than the gray value of the corresponding reference point of the gray value, illustrate the pixel Color it is deeper than the color of reference point, can primarily determine the pixel that the pixel may belong in straight line.Therefore, exist Determine that the gray value of continuous multiple sampled points is all satisfied this above-mentioned two condition, and the length in pixels that continuous multiple pixels are constituted Greater than minimum straight-line detection length, illustrate the stroke in the straight line not instead of text of continuous multiple pixel compositions, grayscale image Straight line in piece may be specifically a row or column in the table of gray scale picture.And then electronic equipment is determining continuous more The straight line of a pixel composition is not the object that OCR technique needs to identify, and then the straight line is removed, to avoid straight in picture The interference that line identifies OCR.
In a kind of implementation of the embodiment of the present application, electronic equipment can be to every a line in gray scale picture and each After pixel in column completes a predetermined registration operation, by the gray scale picture before this treated gray scale picture and this processing It compares.
It specifically, can will be before the gray value of each pixel in this treated gray scale picture and this processing The gray value of each pixel in gray scale picture on corresponding position is compared.
If this time the gray value of each pixel in treated gray scale picture respectively with the corresponding position before this processing The gray value for each pixel set is identical, then the gray scale picture before explanation this time treated gray scale picture and this processing It is identical.
Conversely, if this time in treated gray scale picture there are the gray values of pixel and this corresponding position before handling The gray value of the pixel set is different, then the gray scale picture before explanation this time treated gray scale picture and this processing is not Together.
For example, by the pixel (x in this treated gray scale picture1, y1) gray value and this processing before gray scale Pixel (x in picture1, y1) gray value be compared, similarly by the pixel (x in this treated gray scale picture2, y2)、(x3, y3)……(xn, yn) gray value respectively with this processing before gray scale picture in pixel (x2, y2)、(x3, y3)……(xn, yn) gray value be compared, if all the same, before illustrating this time treated gray scale picture and this processing Gray scale picture it is identical.
At least one is different if it exists, such as (the x in this time treated gray scale picture3, y3) gray value and this at (the x in gray scale picture before reason3, y3) gray value it is different, then before explanation this time treated gray scale picture and this processing Gray scale picture is different.
By above-mentioned comparison, however, it is determined that this time treated, and gray scale picture is identical as the gray scale picture before this processing, then It determines and the processing of gray scale picture is completed.
Or, however, it is determined that this time treated, and gray scale picture is different from the gray scale picture before this processing, then repeats According to specified sequence, to the first pixel be expert at or column in each pixel execute above-mentioned predetermined registration operation the step of, After completing a predetermined registration operation to the pixel in every a line and each column in gray scale picture every time, by the gray scale before processing Gray scale picture is compared picture with treated, until determining the gray scale picture before processing, gray scale picture is identical with treated When, it determines and the processing of gray scale picture is completed.
Corresponding to above method embodiment, the embodiment of the present application also provides a kind of image processing apparatus, as shown in figure 3, should Device includes: gradation processing module 301 and setup module 302.
Gradation processing module 301 obtains the corresponding gray scale of picture to be processed for carrying out gray proces to picture to be processed Picture, gray scale picture include multiple first pixels;
Setup module 302, for during the first pixel is expert at or in column, continuous each picture in multiple pixels The gray value of the gray value of vegetarian refreshments reference point corresponding no more than each pixel, and the first of continuous multiple pixels formation When length in pixels is not less than minimum straight-line detection length, the gray value of each pixel in continuous multiple pixels is respectively set For the gray value of the corresponding reference point of each pixel;
Wherein, continuous multiple pixels include the first pixel, the corresponding reference point of each pixel be and pixel away from Pixel from presetted pixel length.
Optionally, setup module 302 are specifically used for:
According to specified sequence, to the first pixel be expert at or column in each pixel execute following default behaviour Make:
The gray value of the gray value of pixel reference point corresponding with pixel is compared;
If the gray value of pixel is not more than the gray value of the corresponding reference point of pixel, the first length in pixels is increased Preset value;
Judge whether the first length in pixels is not less than minimum straight-line detection length;
If the first length in pixels is not less than minimum straight-line detection length, continuous multiple pictures of the first length in pixels will be constituted In vegetarian refreshments, the gray value of each pixel is respectively set to the gray value of the corresponding reference point of each pixel.
Optionally, setup module 302, if the gray value for being also used to pixel is greater than the gray scale of the corresponding reference point of pixel Value then sets initial value for the first length in pixels, and according to specified sequence, to the first pixel be expert in or column in Next pixel execute predetermined registration operation.
Optionally, setup module 302, if being also used to the first length in pixels is less than minimum straight-line detection length, according to finger Fixed sequence, to the first pixel be expert in or column in next pixel execution predetermined registration operation.
Optionally, setup module 302, be also used to by the gray value of pixel binarization threshold corresponding with gray scale picture into Row compares;
Setup module 302, if the gray value for being specifically also used to pixel is less than binarization threshold, and the gray value of pixel First length in pixels is then increased preset value by the gray value of reference point corresponding no more than pixel.
The embodiment of the present application also provides a kind of electronic equipment, as shown in figure 4, include processor 401, communication interface 402, Memory 403 and communication bus 404, wherein processor 401, communication interface 402, memory 403 are complete by communication bus 404 At mutual communication,
Memory 403, for storing computer program;
Processor 401 when for executing the program stored on memory 403, is realized in above method embodiment by electricity The step of sub- equipment executes.
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.
In another embodiment provided by the present application, a kind of computer readable storage medium is additionally provided, which can It reads to be stored with computer program in storage medium, the computer program realizes any of the above-described image procossing when being executed by processor The step of method.
In another embodiment provided by the present application, a kind of computer program product comprising instruction is additionally provided, when it When running on computers, so that computer executes any image processing method in above-described embodiment.
In the above-described embodiments, can come wholly or partly by software, hardware, firmware or any combination thereof real It is existing.When implemented in software, it can entirely or partly realize in the form of a computer program product.The computer program Product includes one or more computer instructions.When loading on computers and executing the computer program instructions, all or It partly generates according to process or function described in the embodiment of the present application.The computer can be general purpose computer, dedicated meter Calculation machine, computer network or other programmable devices.The computer instruction can store in computer readable storage medium In, or from a computer readable storage medium to the transmission of another computer readable storage medium, for example, the computer Instruction can pass through wired (such as coaxial cable, optical fiber, number from a web-site, computer, server or data center User's line (DSL)) or wireless (such as infrared, wireless, microwave etc.) mode to another web-site, computer, server or Data center is transmitted.The computer readable storage medium can be any usable medium that computer can access or It is comprising data storage devices such as one or more usable mediums integrated server, data centers.The usable medium can be with It is magnetic medium, (for example, floppy disk, hard disk, tape), optical medium (for example, DVD) or semiconductor medium (such as solid state hard disk Solid State Disk (SSD)) etc..
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.Especially for device reality For applying example, since it is substantially similar to the method embodiment, so being described relatively simple, related place is referring to embodiment of the method Part explanation.
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:
Gray proces are carried out to picture to be processed, obtain the corresponding gray scale picture of the picture to be processed, the gray scale picture packet Include multiple first pixels;
The gray value of each pixel is not during first pixel is expert at or in column, in continuous multiple pixels The gray value of reference point corresponding greater than each pixel, and the first length in pixels that continuous multiple pixels are formed is not small When minimum straight-line detection length, the gray value of each pixel in continuous multiple pixels is respectively set to each picture The gray value of the corresponding reference point of vegetarian refreshments;
Wherein, continuous multiple pixels include first pixel, the corresponding reference point of each pixel be with Pixel of the pixel apart from presetted pixel length.
2. the method according to claim 1, wherein described by each pixel in continuous multiple pixels Gray value be respectively set to the gray value of the corresponding reference point of each pixel, comprising:
According to specified sequence, to first pixel be expert at or column in each pixel execute following default behaviour Make:
The gray value of the gray value of pixel reference point corresponding with the pixel is compared;
If the gray value of the pixel is not more than the gray value of the corresponding reference point of the pixel, by first pixel Length increases preset value;
Judge whether first length in pixels is not less than the minimum straight-line detection length;
If first length in pixels will constitute the company of first length in pixels not less than the minimum straight-line detection length Continue in multiple pixels, the gray value of each pixel is respectively set to the gray value of the corresponding reference point of each pixel.
3. according to the method described in claim 2, it is characterized in that, in the gray value by the pixel and the pixel After the gray value of the corresponding reference point of point is compared, the method also includes:
If the gray value of the pixel is greater than the gray value of the corresponding reference point of the pixel, and first pixel is long Degree is set as initial value, and according to the specified sequence, to first pixel be expert in or column in it is next Pixel executes the predetermined registration operation.
4. according to the method described in claim 2, it is characterized in that, judging whether first length in pixels is not less than described After the minimum detection straight length, the method also includes:
If first length in pixels is less than the minimum straight-line detection length, according to the specified sequence, to described first Next pixel during pixel is expert at or in column executes the predetermined registration operation.
5. the method according to claim 3 or 4, which is characterized in that whether not to judge first length in pixels described Before the minimum straight-line detection length, the method also includes:
The gray value of pixel binarization threshold corresponding with the gray scale picture is compared;
If the gray value of the pixel is not more than the gray value of the corresponding reference point of the pixel, by described first Length in pixels increases preset value, comprising:
If the gray value of the pixel is less than the binarization threshold, and the gray value of the pixel is not more than the pixel The gray value of the corresponding reference point of point, then increase the preset value for first length in pixels.
6. a kind of image processing apparatus, which is characterized in that described device includes:
Gradation processing module obtains the corresponding grayscale image of the picture to be processed for carrying out gray proces to picture to be processed Piece, the gray scale picture include multiple first pixels;
Setup module, for during first pixel is expert at or in column, continuous each pixel in multiple pixels The gray value of the gray value reference point corresponding no more than each pixel of point, and continuous multiple pixels formed the When one length in pixels is not less than minimum straight-line detection length, by the gray value point of each pixel in continuous multiple pixels It is not set as the gray value of the corresponding reference point of each pixel;
Wherein, continuous multiple pixels include first pixel, the corresponding reference point of each pixel be with Pixel of the pixel apart from presetted pixel length.
7. device according to claim 6, which is characterized in that the setup module is specifically used for:
According to specified sequence, to first pixel be expert at or column in each pixel execute following default behaviour Make:
The gray value of the gray value of pixel reference point corresponding with the pixel is compared;
If the gray value of the pixel is not more than the gray value of the corresponding reference point of the pixel, by first pixel Length increases preset value;
Judge whether first length in pixels is not less than the minimum straight-line detection length;
If first length in pixels will constitute the company of first length in pixels not less than the minimum straight-line detection length Continue in multiple pixels, the gray value of each pixel is respectively set to the gray value of the corresponding reference point of each pixel.
8. device according to claim 7, which is characterized in that
The setup module, if the gray value for being also used to the pixel is greater than the gray scale of the corresponding reference point of the pixel Value, then set initial value for first length in pixels, and according to the specified sequence, be expert to first pixel In or column in next pixel execute the predetermined registration operation.
9. device according to claim 7, which is characterized in that
The setup module, if being also used to first length in pixels is less than the minimum straight-line detection length, according to described Specified sequence, to first pixel be expert in or column in next pixel execution predetermined registration operation.
10. device according to claim 8 or claim 9, which is characterized in that
The setup module is also used to carry out the gray value of pixel binarization threshold corresponding with the gray scale picture Compare;
The setup module, if the gray value for being specifically also used to the pixel is less than the binarization threshold, and the pixel The gray value of point is not more than the gray value of the corresponding reference point of the pixel, then increases by first length in pixels described pre- If value.
CN201910425235.8A 2019-05-21 2019-05-21 Image processing method and device Active CN110147765B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910425235.8A CN110147765B (en) 2019-05-21 2019-05-21 Image processing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910425235.8A CN110147765B (en) 2019-05-21 2019-05-21 Image processing method and device

Publications (2)

Publication Number Publication Date
CN110147765A true CN110147765A (en) 2019-08-20
CN110147765B CN110147765B (en) 2021-05-28

Family

ID=67592627

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910425235.8A Active CN110147765B (en) 2019-05-21 2019-05-21 Image processing method and device

Country Status (1)

Country Link
CN (1) CN110147765B (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111160209A (en) * 2019-12-24 2020-05-15 北京爱医生智慧医疗科技有限公司 Method and device for eliminating noise line segments in text image
CN111414919A (en) * 2020-03-26 2020-07-14 遥相科技发展(北京)有限公司 Method, device and equipment for extracting characters from printed pictures with forms and storage medium

Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP1184808A2 (en) * 2000-08-29 2002-03-06 Eastman Kodak Company Method for detection of skew angle and border of document images in a production scanning environment
CN101246549A (en) * 2007-02-16 2008-08-20 富士通株式会社 Method and apparatus for recognizing boundary line in an image information
CN103646247A (en) * 2013-09-26 2014-03-19 惠州学院 Music score recognition method
CN104376318A (en) * 2013-08-15 2015-02-25 柯尼卡美能达美国研究所有限公司 Removal of underlines and table lines in document images while preserving intersecting character strokes
CN104424475A (en) * 2013-09-10 2015-03-18 阿里巴巴集团控股有限公司 Method and device for identifying stripe region in image
CN105069452A (en) * 2015-08-07 2015-11-18 武汉理工大学 Straight line removing method based on local structure analysis
CN105469026A (en) * 2014-09-30 2016-04-06 柯尼卡美能达美国研究所有限公司 Horizontal and vertical line detection and removal for document images
CN105868771A (en) * 2016-03-22 2016-08-17 维沃移动通信有限公司 Mobile terminal-based cross stripe image recognition method and mobile terminal
CN107590447A (en) * 2017-08-29 2018-01-16 北京奇艺世纪科技有限公司 A kind of caption recognition methods and device
CN109377451A (en) * 2018-08-28 2019-02-22 深圳蓝韵医学影像有限公司 Remove method, terminal and the storage medium of radioscopic image grid grid shadow

Patent Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP1184808A2 (en) * 2000-08-29 2002-03-06 Eastman Kodak Company Method for detection of skew angle and border of document images in a production scanning environment
CN101246549A (en) * 2007-02-16 2008-08-20 富士通株式会社 Method and apparatus for recognizing boundary line in an image information
CN104376318A (en) * 2013-08-15 2015-02-25 柯尼卡美能达美国研究所有限公司 Removal of underlines and table lines in document images while preserving intersecting character strokes
CN104424475A (en) * 2013-09-10 2015-03-18 阿里巴巴集团控股有限公司 Method and device for identifying stripe region in image
CN103646247A (en) * 2013-09-26 2014-03-19 惠州学院 Music score recognition method
CN105469026A (en) * 2014-09-30 2016-04-06 柯尼卡美能达美国研究所有限公司 Horizontal and vertical line detection and removal for document images
CN105069452A (en) * 2015-08-07 2015-11-18 武汉理工大学 Straight line removing method based on local structure analysis
CN105868771A (en) * 2016-03-22 2016-08-17 维沃移动通信有限公司 Mobile terminal-based cross stripe image recognition method and mobile terminal
CN107590447A (en) * 2017-08-29 2018-01-16 北京奇艺世纪科技有限公司 A kind of caption recognition methods and device
CN109377451A (en) * 2018-08-28 2019-02-22 深圳蓝韵医学影像有限公司 Remove method, terminal and the storage medium of radioscopic image grid grid shadow

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
刘长松,潘世言,郑治枫,丁晓青: ""一种表格框线检测和字线分离算法"", 《电子与信息学报》 *

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111160209A (en) * 2019-12-24 2020-05-15 北京爱医生智慧医疗科技有限公司 Method and device for eliminating noise line segments in text image
CN111160209B (en) * 2019-12-24 2023-07-25 北京爱医生智慧医疗科技有限公司 Method and device for eliminating noise line segments in text image
CN111414919A (en) * 2020-03-26 2020-07-14 遥相科技发展(北京)有限公司 Method, device and equipment for extracting characters from printed pictures with forms and storage medium
CN111414919B (en) * 2020-03-26 2023-12-12 广州市巨应信息科技有限公司 Method, device, equipment and storage medium for extracting text of printed body picture with table

Also Published As

Publication number Publication date
CN110147765B (en) 2021-05-28

Similar Documents

Publication Publication Date Title
US10896349B2 (en) Text detection method and apparatus, and storage medium
CN109142366B (en) Spherical shell defect detection method and device and computer readable storage medium
CN106920233B (en) Scratch detection method, apparatus and electronic equipment based on image procossing
CN109446061B (en) Page detection method, computer readable storage medium and terminal device
CN108615030A (en) A kind of title consistency detecting method, device and electronic equipment
CN110163786A (en) A kind of method, device and equipment removing watermark
CN110147765A (en) A kind of image processing method and device
CN111144337A (en) Fire detection method and device and terminal equipment
CN105761256B (en) The sub-pixel edge straight line acquisition methods and device of image
CN110708568A (en) Video content mutation detection method and device
CN109389110A (en) A kind of area determination method and device
CN105809117A (en) Information prompt method and user terminal
CN112883762A (en) Living body detection method, device, system and storage medium
CN113221601A (en) Character recognition method, device and computer readable storage medium
CN106951811A (en) A kind of image processing method and terminal
CN110969602A (en) Image definition detection method and device
CN108647570B (en) Zebra crossing detection method and device and computer readable storage medium
CN111311619A (en) Method and device for realizing slider verification
CN117557777A (en) Sample image determining method and device, electronic equipment and storage medium
US9070015B2 (en) System and method for iris detection in digital images
CN117078708A (en) Training method, device, equipment, medium and product for image detection and model
WO2021174506A1 (en) Image edge detection method and apparatus, and image signal processor
CN113628192B (en) Image blur detection method, apparatus, device, storage medium, and program product
CN113221742B (en) Video split screen line determining method, device, electronic equipment, medium and program product
CN113313642A (en) Image denoising method and device, storage medium and electronic equipment

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