Method, device and computer program product for processing document image data
Patent Information
- Application Number
- CN202611069373.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-17
- Publication Date
- 2026-10-16
AI Technical Summary
统一压缩策略无法兼顾上述差异化需求,易导致关键诊断特征模糊或引入压缩伪影,影响故障复判准确性,同时无差别的压缩参数设置还造成存储空间和传输带宽的浪费
[0015] The document image data processing method of this invention is applied to a server. The server is equipped with a manufacturing execution system. The document image data processing method obtains image data to be processed extracted from office documents, performs color space statistical operations on the image data to be processed to extract color distribution feature parameters, performs edge detection operations on the image data to be processed to extract corresponding distribution feature parameters, and determines the image content type of the image data to be processed according to preset classification judgment rules based on the color distribution feature parameters and edge distribution feature parameters. Then, according to the image content type, the corresponding target compression strategy is selected from a pre-configured set of differentiated compression strategies. Finally, the target compression strategy is used to perform compression processing on the image data to be processed to generate a compressed target image. In this way, by simultaneously extracting features from image data in both color space and edge structure dimensions, image data with different content attributes, such as photo type, screenshot type, chart type, and general type, can be automatically identified and classified. This allows various types of image data to be matched with differentiated parameters such as compression format, compression quality, color depth, and output size that are adapted to their content characteristics. As a result, the technical effects of not losing key diagnostic features after classification and compression, not introducing compression artifacts, and configuring storage and transmission resources on demand are achieved, significantly improving the processing efficiency of document image data and the fidelity of diagnostic information in the manufacturing execution system.
Smart Images

