A planar image compression method
By introducing joint modeling of task value density and uncertainty at the encoding end and performing topological correction and constraint projection at the decoding end, the problem of inconsistent machine readability and measurability in existing planar image compression methods is solved, and stable recovery of key structures is achieved under finite bit rate.
Patent Information
- Application Number
- CN202511536644.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-27
- Publication Date
- 2026-02-13
- Estimated Expiration
- 2045-10-27
AI Technical Summary
Existing image compression methods suffer from problems such as thinning of strokes, broken connectivity, decreased local contrast, curvature shape shift, and unstable boundary position when processing planar images containing text, tables, barcodes, or regular boundaries. These problems cannot be effectively solved because existing technologies struggle to ensure consistency in machine readability and testability, especially after multiple rounds of transcoding, scaling, or re-encoding.
By acquiring the planar image to be compressed, performing feature extraction, calculating the task value density map and its uncertainty, generating the quantization step size and bit allocation weight, compressing and transforming the image to generate the main bitstream, and combining the invariant feature side channel and task consistency indication information to generate the sub-bitstream and constraint bitstream, and finally performing topological consistency correction and constraint projection at the decoding end to ensure the readability and measurability of key structures.
Under limited bitrate conditions, ensure the quality of recovery of key structures such as character strokes, table grids, and boundary curvature, avoid problems such as stroke breakage, contrast attenuation, and structural distortion, and achieve consistency between subjective visual quality and machine recognition performance.
Smart Images

