Image processing optimization system and method based on big data
By using sample images in image processing technology to divide text and background areas, judge and delete blur areas, and typeset according to character spacing and line spacing, the problems of incomplete text extraction and irregular layout in traditional technology are solved, and efficient text extraction and precise layout of damaged documents are achieved.
Patent Information
- Application Number
- CN202411709337.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-27
- Publication Date
- 2025-03-14
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
When traditional image processing technology deals with damaged or stain-blocked document pages, it is impossible to extract the text content in its complete form, and the extracted text data may have irregular text layout, which leads to the inability to type in accordance with the original text format in the literature.
By selecting a page with complete character content from paper documents as sample images, preprocessing and dividing the text area and background area, calculate the grayscale value of each pixel point, obtain the grayscale value interval, determine whether there is a blurred area in the image file to be identified, and delete the blurred area. Finally, extract the characters and type it according to the character spacing, line spacing and font size.
It realizes the complete extraction of the text content in the document pages covered by damaged or stains, and can accurately type the text according to the original text format in the document, solving the problems of incomplete identification and irregular layout in traditional technology.
Smart Images

Figure CN119625765A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image processing technology, and in particular to an image processing optimization system and method based on big data. Background Art
[0002] With the development of information technology, more and more libraries have begun to digitize documents, aiming to provide more convenient access methods while ensuring the long-term preservation and use of documents. When digitizing documents, the documents are photographed into images, and the text contained in the images is identified and extracted through image processing technology, and converted into text information that can be recognized and processed by computers. However, traditional image processing technology has the following problems when extracting text from images: some pages of documents are damaged or the text is blocked by stains, resulting in incomplete content extracted by image processing technology; at the same time, the text data extracted by existing image processing technology may have irregular text layout, resulting in the inability to typeset the text according to the original text format in the document. Summary of the invention
[0003] The purpose of the present invention is to provide an image processing optimization system and method based on big data to solve the problems raised in the prior art.
[0004] To achieve the above object, the present invention provides the following technical solution, an image processing optimization method based on big data, the optimization method comprising:
[0005] Step S1: selecting a book page with complete character content from a paper document, capturing an image of the book page through an image capture device, and setting the image as a sample image;
[0006] Step S2: pre-processing the sample image and dividing it into a text area and a background area;
[0007] Step S3: Calculate the grayscale value of each pixel in the text area and the background area, and obtain the grayscale value interval of the pixel in the text area and the grayscale value interval of the pixel in the background area;
[0008] Step S4: collecting images of all pages in the paper document by an image acquisition device, sorting the images according to the page number sequence of the pages, and establishing an image file to be identified;
[0009] Step S5: judging the fuzzy area contained in the image file to be identified according to the grayscale value interval of the pixel points in the text area and the grayscale value interval of the pixel points in the background area in the sample image;
[0010] Step S6: deleting the fuzzy area contained in each page image in the image file to be identified;
[0011] Step S7: extracting characters from the image file to be recognized with the fuzzy area deleted, and typeset the characters.
[0012] Furthermore, the process of dividing the text area and the background area in step S2 includes:
[0013] Step S2-1: preprocessing the sample image, and converting the preprocessed sample image into a grayscale image;
[0014] The preprocessed image is converted into a grayscale image. This step removes the color information in the image and only retains the brightness information, which simplifies the complexity of subsequent processing.
[0015] Step S2-2: Calculate the gradient value of each pixel in the grayscale image by using an edge detection operator;
[0016] Step S2-3: Compare the gradient value of each pixel in the grayscale image with the gradient values of the pixels along the gradient direction and in the direction opposite to the gradient direction. If the gradient value of the current pixel is not a local maximum, suppress the gradient value of the current pixel to zero.
[0017] Step S2-4: Connect the pixel points with non-zero gradient values into continuous edge lines, the area wrapped by the edge lines is the text area, and the area outside the text area is the background area.
[0018] In the above steps, a book page image with complete character content is selected from the paper document as the sample image because the sample image only contains two parts: the text area and the background area. The grayscale value range of the pixels in the text area and the background area is constrained by the limited shooting environment, and the text area and the background area are divided from the sample image, which facilitates the subsequent calculation of the grayscale value of the pixel points.
[0019] Furthermore, the process of obtaining the grayscale value interval of the pixel points in the text area and the grayscale value interval of the pixel points in the background area in step S3 includes:
[0020] Step S3-1: Use image processing tools to traverse each pixel in the text area and calculate the grayscale value of each pixel according to the formula Gray 1 =ω 1 R 1 +ω 2 G 1 +ω 3 B 1 ;
[0021] Among them, Gray 1 is the gray value of each pixel in the text area, R 1is the channel value corresponding to the red channel of each pixel in the text area, G 1 is the channel value corresponding to the green channel of each pixel in the text area, B 1 is the channel value corresponding to the blue channel of each pixel in the text area, ω 1 ,ω 2 ,ω 3 R 1 , G 1 , B 1 The corresponding weight;
[0022] Step S3-2: Compare the grayscale values by a comparator and select the maximum grayscale value Gray 1max and minimum gray value Gray 1min , then the grayscale value interval of the text area is [Gray 1min Gray 1max ];
[0023] Step S3-3: Use image processing tools to traverse each pixel in the background area and calculate the grayscale value of each pixel according to the formula Gray 2 =ω 1 R 2 +ω 2 G 2 +ω 3 B 2 ;
[0024] Among them, Gray 2 is the gray value of each pixel in the background area, R 2 is the channel value corresponding to the red channel of each pixel in the background area, G 2 is the channel value corresponding to the green channel of each pixel in the background area, B 2 is the channel value corresponding to the blue channel of each pixel in the background area, ω 1 ,ω 2 ,ω 3 R 2 , G 2 , B 2 The corresponding weight;
[0025] Step S3-4: Compare the grayscale values of each pixel in the background area through a comparator, and select the maximum grayscale value Gray 2max and minimum gray value Gray 2min , then the gray value interval of the background area is [Gray 2min ,Gray 2max ].
[0026] The above steps are to calculate the grayscale values of the pixels in the text area and the background area, and to count the grayscale value intervals of the pixels in the text area and the background area, so as to pave the way for the subsequent determination of the fuzzy area in the image file to be identified.
[0027] Furthermore, the process of determining the fuzzy area contained in the image file to be identified in step S5 includes:
[0028] Step S5-1: pre-processing each page of the image to be identified in the image file to be identified and converting it into a grayscale image;
[0029] Step S5-2: Calculate the grayscale value corresponding to each pixel in each page of the grayscale image;
[0030] Step S5-3: According to the grayscale value interval of the text area, the grayscale value corresponding to each pixel in each page of the grayscale image is traversed, and the pixel whose grayscale value is in the grayscale value interval is marked with a first characteristic symbol;
[0031] Step S5-4: according to the gray value interval of the background area, the gray value corresponding to each pixel in each page of the gray image is traversed, and the pixel whose gray value is in the gray value interval is marked with a second characteristic symbol;
[0032] Step S5-5: deleting the pixel points marked with the first characteristic symbol and the pixel points marked with the second characteristic symbol in each page of the grayscale image;
[0033] Step S5-6: Use image processing software to traverse the remaining pixel points in each page of the grayscale image. If the number of remaining pixel points in the currently traversed grayscale image is zero, there is no blurred area in the grayscale image. If the number of remaining pixel points in the currently traversed grayscale image is not zero, there is a blurred area in the grayscale image. Connect the pixel points into continuous edge lines, and the area wrapped by the edge lines is the blurred area.
[0034] The image file to be identified in the above steps refers to the image file to be identified that is collected in the order of the page numbers of the paper document and constitutes a picture document with page numbers. There may be blurred areas in each page of the picture document that hinder the extraction of text. Therefore, a judgment is made on whether there is a blurred area in each page of the image document based on the grayscale value range of the pixels in the text area and background area mentioned above.
[0035] Furthermore, the process of deleting the pixels in the blurred area in step S6 includes:
[0036] Step S6-1: marking the pixel points in the blurred area of each page of the grayscale image with a third characteristic symbol;
[0037] Step S6-2: using image processing software to delete the pixels marked with the third characteristic symbol in each page of the grayscale image;
[0038] Step S6-3: Fill in the positions of the deleted pixels in the blurred area with characteristic pixels using image processing software.
[0039] The above steps are to delete the fuzzy areas in each page of the image document. At the same time, the pixels in the fuzzy areas can be replaced with feature pixels. Feature pixels can be pixels that can be recognized by the system, which can avoid the system reporting errors when extracting text.
[0040] Furthermore, the process of extracting the characters contained in the text area in step S7 includes:
[0041] Step S7-1: using an image segmentation algorithm to draw a segmentation frame for each character contained in the text area, and each character is within a segmentation frame;
[0042] Step S7-2: representing the position of each character by the row position and column position of the character in the text area;
[0043] Step S7-3: measuring the distance between the segmentation boxes corresponding to each line of characters in the text area and calculating the average value of the distance;
[0044] Step S7-4: taking a weighted average of the distances of each row to obtain the character spacing of the text area;
[0045] Step S7-5: measuring the distance between the segmentation boxes corresponding to each column of characters in the text area and calculating the average value of the distance;
[0046] Step S7-6: taking a weighted average of the distances in each column to obtain the row spacing of the text area;
[0047] Step S7-7: obtaining the area of the segmentation box corresponding to each character in the text area by using a feature extraction technique, and performing weighted average of the area of the segmentation box corresponding to each character to obtain the font size of the character in the text area;
[0048] Step S7-8: typeset the characters contained in the text area according to the character coordinates, font size, character spacing and line spacing.
[0049] Each character in the above steps is limited by a text box, and the size of the text box is the same as the size of the character. By calculating the area of the text box, the font size can be obtained, where the font size is expressed by font size. In addition, by calculating the character spacing and line spacing, the characters are typeset according to the row and column coordinates of the font, which limits the position of each character in the document and avoids format errors.
[0050] In order to better implement the above method, an image processing optimization system based on big data is also proposed. The optimization system includes: image acquisition module, preprocessing module, image segmentation module, character extraction module, and character typesetting module;
[0051] An image acquisition module acquires sample images and image files to be identified through an image acquisition device;
[0052] A preprocessing module, preprocessing the sample image and each page image in the image file to be identified and converting the sample image and each page image in the image file to be identified into a grayscale image;
[0053] The image segmentation module uses edge detection algorithms to divide the text area and background area from the sample image, and uses image processing tools to traverse all the pixels contained in each page of the image file to be identified to determine whether there is a fuzzy area;
[0054] A character extraction module, which draws a segmentation frame for each character contained in the text area through an image segmentation algorithm, calculates the character spacing and line spacing through the distance between the segmentation frames, and calculates the font size according to the area of each segmentation frame;
[0055] The character layout module extracts each character in turn according to the position of the character coordinates, and layouts the characters according to the font size, character spacing and line spacing of the characters in the text area.
[0056] Furthermore, the image acquisition module includes a sample image acquisition unit and a to-be-identified image acquisition unit;
[0057] A sample image acquisition unit, which acquires an image of a page of complete character content in a paper document through an image acquisition device, and sets the image as a sample image;
[0058] The image acquisition unit to be identified acquires images of all pages in the paper document through an image acquisition device, sorts the images according to the page number sequence of the pages, and establishes an image file to be identified.
[0059] Furthermore, the image segmentation module includes a text and background area segmentation unit and a fuzzy area judgment unit;
[0060] The text and background area segmentation unit divides the text area and the background area from the sample image by using an edge detection algorithm;
[0061] The fuzzy area determination unit traverses each page of the image in the to-be-identified image file to determine whether there is a fuzzy area in each page of the image.
[0062] Furthermore, the character extraction module includes a character spacing calculation unit, a line spacing calculation unit, and a font size calculation unit;
[0063] A character spacing calculation unit, which measures the distance between the segmentation boxes corresponding to each row of characters in the text area and calculates the average value of the distance, and performs weighted average of the average value of the distance for each row to obtain the character spacing of the text area;
[0064] A line spacing calculation unit, which measures the distance between the segmentation boxes corresponding to each column of characters in the text area and calculates the average value of the distances, and performs weighted average of the average values of the distances in each column to obtain the line spacing of the text area;
[0065] The font size calculation unit calculates the area of the segmentation box corresponding to each character in the text area, and performs weighted average of the area of the segmentation box corresponding to each character to obtain the font size of the character in the text area.
[0066] Compared with the prior art, the present invention has the following beneficial effects:
[0067] 1. Identify the blurred areas contained in the image
[0068] Traditional image processing technology is often unable to completely extract the text content when processing damaged or stained document pages, which causes the image processing system to malfunction. The present invention, through a carefully designed fuzzy area judgment unit, can detect the fuzzy areas in the pages, and can accurately identify and remove the fuzzy areas in the image.
[0069] 2. Optimize text layout
[0070] The text data extracted by the existing image processing technology may have the problem of irregular text layout, which makes it impossible to typeset according to the original text format in the document. However, the present invention can accurately measure and extract the character information in the text area through the character spacing calculation unit, line spacing calculation unit, and font size calculation unit in the character extraction module. This information is passed to the character typesetting module for accurately typeset the extracted characters according to the original text format. BRIEF DESCRIPTION OF THE DRAWINGS
[0071] Figure 1 It is a schematic diagram of the method of the present invention;
[0072] Figure 2 It is a structural schematic diagram of the present invention. DETAILED DESCRIPTION
[0073] Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in the field without making any creative work shall fall within the scope of protection of the present invention.
[0074] Example: Figure 1-Figure 2 As shown, the present invention provides a technical solution, an image processing optimization method based on big data, and the optimization method includes:
[0075] Step S1: selecting a book page with complete character content from a paper document, capturing an image of the book page through an image capture device, and setting the image as a sample image;
[0076] In an embodiment of the present invention, a document which is very old and has some yellowed and slightly worn pages is selected, and a yellowed page which is intact and not damaged is selected from the document. A sample image is collected by a scanner in a laboratory environment.
[0077] Step S2: pre-processing the sample image and dividing it into a text area and a background area;
[0078] The process of dividing the text area and the background area in step S2 includes:
[0079] Step S2-1: preprocessing the sample image, and converting the preprocessed sample image into a grayscale image;
[0080] Step S2-2: Calculate the gradient value of each pixel in the grayscale image by using an edge detection operator;
[0081] Step S2-3: Compare the gradient value of each pixel in the grayscale image with the gradient values of the pixels along the gradient direction and in the direction opposite to the gradient direction. If the gradient value of the current pixel is not a local maximum, suppress the gradient value of the current pixel to zero.
[0082] Step S2-4: Connect the pixel points with non-zero gradient values into continuous edge lines, the area wrapped by the edge lines is the text area, and the area outside the text area is the background area.
[0083] In an embodiment of the present invention, the collected sample image is first preprocessed, including denoising, brightness and contrast correction, etc., to ensure that the image quality is suitable for subsequent processing, and then the preprocessed image is converted into a grayscale image, and then the Canny edge detection operator is used to perform edge detection on the grayscale image of the sample image to divide the text area and the background area.
[0084] Step S3: Calculate the grayscale value of each pixel in the text area and the background area, and obtain the grayscale value interval of the pixel in the text area and the grayscale value interval of the pixel in the background area;
[0085] The process of obtaining the grayscale value interval of the pixel points in the text area and the grayscale value interval of the pixel points in the background area in step S3 includes:
[0086] Step S3-1: Use image processing tools to traverse each pixel in the text area and calculate the grayscale value of each pixel according to the formula Gray 1 =ω 1 R 1 +ω 2 G 1 +ω 3 B 1 ;
[0087] Among them, Gray 1 is the gray value of each pixel in the text area, R 1 is the channel value corresponding to the red channel of each pixel in the text area, G 1 is the channel value corresponding to the green channel of each pixel in the text area, B 1 is the channel value corresponding to the blue channel of each pixel in the text area, ω 1 ,ω 2 ,ω 3 R 1 , G 1 , B 1 The corresponding weight;
[0088] Step S3-2: Compare the grayscale values by a comparator and select the maximum grayscale value Gray 1max and minimum gray value Gray 1min , then the grayscale value interval of the text area is [Gray 1min Gray 1max ];
[0089] Step S3-3: Use image processing tools to traverse each pixel in the background area and calculate the grayscale value of each pixel according to the formula Gray2 = ω 1 R 2 +ω 2 G 2 +ω 3 B 2 ;
[0090] Among them, Gray 2 is the gray value of each pixel in the background area, R2 is the channel value corresponding to the red channel of each pixel in the background area, G 2 is the channel value corresponding to the green channel of each pixel in the background area, B 2 is the channel value corresponding to the blue channel of each pixel in the background area, ω 1 ,ω 2 ,ω 3 R 2 , G 2 , B 2 The corresponding weight;
[0091] Step S3-4: Compare the grayscale values of each pixel in the background area through a comparator, and select the maximum grayscale value Gray 2max and minimum gray value Gray 2min , then the gray value interval of the background area is [Gray 2min Gray 2max ].
[0092] In an embodiment of the present invention, the gray value of each pixel in the sample image is calculated according to the gray value calculation formula, where ω 1 ,ω 2 ,ω 3 The values of are 0.299, 0.587, and 0.114 respectively, and the grayscale values of the text area and the background area are counted to obtain the grayscale value interval of the pixels in the text area and the grayscale value interval of the pixels in the background area, which provides a reference for the subsequent judgment of the fuzzy area.
[0093] Step S4: The images of all the pages in the paper document are collected by an image collection device, and the images are sorted according to the page number sequence of the pages to create an image file to be identified.
[0094] Step S5: identifying the image file to be identified, and determining the fuzzy area contained in the image file to be identified;
[0095] The process of determining the fuzzy area contained in the image file to be identified in step S5 includes:
[0096] Step S5-1: pre-processing each page of the image to be identified in the image file to be identified and converting it into a grayscale image;
[0097] Step S5-2: Calculate the grayscale value corresponding to each pixel in each page of the grayscale image;
[0098] Step S5-3: According to the grayscale value interval of the text area, the grayscale value corresponding to each pixel in each page of the grayscale image is traversed, and the pixel whose grayscale value is in the grayscale value interval is marked with a first characteristic symbol;
[0099] Step S5-4: according to the gray value interval of the background area, the gray value corresponding to each pixel in each page of the gray image is traversed, and the pixel whose gray value is in the gray value interval is marked with a second characteristic symbol;
[0100] Step S5-5: deleting the pixel points marked with the first characteristic symbol and the pixel points marked with the second characteristic symbol in each page of the grayscale image;
[0101] Step S5-6: Use image processing software to traverse the remaining pixel points in each page of the grayscale image. If the number of remaining pixel points in the currently traversed grayscale image is zero, there is no blurred area in the grayscale image. If the number of remaining pixel points in the currently traversed grayscale image is not zero, there is a blurred area in the grayscale image. Connect the pixel points into continuous edge lines, and the area wrapped by the edge lines is the blurred area.
[0102] In an embodiment of the present invention, an image of each page of the above-mentioned document is collected by a scanner in a laboratory environment to generate an image file to be identified, the image to be identified is preprocessed and converted into a grayscale image, and the grayscale value of the grayscale image is calculated, and the pixels in the grayscale value interval of the text area are marked with a first characteristic symbol, such as marked as 1, and the pixels in the grayscale value interval of the background area are marked with a second characteristic symbol, such as marked as 0, and then the pixels marked as 1 and 0 are deleted, and then the remaining pixels are traversed, and it is determined whether there is a fuzzy area according to the number of remaining pixels.
[0103] Step S6: deleting the fuzzy area contained in each page image in the image file to be identified;
[0104] The process of deleting the pixels in the blurred area in step S6 includes:
[0105] Step S6-1: marking the pixel points in the blurred area of each page of the grayscale image with a third characteristic symbol;
[0106] Step S6-2: using image processing software to delete the pixels marked with the third characteristic symbol in each page of the grayscale image;
[0107] Step S6-3: Fill in the positions of the deleted pixels in the blurred area with characteristic pixels using image processing software.
[0108] Step S7: extracting characters from the image file to be recognized with the fuzzy area deleted, and typeset the characters;
[0109] The process of extracting the characters contained in the text area in step S7 includes:
[0110] Step S7-1: using an image segmentation algorithm to draw a segmentation frame for each character contained in the text area, and each character is within a segmentation frame;
[0111] Step S7-2: representing the position of each character by the row position and column position of the character in the text area;
[0112] Step S7-3: measuring the distance between the segmentation boxes corresponding to each line of characters in the text area and calculating the average value of the distance;
[0113] Step S7-4: taking a weighted average of the distances of each row to obtain the character spacing of the text area;
[0114] Step S7-5: measuring the distance between the segmentation boxes corresponding to each column of characters in the text area and calculating the average value of the distance;
[0115] Step S7-6: taking a weighted average of the distances in each column to obtain the row spacing of the text area;
[0116] Step S7-7: obtaining the area of the segmentation box corresponding to each character in the text area by using a feature extraction technique, and performing weighted average of the area of the segmentation box corresponding to each character to obtain the font size of the character in the text area;
[0117] Step S7-8: typeset the characters contained in the text area according to the character coordinates, font size, character spacing and line spacing.
[0118] In an embodiment of the present invention, the characters in each page image are individually framed out through a character segmentation algorithm, and the positions of the characters are represented by coordinates. The character spacing and line spacing are calculated by measuring the distance between each row and column of character segmentation frames. At the same time, the size of the characters is obtained by measuring the area of each segmentation frame. Finally, the characters are typeset according to the character coordinates, font size, character spacing and line spacing to ensure that the characters are arranged neatly and the spacing is reasonable.
[0119] In order to better implement the above method, the present invention also provides an image processing optimization system based on big data, the optimization system includes: an image acquisition module, a preprocessing module, an image segmentation module, a character extraction module, and a character typesetting module;
[0120] An image acquisition module acquires sample images and image files to be identified through an image acquisition device;
[0121] A preprocessing module, preprocessing the sample image and each page image in the image file to be identified and converting the sample image and each page image in the image file to be identified into a grayscale image;
[0122] The image segmentation module uses edge detection algorithms to divide the text area and background area from the sample image, and uses image processing tools to traverse all the pixels contained in each page of the image file to be identified to determine whether there is a fuzzy area;
[0123] A character extraction module, which draws a segmentation frame for each character contained in the text area through an image segmentation algorithm, calculates the character spacing and line spacing through the distance between the segmentation frames, and calculates the font size according to the area of each segmentation frame;
[0124] The character layout module extracts each character in turn according to the position of the character coordinates, and layouts the characters according to the font size, character spacing and line spacing of the characters in the text area.
[0125] Among them, the image acquisition module includes a sample image acquisition unit and a to-be-identified image acquisition unit;
[0126] A sample image acquisition unit, which acquires an image of a page of complete character content in a paper document through an image acquisition device, and sets the image as a sample image;
[0127] The image acquisition unit to be identified acquires images of all pages in the paper document through an image acquisition device, sorts the images according to the page number sequence of the pages, and establishes an image file to be identified.
[0128] Among them, the image segmentation module includes a text and background area segmentation unit and a fuzzy area judgment unit;
[0129] The text and background area segmentation unit divides the text area and the background area from the sample image by using an edge detection algorithm;
[0130] The fuzzy area determination unit traverses each page of the image in the to-be-identified image file to determine whether there is a fuzzy area in each page of the image.
[0131] Among them, the character extraction module includes a character spacing calculation unit, a line spacing calculation unit, and a font size calculation unit;
[0132] A character spacing calculation unit, which measures the distance between the segmentation boxes corresponding to each row of characters in the text area and calculates the average value of the distance, and performs weighted average of the average value of the distance for each row to obtain the character spacing of the text area;
[0133] A line spacing calculation unit, which measures the distance between the segmentation boxes corresponding to each column of characters in the text area and calculates the average value of the distances, and performs weighted average of the average values of the distances in each column to obtain the line spacing of the text area;
[0134] The font size calculation unit calculates the area of the segmentation box corresponding to each character in the text area, and performs weighted average of the area of the segmentation box corresponding to each character to obtain the font size of the character in the text area.
[0135] Finally, it should be noted that the above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art can still modify the technical solutions described in the aforementioned embodiments or replace some of the technical features therein by equivalents. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. An image processing optimization method based on big data, characterized in that: The optimization method comprises: Step S1: selecting a book page with complete character content from a paper document, capturing an image of the book page through an image capture device, and setting the image as a sample image; Step S2: pre-processing the sample image and dividing it into a text area and a background area; Step S3: Calculate the grayscale value of each pixel in the text area and the background area, and obtain the grayscale value interval of the pixel in the text area and the grayscale value interval of the pixel in the background area; Step S4: collecting images of all pages in the paper document by an image acquisition device, sorting the images according to the page number sequence of the pages, and establishing an image file to be identified; Step S5: judging the fuzzy area contained in the image file to be identified according to the grayscale value interval of the pixel points in the text area and the grayscale value interval of the pixel points in the background area in the sample image; Step S6: deleting the fuzzy area contained in each page image in the image file to be identified; Step S7: extracting characters from the image file to be recognized with the fuzzy area deleted, and typeset the characters.
2. The image processing optimization method based on big data according to claim 1, characterized in that: The process of dividing the text area and the background area in step S2 includes: Step S2-1: preprocessing the sample image, and converting the preprocessed sample image into a grayscale image; Step S2-2: Calculate the gradient value of each pixel in the grayscale image by using an edge detection operator; Step S2-3: Compare the gradient value of each pixel in the grayscale image with the gradient values of the pixels along the gradient direction and in the direction opposite to the gradient direction. If the gradient value of the current pixel is not a local maximum, suppress the gradient value of the current pixel to zero. Step S2-4: Connect the pixel points with non-zero gradient values into continuous edge lines, the area wrapped by the edge lines is the text area, and the area outside the text area is the background area.
3. The image processing optimization method based on big data according to claim 1, characterized in that: The process of obtaining the grayscale value interval of the pixel points in the text area and the grayscale value interval of the pixel points in the background area in step S3 includes: Step S3-1: using image processing tools, traverse each pixel in the text area and calculate the gray value of each pixel according to the formula Gray1=ω1R1+ω2G1+ω3B1; Among them, Gray1 is the gray value of each pixel in the text area, R1 is the channel value corresponding to the red channel of each pixel in the text area, G1 is the channel value corresponding to the green channel of each pixel in the text area, B1 is the channel value corresponding to the blue channel of each pixel in the text area, ω1, ω2, ω3 are the weights corresponding to R1, G1, B1 respectively; Step S3-2: Compare the gray values through a comparator to select the maximum gray value Gray 1max and minimum gray value Gray 1min , then the grayscale value interval of the text area is [Gray 1min ,Gray 1max ]; Step S3-3: using image processing tools, traverse each pixel in the background area and calculate the gray value of each pixel according to the formula Gray2=ω1R2+ω2C2+ω3B3; Among them, Gray2 is the gray value of each pixel in the background area, R2 is the channel value corresponding to the red channel of each pixel in the background area, G2 is the channel value corresponding to the green channel of each pixel in the background area, B2 is the channel value corresponding to the blue channel of each pixel in the background area, ω1, ω2, ω3 are the weights corresponding to R2, G2, B2 respectively; Step S3-4: Compare the grayscale values of each pixel in the background area through a comparator, and select the maximum grayscale value Gray 2max and minimum gray value Gray 2min , then the gray value interval of the background area is [Gray 2min ,Gray 2max ].
4. The image processing optimization method based on big data according to claim 1, characterized in that: The process of determining the fuzzy area contained in the image file to be identified in step S5 includes: Step S5-1: pre-processing each page of the image to be identified in the image file to be identified and converting it into a grayscale image; Step S5-2: Obtain the grayscale value corresponding to each pixel in each page of the grayscale image; Step S5-3: According to the grayscale value interval of the text area, the grayscale value corresponding to each pixel in each page of the grayscale image is traversed, and the pixel whose grayscale value is in the grayscale value interval is marked with a first characteristic symbol; Step S5-4: according to the gray value interval of the background area, the gray value corresponding to each pixel in each page of the gray image is traversed, and the pixel whose gray value is in the gray value interval is marked with a second characteristic symbol; Step S5-5: deleting the pixel points marked with the first characteristic symbol and the pixel points marked with the second characteristic symbol in each page of the grayscale image; Step S5-6: Use image processing software to traverse the remaining pixel points in each page of the grayscale image. If the number of remaining pixel points in the currently traversed grayscale image is zero, there is no blurred area in the grayscale image. If the number of remaining pixel points in the currently traversed grayscale image is not zero, there is a blurred area in the grayscale image. Connect the pixel points into continuous edge lines, and the area wrapped by the edge lines is the blurred area.
5. The image processing optimization method based on big data according to claim 1, characterized in that: The process of deleting the pixels in the blurred area in step S6 includes: Step S6-1: marking the pixel points in the blurred area of each page of the grayscale image with a third characteristic symbol; Step S6-2: using image processing software to delete the pixels marked with the third characteristic symbol in each page of the grayscale image; Step S6-3: Fill in the positions of the deleted pixels in the blurred area with characteristic pixels using image processing software.
6. The image processing optimization method based on big data according to claim 1, characterized in that: The process of typeset the characters in step S7 includes: Step S7-1: using an image segmentation algorithm to draw a segmentation frame for each character contained in the text area, and each character is within a segmentation frame; Step S7-2: representing the position of each character by the row position and column position of the character in the text area; Step S7-3: measuring the distance between the segmentation boxes corresponding to each line of characters in the text area and calculating the average value of the distance; Step S7-4: taking a weighted average of the distances of each row to obtain the character spacing of the text area; Step S7-5: measuring the distance between the segmentation boxes corresponding to each column of characters in the text area and calculating the average value of the distance; Step S7-6: taking a weighted average of the distances in each column to obtain the row spacing of the text area; Step S7-7: obtaining the area of the segmentation box corresponding to each character in the text area by using a feature extraction technique, and performing weighted average of the area of the segmentation box corresponding to each character to obtain the font size of the character in the text area; Step S7-8: typeset the characters contained in the text area according to the character coordinates, font size, character spacing and line spacing.
7. A big data-based image processing optimization system, used to execute the big data-based image processing optimization method according to any one of claims 1 to 6, characterized in that: The optimization system includes an image acquisition module, a preprocessing module, an image segmentation module, a character extraction module, and a character typesetting module; The image acquisition module acquires sample images and image files to be identified through an image acquisition device; The preprocessing module preprocesses the sample image and each page image in the image file to be identified and converts the sample image and each page image in the image file to be identified into a grayscale image; The image segmentation module uses an edge detection algorithm to divide the text area and the background area from the sample image, and uses an image processing tool to traverse all the pixel points contained in each page of the image file to be identified to determine whether there is a fuzzy area; The character extraction module draws a segmentation frame for each character contained in the text area through an image segmentation algorithm, calculates the character spacing and line spacing through the distance between the segmentation frames, and calculates the font size according to the area of each segmentation frame; The character layout module extracts each character in sequence according to the position of the character coordinates, and layouts the characters according to the font size, character spacing and line spacing of the characters in the text area.
8. The image processing optimization system based on big data according to claim 7, characterized in that: The image acquisition module includes a sample image acquisition unit and a to-be-identified image acquisition unit; The sample image acquisition unit acquires an image of a page of complete character content in a paper document through an image acquisition device, and sets the image as a sample image; The to-be-recognized image acquisition unit acquires images of all pages in the paper document through an image acquisition device, sorts the images according to the page number sequence of the pages, and establishes an to-be-recognized image file.
9. The image processing optimization system based on big data according to claim 7, characterized in that: The image segmentation module includes a text and background area segmentation unit and a fuzzy area judgment unit; The text and background area segmentation unit divides the text area and the background area from the sample image by using an edge detection algorithm; The fuzzy area determination unit traverses each page of the image in the to-be-recognized image file to determine whether there is a fuzzy area on each page of the image.
10. The image processing optimization system based on big data according to claim 7, characterized in that: The character extraction module includes a character spacing calculation unit, a line spacing calculation unit, and a font size calculation unit; The character spacing calculation unit measures the distance between the segmentation boxes corresponding to each row of characters in the text area and calculates the average value of the distances, and performs weighted average of the average value of the distances for each row to obtain the character spacing of the text area; The line spacing calculation unit measures the distance between the segmentation boxes corresponding to each column of characters in the text area and calculates the average value of the distances, and performs weighted average of the average values of the distances in each column to obtain the line spacing of the text area; The font size calculation unit calculates the area of the segmentation box corresponding to each character in the text area, and performs weighted average of the area of the segmentation box corresponding to each character to obtain the font size of the character in the text area.