Figure CN122933920A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of document image data processing technology, and in particular to a method, apparatus and computer program product for processing document image data. Background Technology
[0002] In Manufacturing Execution System (MES) applications, the MES system is responsible for providing core functions such as operational status monitoring, diagnostic task scheduling, diagnostic report aggregation, and on-chain evidence storage for blockchain server fault diagnosis equipment. It also centrally manages various fault diagnosis devices distributed across the production line. The test results, defect images, and repair instructions output by the fault diagnosis equipment are typically generated as diagnostic reports in the form of office documents. These documents embed a large amount of key image data, which needs to be extracted and incorporated into the MES system for unified storage, traceability, and on-chain evidence storage.
[0003] However, current MES systems generally use a single compression algorithm to process image data extracted from office documents, without differentiating based on the image content type. Diagnostic reports contain actual photos of equipment, waveform charts, as well as labeled diagrams and textured areas. Different content types have drastically different requirements for fidelity and compression ratio. Photographic images need to maintain natural color transitions at high compression ratios, while chart images need to retain edge sharpness and line integrity to avoid blurring key data. A uniform compression strategy cannot accommodate these differentiated needs, easily leading to blurred key diagnostic features or introducing compression artifacts, affecting the accuracy of fault re-diagnosis. At the same time, indiscriminate compression parameter settings also waste storage space and transmission bandwidth. Summary of the Invention
[0004] The main objective of this invention is to provide a method for processing document image data, which aims to improve the processing efficiency and diagnostic information fidelity of document image data in manufacturing execution systems.
[0005] To achieve the above objectives, the present invention provides a method for processing document image data, applied on a server, wherein the server is equipped with a manufacturing execution system, and the method for processing document image data includes: Retrieve image data to be processed extracted from office documents; Perform color space statistical operations on the image data to be processed to extract color distribution feature parameters; Perform edge detection on the image data to be processed and extract the corresponding distribution feature parameters; Based on the color distribution feature parameters and the edge distribution feature parameters, the image content type of the image data to be processed is determined according to the preset classification and judgment rules; Based on the image content type, select the corresponding target compression strategy from the pre-configured set of differentiated compression strategies; The target compression strategy is used to compress the image data to be processed, generating a compressed target image.
[0006] Optionally, performing color space statistical operations on the image data to be processed to extract color distribution feature parameters includes: The image data to be processed is converted from the original color space to a uniform color space; Traverse all pixels of the image data to be processed, and for each pair of adjacent pixels, obtain the channel value of each channel in the uniform color space. Calculate the weighted difference between the channel values of each channel to obtain the color difference value between the adjacent pixels. Two adjacent pixels with a color difference value less than a preset color difference threshold are marked as approximately solid color pixels, and the total number of pixels that are determined to be approximately solid color pixels after deduplication is counted. Calculate the ratio of the total number of near-solid color pixels to the total number of pixels, and determine the solid color region proportion parameter.
[0007] Optionally, performing color space statistical operations on the image data to be processed to extract color distribution feature parameters further includes: The color space of the image data to be processed is quantized into a preset number of color buckets; Count the number of pixels that fall into each color bucket; The number of color buckets whose number of pixels exceeds a preset percentage threshold is determined as the effective color quantity parameter.
[0008] Optionally, performing color space statistical operations on the image data to be processed to extract color distribution feature parameters further includes: The number of pixels in the image data to be processed where at least one of the red, green, and blue channels exceeds a preset saturation threshold is counted. The ratio of the number of such pixels to the total number of pixels is calculated and determined as the percentage of high-saturation pixels.
[0009] Optionally, performing edge detection on the image data to be processed and extracting edge distribution feature parameters includes: Perform gradient intensity-based edge detection on the image data to be processed to generate a binary edge image; The ratio of the number of edge pixels to the total number of pixels in the binary edge image is statistically analyzed and determined as the edge pixel density parameter. Perform line segment detection on the binary edge image to identify line segments whose length exceeds a preset ratio of the side length of the image data to be processed; The number of identified straight line segments is counted and determined as the density parameter of the long straight line segments.
[0010] Optionally, performing edge detection on the image data to be processed and extracting edge distribution feature parameters further includes: In the binary edge image, the number of edge pixels with a gradient direction of horizontal and the number of edge pixels with a gradient direction of vertical are counted respectively. The ratio of the number of edge pixels in the horizontal direction to the number of edge pixels in the vertical direction is calculated and determined as the directional edge ratio parameter.
[0011] Optionally, determining the image content type of the image data to be processed based on the color distribution feature parameters and the edge distribution feature parameters according to a preset classification rule includes: When the solid color area ratio parameter exceeds the first color threshold and the effective color quantity parameter exceeds the second color threshold, the image content type is determined to be a photo type. When the proportion of high-saturation pixels exceeds the preset saturation judgment threshold and the density parameter of the long straight line segment is lower than the first structure threshold, the image content type is determined to be a screenshot type. When the edge pixel density parameter exceeds the second structure threshold or the long straight line segment density parameter exceeds the third structure threshold, the image content type is determined to be a chart type. When the color distribution feature parameter and the edge distribution feature parameter both fail to meet the determination conditions for any of the above photo type, screenshot type, and chart type, the image content type is determined to be a general type.
[0012] Optionally, selecting a corresponding target compression strategy from a pre-configured set of differentiated compression strategies based on the image content type includes: When the image content type is a photo, a first compression strategy is selected. The first compression strategy uses a lossy compression format, a first compression quality parameter, and a first output width parameter. When the image content type is a screenshot, the second compression strategy is selected. The second compression strategy uses a lossless compression format and low bit depth parameters. When the image content type is a chart, the third compression strategy is selected. The third compression strategy uses a lossless compression format and keeps the original compression parameters unchanged. When the image content type is a general type, the default compression strategy is selected.
[0013] In addition, to achieve the above objectives, the present invention also provides a processing apparatus, the processing apparatus comprising: a memory, a processor, and a document image data processing program stored in the memory and executable on the processor, the document image data processing program being configured to implement the document image data processing method as described above.
[0014] In addition, to achieve the above objectives, the present invention also provides a computer program product, including the processing apparatus described above.
[0015] The document image data processing method of this invention is applied to a server. The server is equipped with a manufacturing execution system. The document image data processing method obtains image data to be processed extracted from office documents, performs color space statistical operations on the image data to be processed to extract color distribution feature parameters, performs edge detection operations on the image data to be processed to extract corresponding distribution feature parameters, and determines the image content type of the image data to be processed according to preset classification judgment rules based on the color distribution feature parameters and edge distribution feature parameters. Then, according to the image content type, the corresponding target compression strategy is selected from a pre-configured set of differentiated compression strategies. Finally, the target compression strategy is used to perform compression processing on the image data to be processed to generate a compressed target image. In this way, by simultaneously extracting features from image data in both color space and edge structure dimensions, image data with different content attributes, such as photo type, screenshot type, chart type, and general type, can be automatically identified and classified. This allows various types of image data to be matched with differentiated parameters such as compression format, compression quality, color depth, and output size that are adapted to their content characteristics. As a result, the technical effects of not losing key diagnostic features after classification and compression, not introducing compression artifacts, and configuring storage and transmission resources on demand are achieved, significantly improving the processing efficiency of document image data and the fidelity of diagnostic information in the manufacturing execution system. Attached Figure Description
[0016] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.
[0017] Figure 1 This is a schematic flowchart of a document image data processing method according to an embodiment of the present invention; Figure 2 This is a schematic flowchart of a document image data processing method according to another embodiment of the present invention; Figure 3 This is a schematic flowchart of a document image data processing method according to another embodiment of the present invention; Figure 4 This is a schematic flowchart of a document image data processing method according to another embodiment of the present invention; Figure 5This is a schematic flowchart of a document image data processing method according to another embodiment of the present invention; Figure 6 This is a schematic flowchart of a document image data processing method according to another embodiment of the present invention; Figure 7 This is a schematic flowchart of a document image data processing method according to another embodiment of the present invention; Figure 8 This is a schematic flowchart of a document image data processing method according to another embodiment of the present invention.
[0018] The realization of the objective, functional features and advantages of the present invention will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation
[0019] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Well-known modules, units, and their connections, links, communications, or operations are not shown or described in detail. Furthermore, the described features, architectures, or functions can be combined in any way in one or more embodiments. Those skilled in the art should understand that the various embodiments described below are for illustrative purposes only and are not intended to limit the scope of protection of the present invention. It is also readily understood that the modules, units, or processing methods in the various embodiments shown herein and in the accompanying drawings can be combined and designed in various different configurations. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without creative effort are within the scope of protection of the present invention.
[0020] In the document image processing scenarios of manufacturing execution systems, existing technologies generally use uniform compression parameters and a single compression format to process diagnostic image data extracted from office documents. They fail to match corresponding compression strategies according to the differences in image content types (such as real photos, waveform charts, UI screenshots, and labeled diagrams). This results in color banding and texture blurring in photo images under excessively high compression ratios, and loss of edge sharpness in chart images under excessively low compression quality, making key data unrecognizable. At the same time, using indiscriminate output parameter settings for images of different content types leads to a waste of storage space and transmission bandwidth.
[0021] The main solution of this application embodiment is as follows: by acquiring the image data to be processed extracted from office documents, performing color space statistical operations on the image data to be processed to extract color distribution feature parameters, performing edge detection operations on the image data to be processed to extract corresponding distribution feature parameters, and determining the image content type of the image data to be processed according to preset classification judgment rules based on the color distribution feature parameters and edge distribution feature parameters, selecting the corresponding target compression strategy from a pre-configured set of differentiated compression strategies according to the image content type, and finally performing compression processing on the image data to be processed using the target compression strategy to generate the compressed target image.
[0022] In this embodiment, for ease of description, the following description uses the processing device as the execution subject.
[0023] This application provides a solution that achieves automatic identification and differentiated compression of image content types through dual feature extraction of color space statistics and edge detection. This enables simultaneous optimization of the fidelity and storage and transmission efficiency of the diagnostic images after classification and compression, thereby ensuring the accuracy of fault re-judgment in the manufacturing execution system and the traceability of evidence stored on the data chain.
[0024] Therefore, the present invention proposes a method for processing document image data; it is understood that the computer program product is provided with a processing device for storing and executing the following method, and the processing device can be implemented by a main controller, such as MCU (Micro controller Unit), DSP (Digital Signal Processor), FPGA (Field Programmable Gate Array), SOC (System-on-Chip), etc.
[0025] Because existing manufacturing execution systems use a uniform compression method to process image data extracted from office documents without differentiating them according to the type of image content, problems such as blurred key diagnostic features, introduction of compression artifacts, and waste of storage and transmission resources occur after compression for different types of images.
[0026] Therefore, referring to Figure 1 In one embodiment of the present invention, the method for processing document image data includes steps S100-S600, wherein: S100: Obtain the image data to be processed extracted from office documents; S200: Perform color space statistical operations on the image data to be processed to extract color distribution feature parameters. The color distribution feature parameters include at least the pure color area ratio parameter based on the color difference between adjacent pixels and the effective color quantity parameter based on color space quantization. S300: Perform edge detection on the image data to be processed and extract the corresponding distribution feature parameters. The edge distribution feature parameters include at least the edge pixel density parameters based on gradient intensity and the long straight line segment density parameters based on straight line segment recognition. S400. Based on color distribution feature parameters and edge distribution feature parameters, determine the image content type of the image data to be processed according to the preset classification judgment rules. The image content type includes at least two of the following: photo type, screenshot type, chart type, and general type. S500: Select the corresponding target compression strategy from the pre-configured set of differentiated compression strategies based on the image content type; S600: The target compression strategy is used to compress the image data to be processed, generating a compressed target image.
[0027] Among them, the image data to be processed refers to the raw image data extracted from office documents and to be input into the manufacturing execution system for processing. Raw image data includes, but is not limited to, actual photos of equipment, diagnostic waveform screenshots, structural annotation diagrams, microscopic images of defect areas, and maintenance guidance diagrams. Color space statistical operations refer to the statistical analysis and processing of image data in the color dimension, including sub-operations such as color space conversion, pixel-level color difference calculation, region proportion statistics, and color quantization statistics. Color distribution characteristic parameters refer to the set of numerical parameters extracted based on color space statistical operations to characterize the color distribution characteristics of image data. The pure color region proportion parameter refers to the ratio of the number of pixels in a region to the total number of pixels after identifying pixel clusters with color difference values below a preset threshold as approximately pure color regions based on adjacent pixel color difference judgment. The effective color quantity parameter refers to the ratio of the number of pixels in the image region to the total number of pixels. After quantizing the color space into a preset number of color buckets, the number of color buckets whose pixel count exceeds a preset percentage threshold is counted. Edge detection operation refers to the gradient intensity calculation and structured edge recognition processing performed on the image data. Edge distribution feature parameters refer to the set of numerical parameters extracted based on edge detection operation to characterize the edge distribution characteristics of image data. Edge pixel density parameters refer to the ratio of edge pixels to the total number of pixels in a binary edge image. Long line segment density parameters refer to the number of long line segments identified in the edge detection results whose length exceeds a preset percentage of the image side length. Image content type refers to the content category label determined comprehensively based on the color and edge distribution characteristics of the image data. Differentiated compression strategy set refers to the pre-configured set of compression format, compression quality parameters, color depth parameters, and output size parameters that correspond one-to-one with each image content type.
[0028] Secondly, the processing device acquires the image data to be processed extracted from the office document. The office document can be a diagnostic report file in DOCX, ODT, or PDF format. The image data to be processed is loaded into memory in the form of a pixel matrix. The number of rows in the pixel matrix corresponds to the image height, and the number of columns corresponds to the image width. Each pixel contains channel values of at least three color channels.
[0029] Subsequently, the manufacturing execution system performs color space statistical operations on the image data to be processed, extracting color distribution feature parameters, including the percentage of pure color areas and the number of effective colors. Simultaneously, it performs edge detection operations on the image data to be processed, extracting edge distribution feature parameters, including edge pixel density and long line segment density. These color space statistical operations and edge detection operations can be performed in parallel or sequentially in any order.
[0030] Finally, based on color distribution feature parameters and edge distribution feature parameters, the manufacturing execution system determines the image content type (including photo type, screenshot type, chart type, and general type) of the image data to be processed according to the preset classification judgment rules. According to the determined image content type, the system selects the corresponding target compression strategy from the pre-configured differential compression strategy set and performs compression processing on the image data to be processed using the target compression strategy to generate the compressed target image. The target image is then included in the image repository of the manufacturing execution system for unified storage and on-chain evidence storage.
[0031] Through the above technical solution, this embodiment extracts color distribution features in the color space dimension and edge distribution features in the structural dimension from the image data to be processed simultaneously. Based on the dual feature parameters, it automatically determines the image content type according to preset rules and performs differentiated compression by matching a compression strategy adapted to the content type. This achieves automatic recognition and adaptive compression of images of different content types, ensuring that the color transition of photo images remains natural, the edge sharpness of chart images is not lost, and the UI text of screenshot images is recognizable. At the same time, it optimizes the configuration of storage space and transmission bandwidth according to the content type, thereby improving the overall processing efficiency of document image data in the manufacturing execution system.
[0032] This embodiment employs a collaborative mechanism of dual-path feature extraction using color space statistics and edge detection, simultaneously using feature parameters belonging to different sensory dimensions (color and structure) as the basis for content type determination. Existing technologies, when encountering document image data compression quality issues, use single-dimensional analysis methods. If color fidelity is a concern, color histogram analysis is performed followed by adjusting the compression color depth parameter; if edge sharpness is a concern, sharpening filtering is performed before compression. However, these two single-dimensional methods cannot solve the adaptive compression decision problem under the premise of unknown content type: color histogram analysis can only reflect the overall color distribution and cannot distinguish between the color gradient areas of natural photographs and the solid color filled areas of artificial charts; while sharpening filtering can enhance edges, it also amplifies noise and compression artifacts in photographic images. Existing technologies typically use format judgment based on file metadata (such as selecting a compressor based on file extension or MIME type) to solve the problem of "adaptive compression of image content." However, image data embedded in office documents loses its original file format information after extraction, rendering metadata solutions completely ineffective in this scenario. This embodiment integrates two statistical measures of color dimension—the proportion of solid color areas driven by color difference value and the number of effective colors quantized by color bucket—with two statistical measures of structural dimension—edge pixel density driven by gradient and long line segment density driven by line segment—into a unified classification input. This makes the distinction between natural images (rich color transitions and scattered edges) and artificial images (concentrated solid color areas and dense structured edges) multi-dimensionally discernible. Compared with existing technologies, this embodiment eliminates the compression strategy mismatch problem caused by the inability to obtain original file format information through a content-aware three-stage processing link of classification-matching-compression.
[0033] The document image data processing method of this embodiment is applied to the server, which is equipped with a manufacturing execution system. The document image data processing method obtains the image data to be processed extracted from office documents, performs color space statistical operations on the image data to be processed to extract color distribution feature parameters, performs edge detection operations on the image data to be processed to extract corresponding distribution feature parameters, and determines the image content type of the image data to be processed according to preset classification judgment rules based on the color distribution feature parameters and edge distribution feature parameters. Then, according to the image content type, the corresponding target compression strategy is selected from a pre-configured set of differentiated compression strategies. Finally, the target compression strategy is used to perform compression processing on the image data to be processed to generate a compressed target image. In this way, by simultaneously extracting features from image data in both color space and edge structure dimensions, image data with different content attributes, such as photo type, screenshot type, chart type, and general type, can be automatically identified and classified. This allows various types of image data to be matched with differentiated parameters such as compression format, compression quality, color depth, and output size that are adapted to their content characteristics. As a result, the technical effects of not losing key diagnostic features after classification and compression, not introducing compression artifacts, and configuring storage and transmission resources on demand are achieved, significantly improving the processing efficiency of document image data and the fidelity of diagnostic information in the manufacturing execution system.
[0034] If the Euclidean distance in the RGB space is used directly as the standard for measuring color difference, the non-uniformity of the RGB space will cause the same value of color difference to correspond to different human visual perception differences in different color areas. For example, the human eye can perceive a small change in the value in the blue area, but the human eye can hardly perceive the same value change in the green area. This makes it impossible to guarantee the visual uniformity of pure color areas divided based on RGB color difference.
[0035] Therefore, referring to Figure 2 Another embodiment of the present invention provides a method for processing document image data, based on the above. Figure 1 The illustrated embodiment performs color space statistical operations on the image data to be processed to extract color distribution feature parameters, including steps S210-S240, wherein: S210. Convert the image data to be processed from the original color space to a uniform color space; S220. Traverse all pixels of the image data to be processed. For each pair of adjacent pixels, obtain the channel value of each channel in the uniform color space. Calculate the weighted difference of the channel values of each channel to obtain the color difference value between the adjacent pixels. S230. Mark two adjacent pixels with a color difference value less than a preset color difference threshold as approximately pure color pixels, and count the total number of pixels that are determined to be approximately pure color pixels after deduplication. The preset color difference threshold is the minimum perceptible difference value that is indistinguishable by the human visual system in a uniform color space. S240. Calculate the ratio of the total number of near-solid color pixels to the total number of pixels, and determine the solid color area ratio parameter.
[0036] Uniform color space refers to a color space with perceptual uniformity, meaning that the Euclidean distance between any two points in this color space is linearly related to the degree of color difference perceived by the human eye. Uniform color space includes, but is not limited to, CIELAB and CIELUV color spaces. Adjacent pixels refer to two pixels that are adjacent in the horizontal or vertical direction in the image pixel matrix. Weighted calculation refers to assigning weight coefficients corresponding to the sensitivity of each channel in the human visual system to the difference of each channel and then summing them up, where the weight coefficient of the luminance channel is higher than that of the chrominance channel. The preset color difference threshold is the minimum perceptible difference (Just Noticeable Difference, or JND) defined in the uniform color space that is indistinguishable by the human visual system. The typical value range of this threshold in the CIELAB color space is 1.0 to 3.0. Approximate pure color pixels refer to pixels whose color difference with their adjacent pixels in the uniform color space is less than the minimum perceptible difference, indicating that the pixel cannot be visually distinguished from its adjacent pixels.
[0037] Secondly, the processing device converts the image data to be processed from the original color space (such as sRGB color space) to a uniform color space (such as CIELAB color space). The conversion process may include: first converting the RGB channel values of each pixel into linear RGB values through gamma inverse correction, then converting the linear RGB values into CIEXYZ tristimulus values through the XYZ color space intermediate transformation matrix, and finally mapping the CIEXYZ tristimulus values to the L* channel (luminance), a* channel (green-red hue), and b* channel (blue-yellow hue) of the CIELAB space through nonlinear transformation. Subsequently, the processing device traverses all pixels of the image data to be processed. For each pair of horizontally adjacent and vertically adjacent pixels (a total of 2×(M-1)×N + 2×M×(N-1) pairs, where M is the number of pixels in the image height and N is the number of pixels in the image width), it obtains the channel values of the three channels L*, a*, and b* in the CIELAB space. The color difference value can be calculated according to the formula ΔE = sqrt(wL·(ΔL*)² + wa·(Δa*)² + wb·(Δb*)²), where ΔL*, Δa*, and Δb* are the differences between adjacent pixels in each channel, and wL, wa, and wb are the weighting coefficients of the luminance channel and the two chrominance channels, respectively. The weighting coefficient wL of the luminance channel is greater than wa and wb to reflect that the human eye is more sensitive to luminance differences than chrominance differences.
[0038] Finally, the processing device marks two adjacent pixels with a color difference value less than a preset color difference threshold (such as a JND value of 2.3) as approximately solid color pixels. It then performs deduplication and statistical analysis on all marked pixels to obtain the total number of approximately solid color pixels, calculates the ratio of this total number to the total number of pixels, and determines this ratio as the solid color region proportion parameter.
[0039] Through the above technical solution, this embodiment converts image data to a perceptibly uniform color space, calculates the color difference between adjacent pixels using a weighted color difference formula, and compares it with the minimum perceptible difference to determine approximately pure color pixels. This achieves the quantification of the proportion of pure color areas consistent with human visual perception, enabling accurate differentiation between large-area color gradient areas (continuous but slowly changing color differences between adjacent pixels) in photographic images and pure color filled areas (large areas with zero color difference between adjacent pixels) in chart-like images.
[0040] This embodiment replaces the original color space with a uniform color space as the basis for color difference calculation and uses the minimum perceptible difference to the human eye as the absolute threshold for pure color determination, shifting the definition of pure color areas from a numerical-driven to a perception-driven approach. Existing technologies, when performing color consistency analysis on images, typically use the channel value difference in the RGB space or the brightness difference after grayscale conversion as a uniformity measure. However, this approach results in completely different perceptual differences for the same numerical difference in different color areas within the RGB space. Compared to existing technologies, this embodiment eliminates the problem of misjudging pure color areas caused by RGB space inhomogeneity through uniform color space conversion and JND threshold determination.
[0041] The solid color area ratio parameter can only reflect the coverage of large areas of consistent color in an image. It still lacks an effective quantitative indicator for the overall color richness of the image, that is, the number of effective color types actually contained in the image. A high-resolution real-world photo taken by a device may contain a large number of color transition areas (low solid color area ratio), while a Gantt chart with a large area of solid color filling containing only a few colors (high solid color area ratio) has a difference in color complexity. If there is only a solid color area ratio parameter but no effective color quantity parameter, the two types of images cannot be effectively distinguished in terms of color dimension.
[0042] Therefore, referring to Figure 3 Another embodiment of the present invention provides a method for processing document image data, based on the above. Figure 2 The embodiment shown performs color space statistical operations on the image data to be processed to extract color distribution feature parameters, and further includes steps S250-S270, wherein: S250: Quantize the color space of the image data to be processed into a preset number of color buckets; S260. Count the number of pixels that have fallen into each color bucket; S270. The number of color buckets whose number of pixels exceeds a preset percentage threshold is determined as the effective color quantity parameter.
[0043] Color space quantization refers to the process of discretizing the continuous color range of a color space into a finite number of color intervals. Color buckets refer to each discrete color interval formed after color space quantization. The number of color buckets N is determined by a preset parameter, with typical values of 64, 128, or 256. The preset percentage threshold is the minimum percentage value used to determine whether the number of pixels covered by a color bucket meets the "valid" standard. This percentage threshold is usually set to 0.1% to 1.0% of the total number of pixels. The effective color quantity parameter refers to the number of color buckets whose number of pixels exceeds the preset percentage threshold. The higher the value, the richer the color composition of the image.
[0044] Secondly, the processing device evenly divides the color space (such as CIELAB space or RGB space) of the image data to be processed into a preset number of intervals according to each channel, forming N color buckets. For example, when using RGB space and quantizing each channel into 4 intervals, the total number of color buckets is 4×4×4=64; when using CIELAB space, only the a* and b* chromaticity channels can be quantized while retaining the continuous value of the L* luminance channel, so as to reduce the total number of color buckets and focus on the distribution statistics of the chromaticity dimension.
[0045] Subsequently, the processing device traverses all pixels of the image data to be processed, places each pixel into the corresponding color bucket according to its color channel value and accumulates the count. After the traversal is completed, the ratio of the cumulative number of pixels in each color bucket to the total number of pixels is calculated. The number of color buckets whose ratio exceeds a preset percentage threshold (such as 0.5%) is determined as the effective color quantity parameter.
[0046] Through the above technical solution, this embodiment realizes the quantitative representation of the color richness of image data by color space quantization and effective color bucket ratio statistics, so that artificial charts with simple color composition (few effective colors) and real photos with rich color levels (many effective colors) can be distinguished in the color dimension.
[0047] For certain types of images, especially screenshots, a unique pattern emerges in their color composition: a large number of UI controls (such as buttons, icons, and status indicators) in the screenshot employ highly saturated colors to emphasize interactive guidance, while the page background and text areas are predominantly low-saturation grayscale tones. Neither the solid color area percentage parameter nor the effective color quantity parameter can directly capture this characteristic of concentrated high-saturation pixel distribution. This leads to confusion between high-saturation UI screenshots and naturally occurring photos with rich but low-saturation colors when classifying them solely based on the first two color parameters.
[0048] Therefore, referring to Figure 4 Another embodiment of the present invention provides a method for processing document image data, based on the above. Figure 3 The embodiment shown performs color space statistical operations on the image data to be processed to extract color distribution feature parameters, and further includes steps S280-S290, wherein: S280. Count the number of pixels in the image data to be processed where at least one of the red, green and blue channels has a value that exceeds a preset saturation threshold. S290. Calculate the ratio of the number of pixels to the total number of pixels, and determine it as the parameter for the proportion of high-saturation pixels.
[0049] The preset saturation threshold is the lower limit of the channel value used to determine whether a pixel belongs to a high saturation pixel. The typical value of the saturation threshold is 200 to 240 in the channel value range of 0 to 255. A high saturation pixel is a pixel whose channel value of at least one of the red, green and blue channels exceeds the preset saturation threshold. Such pixels are visually represented as bright and intense colors.
[0050] Next, the processing device iterates through all pixels of the image data to be processed, checking for each pixel to see if at least one of its R-channel, G-channel, and B-channel values exceeds a preset saturation threshold (e.g., 230). If so, the pixel is marked as a high-saturation pixel and counted cumulatively. After the iteration is complete, the ratio of the number of high-saturation pixels to the total number of pixels is calculated, and this ratio is determined as the high-saturation pixel proportion parameter.
[0051] Through the above technical solution, this embodiment extracts the high saturation pixel ratio parameter by statistically analyzing the high channel value pixels in the RGB three channels, so that the high saturation color distribution characteristics of UI controls in screenshot images can be quantitatively captured, thereby effectively distinguishing screenshot images from photo images and chart images in terms of color feature dimension.
[0052] If the gradient threshold for edge detection is set improperly, texture details in the photographic image (such as scratches on a metal surface or fabric texture) will be misdetected as dense edges, resulting in abnormally high edge pixel density parameters that can be confused with the image. If the minimum length parameter for line segment detection is not related to the image size, images of different resolutions will produce incomparable long line segment density values.
[0053] Optionally, refer to Figure 5 The present invention also provides a method for processing document image data, based on the above. Figure 1 The embodiment shown performs an edge detection operation on the image data to be processed, extracting edge distribution feature parameters, including steps S310-S340, wherein: S310. Perform gradient intensity-based edge detection on the image data to be processed to generate a binary edge image; S320. The ratio of the number of edge pixels to the total number of pixels in a binary edge image is used as the edge pixel density parameter. S330: Perform line segment detection on the binary edge image and identify line segments whose length exceeds a preset ratio of the side length of the image data to be processed. S340. Count the number of straight line segments identified and determine them as the density parameter of long straight line segments.
[0054] Among them, gradient intensity-based edge detection refers to the detection method that determines edge pixels by calculating the gradient magnitude of each pixel in the image and comparing it with preset high and low thresholds. Edge detection methods include, but are not limited to, the Canny edge detection algorithm and the Sobel edge detection algorithm. Binary edge image refers to a binary image of the same size as the original image, where the pixel value of edge pixels is 1 (or 255) and the pixel value of non-edge pixels is 0. Line segment detection refers to the algorithm for detecting and extracting line segments from binary edge images, including but not limited to the Hough Line Transform algorithm and the Line Segment Detector (LSD) algorithm. The preset ratio of image side length refers to the ratio coefficient between the minimum length threshold of line segments and the smaller of the width and height of the image as the benchmark. The typical value of this ratio coefficient is 0.05 to 0.20, that is, the minimum length of long line segments is not less than 5% to 20% of the length of the short side of the image.
[0055] Secondly, the processing device performs Canny edge detection on the image data to be processed: first, the image data is converted into a grayscale image, and Gaussian filtering is applied to the grayscale image to suppress noise (Gaussian kernel size is, for example, 5×5, standard deviation σ is 1.4). Then, the gradient magnitude and gradient direction of each pixel are calculated (for example, using the Sobel operator to calculate the horizontal gradient Gx and vertical gradient Gy, gradient magnitude G=sqrt(Gx²+Gy²), gradient direction θ=arctan(Gy / Gx)). Then, non-maximum suppression is applied to the gradient magnitude image to refine the edges. Finally, a binary edge image is generated using a double thresholding method (high threshold is, for example, 100, low threshold is, for example, 50) and edge concatenation operations. After generating the binary edge image, the manufacturing execution system counts the ratio of the number of edge pixels (pixels with a pixel value of 255) to the total number of pixels, and this ratio is determined as the edge pixel density parameter.
[0056] Subsequently, the processing device performs line segment detection on the binary edge image, for example, using the Progressive Probabilistic Hough Transform algorithm, and sets parameters such as minimum voting threshold, minimum line segment length (dynamically calculated based on a preset proportional coefficient of the image's short side length), and maximum line segment gap. For each detected line segment, it is determined whether its actual length exceeds a preset proportion (e.g., 10%) of the short side length of the image data to be processed; if it does, the line segment is counted as a long line segment.
[0057] Finally, the processing device counts the total number of long straight line segments identified and determines this number as the long straight line segment density parameter.
[0058] Through the above technical solution, this embodiment effectively suppresses false edges caused by texture noise in photographic images by using the dual threshold mechanism of Canny edge detection. By dynamically associating the minimum length of the straight line segment with the image size, the density parameter of the long straight line segment has resolution invariance, realizing the reliable extraction of two structural dimension parameters: edge pixel density and long straight line segment density. This makes chart-type images (high edge density, high long straight line segment density) and photographic images (medium edge density, low long straight line segment density) significantly differentiating in structural dimension.
[0059] This embodiment constructs a robust edge feature extraction pipeline for noisy textures by employing dual-threshold Canny edge detection combined with resolution-adaptive line segment length thresholding. Existing technologies typically use fixed-parameter edge detection processes when extracting image edge features, such as using the Sobel operator to calculate gradient magnitude and then binarizing with a single global threshold. However, this approach generates numerous false edges when dealing with textured regions in photographic images (such as metal surfaces, fabric textures, and circuit board copper traces), causing their edge pixel density to numerically approximate that of chart-like images, leading to subsequent content classification failures. Compared to existing technologies, this embodiment establishes clear structural parameter boundaries between photographic textures and chart lines through dual-threshold suppression and resolution-adaptive line segment detection.
[0060] Edge pixel density parameters and long line segment density parameters are both scalar statistics of edge distribution and cannot reflect the directional distribution characteristics of edges. In chart-like images (such as Gantt charts, flowcharts, and circuit diagrams), the horizontal and vertical edges are usually significantly asymmetrically distributed (for example, in time series images, the edges along the horizontal time axis are far more numerous than the edges of the vertical event markers), while the edge directions in natural photographic images tend to be isotropically distributed. The lack of edge distribution parameters with a directional dimension will make it impossible to distinguish between two types of images with significantly different edge direction patterns (such as tables with dense horizontal lines and natural textures with uniformly directional edges) in terms of structural dimension.
[0061] Therefore, referring to Figure 6 Another embodiment of the present invention provides a method for processing document image data, based on the above. Figure 5 The embodiment shown performs edge detection on the image data to be processed and extracts edge distribution feature parameters, and further includes steps S350-S360, wherein: S350. In a binary edge image, count the number of edge pixels with a gradient direction of horizontal and the number of edge pixels with a gradient direction of vertical. S360. Calculate the ratio of the number of edge pixels in the horizontal direction to the number of edge pixels in the vertical direction, and determine it as the direction edge ratio parameter.
[0062] Here, a gradient direction of horizontal direction refers to edge pixels whose gradient direction angle falls within a preset horizontal angle range. Typical values for the horizontal angle range are 0°±15° and 180°±15°, corresponding to edges where the gradient direction and the horizontal line form an angle of less than 15°. A gradient direction of vertical direction refers to edge pixels whose gradient direction angle falls within a preset vertical angle range. Typical values for the vertical angle range are 90°±15° and 270°±15°, corresponding to edges where the gradient direction and the vertical line form an angle of less than 15°. The direction edge ratio parameter is the ratio of the number of edge pixels in the horizontal direction to the number of edge pixels in the vertical direction. When the ratio is close to 1.0, it indicates that the edge direction distribution tends to be isotropic (such as in natural photos). When the ratio deviates significantly from 1.0, it indicates that the edge direction distribution has a directional bias (such as in artificial graphics like tables and flowcharts).
[0063] Secondly, during the generation of the binary edge image, the processing device has recorded the gradient direction of each edge pixel (such as the θ value calculated in Canny edge detection). It then iterates through all edge pixels in the binary edge image, retrieving their gradient direction values: if θ is within the range of 0°±15° or 180°±15°, the edge pixel is counted in the horizontal direction; if θ is within the range of 90°±15° or 270°±15°, the edge pixel is counted in the vertical direction.
[0064] Subsequently, the processing device calculates the ratio R = Nhorizontal / Nvertical (when Nvertical is zero, a preset maximum constant is taken) of the number of horizontal edge pixels Nhorizontal to the number of vertical edge pixels Nvertical, and determines this ratio as the directional edge ratio parameter.
[0065] Through the above technical solution, this embodiment utilizes the gradient direction information calculated during the Canny edge detection process to count the number of edge pixels in the horizontal and vertical directions in the binary edge image and calculate their ratio, thereby realizing the quantitative representation of the edge direction distribution characteristics. This further distinguishes the chart with dense horizontal lines (direction-edge ratio much greater than 1.0) from the natural photograph with isotropic edges (direction-edge ratio close to 1.0) in terms of structural dimension.
[0066] The specific logic of the classification rules involves how to combine various feature parameters into judgment conditions, how to arrange the priority order of judgments among different types, and the specific numerical settings of each judgment threshold. However, these details are not clearly defined in the above embodiments. If the judgment rules are poorly designed, for example, if there is overlap between judgment conditions leading to an image simultaneously meeting the judgment conditions of multiple types, or if the judgment threshold for a certain type is set too leniently, causing a large number of other types of images to be misclassified as the same type, then the classification process will lose its practical engineering significance. Therefore, referring to Figure 7 Another embodiment of the present invention provides a method for processing document image data, based on the above. Figure 1 The illustrated embodiment determines the image content type of the image data to be processed based on color distribution feature parameters and edge distribution feature parameters, according to a preset classification and determination rule, including steps S410-S440, wherein: S410. When the solid color area ratio parameter exceeds the first color threshold and the effective color quantity parameter exceeds the second color threshold, the image content type is determined to be a photo type. S420. When the proportion of high-saturation pixels exceeds the preset saturation judgment threshold and the density parameter of long straight line segments is lower than the first structure threshold, the image content type is determined to be a screenshot type. S430. When the edge pixel density parameter exceeds the second structure threshold or the long straight line segment density parameter exceeds the third structure threshold, the image content type is determined to be a chart type. S440. When the color distribution feature parameter and edge distribution feature parameter do not meet any of the above-mentioned conditions for photo type, screenshot type and chart type, the image content type is determined to be a general type.
[0067] The first color threshold is used to determine whether the proportion of solid color areas meets the photo type standard. Photo images, due to their large-area color gradient rather than solid color filling, typically have a low solid color area proportion parameter, with a typical first color threshold value of 0.15 to 0.35. The second color threshold is used to determine whether the number of effective colors meets the photo type standard. Photo images have rich color compositions, and their effective color number parameter is typically high (e.g., more than 20 effective color buckets). The preset saturation judgment threshold is used to determine whether the proportion of high-saturation pixels meets the screenshot type standard. Screenshot images, due to their large number of high-saturation UI control elements, typically have a high proportion of high-saturation pixels, with a typical preset saturation judgment threshold value of 0.05 to 0.15. The first structure threshold is used to distinguish between screenshot types and chart types. The first threshold is the minimum density of long straight lines in screenshot images (separators and borders in UI interfaces are usually short and discontinuous), typically ranging from 3 to 8 long straight line segments. The second structural threshold is used to determine whether the edge pixel density meets the chart type standard. Chart images typically have a higher edge pixel density parameter due to the presence of dense curves, polylines, and annotation lines, typically ranging from 0.04 to 0.10. The third structural threshold is used to determine whether the density of long straight line segments meets the chart type standard. Chart images (such as waveforms, circuit diagrams, and mechanical drawings) contain a large number of long straight line segments, typically ranging from 5 to 15 long straight line segments. The general type refers to the collective term for image content types that do not meet the criteria for photo, screenshot, and chart types simultaneously, typically including texture images, mixed content images, and low-contrast images.
[0068] The classification rules are executed in a priority order: first, the photo type is determined (if both the solid color area ratio parameter exceeds the first color threshold and the effective color quantity parameter exceeds the second color threshold); then, the screenshot type is determined (if both the high saturation pixel ratio parameter exceeds the preset saturation threshold and the long line segment density parameter is lower than the first structure threshold); next, the chart type is determined (if either the edge pixel density parameter exceeds the second structure threshold or the long line segment density parameter exceeds the third structure threshold); finally, images that do not meet all the above conditions are classified as general type. This priority order ensures that once an image is determined to be a photo, no further judgment is made, avoiding the problem of a photo being mistakenly classified as a chart because it simultaneously meets the edge conditions of the chart type.
[0069] Through the above technical solution, this embodiment constructs a multi-dimensional classification judgment rule with hierarchical priority. It combines three parameters of color dimension (pure color area ratio, effective color quantity, and high saturation pixel ratio) with two parameters of structure dimension (edge pixel density and long straight line segment density) according to type characteristics to form mutually exclusive judgment conditions. This achieves accurate automatic classification of photo type, screenshot type, chart type and general type. The classification process has both high accuracy and high robustness.
[0070] After obtaining the image content type tags, the next step is to map these tags to specific, executable compression strategies. This can include selecting the compression format, setting compression quality parameters, determining color depth parameters, and calculating output size parameters. However, it is still necessary to establish a set of strategy mapping rules that match the characteristics of each content type to ensure that the color transition of photo types does not produce discontinuities due to lossy compression, that the text and icons of screenshot types do not become blurry due to reduced color depth, and that the lines of chart types do not change due to format conversion.
[0071] Therefore, referring to Figure 8 Another embodiment of the present invention provides a method for processing document image data, based on the above. Figure 7 The illustrated embodiment selects a corresponding target compression strategy from a pre-configured set of differentiated compression strategies based on the image content type, including steps S510-S540, wherein: S510. When the image content type is a photo, select the first compression strategy. The first compression strategy adopts a lossy compression format, a first compression quality parameter, and a first output width parameter. S520. When the image content type is screenshot, select the second compression strategy. The second compression strategy uses lossless compression format and low bit depth parameter. S530. When the image content type is a chart, select the third compression strategy. The third compression strategy uses a lossless compression format and keeps the original compression parameters unchanged. S540. When the image content type is general, select the default compression strategy.
[0072] Among them, lossy compression formats refer to image encoding formats that achieve high compression ratios by discarding some visual information, including but not limited to JPEG format and WebP lossy mode; the first compression quality parameter refers to the quality factor of the lossy compression format, which typically ranges from 75 to 90 within the range of 0 to 100, balancing compression ratio and visual fidelity; the first output width parameter refers to the maximum width of the target image after compression in pixels, which is proportionally reduced to the value of the parameter when the original image width exceeds this parameter, and the typical value of this parameter is 1920 or 2048; lossless compression formats refer to formats that do not lose any original information during the compression process. Image encoding formats for pixel information include, but are not limited to, PNG format and WebP lossless mode; low bit depth parameters refer to reducing the image from the original 24-bit or 32-bit color depth to 8-bit or lower bit depth, replacing the full color gamut representation with a color index table (palette) to significantly reduce file size while maintaining visual quality; keeping the original compression parameters unchanged means not performing lossy recompression on the image data, not changing the original color depth and resolution, and outputting it in its original quality; the default compression strategy refers to using the system's preset general compression parameters, such as the default parameter combination of JPEG format, quality factor 85, and output width 1920.
[0073] Secondly, when the processing device determines that the image content type is a photograph, it selects the first compression strategy: the compression format is JPEG, the compression quality parameter qs is set to 85, and the output width parameter Wout is set to 1920 pixels. If the original image width exceeds 1920 pixels, it is proportionally reduced before encoding; if the original image width does not exceed 1920 pixels, the original size is maintained. JPEG's DCT transform encoding and chroma subsampling mechanism are suitable for processing photographic images with rich color gradations, and a quality factor of 85 can significantly reduce file size while maintaining visual degradation that is imperceptible to the naked eye.
[0074] Subsequently, when the processing device determines that the image content type is a screenshot, it selects the second compression strategy: the compression format is PNG, and the color depth parameter is reduced from the original 32-bit (8 bits each for RGBA) to 8-bit indexed color (256-color palette). The lossless compression characteristics of the PNG format ensure that the edges of text and icons in the screenshot do not introduce compression artifacts. The 8-bit indexed color can achieve visually indistinguishable color depth reduction in screenshot-type images (the number of colors is usually no more than 256), while the file size is significantly smaller than that of 24-bit PNG.
[0075] Finally, when the processing device determines that the image content type is a chart, it selects the third compression strategy: the compression format is PNG, and no parameters of the original image are changed (color depth and resolution are kept at their original values) to ensure that the fine lines, coordinate grids, data markers and annotation text in the chart are completely preserved after compression; when the manufacturing execution system determines that the image content type is a general type, it selects the default compression strategy.
[0076] Through the above technical solution, this embodiment maps image content types to first to third compression strategies and a default compression strategy with differentiated compression formats, compression quality, color depth, and output size. This achieves lossy high compression ratio output for photo images, lossless low color depth output for screenshot images, lossless full parameter preservation output for chart images, and default parameter output for general images, thus achieving an optimal balance between fidelity and file size to suit the characteristics of various images.
[0077] The present invention also proposes a processing apparatus, which includes: a memory, a processor, and a processing program for document image data stored in the memory and executable on the processor, wherein the document image data processing program is configured to implement the document image data processing method described above.
[0078] It is worth noting that since the processing device of the present invention is based on the above-described document image data processing method, the embodiments of the processing device of the present invention include all the technical solutions of all embodiments of the above-described document image data processing method, and the technical effects achieved are exactly the same, so they will not be repeated here.
[0079] The present invention also proposes a computer program product, which includes a processing device as described in the above embodiments.
[0080] It is worth noting that, since the computer program product of the present invention is based on the above-described processing device, the embodiments of the computer program product of the present invention include all the technical solutions of all embodiments of the above-described processing device, and the technical effects achieved are exactly the same, which will not be repeated here.
[0081] The above are merely preferred embodiments of the present invention and do not limit the scope of the patent. Any equivalent structural or procedural transformations made based on the description and drawings of the present invention, or direct or indirect applications in other related technical fields, are similarly included within the scope of patent protection of the present invention.
Claims
1. A method for processing document image data, applied on a server, wherein the server is equipped with a manufacturing execution system, characterized in that, The method for processing the document image data includes: Retrieve image data to be processed extracted from office documents; Perform color space statistical operations on the image data to be processed to extract color distribution feature parameters; Perform edge detection on the image data to be processed and extract the corresponding distribution feature parameters; Based on the color distribution feature parameters and the edge distribution feature parameters, the image content type of the image data to be processed is determined according to the preset classification and judgment rules; Based on the image content type, select the corresponding target compression strategy from the pre-configured set of differentiated compression strategies; The target compression strategy is used to compress the image data to be processed, generating a compressed target image.
2. The document image data processing method as described in claim 1, characterized in that, The step of performing color space statistical operations on the image data to be processed to extract color distribution feature parameters includes: The image data to be processed is converted from the original color space to a uniform color space; Traverse all pixels of the image data to be processed, and for each pair of adjacent pixels, obtain the channel value of each channel in the uniform color space. Calculate the weighted difference between the channel values of each channel to obtain the color difference value between the adjacent pixels. Two adjacent pixels with a color difference value less than a preset color difference threshold are marked as approximately solid color pixels, and the total number of pixels that are determined to be approximately solid color pixels after deduplication is counted. Calculate the ratio of the total number of near-solid color pixels to the total number of pixels, and determine the solid color region proportion parameter.
3. The document image data processing method as described in claim 2, characterized in that, The step of performing color space statistical operations on the image data to be processed and extracting color distribution feature parameters further includes: The color space of the image data to be processed is quantized into a preset number of color buckets; Count the number of pixels that fall into each color bucket; The number of color buckets whose number of pixels exceeds a preset percentage threshold is determined as the effective color quantity parameter.
4. The document image data processing method as described in claim 3, characterized in that, The step of performing color space statistical operations on the image data to be processed and extracting color distribution feature parameters further includes: The number of pixels in the image data to be processed where at least one of the red, green, and blue channels exceeds a preset saturation threshold is counted. The ratio of the number of such pixels to the total number of pixels is calculated and determined as the percentage of high-saturation pixels.
5. The document image data processing method as described in claim 1, characterized in that, The step of performing edge detection on the image data to be processed and extracting edge distribution feature parameters includes: Perform gradient intensity-based edge detection on the image data to be processed to generate a binary edge image; The ratio of the number of edge pixels to the total number of pixels in the binary edge image is statistically analyzed and determined as the edge pixel density parameter. Perform line segment detection on the binary edge image to identify line segments whose length exceeds a preset ratio of the side length of the image data to be processed; The number of identified straight line segments is counted and determined as the density parameter of the long straight line segments.
6. The document image data processing method as described in claim 5, characterized in that, The step of performing edge detection on the image data to be processed and extracting edge distribution feature parameters further includes: In the binary edge image, the number of edge pixels with a gradient direction of horizontal and the number of edge pixels with a gradient direction of vertical are counted respectively. The ratio of the number of edge pixels in the horizontal direction to the number of edge pixels in the vertical direction is calculated and determined as the directional edge ratio parameter.
7. The document image data processing method as described in claim 1, characterized in that, The step of determining the image content type of the image data to be processed based on the color distribution feature parameters and the edge distribution feature parameters, according to a preset classification and determination rule, includes: When the solid color area ratio parameter exceeds the first color threshold and the effective color quantity parameter exceeds the second color threshold, the image content type is determined to be a photo type. When the proportion of high-saturation pixels exceeds the preset saturation judgment threshold and the density parameter of the long straight line segment is lower than the first structure threshold, the image content type is determined to be a screenshot type. When the edge pixel density parameter exceeds the second structure threshold or the long straight line segment density parameter exceeds the third structure threshold, the image content type is determined to be a chart type. When the color distribution feature parameter and the edge distribution feature parameter both fail to meet the determination conditions for any of the above photo type, screenshot type, and chart type, the image content type is determined to be a general type.
8. The document image data processing method as described in claim 7, characterized in that, The step of selecting a corresponding target compression strategy from a pre-configured set of differentiated compression strategies based on the image content type includes: When the image content type is a photo, a first compression strategy is selected. The first compression strategy uses a lossy compression format, a first compression quality parameter, and a first output width parameter. When the image content type is a screenshot, the second compression strategy is selected. The second compression strategy uses a lossless compression format and low bit depth parameters. When the image content type is a chart, the third compression strategy is selected. The third compression strategy uses a lossless compression format and keeps the original compression parameters unchanged. When the image content type is a general type, the default compression strategy is selected.
9. A processing apparatus, characterized in that, The processing apparatus includes: a memory, a processor, and a document image data processing program stored in the memory and executable on the processor, the document image data processing program being configured to implement the document image data processing method as described in any one of claims 1 to 8.
10. A computer program product, characterized in that, Includes the processing apparatus as described in claim 9.