Figure CN121000883B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of image compression, in particular to a planar image compression method. BACKGROUND
[0002] Most of the existing image compression methods take improving the subjective visual quality as the goal, and usually adopt optimization strategies based on pixel error or perception indicators. However, when the compression object is a planar image containing text, table, barcode or regular boundary, the processing results of the existing technology often have problems such as thinning of strokes, breaking of connected relationship, decrease of local contrast, deviation of curvature form and instability of boundary position. Further, after multiple rounds of transcoding, scaling or re-encoding, these problems will be amplified, so that although the image can still maintain high clarity in overall visual effect, the performance in downstream tasks such as recognition, structured analysis and automatic measurement will be significantly reduced, which is manifested as decrease of OCR recall rate, increase of table segmentation error rate, increase of barcode decoding failure rate and insufficient accuracy of key geometric measurement. Therefore, the existing technology has the defect of inconsistency between perception quality and task usability in the compression scene of planar images, and it is difficult to maintain machine readability and measurability while ensuring limited code rate.
[0003] To solve the above problems, the present application designs a planar image compression method. SUMMARY
[0004] The technical problem to be solved by the present application is to provide a planar image compression method to solve the problems of the prior art. The planar image compression method comprises the following steps: acquiring a planar image to be compressed; performing feature extraction on the planar image to obtain image features, and calculating a task value density map and its corresponding uncertainty; generating a quantization step and a bit allocation weight according to the task value density map and the uncertainty, performing compression transformation on the planar image to obtain a main code stream; further generating an invariant feature side channel and task consistency indication information according to the image features, and compressing to obtain a secondary code stream and a constraint code stream; and sending the main code stream, the secondary code stream and the constraint code stream to a decoding end. After the decoding end performs inverse entropy decoding and inverse quantization on the main code stream to obtain an initial reconstructed image, topological consistency correction is performed in combination with the secondary code stream, and constraint projection and connected compensation are performed using the parameter information of the constraint code stream, and finally a recovered image meeting the task consistency requirement is output. The present application can guarantee the readability and measurability of key structures such as character strokes, table grids and boundary curvature under the condition of limited code rate, and realize the consistency of subjective visual quality and machine recognition performance.
[0005] To achieve the above purpose, the present application provides the following technical solutions:
[0006] A planar image compression method applied to an encoding end of an image compression system, the image compression system further comprising a decoding end for reconstructing an image according to a code stream output by the encoding end, the method comprising:
[0007] obtaining a planar image to be compressed;
[0008] performing feature extraction on the planar image to obtain image features, calculating a task value density map and an uncertainty corresponding to the task value density map according to the image features;
[0009] generating a quantization step and a bit allocation weight according to the task value density map and the uncertainty corresponding to the task value density map, to perform a compression transformation on the planar image to obtain a main code stream;
[0010] sending the main code stream to the decoding end.
[0011] The image features are used to represent edges, strokes, connectivity, curvature, texture complexity, and text candidate region confidence of the planar image.
[0012] The method further comprises:
[0013] calculating an invariant feature side channel according to the image features, wherein the invariant feature side channel comprises at least one of stroke skeleton and connected topology, line segment and arc segment and their geometric tolerance, text line direction statistics, key points and adjacency relationship, table grid structure descriptor, and region shape;
[0014] generating task consistency indication information according to the image features, wherein the task consistency indication information comprises at least one of stroke width, local contrast, connectivity retention rate, curvature deviation upper limit, and boundary offset upper limit;
[0015] compressing the invariant feature side channel and the task consistency indication information to obtain corresponding secondary code stream and constraint code stream;
[0016] sending the secondary code stream and the constraint code stream, and the main code stream to the decoding end.
[0017] calculating a task value density map and an uncertainty corresponding to the task value density map according to the image features, comprises:
[0018] dividing the planar image into pixel-level and sub-block-level candidate units according to a preset multi-scale division rule, and calculating a plurality of sub-features for representing the importance of downstream tasks for each candidate unit based on the image features;
[0019] fusing the plurality of sub-features according to a preset mapping rule to obtain a task contribution score of each candidate cell, and performing connectivity correction on the task contribution score through spatial regularization and topological consistency constraint to generate a task value density map with the same coordinate system dimension as the planar image;
[0020] performing uncertainty evaluation on the task value density map to obtain the uncertainty.
[0021] The uncertainty evaluation at least includes one of:
[0022] result dispersion evaluation;
[0023] stability evaluation based on input disturbance, wherein the input disturbance includes scaling, noise and color disturbance;
[0024] entropy value evaluation of output probability distribution;
[0025] observation confidence evaluation of texture complexity.
[0026] The generated quantization step and bit allocation weight include:
[0027] performing compressed sensing on the planar image to obtain corresponding transform coefficients;
[0028] According to the uncertainty corresponding to the task value density map, the transform coefficients of the planar image are weighted and sparsely modeled to obtain a sparse signal representation for representing task value weight and confidence constraint;
[0029] Project the sparse signal representation on the observation sequence matrix, and calculate the reconstruction error of each candidate cell in the task value density map in the projection domain, wherein the reconstruction error is used to represent the recovery sensitivity of the candidate cell under the condition of meeting the global code rate constraint;
[0030] According to the reconstruction error, the candidate cells are prioritized to obtain high-priority, medium-priority and low-priority regions;
[0031] For the high-priority region, set the quantization step within the preset tightening interval and allocate the corresponding bit share; for the medium-priority region, set the quantization step within the preset reference interval and allocate the corresponding bit share; for the low-priority region, set the quantization step within the preset relaxation interval and allocate the corresponding bit share.
[0032] Performing compressed sensing on the planar image to obtain corresponding transform coefficients, including:
[0033] The planar image is divided into a plurality of candidate regions according to a preset blocking rule, and the image signal is sparsely represented in each candidate region through a sparse dictionary to obtain a sparse coefficient set;
[0034] constructing an observation sequence matrix satisfying a compressive sensing constraint condition corresponding to the planar image, and performing linear observation on a sparse coefficient set through the observation sequence matrix to obtain corresponding observation values;
[0035] based on the observation values and a preset sparse prior, performing optimization solving to obtain an approximate coefficient representation of the planar image in a sparse domain;
[0036] taking the approximate coefficient representation as the transform coefficient.
[0037] compressing the invariant feature side channel and the task consistency indication information to obtain corresponding secondary code streams and constraint code streams, including:
[0038] topologically maintaining coding the invariant feature side channel to obtain an invariant feature symbol sequence, wherein the topologically maintaining coding includes arranging spatial position points of stroke skeletons and line segments and arc segments according to a preset scanning order, differentially coding coordinate difference values between adjacent points in the invariant feature side channel, representing a connection relationship between adjacent points through an adjacency list, and coding an adjacency list index, and setting topological marker bits for closed regions, intersection points and branch points and embedding the topological marker bits in a coding sequence in the form of a Boolean symbol;
[0039] segmentally coding the task consistency indication information to obtain a task symbol sequence, wherein the segmental coding includes dividing into multiple region segments according to a spatial distribution of the task consistency indication information in the planar image, each region segment corresponding to a parameter set, fitting the parameter set to obtain a range marker and a priority marker corresponding to each parameter set;
[0040] performing entropy coding on the invariant feature symbol sequence and the task symbol sequence with a task value density map and an uncertainty corresponding to the task value density map as context conditions to obtain a basic bit stream and an enhanced bit stream, wherein the basic bit stream includes skeleton topology and mandatory constraints, and the enhanced bit stream includes geometric refinement and suggested constraints;
[0041] outputting the secondary code streams and the constraint code streams according to the basic bit stream and the enhanced bit stream.
[0042] A planar image compression method applied to a decoding end of an image compression system, the image compression system further including an encoding end configured to compress the planar image and transmit a main code stream, secondary code streams and constraint code streams corresponding to a compression result to the decoding end, the method including:
[0043] receiving the main code stream, secondary code streams and constraint code streams;
[0044] perform inverse entropy decoding and inverse quantization on the main bitstream to obtain a first reconstructed image and a residual distribution of the first reconstructed image;
[0045] perform reconstruction on the side bitstream, spatially align the reconstructed invariant feature side channel with the first reconstructed image, and perform topological consistency correction to obtain a second reconstructed image;
[0046] perform reconstruction on the constraint bitstream, constrain project the reconstructed task consistency indication information and the residual distribution, and perform connectivity compensation on the second reconstructed image according to the constraint projection result to obtain a recovered image.
[0047] The topological consistency correction comprises:
[0048] perform bridge repair based on adjacency relationship on the first reconstructed image according to the breaking position of the stroke skeleton in the invariant feature side channel;
[0049] perform geometric rollback based on parameterized tolerance on the first reconstructed image according to the boundary position of the line segment or arc segment in the invariant feature side channel;
[0050] perform boundary adjustment based on vertex difference on the first reconstructed image according to the offset boundary of the closed region in the invariant feature side channel.
[0051] Compared with the prior art, the application has the beneficial effects that:
[0052] By introducing joint modeling of task value density and uncertainty at the encoding end, and combining the invariant feature side channel and the task consistency indication information for topological correction and constraint projection at the decoding end, the application can prioritize the recovery quality of key areas such as character strokes, table lines, barcode modules and regular geometric boundaries under the condition of limited code rate, thereby avoiding the problems of stroke breaking, contrast attenuation and structural distortion in the prior art. BRIEF DESCRIPTION OF DRAWINGS
[0053] Other features, objects and advantages of the application will become more apparent from the following detailed description of non-limiting embodiments, made with reference to the accompanying drawings:
[0054] Figure 1 An exemplary application scenario provided for the embodiments of the application;
[0055] Figure 2 A flowchart of a planar image compression method provided for the embodiments of the application;
[0056] Figure 3 A method flowchart for generating a side bitstream and a constraint bitstream provided for the embodiments of the application;
[0057] Figure 4 A flowchart of another planar image compression method provided by an embodiment of the present application is shown in FIG. 2. DETAILED DESCRIPTION
[0058] The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all the embodiments of the present application.
[0059] In this document, reference to“an embodiment” means that a particular feature, structure, or characteristic described in connection with the embodiment can be included in at least one embodiment of the application. The appearances of the phrase“in an embodiment” in various places in the specification are not necessarily all referring to the same embodiment, nor are they necessarily mutually exclusive of one another. Those skilled in the art will appreciate from the present description that embodiments described herein can be combined with other embodiments in various ways.
[0060] In actual business, planar images usually carry highly structured information carriers, rather than natural scenes in the general sense.
[0061] For example, a bill, a contract, a receipt, a device nameplate, a logistics waybill, an inspection report, a table, and a partial drawing usually include fine lines and regular grids, character strokes, and low-texture backgrounds in the same frame, which are visually simple and heterogeneous in statistical characteristics.
[0062] An organization (including but not limited to a government electronic archive receiving platform, a financial bill centralized storage system, a cross-border customs declaration document image review platform, and a drug and special equipment compliance verification platform) that carries out automated acceptance, reconciliation, filing, and auditing for such carriers forms a joint process of restricted transmission-platform reorganization-long-term retention between the acquisition link and the archiving link:
[0063] Front-end devices are diverse and widely distributed, and need to be concentrated back through a controlled bandwidth private line or an encrypted tunnel. In order to reduce storage and retrieval costs, uniform transcoding, sampling, and scaling will be performed to meet the archiving specifications; in the background, OCR, table analysis, key field positioning, seal / sign verification, barcode / QR code decoding, and format consistency checking are directly completed on the image.
[0064] The core contradiction thus generated is not in the data task of planar images, but in the inevitable premise of controlled code rate and uniform transcoding, how to stably guarantee the lower limit of machine readability to avoid rework.
[0065] It can be understood that the inherent characteristics of the planar image determine the vulnerability of compression: mission-critical information is often concentrated in the geometric and topological structure, such as the minimum line width of character strokes, the local contrast of adjacent strokes, the connectivity of table grids, the curvature tolerance of polyline or circular arc, the minimum resolvable unit of barcode module, etc. Once the conventional perception-driven compression strategy considers them as high-frequency textures that can be sacrificed and flattens or breaks them, even if the subjective quality is still considered clear, the downstream recognition, positioning and measurement will have a disproportionate performance collapse.
[0066] Further, there are multiple rounds of uncertain processing in real scenarios, such as automatic sharpening and noise reduction at the shooting end, unified scaling and color domain conversion on the platform side, and re-encoding during long-term storage, making it difficult for traditional code control targeting only PSNR / SSIM to provide any guarantee for task indicators. The research and development work of those skilled in the art has long been plagued by the mismatch between perception indicators and task indicators.
[0067] In a representative embodiment, financial institutions collect mobile terminal and centralized storage of bills and contract attachments across branches.
[0068] The image contains red seal superimposed text, fine grid table and diagonal fine lines, local highlights caused by embossed metal nameplate reflection, barcodes / QR codes and character neighbors. Limited by the encryption bandwidth quota from the office park to the data center and the time window of centralized storage, the front end needs to perform rate control before uploading; the storage platform performs standardized size and re-encoding on the image for unified retrieval and long-term archiving. If the conventional compression path is still followed, slight line width thinning, destruction of stroke connectivity, and local contrast drop can cause OCR recall reduction, table cell missegmentation, and barcode module misjudgment, triggering manual review, secondary submission, and audit process delay.
[0069] To solve the objective constraints of such scenarios, the method of the present application performs online evaluation of image regions in terms of task value density and uncertainty at the encoding end, taking the minimum stroke width, local contrast, connectivity, and curvature deviation as rigid boundaries or soft constraints for resource allocation, and prioritizing the regions most critical to downstream tasks under a given rate budget; at the decoding end, the method combines the structure side channel carried in the secondary stream and the task consistency indication carried in the constraint stream to correct the topological consistency of the initial reconstruction result and project the constraint recovery, so as to offset the uncontrollable disturbance introduced by platform transcoding and make subjective visibility and machine readability consistent in the same stream.
[0070] Based on the same concept, the method of the present application can be seamlessly migrated to scenarios such as government electronic archive acceptance, cross-border trade document review, and compliance record archiving of pharmaceutical production and equipment maintenance.
[0071] The common point of the foregoing scenarios is that:
[0072] Uplink bandwidth is controlled or there is time slice competition; the platform must perform standardized transcoding; the value of the image is mainly carried by structured and extractable strokes / boundaries / grids; and the downstream task indicators have the minimum available line with legal or compliance constraints.
[0073] Under this constraint system, the implementation method of this application provides an engineering path for planar image compression centered on task consistency, avoiding the common defect of traditional strategies that have good perception indicators but fail in task indicators, and ensuring the readability / measurability reliability of cross-platform, cross-link and cross-time period processing without limiting specific devices, shooting postures or single-category documents.
[0074] refer to Figure 1 , Figure 1 This is an exemplary application scenario diagram provided for an embodiment of this application.
[0075] Figure 1 The application scenarios shown include the encoding end, the transmission end, and the decoding end.
[0076] The encoding end is used for feature extraction, task value density calculation, and bitstream generation of the planar image to be processed. The encoding end includes:
[0077] The data acquisition module is used to acquire the planar image to be compressed and perform preprocessing.
[0078] The feature extraction module is used to perform feature analysis on the planar image to obtain image features that characterize edges, strokes, connectivity, curvature, texture complexity, and confidence of text candidate regions, and to generate a task value density map and corresponding uncertainty based on the image features.
[0079] The encoding module is used to generate quantization step size and bit allocation weight based on the task value density map and uncertainty, compress and transform the planar image to obtain the main bitstream, and further generate invariant feature side channel and task consistency indication information. After compression, the sub-bitstream and constraint bitstream are obtained, and finally the main bitstream, sub-bitstream and constraint bitstream are output.
[0080] The transmission end includes a transmission path for transmitting the main bitstream, the secondary bitstream, and the constraint bitstream between the encoding end and the decoding end.
[0081] The decoding end is used to decode and restore the received bitstream. The decoding end includes:
[0082] The decoding module is used to perform anti-entropy decoding and dequantization on the main bitstream to obtain the initial reconstructed image, and to recover the invariant feature side channel and task consistency indication information based on the sub-bitstream and constraint bitstream;
[0083] The data restoration module is configured to fuse the invariant feature side channel and the task consistency indication information with the initial reconstructed image, perform topological consistency correction and constrained projection reconstruction, and obtain a target reconstructed image that meets a lower limit requirement of task consistency.
[0084] Next, a plane image compression method provided by an embodiment of the present application is further described in combination with the drawings, Figure 2 The method shown is applied to an encoding end of an image compression system, the image compression system further includes a decoding end configured to perform image reconstruction according to a code stream output by the encoding end, and the method includes the following steps.
[0085] S1: Obtain a plane image to be compressed.
[0086] In this embodiment, the plane image to be compressed can be a bill image for automatic processing, a contract attachment, a table scan, a logistics face sheet or a device nameplate photo, and the common feature is that there are heterogeneous elements such as character strokes, table lines, seal edges and low-texture backgrounds in the image.
[0087] As can be understood by those skilled in the art, the source of the plane image is not limited to a scanner or a mobile terminal photographing, and any two-dimensional image that can generate structured content can be applicable, and the present application does not limit this.
[0088] S2: Feature extraction is performed on the plane image to obtain image features, a task value density map is calculated according to the image features, and an uncertainty corresponding to the task value density map is calculated.
[0089] In this embodiment, the image features include but are not limited to edge strength, stroke energy, connectivity index, curvature change, texture complexity and character candidate region confidence. Based on these features, the image is divided into pixel-level and sub-block-level units by using a multi-scale division method, the task contribution scores of the units are calculated, and the task value density map is finally generated by correcting the scores through spatial regularization and topological consistency constraint. Further, the reliability of the task value density map is estimated in combination with multi-model inference results, input disturbance test and probability distribution entropy value, and the uncertainty is formed.
[0090] S3: According to the task value density map and the uncertainty corresponding to the task value density map, a quantization step and a bit allocation weight are generated to perform compression transformation on the plane image, and a main code stream is obtained.
[0091] In this embodiment, compressed sensing processing is first performed on the planar image to obtain transform domain coefficients. Then, based on the joint distribution of task value density and uncertainty, weighted sparse modeling is performed on each candidate unit, and the reconstruction error is calculated by projecting the observation sequence matrix. According to the superposition effect of reconstruction error and task value, the region is divided into high-priority, medium-priority, and low-priority regions, corresponding to the quantization step sizes of the tightening interval, the baseline interval, and the loosening interval, respectively. Simultaneously, a higher bit share than the baseline is allocated to the high-priority region, a lower bit share than the baseline is allocated to the low-priority region, and the medium-priority region maintains an average level. This differentiated allocation strategy can stably guarantee the minimum recovery requirements of character stroke width, table connectivity, and curvature constraints within a given bit rate budget, avoiding the loss of machine readability caused by traditional perceptual compression.
[0092] S4: Send the main bitstream to the decoding end;
[0093] It is understood that the image compression system in this application specifically refers to a functional assembly formed to realize the aforementioned planar image compression and reconstruction process, including an encoding end for executing encoding method steps, a transmission path for carrying the main bitstream / sub-bitstream / constraint bitstream transmission, and a decoding end for performing decoding and constraint restoration; its physical form can be a standalone device, an edge-end integrated machine, a distributed cluster, or a cloud-edge collaborative device, or it can be implemented by a processor executing program instructions in a storage medium, or implemented through a programmable logic device / application-specific integrated circuit; the transmission path can be a wired or wireless network, a leased line or a virtual private network, and intermediate transcoding, scaling, or archiving links are allowed; the encoding end and the decoding end are only logically divided and are not limited to independent hardware units, and can be integrated with the acquisition / storage / business processing module or deployed separately as needed; the terminology is not limited to a specific brand, interface, or protocol stack, as long as it can output a constraint bitstream containing a main bitstream, a sub-bitstream carrying invariant feature side channels, and task consistency indication information, and complete reconstruction and consistency correction at the decoding end accordingly, it should be considered to fall within the application scope of the image compression system described in this application.
[0094] Before detailing the specific technical aspects of the steps, this application's embodiments need to reiterate:
[0095] To facilitate understanding of the technical logic of this application, the information organization method of planar images in engineering compression scenarios will be explained first.
[0096] In this application, the planar image is not a homogeneous signal; its effective information is highly concentrated in geometric and topological elements that can be formally characterized, such as the line width and connectivity of character strokes, the row and column relationships of grids, the boundaries and corners of condition markings, and the smallest modular unit of barcodes / QR codes.
[0097] If only pixel error or perceptual metric is targeted in actual compression, the above elements are easily misjudged as high-frequency components that can be sacrificed, leading to nonlinear failure of downstream recognition and measurement performance in the case of acceptable visual quality. To avoid such mismatch, the present embodiment first establishes the division of the task-related information fidelity region and the allowable distortion region at the encoding end, and all subsequent parameter generation is subject to this division as a constraint premise, with the goal of concentrating code rate consumption on key structures that determine machine readability, thereby achieving consistency between code control and task indicators.
[0098] In the method logic at the encoding side, first, the joint characterization of the degree of influence on the task and the stability of the evaluation is formed according to the local statistics and semantic clues of the image content, which can be understood as value and confidence, respectively.
[0099] Further, instead of directly using the joint characterization as a threshold screening, it is converted into a parameterized description of the allowed distortion set:
[0100] For regions with high value and high confidence, only quantization disturbance under the conditions of meeting the minimum stroke width, minimum local contrast, connected relationship not being destroyed, curvature deviation upper limit being controlled, etc. is allowed; for regions with low value or low confidence, more relaxed distortion boundary is allowed, but it is still required to maintain consistency with adjacent regions in structure. The method of the present application is equivalent to setting the feasible solution space for different regions, so that subsequent quantization and bit allocation are optimized in the solution set that meets the constraints, thereby avoiding the case where the perceptual score is improved but the task fails.
[0101] In addition to the main code stream, the present embodiment also constructs two groups of additional information to enhance the recoverability after cross-platform transmission.
[0102] One group is the invariant feature side channel, which uses compact representations such as topologically preserved graph structure, geometric element parameters, and regular grid description to independently save structural information such as connection relationship, curvature form, grid frequency and offset that are easily damaged in re-encoding, and realizes spatial alignment with the main code stream through anchor points and block-level indexing.
[0103] The other group is the task consistency indication information, which parameterizes the stroke width, contrast, connectivity, curvature deviation, boundary offset, etc. by region, only records the section parameters, applicable range and priority markers, and uses hierarchical levels of mandatory constraints and suggested constraints to facilitate differential recovery at the decoding end.
[0104] The two groups of information are respectively formed into a secondary code stream and a constraint code stream after context adaptive entropy coding, with the purpose of providing the decoding end with verifiable and projectable structural benchmarks and constraint bases without significantly increasing the total code rate.
[0105] It is worth noting that the foregoing process does not limit the specific shooting medium, the collection posture or the business category. The acquisition of the value degree and the confidence degree can be realized by different features and criteria, including but not limited to edge strength, stroke energy, connectivity, curvature change, character candidate confidence, key point density, etc. The division granularity of the segmentation parameter can also be adjusted according to the storage and real-time requirements.
[0106] As can be appreciated by those skilled in the art, as long as a feasible solution space about the task-sensitive structure can be formed at the encoding side, and the topological correction and constraint projection are performed accordingly at the decoding side, the technical effect of guaranteeing the task consistency at a limited code rate can be achieved.
[0107] Next, the technical content of the image features of the method of the present application is further expanded.
[0108] In the present embodiment, the image features are used to represent the edges, strokes, connectivity, curvature, texture complexity and character candidate region confidence of the planar image.
[0109] It can be understood that the feature extraction can be realized by a classical image processing process (including but not limited to directional filtering, structure tensor analysis, thinning / skeletonization, connected component labeling, local fitting and parameterized description), by a learning feature network (including but not limited to lightweight semantic segmentation, text detection and thin line enhancement subnetwork), or by a fusion of the two; the running platform can be a general-purpose processor, a graphics processing unit, a programmable logic device or a special-purpose circuit, and the parameter training can be completed based on public data or internal samples, which is not described in detail herein.
[0110] Next, the technical content of the image feature processing of the method of the present application is further expanded.
[0111] It can be understood that the task value density map and the uncertainty corresponding to the task value density map are not independent endpoints in the present application, but are used as pre-inputs for subsequent compressive sensing processing, for depicting the difference and reliability of different regions of the image in the task semantics in advance before signal projection and sparse modeling, and the basic principle is that:
[0112] The reconstruction accuracy of compressive sensing depends on two core factors, one is the sparsity of the signal in the sparse domain, and the other is the resource allocation mode of the sparse coefficients in the observation and reconstruction process. If the same homogeneous sparse modeling and observation are used for all image regions at the encoding end without distinction, the limited projection dimension and code rate will be evenly distributed to a large number of low-value regions, resulting in irreversible cracking and weakening of key strokes, connected boundaries and table grids in reconstruction.
[0113] In the embodiment, by calculating the task value density map in advance, a weighted model can be established for the sparse signal before the compressed sensing projection: the high value area is given a higher retention weight, and the low value area is given a lower retention weight. In this way, when constructing the observation sequence matrix and performing sparse representation, the observation energy is guided to concentrate in the task critical area, so that the limited observation value carries more task-related structural information. At the same time, combined with the uncertainty map, the protection redundancy can be moderately increased in the high value but unstable evaluation area, and the code rate input is reduced in the low value and stable evaluation area. In other words, the value density provides the importance ranking, and the uncertainty provides the credibility boundary, and after the combination of the two, a weighted sparse signal representation that can be directly used by the compressed sensing process is formed.
[0114] In one example, calculating a task value density map according to the image feature and the uncertainty corresponding to the task value density map comprises:
[0115] S2.1: According to the preset multi-scale division rule, the planar image is divided into pixel-level and sub-block-level candidate units, and a plurality of sub-features for representing the importance of the downstream task are calculated for each candidate unit based on the image feature;
[0116] Specifically, the structure carrying the task semantics in the planar image often appears in sub-pixel or pixel scale, and is not naturally aligned with the block grid adopted in subsequent encoding; if only a single block-level granularity is described, information leakage will occur at the intersection of strokes and the turning place of thin lines, and only pixel-level granularity is easy to be disturbed by noise and contrast fluctuations. Therefore, a candidate unit set of pixel-level and sub-block-level is constructed, and aliasing effect and block boundary artifacts are suppressed through multi-scale division, so that the description of thin lines and connectivity has both sensitivity and stability.
[0117] In the embodiment, the pixel-level candidate is represented by a full-pixel grid; the sub-block-level candidate is represented by a grid aligned with the encoding block, and the block edge length can be 8x8 or 16x16, and a half-block overlap is set to alleviate the boundary truncation.
[0118] The sub-features of each candidate unit are calculated: in terms of edge and stroke, a direction-adjustable filter bank is used to obtain gradient amplitude and main direction, and combined with thin line enhancement response and local contrast constraint to filter out texture high frequency; for the response meeting the thin line hypothesis, thinning is performed to obtain the skeleton, and the approximate line width is estimated along the main direction by distance transform; in terms of connectivity, the connected components of the binary foreground are labeled, the component area, slenderness ratio and hole count are recorded, and the undirected graph is constructed on the skeleton graph to obtain the end points, branch points and their adjacency degrees; in terms of curvature, broken lines and arc segments are extracted from the skeleton and significant edges, local robust fitting is used to estimate the curvature and curvature trend at the vertex, and the parameterized description and tolerance band of suspected regular geometry are recorded; in terms of texture complexity, the eigenvalue ratio of structure tensor, band-pass energy density, local entropy and spectral energy concentration are calculated to distinguish low-texture background, regular repeating texture and irregular texture; in terms of text candidate, the outputs of traditional candidate and lightweight detection branch on the down-sampled feature map are combined to obtain the candidate text line direction, line spacing, character anchor point and region confidence. The foregoing sub-features are directly output at the pixel level and in the form of regional statistics at the sub-block level, which are used for subsequent fusion.
[0119] S2.2: According to the preset mapping rule, the plurality of sub-features are fused to obtain the task contribution score of each candidate unit, and the task contribution score is modified in connectivity by spatial regularization and topological consistency constraint, to generate a task value density map with the same coordinate system dimension as the planar image;
[0120] Specifically, the contribution of multi-source sub-features to the task is non-homogeneous:
[0121] Stroke line width and local contrast are more sensitive to OCR, connectivity and table grid are more critical to layout analysis, and curvature and its tolerance are more important to the maintenance of regular geometry; if simply linearly summarized, high-frequency textures may be misjudged as high value or thin lines may be underestimated in low-contrast background.
[0122] In this embodiment, each sub-feature is first normalized and dynamically compressed, and a lookup table and piecewise linear mapping are used to establish a monotonic relationship with the task relevance, for example, pixels with line width close to the minimum readable threshold are given higher weights, the risk of breaking of connected components and the density of skeleton end points are given promotion items, and deviations within the tolerance band of regular geometry are given protection items;
[0123] Further, the initial task contribution score is calculated at the pixel level and the sub-block level respectively, and edge-guided regularization is performed in space:
[0124] The difference between adjacent units is relaxed at strong edges and tightened in the same text line or table line direction to avoid breakpoints along the structure direction;
[0125] Further, the embodiments of the present application further include topology consistency constraints to propagate scores along graph edges with skeleton graph and grid graph as carriers, to ensure the score continuity of the whole text line and the whole table line, and to prevent low scores in only inflection points or weak paragraphs from splitting the structure; for barcode and two-dimensional code regions, the module size and alignment angle are used as a priori, and the contribution peaks are reserved on the module boundary and moderately suppressed inside the module to meet the dependence of decoding algorithms on boundary sharpness.
[0126] S2.3: performing uncertainty evaluation on the task value density map to obtain the uncertainty;
[0127] Specifically, simply relying on the task value density for resource allocation may produce overconfidence in boundary conditions, low-contrast regions, or approximate structure regions, thereby directing limited code rate to regions that are not stable in return; the purpose of introducing uncertainty evaluation is to measure the robustness of value evaluation, so that resource preference is not only driven by importance, but also constrained by evaluation reliability, thereby maintaining the recoverable margin on the decoding side under unknown processing chains (such as scaling, re-encoding, color transformation) and unknown task sets.
[0128] In the present embodiment, the uncertainty evaluation at least includes one of the following:
[0129] result dispersion evaluation;
[0130] stability evaluation based on input disturbance, wherein the input disturbance includes scaling, noise, and color disturbance;
[0131] entropy value evaluation of output probability distribution;
[0132] observation confidence evaluation of texture complexity;
[0133] In one example, the result dispersion evaluation is achieved by repeated calculation under multiple models or multiple parameter settings.
[0134] Specifically, for the same planar image, different parameter combinations (such as different threshold settings, different scale filter sets, or different skeleton extraction algorithms) can be used in the feature extraction stage, thereby generating multiple candidate task value density maps. The contribution scores of each candidate unit are statistically analyzed, and if the results differ significantly between multiple models, it indicates that the value judgment of this region is unstable and should be assigned a higher uncertainty; otherwise, if the results are highly consistent, the uncertainty is lower. This method can reveal the risks brought by model bias and parameter dependence, so that the code rate allocation avoids over-investment in inconsistent model regions.
[0135] In another example, the stability evaluation based on input disturbance is completed by simulating the distortion that may occur on the transmission link.
[0136] Specifically, a slight perturbation is applied on the original image, such as scaling the resolution, superimposing low-intensity noise, adjusting the color component or brightness range, and then recalculating the task value density map. Compare the contribution score distribution before and after the perturbation. If the distribution deviates greatly under the perturbation condition, it indicates that the feature expression of the region is sensitive to link perturbation, and the subsequent reconstruction uncertainty is high; if the result is still basically consistent after the perturbation, it indicates that the region is robust and can be moderately adjusted in code rate allocation.
[0137] In another example, the entropy value evaluation of the output probability distribution is mainly applicable to the candidate region based on a detection model or a classification model.
[0138] Specifically, when the text detection, table detection or barcode detection module gives a probability output for a region, if the probability distribution is concentrated and the maximum value is significantly higher than the second highest value, it indicates that the model is more certain about the region and has low uncertainty; if the probability distribution is dispersed and the maximum value is close to the second highest value, it indicates that the model has ambiguity or ambiguity for the region, which should be determined as high uncertainty.
[0139] Among them, the detection model or classification model can be realized by traditional image processing algorithms, such as rule detectors based on connected component analysis, edge enhancement and geometric constraints, or through deep learning networks, such as convolutional neural networks, recurrent neural networks or target detection frameworks based on attention mechanisms, or through lightweight semantic segmentation networks or multi-task learning networks, which are not limited by the present application.
[0140] As can be appreciated by those skilled in the art, the selection of the model can be adjusted according to the specific deployment environment, computing resources and accuracy requirements of the target task, as long as it can output the region probability distribution and meet the basic requirements of entropy calculation.
[0141] In another example, the observation confidence evaluation of texture complexity is calculated by analyzing the local signal-to-noise ratio, local contrast and structure tensor features.
[0142] Specifically, in a low-contrast background or a strong texture region, the difference between the strokes and the background is not enough, and the boundary information is easily covered by noise or compression loss, thereby reducing the task readability. In this case, the signal-to-noise ratio and contrast index are calculated for the local region, and the directionality feature of the structure tensor is combined to determine whether the information is stable enough; if the region texture is complex and the signal-to-noise ratio is low, a high uncertainty is given; if the region texture is simple and the signal-to-noise ratio is high, a low uncertainty is given.
[0143] Further, the aforementioned multi-class evaluation results are weighted and fused, and are smoothed through spatial regularization and topological consistency constraints, so that the uncertainty is continuously distributed near the structural boundary, without isolated noise points or large unreasonable mutations, to obtain the corresponding uncertainty.
[0144] Next, the technical content of the compression transformation of the method of the present application is further developed.
[0145] In one example, the generating quantization step and bit allocation weight comprises:
[0146] S3.1: compressive sensing is performed on the planar image to obtain corresponding transform coefficients;
[0147] Specifically, the planar image is first divided into blocks according to a grid aligned with the coding blocks with half-block overlap, and a sparse representation domain matching the structure of each block is selected according to the text / line direction obtained in the previous step.
[0148] In one example, the basic principle of compressive sensing on the planar image to obtain transform coefficients is to utilize the compressibility of the signal in a certain sparse domain, to approximate the recovery of high-dimensional information through low-dimensional observation, thereby reducing the amount of redundant data and improving the coding efficiency.
[0149] Specifically, the planar image is first divided into a plurality of candidate regions according to a predetermined block division rule, which is done because local regions usually have stronger sparsity in a certain sparse basis, facilitating subsequent modeling; within each region, the image signal is represented sparsely using a sparse dictionary (such as a wavelet dictionary, a discrete cosine dictionary, or an overcomplete dictionary obtained by training) to obtain a sparse coefficient set, most elements in the sparse coefficient set are close to zero, and only a small number of coefficients carry the main information.
[0150] Further, an observation sequence matrix satisfying the compressive sensing constraint condition is constructed, which usually requires low correlation with the sparse dictionary to ensure that the observation process retains sufficient information, common design methods include Gaussian random matrix, Bernoulli matrix or structured Hadamard matrix, and linear observation of the sparse coefficient set is performed through the observation sequence matrix to obtain observation values.
[0151] Further, based on the observation values and sparse prior knowledge, an optimization solving method is used to recover the approximate coefficient representation of the planar image in the sparse domain, and finally the approximate coefficient representation is used as the transform coefficient for subsequent quantization and bit allocation. In this process, sparse representation refers to reconstructing the original signal with as few non-zero coefficients as possible in a high-dimensional basis function set, the observation sequence matrix is a linear operator that maps the high-dimensional sparse signal to the low-dimensional observation space, and the optimization solving is a calculation method for recovering the sparsest solution from the underdetermined equation set. Through this process, the low-dimensional projection approximation can be used to replace the high-dimensional original data without significantly increasing the computational overhead, effectively compressing the planar image, and providing a stable transform coefficient basis for the subsequent differentiated resource allocation of value guidance.
[0152] S3.2: Weighted sparse modeling of the transform coefficients of the planar image according to the uncertainty corresponding to the task value density map, to obtain a sparse signal representation for representing the task value weight and the confidence constraint;
[0153] Specifically, based on the task value density and the uncertainty, two types of weights are specified for each candidate unit and the frequency band to which it belongs:
[0154] One is a reservation weight, which is used to improve the selection priority of the atom corresponding to the unit;
[0155] The other is a confidence boundary, which is used to limit the acceptable approximation error amplitude of the unit.
[0156] The reservation weight monotonically increases with the value density, and the confidence boundary monotonically tightens with the uncertainty. Both of them spread in the text line / table line direction in space, making the constraints of the entire structure consistent. In the frequency band dimension, the directional atoms near the main direction of the stroke and the band-pass atoms of their harmonics obtain higher reservation weights, while the high frequencies unrelated to the task in the background low frequencies are down-regulated.
[0157] In this embodiment, a weighted sparse prior is imposed on the transform coefficient tensor, and a group structure is modeled to fit the real geometry:
[0158] The atoms in the same skeleton neighborhood form a group, the same grid row / column forms a group, and the barcode module boundary forms a group; the activation of the atoms in the group is promoted by the reservation weight, and the activation of the atoms outside the group is inhibited.
[0159] In some optional specific embodiments, the reconstruction process further includes a double-track shutdown rule: when the approximation error of a certain candidate unit reaches its confidence boundary lower limit, stop refining at that unit, and pass the budget to high-value units that have not reached the limit; when the global code rate trial reaches the reserved threshold, switch to a mode of only slightly refining high-value high-uncertainty units to form a sparse signal representation with key reservation and residual inhibition.
[0160] S3.3: Projecting the sparse signal representation onto the observation sequence matrix, and calculating the reconstruction error of each candidate unit in the task value density map in the projection domain, wherein the reconstruction error is used to represent the recovery sensitivity of the candidate unit under the condition of meeting the global code rate constraint;
[0161] Specifically, the weighted sparse representation is forward projected under the same observation sequence matrix as S3.1 to obtain simulated observations, which are compared with actual observations. The projection residuals of the two reflect the degree of consistency of the current representation with the observations.
[0162] In this embodiment, two stabilization methods are introduced for error calculation.
[0163] One is residual extrapolation with early stopping:
[0164] Only a few iterations are used to estimate the error for each unit, and the error-iteration curve slope of the unit history is used for extrapolation to avoid full high-cost reconstruction.
[0165] The other is structure consistency penalty, which weights and amplifies the error that conflicts with the skeleton / mesh structure in the secondary stream, so that the subsequent priority division is biased towards the unit that contributes more to the structure consistency.
[0166] It can be understood that the specific way to calculate the reconstruction error of each candidate unit in the task value density map in the projection domain can be implemented in various ways.
[0167] For example, a residual energy allocation-based method can be used, that is, the difference between the observation value and the reconstruction value is calculated as residual energy in the projection domain, and the residual energy is allocated back to the corresponding candidate unit through atomic response or basis function mapping to estimate its reconstruction error;
[0168] An iterative reconstruction difference-based method can also be used, which records the convergence trajectory of the candidate unit at different iteration rounds during sparse reconstruction, and infers the reconstruction error through convergence rate and stability;
[0169] A task loss approximation-based method can also be used, which corresponds the residual of the candidate unit in the projection domain to the deviation of the task feature, thereby indirectly deriving the task-related reconstruction error of the candidate unit.
[0170] S3.4: Priority division is performed on the candidate units according to the reconstruction error, to obtain high-priority, medium-priority and low-priority regions;
[0171] It can be understood that the high-priority, medium-priority and low-priority regions can be divided by pre-set segmentation thresholds, which can be determined by a large number of experiments by those skilled in the art. The specific threshold can be a range, and the reconstruction error in the corresponding range is the corresponding priority. It can also be a plurality of specific numerical values, which meet the numerical size relationship to be the corresponding priority. The present application does not make more limitations here.
[0172] S3.5: For the high-priority region, set the quantization step size in the pre-set tightening interval and allocate the corresponding bit share; for the medium-priority region, set the quantization step size in the pre-set reference interval and allocate the corresponding bit share; for the low-priority region, set the quantization step size in the pre-set relaxation interval and allocate the corresponding bit share;
[0173] Specifically, a reference quantization step and an upper and lower limit interval are preset for each frequency band, and then a corresponding interval is selected according to the region priority: a high priority uses a tightened interval, a low priority uses a relaxed interval, and a medium priority uses a reference interval.
[0174] In the embodiment, the interval boundary is determined by the value density and the uncertainty. The higher the uncertainty, the lower the upper limit of the tightened interval and the higher the lower limit of the relaxed interval, so as to increase the protection redundancy. The bit share is allocated in units of regions, the basic needs of high priority regions are met first, and then the supplement is allocated according to the decreasing sensitivity; within the region, the step transition is linear or piecewise gradual along the text line / table line direction, so as to avoid quantization steps along the structure direction.
[0175] Further, the quantization step and the bit share setting can also be linked with the entropy model to perform a quick evaluation of trial quantization-trial entropy coding for each region. If the cumulative code rate exceeds the budget, the supplement share of the low priority region is preferentially recovered; if there is still a margin in the budget, a small amount of additional allocation is added in the high priority region with high uncertainty. In order to ensure consistency across block boundaries, the step of adjacent blocks in the boundary band adopts a merging strategy of the nearest neighbor; in order to ensure the executability of the structure constraint, a structure guardian threshold is added in the tightened interval:
[0176] If the trial quantization results in a minimum stroke width or minimum contrast prediction below the threshold, the step is automatically adjusted downward until the threshold is met or the bit share of the region is increased by a minimum increment.
[0177] In one example, the method of the present application further comprises:
[0178] S5: generating a secondary code stream and a constraint code stream according to the image features.
[0179] It can be understood that after the secondary code stream and the constraint code stream are generated, the secondary code stream and the constraint code stream, and the main code stream can be sent to the decoding end.
[0180] Reference Figure 3 , Figure 3 The method flow chart for generating the secondary code stream and the constraint code stream of the embodiment of the present application.
[0181] In one example, the specific steps of S5 are as follows:
[0182] S5.1: calculating an invariant feature side channel according to the image features, wherein the invariant feature side channel at least includes one of stroke skeleton and connected topology, line segment and arc segment and their geometric tolerance, text line direction statistics, key points and adjacency relationship, table grid structure descriptor, and region shape;
[0183] Specifically, to provide a structural reference for the reconstructed results after multiple rounds of transcoding or scaling at the decoding end, it is necessary to separate low-dimensional structural quantities that are stable for task judgment and weakly related to perceptual details from the planar image. The low-dimensional structural quantities remain relatively unchanged under resampling and light denoising, and can be used as anchor points for topological correction and constrained projection. Therefore, the descriptors related to boundaries, skeletons, regular geometry and layout order are extracted as independent side channels, and an invertible alignment relationship is established with the main code stream, so as to preferentially guarantee the recoverability of character connectivity, grid alignment and curvature form under limited code rate.
[0184] In the embodiment, the skeleton nodes are numbered in the order of space-filling curves, the node coordinates are quantized in a grid manner relative to the block anchor points, and the adjacency relationship is recorded in a sparse adjacency table and a Boolean flag of end point / branch point; the line segments and arc segments are obtained by robust fitting of edge point sets, the straight lines are parameterized by start point-direction-length, the circular arcs are parameterized by center direction-radius-arc length, and the tolerance bands are estimated according to local curvature distribution and imaging scale; the text line direction statistics are obtained by joint calculation of direction histogram and projection spectrum, and the output main direction, line spacing and direction bucket index are obtained; after stability screening, the key points are used to establish the adjacency relationship and remove the cross-structure short circuit by using k-nearest neighbor and angle consistency; the table grid structure is represented by row and column base frequency and offset sequence, and intersection sparse mask; the region shape is represented by polygon chain code and vertex difference.
[0185] S5.2: generating task consistency indication information according to the image features, wherein the task consistency indication information at least includes one of stroke width, local contrast, connectivity preservation rate, curvature deviation upper limit and boundary offset upper limit;
[0186] Specifically, the separate structural anchor points can only be used for morphological alignment, and it is difficult to constrain the influence of quantization disturbance on the readability / measurability threshold; in order to enable the decoding end to maintain the lower limit of task performance under unknown processing chain, it is necessary to solidify the acceptable distortion range in the form of parameterization as a projectable constraint set, covering key thresholds such as line width, contrast, connectivity, curvature and boundary position, so as to give a clear feasible region for local adjustment in the reconstruction stage.
[0187] In the present embodiment, the stroke width threshold is obtained by distance transform statistics from the skeleton centerline to the boundary, and the minimum reserved value is given in piecewise constant or piecewise linear form for different font size / line width sections; the local contrast threshold is output by robust quantile difference and contrast statistics within the directional window, avoiding the influence of global brightness drift; the connectivity preservation rate is calculated according to the edge set of the skeleton graph and the weak contrast breakpoint risk, and is defined as the minimum continuous proportion of the structure edge that should be preserved after reconstruction, and gives priority order to the bridging repair position; the curvature deviation upper limit is jointly determined by the tolerance band of arc segment fitting and the sampling scale, and the equivalent curvature of straight line segment is given a near-zero tolerance, and the tolerance upper limit of small radius arc segment is given a radius-increasing tolerance upper limit; the boundary offset upper limit is expressed by the vertex offset boundary equivalent to the Hausdorff distance, and the offset boundary is given in segments on the long side to control the cumulative error. The spatial allocation of parameters is carried out in units of structure regions: the text line is assigned, the table line is assigned in row / column segments, and the isolated graphics is assigned in shape regions, and the applicable range mask and priority label are attached.
[0188] S5.3: compressing the invariant feature side channel and the task consistency indication information to obtain a corresponding secondary code stream and a constraint code stream;
[0189] Specifically, if the structure and constraints are stored in a pixel-by-pixel form, unnecessary burden will be caused, and it is difficult to maintain topological invariance; therefore, joint compression of topological preservation and parameterized modeling is adopted, so that the symbol sequence is fully de-redundant before entropy coding, and the spatial anchoring information with the main code stream is recorded in the code stream, ensuring that the decoding end can be randomly accessed and incrementally used.
[0190] In the present embodiment, the invariant feature side channel adopts three types of encoding:
[0191] The first is graph structure encoding, the skeleton nodes are ordered according to the space-filling curve, the node coordinates are differentially encoded with respect to the block anchor points and are variable-length encoded, the adjacency table is recorded with node index difference, and the end point / branching / closed loop is marked with a Boolean bit.
[0192] The second is geometric element encoding, the line / arc parameters are quantized after orthogonalization, the adjacent element parameter difference is differentially encoded and uses run-length encoding for repeated patterns, and the tolerance band is quantized as a level code word.
[0193] The third is grid and text direction encoding, the row and column base frequency and offset sequence uses prediction residual encoding, the intersection sparse mask uses bit plane and run mixed encoding, and the text direction is bucket indexed and the line spacing is entropy encoded.
[0194] Further, the task consistency indication information is encoded using a segmented model:
[0195] Write regionally segment boundary index, parameter vector, applicable mask and priority mark, boundary track is expressed in chain code or polygon vertex difference, parameter vector is rotated and quantized according to dimension correlation, forced constraint and recommended constraint are put into base layer and enhancement layer respectively.
[0196] In one example, the invariant feature side channel and the task consistency indication information are compressed to obtain a corresponding secondary code stream and a constraint code stream, including:
[0197] The invariant feature side channel is topologically maintained and coded to obtain an invariant feature symbol sequence, wherein the topologically maintained and coded includes arranging the spatial position points of stroke skeletons and line segments and arc segments according to a preset scanning order, differentially encoding the coordinate difference values between adjacent points in the invariant feature side channel, representing the connectivity between adjacent points by an adjacency list, and encoding the adjacency list index, and setting topological mark bits for closed regions, intersection points and branch points and embedding the coding sequence in the form of a Boolean symbol;
[0198] The task consistency indication information is segmented and coded to obtain a task symbol sequence, wherein the segmented and coded includes dividing into multiple region segments according to the spatial distribution of the task consistency indication information in the planar image, each region segment corresponding to a parameter set, fitting the parameter set to obtain a range mark and a priority mark corresponding to each parameter set;
[0199] The invariant feature symbol sequence and the task symbol sequence are entropy coded using the task value density map and the uncertainty corresponding to the task value density map as context conditions to obtain a base bit stream and an enhancement bit stream, wherein the base bit stream includes skeleton topology and forced constraint, and the enhancement bit stream includes geometric refinement and recommended constraint;
[0200] The secondary code stream and the constraint code stream are output according to the base bit stream and the enhancement bit stream.
[0201] Next, further introduce another planar image compression method provided by the embodiments of the application in combination with the drawings, Figure 4 The method shown is applied to a decoding end of an image compression system, the image compression system further includes an encoding end, the encoding end is configured to compress the planar image and transmit a main code stream, a secondary code stream and a constraint code stream corresponding to the compression result to the decoding end, and the method includes:
[0202] A1: receiving the main code stream, the secondary code stream and the constraint code stream;
[0203] Specifically, upon receiving the data, the encapsulation headers of the three bitstreams are parsed to read the version identifier, block-level index, spatial anchor point, scale level, random access index, and integrity verification field. Out-of-order reordering and packet loss detection are performed based on timestamps or sequence numbers. If an enhancement layer is detected as missing, only the base layer is used in subsequent processes. The header information of the main bitstream is used to recover regionalized quantization parameters, context model numbers, and block grid alignment relationships. For the secondary bitstreams, spatial indices of structural symbols such as skeletons / geometry / grids are recovered. For the constrained bitstreams, the applicable range mask for segmentation parameters and mandatory / suggested priority markers are recovered, and a one-to-one mapping table with the main bitstream block grid is established.
[0204] A2: Perform anti-entropy decoding and inverse quantization on the main bitstream to obtain the first reconstructed image and the residual distribution of the first reconstructed image;
[0205] Specifically, context-adaptive inverse entropy decoding is performed on the main bitstream according to the segment index to restore the transform domain symbol and regionalized quantization step size. Inverse quantization and inverse transformation are then performed based on the block grid and scale level to obtain the initial reconstruction result. To characterize the local recoverability differences caused by quantization and inverse transformation, the pixel / sub-block level residual distribution is estimated based on the decoded quantization step size, coefficient amplitude, and inter-block boundary continuity. The residual distribution records the locally allowed correction amplitude and direction preference (such as easier repair along the skeleton normal direction) in the form of a repairable margin map.
[0206] In this embodiment, the inverse quantization parameters are loaded with boundary information of three types of intervals: tightened, reference, and relaxed, according to regional priority. A transition band is set at the block boundary, and the quantization steps are smoothed by linear or piecewise interpolation. To reduce ringing and block effects, a light artifact removal preprocessing with structure preservation is adopted without destroying the frequency band energy distribution. Equalization filtering is applied only in low-texture areas, and the original frequency band relationship is maintained near fine lines and boundaries. At the same time, the difference before and after processing is written into the residual distribution as the preprocessing residual, which provides a reference for subsequent constrained projection.
[0207] A3: Reconstruct the sub-stream, spatially align the reconstructed invariant feature side channel with the first reconstructed image, and perform topological consistency correction to obtain the second reconstructed image;
[0208] Specifically, after the sub-stream is de-entropy decoded, the coordinates and adjacency relationships of skeleton nodes, parameters of line segments and arc segments and their tolerance bands, statistics of text line directions and line spacing, fundamental frequencies and offset sequences of table rows and columns, sparse masks of intersection points, key points and their adjacency graphs, etc. are reconstructed. Then, based on the block index, intra-block offset, scale level and spatial anchor point, the above structural quantities are aligned with the first reconstructed image. During the alignment process, cross-block connectors are used to splice segments into chains for long cross-block structures, and sub-pixel interpolation is performed on diagonal structures according to the direction vector.
[0209] In one example, the topological consistency correction comprises:
[0210] performing a bridge repair on the first reconstructed image based on an adjacency relationship according to a broken position of the stroke skeleton in the invariant feature side channel;
[0211] performing a geometric rollback on the first reconstructed image based on a parameterized tolerance according to a boundary position of the line segment or the arc segment in the invariant feature side channel;
[0212] performing a boundary adjustment on the first reconstructed image based on a vertex difference according to a shifted boundary of the closed region in the invariant feature side channel.
[0213] It can be understood that the topological consistency correction can be implemented based on existing image processing and computer vision methods. For example, when there is a broken position in the stroke skeleton recorded in the invariant feature side channel, the broken area in the first reconstructed image can be connected and compensated at the pixel level to restore the continuity of the stroke by using the adjacency relationship and the shortest path connection strategy of the skeleton node, in combination with a thinning algorithm or a morphological bridge method; when the invariant feature side channel provides a boundary position of a line segment or an arc segment, the shifted boundary in the first reconstructed image can be rolled back to make the edge morphology consistent with the geometric model in the side channel by using a parameterized fitting method in combination with a preset geometric tolerance range; when the invariant feature side channel contains a shifted boundary of a closed region, the boundary position can be corrected vertex by vertex to ensure that the overall shape and structure of the closed region remain stable by using a polygon vertex difference representation and a chain code matching method.
[0214] These processes all belong to topological preservation and geometric correction means commonly used in the art, and can be completed by using existing image repair, contour adjustment or optimization methods based on a graph structure, which will not be described herein.
[0215] A4: reconstructing the constraint code stream, performing constraint projection on the reconstructed task consistency indication information and the residual distribution, and performing connected compensation on the second reconstructed image according to the constraint projection result to obtain a recovered image;
[0216] Specifically, after decoding the constraint code stream, a stroke width lower limit, a local contrast lower limit, a connectivity preservation rate, a curvature deviation upper limit and a boundary shift upper limit segmented by regions, and their applicable masks and priorities are obtained. The parameter set is combined with the current residual distribution to form a feasible solution description of each target region: the adjustment direction allowed by the pixel, the amplitude limit allowed and the structure threshold to be met. The constraint projection is executed region by region:
[0217] In stroke regions, restricted thickening or thinning is performed along the skeleton normal until the line width lower limit is reached; in low-contrast regions, contrast stretching is performed within a local window while keeping the background mean unchanged; in curvature-limited regions, the displacement of boundary points is constrained so that the equivalent curvature does not exceed the limit; in boundary position-limited regions, the displacement of vertices is limited so that it does not exceed the upper limit. Each local adjustment is based on the principle of minimizing the increment of residual distribution, and the adjusted difference is written back to the projection residual.
[0218] In this embodiment, connectivity compensation is performed on the graph structure according to the connectivity retention rate and the bridging priority:
[0219] For edges in the skeleton graph that are below the target retention rate, restricted morphological bridging is performed along the shortest connection path, and the bridging strength is determined by the constraint priority and the residual margin. For table grid breakpoints, intersection backfilling is performed after alignment according to the row / column base frequency, and difference smoothing is performed at the junction to avoid steps. For barcode / QR code boundaries, fine-grained contrast stretching is preferentially performed at the module boundary, and excessive modification inside the module is prohibited to maintain decoding robustness. After completing the regional connectivity compensation, a consistency marker graph is generated, and each region is verified. If the threshold is still not met and there is a corresponding segment in the enhancement layer, local backfilling is triggered and projection is performed again until the forced constraint passes the verification or the enhancement layer is exhausted.
[0220] Although the embodiments of the present application have been shown and described above, it should be understood that the above-described embodiments are exemplary and should not be construed as limiting the present application, and those of ordinary skill in the art can make changes, modifications, replacements and variations to the above-described embodiments within the scope of the present application.
Claims
1. A planar image compression method applied to an encoding end of an image compression system, characterized in that, The image compression system further comprises a decoding end configured to reconstruct an image according to a bitstream output by the encoding end, and the method comprises: obtaining a planar image to be compressed; extracting features of the planar image to obtain image features, calculating a task value density map and uncertainty corresponding to the task value density map according to the image features; generating a quantization step and a bit allocation weight according to the task value density map and the uncertainty corresponding to the task value density map, to perform compression transformation on the planar image to obtain a main bitstream; sending the main bitstream to the decoding end; calculating a task value density map and uncertainty corresponding to the task value density map according to the image features, comprising: dividing the planar image into candidate units at the pixel level and the sub-block level according to a preset multi-scale division rule, and calculating a plurality of sub-features for representing the importance of downstream tasks for each candidate unit based on the image features; fusing the plurality of sub-features according to a preset mapping rule to obtain a task contribution score of each candidate unit, and performing connectivity correction on the task contribution score through spatial regularization and topological consistency constraint to generate a task value density map with the same coordinate system dimension as the planar image; performing uncertainty evaluation on the task value density map to obtain the uncertainty; the uncertainty evaluation at least includes one of the following: result dispersion evaluation; stability evaluation based on input disturbance, wherein the input disturbance includes scaling, noise and color disturbance; entropy value evaluation of output probability distribution; observation confidence evaluation of texture complexity.
2. The method of claim 1, wherein The image features are used to represent the edges, strokes, connectivity, curvature, texture complexity and text candidate region confidence of the planar image.
3. The method of claim 1, wherein The method further comprises: calculating an invariant feature side channel according to the image features, wherein the invariant feature side channel at least includes one of stroke skeleton and connected topology, line segment and arc segment and their geometric tolerance, text line direction statistics, key points and adjacency relationship, table grid structure descriptor and region shape; generating task consistency indication information according to the image features, wherein the task consistency indication information at least includes one of stroke width, local contrast, connectivity retention rate, curvature deviation upper limit and boundary offset upper limit; compressing the invariant feature side channel and the task consistency indication information to obtain corresponding secondary bitstream and constraint bitstream; sending the secondary bitstream and constraint bitstream, and the main bitstream to the decoding end.
4. The method of claim 1, wherein The generation of the quantization step and the bit allocation weight comprises: performing compression sensing on the planar image to obtain corresponding transform coefficients; performing weighted sparse modeling on the transform coefficients of the planar image according to the uncertainty corresponding to the task value density map to obtain a sparse signal representation for representing task value weight and confidence constraint; projecting the sparse signal representation on an observation sequence matrix, and calculating reconstruction error of each candidate unit in the task value density map in the projection domain, wherein the reconstruction error is used to represent the recovery sensitivity of the candidate unit under the condition of meeting the global code rate constraint. The candidate units are prioritized according to the reconstruction errors, and high-priority, medium-priority and low-priority regions are obtained; For the high-priority region, a quantization step is set within a preset tightening interval and a corresponding bit share is allocated; for the medium-priority region, a quantization step is set within a preset reference interval and a corresponding bit share is allocated; and for the low-priority region, a quantization step is set within a preset relaxation interval and a corresponding bit share is allocated.
5. The method of claim 4, wherein The planar image is compressed sensing to obtain corresponding transform coefficients, including: The planar image is divided into multiple candidate regions according to a preset blocking rule, and sparse dictionary is used to perform sparse representation on image signals in each candidate region to obtain a sparse coefficient set; An observation sequence matrix satisfying the compression sensing constraint condition corresponding to the planar image is constructed, and linear observation is performed on the sparse coefficient set through the observation sequence matrix to obtain corresponding observation values; Based on the observation values and a preset sparse priori, optimal solution is obtained to obtain an approximate coefficient representation of the planar image in the sparse domain; The approximate coefficient representation is taken as the transform coefficient.
6. The method of claim 3, wherein The invariant feature side channel and the task consistency indication information are compressed to obtain corresponding secondary code streams and constraint code streams, including: The invariant feature side channel is topologically preserved coded to obtain an invariant feature symbol sequence, wherein the topologically preserved coding includes arranging the spatial position points of stroke skeletons and line segments, arc segments according to a preset scanning order, differentially encoding the coordinate difference values between adjacent points in the invariant feature side channel; the connectivity relationship between adjacent points is represented by an adjacency list, and the adjacency list index is encoded; topological marker bits are set for closed regions, intersection points and branch points, and are embedded in the coding sequence in the form of Boolean symbols; The task consistency indication information is segmented coded to obtain a task symbol sequence, wherein the segmented coding includes dividing into multiple region segments according to the spatial distribution of the task consistency indication information in the planar image, each region segment corresponding to a parameter set; fitting the parameter set to obtain the range marker and priority marker corresponding to each parameter set; The invariant feature symbol sequence and the task symbol sequence are entropy coded to obtain a basic bit stream and an enhanced bit stream, taking the task value density map and the uncertainty corresponding to the task value density map as context conditions, wherein the basic bit stream includes skeleton topology and mandatory constraints, and the enhanced bit stream includes geometric refinement and recommended constraints; The secondary code streams and the constraint code streams are output according to the basic bit stream and the enhanced bit stream.
7. The method of claim 3, applied to a decoding end of an image compression system, wherein, The method includes: receiving the main code stream, secondary code stream and constraint code stream; performing inverse entropy decoding and inverse quantization on the main code stream to obtain a first reconstructed image and a residual distribution of the first reconstructed image; reconstructing the secondary code stream, spatially aligning the reconstructed invariant feature side channel with the first reconstructed image, and performing topological consistency correction to obtain a second reconstructed image; The constraint code stream is reconstructed, the reconstructed task consistency indication information is constrainedly projected with the residual distribution, and the second reconstructed image is compensated in connectivity according to the constrained projection result, so as to obtain a recovered image.
8. The method of claim 7, wherein, The topological consistency correction comprises: According to the breaking position of the stroke skeleton in the invariant feature side channel, the first reconstructed image is bridged and repaired based on the adjacency relationship; According to the boundary position of the line segment or the arc segment in the invariant feature side channel, the first reconstructed image is geometrically recalled based on the parameterized tolerance; According to the offset boundary of the closed region in the invariant feature side channel, the first reconstructed image is boundary adjusted based on the vertex difference.
Citation Information
Patent Citations
Learning image compression method and device for image sparse mask window attention
CN118368431A
Machine and human vision-oriented image coding and decoding method and compression method
CN119180874A