JPEG image compression method and system based on double markov chain optimization
By using a JPEG image compression system based on a dual Markov chain to dynamically adjust compression parameters, the adaptability and efficiency issues of JPEG image compression technology in complex scenarios are solved, achieving a balance between image quality and efficiency, and improving user experience and system performance.
Patent Information
- Application Number
- CN202511501194.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-21
- Publication Date
- 2026-01-27
- Estimated Expiration
- 2045-10-21
AI Technical Summary
Existing JPEG image compression technology struggles to adaptively adjust compression parameters when faced with complex and ever-changing application scenarios, fails to fully utilize multi-dimensional information, and struggles to achieve a good balance between image quality and efficiency in different scenarios.
A JPEG image compression system based on dual Markov chains is adopted. By receiving device events, image operations and system environment data, the status is dynamically updated, and quality factor prediction is performed using at least two Markov chain models to optimize image compression parameters.
It achieves stable operation under different network and device conditions, improves image quality and compression efficiency, enhances system adaptability and user experience, improves image quality by about 20%, and reduces transmission time by about 30%.
Smart Images

Figure CN120980244B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image compression technology, and in particular to a JPEG image compression method and system based on dual Markov chain optimization. Background Technology
[0002] JPEG image compression technology, widely used in image storage and transmission, aims to preserve image information with minimal storage space while maintaining acceptable visual quality. In traditional JPEG compression implementations, the quality factor is the core parameter determining the compression effect. Especially in scenarios such as remote desktop transmission, image compression, and financial market analysis, real-time adjustment of the quality factor can effectively balance performance and resource consumption. Markov chains, as a probabilistic stochastic process modeling tool, are ideal for predicting quality factors due to their memorylessness and efficient description of state transitions. Furthermore, by setting different quality factors for different time windows or data windows, the system's adaptability and efficiency can be further improved.
[0003] However, existing JPEG image compression techniques based on Markov chains to predict quality factors have some shortcomings. First, in practical applications, the system operating environment is complex and variable, changing not only with time or data windows but also potentially affected by various other factors, such as dynamic changes in network bandwidth and differences in device performance. Existing methods only consider time or data windows as a single dimension when setting quality factors, failing to comprehensively and accurately adapt to complex real-world environments. For example, in remote desktop transmission scenarios with unstable networks, even if the quality factor is set according to a time window, a sudden drop in network bandwidth can cause image transmission lag, and existing technologies cannot respond to such changes in a timely manner. Second, the state transition matrix of the Markov chain in traditional methods is usually fixed, failing to consider the dynamic evolution of the system state. In reality, the system state may change with changes in user behavior patterns, increased device usage time, and other factors. For example, after prolonged use of remote desktop, a user's operating habits may change, and the original state transition matrix cannot accurately reflect this change, leading to inaccurate quality factor prediction and consequently affecting image compression performance and system performance. Furthermore, existing image compression methods rely on a limited approach to analyzing user input activity data, depending solely on keyboard and mouse events to determine user activity levels. This neglects other information that might reflect user needs regarding images, such as zooming actions and viewing duration. This singular data source results in an incomplete understanding of user needs and fails to provide a richer basis for accurate prediction of quality factors. Summary of the Invention
[0004] This invention focuses on solving a series of key problems faced by traditional JPEG image compression technology in practical applications, aiming to improve the overall performance and adaptability of image compression to meet diverse user needs and complex system environments. Specifically, the technical problems to be solved include the following aspects:
[0005] 1. The problem of adaptive compression parameters. Traditional JPEG image compression technology usually uses fixed compression parameters, lacking the ability to dynamically adjust them according to actual conditions. In different application scenarios, such as varying network bandwidth, device performance, and user image quality requirements, this fixed-parameter compression method is difficult to achieve ideal results.
[0006] 2. The problem of utilizing multi-dimensional information. Limitations of traditional technologies: Most existing image compression technologies only focus on the characteristics of the image itself, such as pixel values and color modes, ignoring the important impact of multi-dimensional information such as user operation intentions and system environment parameters on the compression effect.
[0007] 3. Adaptability issues in complex scenarios. Real-world application scenarios are complex and varied. Different types of devices (such as mobile devices, personal computers, servers, etc.) have different performance characteristics, and network environments range from low-speed mobile networks to high-speed wired networks. Moreover, users' image quality requirements vary depending on the specific task. Traditional fixed-parameter compression techniques are difficult to adapt to such complex and varied scenarios.
[0008] 4. The issue of balancing image quality and efficiency. Traditional JPEG image compression technology, lacking comprehensive consideration and adaptive adjustment capabilities for various factors, struggles to achieve a good balance between image quality and efficiency in different scenarios. In some cases, it sacrifices too much image quality to pursue a high compression ratio, or fails to effectively improve compression efficiency to maintain image quality.
[0009] In summary, this invention aims to solve the technical problems of traditional JPEG image compression technology in terms of compression parameter adaptation, multi-dimensional information utilization, adaptation to complex scenes, and the balance between image quality and efficiency.
[0010] To solve the above-mentioned technical problems, the present invention provides the following technical solutions:
[0011] On one hand, the present invention provides a JPEG image compression system based on a Markov chain, the system comprising:
[0012] Receiving / Acquisition Unit: Used to receive device event data, and / or image operation data, and / or system environment data;
[0013] Activity Level Analysis Unit: Analyzes user activity levels based on data from the receiving / acquisition unit;
[0014] State Update Unit: Used to receive the activity level analysis results from the activity level analysis unit, as well as the historical state information of the system, generate state update information, and update the system state;
[0015] Markov prediction unit: consists of at least two Markov chains, used to receive state update information from the state update unit and perform quality factor prediction;
[0016] JPEG compression unit: Used to receive the quality factor prediction results from the Markov prediction unit and compress the image;
[0017] Output image processing unit: Used to output the image processed by the JPEG compression unit.
[0018] Preferably, the receiving / acquisition unit includes:
[0019] Keyboard and mouse event listeners: used to monitor keyboard and mouse events and collect user input activity data;
[0020] System environment data acquisition unit: used to collect data on network bandwidth, device CPU utilization, and remaining device memory;
[0021] The image manipulation data acquisition unit is used to collect data such as image scaling ratio, rotation angle, and browsing time.
[0022] Furthermore, after the activity level detection unit calculates the comprehensive activity level score, the state update unit dynamically updates the transition matrix as user interaction data accumulates.
[0023] Furthermore, the Markov prediction unit determines the user's activity state based on the user's behavior and predicts the next quality factor based on the state change; the Markov prediction unit has at least two Markov chain models.
[0024] More preferably, the Markov prediction unit includes a window switching unit and a state space, the state space including an activity state and a window state, the activity state being divided based on the intensity of user interaction; the window state being determined based on the user's switching between different windows.
[0025] On the other hand, the present invention also provides a JPEG image compression method based on dual Markov chain optimization, applied to the above-mentioned system, the method comprising the following steps:
[0026] Step 1: Receive device event data, and / or image operation data, and / or system environment data;
[0027] Step 2: Analyze user activity levels based on the received data;
[0028] Step 3: Based on the activity level analysis results and the system's historical state information, generate state update information and update the system's current state;
[0029] Step 4: Based on the state update information from Step 3, perform quality factor prediction using at least two Markov chains;
[0030] Step 5: Compress the image based on the quality factor prediction results obtained in Step 4;
[0031] Step 6: Output the compressed image.
[0032] Furthermore, the device event data includes: user input activity data collected by monitoring keyboard and mouse events using a keyboard and mouse event listener; specifically including:
[0033] Collect system environment data: Collect system network bandwidth and device performance parameters;
[0034] Image operation data acquisition: Data that records the specific actions a user takes to manipulate an image.
[0035] Furthermore, step 2 includes:
[0036] By comprehensively analyzing the event data from the receiving device, and / or image operation data, and / or system environment data, the user activity level can be determined.
[0037] The analysis of user activity levels includes the following steps:
[0038] Receive user input activity data, analyze the user's activity level based on input device operations, and output a quantitative score of user input activity level.
[0039] Based on network bandwidth and equipment performance parameters, analyze the impact of the system environment on user activities and output the environmental impact assessment results;
[0040] Analyze user needs for images using image manipulation data and output analysis results that reflect the degree of user needs for images.
[0041] The results of the above analysis are combined and calculated to obtain a comprehensive score that fully reflects the user's activity level.
[0042] Step 3 further includes:
[0043] Step 3-1: Input the overall activity level score and historical state data, extract key features from the overall activity level score and the system's historical state data, and output the extracted state feature vector;
[0044] Step 3-2: Input the state feature vector and state transition rules. Based on the state feature vector and the pre-set state transition rules, determine whether the system needs to perform a state transition and output the state transition decision result.
[0045] Step 3-3: Input the state transition decision result and the target state information. Based on the result of the state transition judgment sub-step, update the current system state and output the updated current system state.
[0046] Step 4 further includes:
[0047] Step 4-1: Based on the updated current system state, initialize the state and state transition matrix of the first Markov chain;
[0048] Step 4-2: Input the relevant parameters of the first Markov chain after initialization. The first Markov chain performs preliminary quality factor prediction based on its own state transition matrix and the current state; output the preliminary quality factor prediction results.
[0049] Step 4-3: Input the preliminary quality factor prediction results and system environment parameters of the first Markov chain. Combine the preliminary prediction results of the first Markov chain with the system environment parameters to initialize the second Markov chain. Set the initial state and transition matrix of the second Markov chain and output the relevant parameters of the initialized second Markov chain.
[0050] Step 4-4: Input the initialized parameters of the second Markov chain and the preliminary quality factor prediction results of the first Markov chain. The second Markov chain adjusts and optimizes the preliminary prediction results of the first Markov chain based on its own state transition matrix. Through further state transition calculations, the final quality factor prediction results are output.
[0051] This invention, through innovative technologies such as multi-source data acquisition, dual Markov chain prediction, and end-to-end optimization, achieves the following technical effects:
[0052] This invention optimizes the balance between image compression quality and efficiency. It utilizes a dual Markov chain to accurately predict the quality factor, allowing compression parameters to be flexibly adjusted according to different system environments and user needs. In scenarios with limited network bandwidth, it can reasonably reduce image quality to ensure smooth transmission. Testing shows that it can reduce transmission time by approximately 30% while maintaining basic image visual quality, effectively reducing bandwidth consumption. When device performance is good and network bandwidth is sufficient, it can provide high-quality image compression results, with a subjective evaluation of approximately 20% improvement in image quality, achieving a good balance between storage space and image quality.
[0053] Dynamic resource utilization. This invention dynamically adjusts the compression strategy based on system resources (such as network bandwidth, CPU utilization, etc.) and user operations, avoiding resource waste or poor image quality caused by compression with fixed parameters. For example, when network bandwidth is sufficient, bandwidth resources are fully utilized to improve image quality; when CPU utilization is high, the complexity of the compression algorithm is optimized to ensure stable system operation while achieving high-quality compression.
[0054] Enhanced system environmental adaptability. This invention comprehensively collects multi-dimensional data, including input device events, system environment parameters, and image-related operations, to fully perceive the system's operating status and user intent. Whether in the weak network environment of mobile devices, the high-speed network conditions of high-performance servers, or considering different user operating habits, the system can make appropriate compression decisions based on this multi-source data. Testing shows that under different network conditions (such as 2G-5G networks) and device performance (low, medium, and high-configuration devices), the system maintains a stable operating success rate of over 95%.
[0055] Dynamic state updates respond to changes in real time. This invention dynamically updates the system state to respond promptly to changes in the system environment and user behavior. For example, when network bandwidth suddenly changes or user operation frequency changes, the system can quickly adjust its state and, based on this, re-predict the quality factor and adjust compression parameters to ensure that image compression always adapts to the actual situation.
[0056] Enhancing User Experience. This invention provides image quality that meets user expectations based on their image manipulation and activity levels. For example, when a user frequently zooms in and out of an image, the system can predict the user's focus on image details, thus providing a higher-quality compressed image. Surveys show that in scenarios where users frequently manipulate images, user satisfaction with image quality increases by approximately 35%, enhancing the user experience in image browsing and processing. Attached Figure Description
[0057] Figure 1 A logic diagram of the system provided in an embodiment of the present invention.
[0058] Figure 2 This is a schematic diagram of the working state of the Markov prediction unit in an embodiment of the present invention.
[0059] Figure 3 This is a flowchart of the method provided in an embodiment of the present invention. Detailed Implementation
[0060] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention.
[0061] 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, and not all embodiments.
[0062] Example 1
[0063] like Figure 1 As shown, this invention provides an adaptive JPEG image compression system based on dual Markov chain optimization, the system comprising:
[0064] The receiving / acquisition unit is used to receive or acquire device event data, and / or image operation data, and / or system environment data.
[0065] Activity Level Analysis Unit: Receives data from the receiving / acquisition unit and analyzes user activity levels.
[0066] State Update Unit: Receives the activity level analysis results from the activity level analysis unit, as well as the system's historical state information, generates state update information, and updates the system state.
[0067] Markov prediction unit: Receives state update information from the state update unit and uses at least two interconnected Markov chains to predict the quality factor.
[0068] JPEG Compression Unit: Receives the quality factor prediction results from the Markov Prediction Unit and compresses the image.
[0069] Output image processing unit: Outputs the image processed by the JPEG compression unit.
[0070] The interaction and information transmission of these units determine the final image quality factor selection.
[0071] In a preferred embodiment of the present invention, the receiving / acquisition unit includes a keyboard and mouse event listener, which is used to monitor keyboard and mouse events and collect user input activity data.
[0072] Mouse events are a crucial way for users to interact with computers. In adaptive compression systems, mouse activity can reflect the user's level of attention. When a user frequently clicks or moves the mouse, it indicates that the user is actively interacting with the system, and the system should improve the compression quality of the image to ensure higher visual clarity and display effects.
[0073] Keyboard events are also an important indicator for assessing the intensity of user interaction. Users typically require more attention when typing, so the system can determine whether a user is in a high-activity state by capturing keyboard events. The keyboard event listener is also connected to the activity level detection module, indicating that keyboard input will affect the increase in activity level.
[0074] The system monitors keyboard input in real time, enabling rapid response and adjustment of the compression quality factor. It uses a hook mechanism to listen for mouse and keyboard events in real time, recording information for each event. Event types include mouse clicks, movements, and keyboard key presses, and the system records the time of occurrence for frequency calculation. It also records the mouse coordinates and the corresponding window handle.
[0075] Preferably, the receiving / acquisition unit further includes a system environment data acquisition unit for acquiring data such as network bandwidth (Mbps), device CPU utilization (%), and remaining device memory (GB). For example, when performing image compression on a mobile device, network bandwidth may vary in different base station coverage areas; for instance, when switching from a 4G network to a Wi-Fi network, the bandwidth may change from 10Mbps to 50Mbps. Simultaneously, after running multiple applications, the device's CPU utilization may increase from 30% to 70%, while the remaining memory may decrease from 2GB to 1GB. These parameter changes have a significant impact on image compression and transmission strategies.
[0076] Preferably, the receiving / acquisition unit further includes an image operation data acquisition unit, used to acquire data such as image scaling ratio, rotation angle, and browsing time. For example, when a user views a map image, they may zoom in by 200% and rotate it by 90 degrees for 30 seconds. These operations reflect the user's focus on specific information in the image, providing a basis for analyzing the user's image needs.
[0077] The activity level analysis unit analyzes user activity levels based on data from the receiving / collecting unit.
[0078] In an illustrative implementation, user interaction events monitored by a mouse and keyboard listener can be used to calculate the level of activity. First, user interaction events are statistically analyzed per unit of time. For example, 10 mouse clicks and 5 keyboard inputs per second are used to calculate the probability of these events. These statistics serve as the basic input for user activity, helping the system determine the intensity of user interaction. Generally, a higher number of mouse clicks and keyboard inputs indicates a higher level of user activity, and vice versa. Besides mouse clicks and keyboard inputs, mouse movement is also an important indicator of user activity intensity. In the system, mouse movement speed is usually calculated by the change in mouse coordinates. Mouse movement speed represents the displacement of the mouse per unit of time, usually measured in pixels per second. A faster mouse movement speed indicates that the user is browsing quickly or performing complex operations, typically indicating a higher level of activity; while a slower mouse movement speed suggests that the user may be in a low-activity state or performing simple browsing and operations. The method for calculating mouse movement speed is as follows:
[0079]
[0080] in, It refers to mouse movement speed. It is the distance the mouse moves. and All are mobile durations, ( , ),( , The coordinates represent the screen coordinates. Finally, different types of user interaction events are assigned weights (e.g., keyboard input is weighted higher than mouse movement), resulting in an activity level value between 0 and 1. The closer the score is to 1, the higher the intensity of the user interaction. The system dynamically adjusts the image quality factor based on this score. The calculation method is as follows:
[0081]
[0082] in, , , It's weight. It's the activity level. It represents the frequency of mouse clicks per unit of time, that is, the number of times the user clicks the mouse within a statistical period (such as 1 second), which directly reflects the frequency of mouse click operations; It represents the speed of mouse movement, measures how fast the user moves the mouse, and reflects the dynamic characteristics of mouse operation; The frequency of keyboard input per unit of time is the number of times a user types on the keyboard within a statistical period, reflecting the activity level of keyboard interaction.
[0083] In a more preferred embodiment, multi-dimensional activity level analysis can be performed.
[0084] Different weight values can be assigned to device event data, image operation data, and system environment data. For example, for device event data, different operations can be assigned different weights, such as a copy-paste operation weight of 0.8 and a regular key press weight of 0.2. In one embodiment, in a text editing scenario, users frequently perform text input (regular key press frequency of 50 times / minute) and copy-paste operations (operation frequency of 10 times / minute). Based on the assigned weights, a user input activity level score is calculated. =0.2×50+0.8×10=10+8=18.
[0085] In one embodiment, the weighting of system environment data can vary. For example, there might be a bandwidth impact coefficient (set according to different bandwidth ranges; for instance, a coefficient of 0.5 for bandwidth below 1Mbps, 0.8 for bandwidth between 1 and 10Mbps, and 1 for bandwidth exceeding 10Mbps) and a device performance impact coefficient (based on a comprehensive assessment of CPU utilization and remaining memory). In a specific case, if the network bandwidth is 5Mbps, the bandwidth impact coefficient is 0.8. If the device CPU utilization is 60% and the remaining memory is 1.5GB, then the device performance impact coefficient is 0.7. The comprehensive assessment of the system environment's impact on user activity results in the product of the two coefficients: 0.8 × 0.7 = 0.56.
[0086] Regarding image manipulation data, weights can be assigned to scaling parameters (e.g., 1.2 for zooming in and 0.8 for zooming out), rotation parameters (1.5 for rotation angles exceeding 90 degrees and 1 for rotation angles below 90 degrees), and browsing duration parameters (1.3 for browsing durations exceeding 60 seconds and 1 for browsing durations below 60 seconds). For example, a user performs a 200% zoom operation (scaling parameter 1.2), a 45-degree rotation operation (rotation parameter 1), and a 40-second browsing duration (browsing duration parameter 1). Based on this, the user's image demand level analysis result is the product of the above parameters, i.e., 1.2 × 1 = 1.2. When calculating the overall activity level, Activity Level Analysis Unit 2 can accept user input activity weights (0.5), system environment impact weights (0.3), and image manipulation demand weights (0.2). Given a user-input activity level score of 18, a system environment impact assessment result of 0.56, and an image manipulation demand level analysis result of 1.2. The calculation method for the overall activity level score is as follows: Overall score = 0.5 × 18 + 0.3 × 0.56 + 0.2 × 1.2 = 9 + 0.168 + 0.24 = 9.408. Of course, this embodiment is merely illustrative and not intended to limit the invention.
[0087] Once the comprehensive score of user activity level is obtained, the state update unit will perform state updates and the Markov prediction unit will update the transition matrix. After the transition matrix stabilizes, the quality factor prediction will be performed.
[0088] Preferably, the overall activity level score is mapped to a discrete state space X={0,1,2}, and the mapping rule is as follows:
[0089] ;
[0090] in, : Represents the updated discrete state, with a value range of X={0,1,2}, which is the final result mapped to the discrete state space.
[0091] The activity level score (overall activity level score) is a continuous value that reflects the intensity of user interaction.
[0092] : The floor symbol, for The result of 3 is taken as an integer.
[0093] Take the smaller value.
[0094] This step ensures The result conforms to a predetermined discrete state range, not exceeding the maximum value of 2 in the discrete state space X={0,1,2}. The mapping operation described above maps continuous activity level values to the discrete state space X={0,1,2} by scaling, rounding, and limiting them, providing discretized state inputs for subsequent state updates, transition matrix updates, and quality factor predictions.
[0095] In a simple scenario, the Markov prediction unit dynamically predicts and updates the quality factor of JPEG compression by tracking user interactions (such as keyboard and mouse events) and system activity levels in real time, thereby finding the optimal balance between image quality and compression efficiency, optimizing user experience and system performance.
[0096] The state space is where the user's activity level is discretized into a finite number of states, for example... , representing low activity, moderate activity, and high activity, respectively.
[0097] In a low-activity state, the user barely interacts with a particular window, and the window's activity level is very low. This state typically occurs when the user is inactive or has been idle for an extended period, indicating that the window is idle. Windows can reduce resource consumption by lowering their quality factor. For example, when displaying static images, or when the user is viewing non-essential information (such as a file list or icons), high compression quality is not necessary; a lower quality factor, such as 30 to 50, can be chosen to improve compression efficiency.
[0098] Moderate activity indicates occasional user interaction, typically occurring when browsing web pages, reading articles, or performing light tasks. In this state, user input frequency is relatively low, but some activity is still observed. For this type of state, the system should ensure image quality while maintaining relatively low resource consumption. The quality factor for moderate activity is usually set at a moderate level to balance quality and efficiency, for example, a quality factor of 50 to 75.
[0099] In high-activity states, users frequently perform interactive operations such as typing, clicking, dragging, and swiping. This type of state typically occurs during tasks where users are highly focused, such as video editing, gaming, or software development. In these situations, the system needs to provide optimal image quality, therefore a higher quality factor should be chosen to ensure clear details and realistic images. However, since high interaction in this state can lead to significant computational resource demands, the system needs to ensure that the quality factor is chosen within an acceptable range of resource consumption, for example, a quality factor between 75 and 95. These states reflect the intensity and frequency of user interaction, such as no operation, occasional clicks, or frequent input.
[0100] The state update unit generates the state transition matrix. Illustratively, for a state space of n=3, the transition matrix A can initially be uniformly distributed, i.e.:
[0101] ;
[0102] After the activity level detection unit calculates the activity level value, the state update unit dynamically updates the transition matrix as user interaction data accumulates. By counting the number of transitions and normalizing, the state distribution may converge to a stationary distribution after multiple iterations.
[0103] When the system reaches a steady state, there exists a probability vector. ,satisfy: , , This represents the probability of a state transition.
[0104] By solving the system of linear equations =0, can obtain The specific values, It is an identity matrix.
[0105] This means that over a long period of time, the probability of the system in each state remains constant. While the quality factor cannot be obtained directly through Markov modeling, it is typically a function of the historical states and the transition matrix. In a steady state, the quality factor can be derived from a stationary distribution. It is determined by a weighted combination of the transition matrix.
[0106] In a more preferred embodiment, the state is calculated first. :
[0107]
[0108] Then, the expected value of the quality factor is calculated based on the state distribution. :
[0109]
[0110] in, Indicates time The state vector at time t, It is the nth power of the transition matrix; 1, 2,…, n It is a weighting coefficient, representing the contribution of different historical moments to the quality factor. express The quality factor at a given moment is a quantity related to the system state, reflecting a certain quality characteristic of the system at that moment. express The system is in a state at any given time. ( The probability of (=0,1,2) reflects the distribution of the system's states at different times. Indicates the system is in a state. ( The quality factor values corresponding to the discrete state i are 0, 1, 2, i.e., the specific quality factor values associated with each discrete state i.
[0111] Predicting user activity states in the next few seconds or steps and adjusting the quality factor accordingly is suitable for scenarios requiring proactive optimization (such as adjusting the quality factor in high-latency networks). The expected value... It can be used to calculate the state distribution after multi-step transitions.
[0112] Markov prediction units determine a user's activity state based on their behavior and predict the next quality factor based on state changes. In a single-layer Markov chain model, the system typically focuses on only one dimension of state change, such as the user's activity level, and dynamically adjusts the image compression quality factor based on these state transitions. However, focusing solely on a single state change cannot predict changes across different windows, and the global quality factor cannot predict the local quality factor for each window. User behavior is not only reflected in activity states; window switching also significantly impacts the image compression quality factor. For example, a user switching from window A (low activity) to window B (high activity) affects the adjustment of compression quality. Single-layer models cannot capture this change. Therefore, two-layer Markov chain models (i.e., incorporating window switching prediction) more accurately reflect user behavior patterns and make more precise predictions about quality factor adjustments than single-layer models.
[0113] Therefore, preferably, the Markov prediction unit of the present invention employs multi-Markov prediction, which includes at least one Markov chain model. For illustrative purposes, two Markov chains are used below as an example; those skilled in the art should understand that similar extensions can be made for cases with more Markov chains.
[0114] The Markov prediction unit includes a window switching unit, which enhances the prediction of window activity states by introducing window switching. This makes state transitions not only dependent on the intensity of user interaction but also include the user's switching between different windows. This enhancement allows the model to understand user behavior more granularly, thereby providing more flexible and accurate quality factor predictions and adjustments.
[0115] In a single-layer Markov chain model, the activity state is the only state dimension. Typically, the user's activity state is discretized into three main states (low activity, medium activity, and high activity), which the system uses to adjust the quality factor for image compression. The transition matrix is a... A matrix representing the transition probabilities between states, such as the probability of transitioning from a low-activity state to a high-activity state.
[0116] Unlike single-layer models, taking a two-layer Markov chain as an example, the Markov prediction unit described in this invention also includes a state space. By introducing a hierarchy of window states, the state space is expanded to two dimensions: activity state and window state. The first layer, activity states (low, medium, high activity), is based on the intensity of user interaction. The second layer, window states (window A, window B, window C, etc.), is determined based on the user's switching between different windows. Each window has its corresponding activity state; for example, window A might be in a low activity state, while window B might be in a high activity state. Through this structure, the prediction model not only adjusts the image quality factor based on the user's activity intensity but also considers the user's switching between different windows, thus expanding the state space to a combination of multiple window states.
[0117] If the system has two windows (A and B), and each window has three active states, then the state space becomes: , representing the high, medium, and low states of window A and window B, respectively. The transition matrix is thus expanded into a single... The matrix records the transition probabilities between each window state.
[0118] In the Markov prediction unit described in this invention, the state space consists of two parts: the active state space and the window state space. For better illustration, some definitions are provided for these parts in this invention.
[0119] Let the activity state space be denoted as , where each state is denoted as . This indicates a different level of activity (e.g., low activity, medium activity, high activity).
[0120] This is the window state space, where each window... Represent different windows (e.g., window A, window B).
[0121] The state of a system can be represented as a binary tuple. ,in Indicates the activity status. Indicates the window state.
[0122] Activity state transition matrix This records the transition probabilities from one activity state to another. The size of this matrix... ,in Indicates from active state Transition to active state The probability of.
[0123] ;
[0124] Window state transition matrix This records the transition probabilities from one window state to another. The size of this matrix... ,in Indicates the window state Transition to active state The probability of.
[0125] ;
[0126] Since the system's states are tuples consisting of active states and window states, the transition matrix of a two-level Markov chain is actually a joint transition probability matrix. This matrix records the transition probabilities from the current active state and window state to the next active state and window state. Joint Transition Probability Matrix The size is That is, it records the transition probabilities between all possible state pairs, which can be expressed as:
[0127] ;
[0128] in, Indicates from the current state Transition to the next state The probability of.
[0129] Joint transition matrix The update is calculated based on the transition frequency of the activity state and window state. Each user action (such as window switching or activity state change) affects the corresponding value in the joint transition matrix.
[0130]
[0131] in, Indicates from state Transferred to The transition probability, From state The total frequency of transitions to any other state.
[0132] The operating state of the Markov prediction unit is as follows: Figure 2 As shown, once enough switching counts have been collected, when editing a Word document at time t, if the probability of switching to a browser window and being in a highly active state at the next moment is predicted to be 0.8, the quality factor of the browser window will be increased in advance, thereby reducing delays and improving the experience.
[0133] Example 2
[0134] like Figure 3As shown, this invention provides an adaptive JPEG image compression method based on dual Markov chain optimization, which includes the following steps:
[0135] Step 1: Receive device event data, and / or image operation data, and / or system environment data.
[0136] Step 2: Analyze user activity levels based on the received data.
[0137] Step 3: Update the current system status based on the activity level analysis results and the system's historical status information.
[0138] Step 4: Use at least two interconnected Markov chains to predict the quality factor.
[0139] Step 5: Compress the image based on the quality factor prediction results obtained from at least two interrelated Markov chains.
[0140] Step 6: Output the compressed image.
[0141] Step 1: Collect multi-dimensional data related to user operations and system environment, specifically including the following steps:
[0142] Input device event acquisition: Keyboard and mouse event listeners are used to monitor keyboard and mouse events and collect user input activity data, such as key press frequency and mouse movement trajectory. The input here is the raw event signal generated by the keyboard and mouse. After being processed by the listener, the output is user input activity data that can be recorded and analyzed. This data will be used for subsequent user activity level analysis.
[0143] This also includes collecting system environment data: gathering environmental parameters such as network bandwidth and device performance. It collects raw parameter signals from network interfaces and device performance monitoring modules, processes them, and outputs standardized system environment parameter data, which will provide a basis for subsequent status updates.
[0144] Collect image operation data: Monitor user operations on images, such as zooming, rotating, and browsing time, and output relevant data recording the specific operations of users on images to help analyze the degree of user demand for images and provide a reference for quality factor prediction.
[0145] Step 2: Multi-dimensional activity level analysis, comprehensively analyzing user activity levels by integrating data from multiple sources. This analysis includes:
[0146] User input activity level analysis: Receives user input activity data collected from input device events, analyzes the user's activity level based on input device operations using a specific algorithm (such as setting weights for different operations and calculating activity level scores based on operation frequency and complexity), and outputs a quantified comprehensive score of user input activity level, which is used for comprehensive activity level calculation.
[0147] System Environmental Impact Analysis: Based on data such as network bandwidth and equipment performance collected from system environmental parameters, the analysis examines the potential impact of the system environment on user activities (e.g., when network bandwidth is low, users may be more inclined to receive low-quality but fast-transmitting images). The output is the environmental impact assessment result, which is also used for comprehensive activity level calculation.
[0148] Image operation requirements analysis: Utilizing operation data collected from image-related operations, analyze the degree of users' specific image requirements (e.g., frequent zooming of images may indicate a high demand for image details), output analysis results reflecting the degree of users' image requirements, and participate in the calculation of the overall activity level.
[0149] Comprehensive Activity Level Calculation: The three analysis results mentioned above are integrated and calculated (e.g., through a weighted average, with different weights set according to different scenarios) to obtain a comprehensive score reflecting the user's activity level. Specifically, the inputs are the user's comprehensive activity level score, the environmental impact assessment results, and the user's image demand analysis results; the output is the comprehensive activity level score, which will be used for status updates.
[0150] Step 3: Dynamic State Update. Based on the results of multi-dimensional activity level analysis and the system's historical state information, dynamically update the current system state. This step further includes:
[0151] Step 3-1: State Feature Extraction: Input the comprehensive activity level score and historical state data, extract key features (such as the trend of the comprehensive activity level score and the frequency of historical state transitions) from the comprehensive activity level score and the system's historical state data, and output the extracted state feature vector for state transition judgment.
[0152] Step 3-2: State Transition Judgment: The input is the state feature vector and the state transition rule. Based on the state feature vector and the pre-set state transition rule (which can be trained based on a large amount of actual data, for example, when the overall activity level score suddenly increases and the network bandwidth is sufficient, the system state may transition from "low activity - low quality image transmission mode" to "high activity - high quality image transmission mode"), it is determined whether the system needs to perform a state transition, and the state transition decision result is output.
[0153] Step 3-3: State Update Execution: The input is the state transition decision result and the target state information (if a transition is required, the target state is determined according to the rules). Based on the state transition judgment result, the current state of the system is updated, and the output is the updated current state of the system, which will be used for Markov prediction.
[0154] The purpose of recording state transitions is to calculate the probability using a finite number of training iterations, calculated as P = (number of transitions from state A to state B) / total number of iterations. This allows us to obtain the transition matrix between each state in the entire system. With sufficient data, the transition matrix tends to stabilize, ultimately enabling us to predict which window the user might interact with in the next moment and whether to improve the quality factor of that window for better image quality. Therefore, state transitions are recorded regardless of whether they occur initially. Initially, the data is unstable and may not fully reflect user habits. The prediction results using the Markov chain are compared with the actual situation at time t. The goal is achieved when the set accuracy is reached. The significance of this is that it allows us to predict in advance which window the user will visit and their activity level at time t+1, thus improving the quality factor in advance and reducing latency and perceptual ambiguity. It also prevents noise, such as accidental clicks or swipes, which clearly deviate from the probability matrix and might be ignored, avoiding unnecessary adjustments.
[0155] Step 4: Dual Markov Chain Collaborative Prediction, using two interconnected Markov chains to predict the quality factor. This step includes:
[0156] Step 4-1: Initialization of the first Markov chain: Based on the updated current system state, initialize the state and state transition matrix of the first Markov chain. Preferably, the updated current system state is input, and the initial state and state transition matrix of the first Markov chain are generated through a specific algorithm (such as setting different initial states and transition probabilities according to different categories of system states). The initialized parameters of the first Markov chain are output for prediction of the first Markov chain.
[0157] Step 4-2: First Markov Chain Prediction: Input the initialized parameters of the first Markov chain. Based on its state transition matrix and current state, the first Markov chain performs a preliminary quality factor prediction. Output the preliminary quality factor prediction result, which will be used to adjust the second Markov chain.
[0158] Step 4-3: Second Markov Chain Initialization: Input the preliminary quality factor prediction results of the first Markov chain and system environment parameters. Combine the preliminary prediction results of the first Markov chain with additional information such as system environment parameters to initialize the second Markov chain. Set the initial state and transition matrix of the second Markov chain by considering the impact of environmental factors on the quality factor (e.g., the predicted quality factor can be appropriately increased when network bandwidth is high). Output the relevant parameters of the initialized second Markov chain for adjustment.
[0159] Step 4-4: Second Markov Chain Adjustment: Input the initialized parameters of the second Markov chain and the preliminary quality factor prediction results of the first Markov chain. The second Markov chain adjusts and optimizes the preliminary prediction results of the first Markov chain based on its own state transition matrix. Through further state transition calculations (fine-tuning the prediction results in conjunction with dynamic changes in environmental factors), the final quality factor prediction result is output, which will be used for image compression.
[0160] Step 5: Adaptive image compression. Based on the quality factor prediction results obtained from the dual Markov chain collaborative prediction, the image is adaptively compressed. This step further includes:
[0161] Step 5-1: Image Preprocessing: Preprocess the original image, such as color space conversion and noise removal. Input the original image data, process it using the appropriate algorithm (e.g., use Gaussian filtering to remove noise, and select a suitable color space conversion method according to the image type), and output the preprocessed image for compression parameter adjustment.
[0162] Step 5-2: Compression Parameter Adjustment: The input is the final quality factor prediction result and the default JPEG compression parameters. The compression parameters are adjusted through a specific mapping relationship (e.g., the higher the quality factor, the finer the quantization table). Based on the final quality factor prediction result, the relevant parameters of the JPEG compression algorithm (such as quantization table, entropy coding parameters, etc.) are adjusted, and the adjusted compression parameters are output for the JPEG compression execution sub-step.
[0163] Step 5-3: JPEG Compression Execution: Input the preprocessed image and the adjusted compression parameters. Using the adjusted compression parameters, perform JPEG compression on the preprocessed image and output the compressed image data, which will be used for image output.
[0164] Step 6: Optimize image output. Post-process the compressed image and then output it. This includes:
[0165] Image post-processing: Post-processing is performed on the compressed image, such as sharpening to enhance image edges, adjusting brightness and contrast, etc. The input compressed image data is processed using appropriate image processing algorithms (such as Laplacian sharpening and histogram equalization to adjust brightness and contrast), and the output post-processed image is used in the image quality assessment sub-step.
[0166] Image quality assessment: The post-processed image is evaluated using metrics such as Peak Signal-to-Noise Ratio (PSNR) and Structural Similarity (SSIM) for quantitative assessment. The input is the post-processed image, and the output is the image quality assessment result, used to determine if the compression parameters need readjustment. If the assessment result does not meet the preset standards, it is fed back to the compression parameter adjustment sub-step of the adaptive image compression step for readjustment and compression; if the standards are met, the image output execution sub-step is initiated.
[0167] Image output execution: Outputs the post-processed and quality-assessed image. The input is a quality-assessed image, and the output is a usable final image, such as for display on a remote desktop or for storage locally.
[0168] This invention achieves significant technical results in the field of image compression through innovative technologies such as multi-source data acquisition, dual Markov chain prediction, and end-to-end optimization.
[0169] Optimizes the balance between image compression quality and efficiency. Utilizing a dual Markov chain for precise prediction of the quality factor, compression parameters can be flexibly adjusted according to different system environments and user needs. In scenarios with limited network bandwidth, image quality can be reasonably reduced to ensure smooth transmission. Testing shows that transmission time can be shortened by approximately 30% while maintaining basic image visual quality, effectively reducing bandwidth consumption. When device performance is good and network bandwidth is sufficient, high-quality image compression results can be provided, with a subjective evaluation of approximately 20% improvement in image quality, achieving a good balance between storage space and image quality.
[0170] Dynamic resource utilization. The compression strategy is dynamically adjusted based on system resources (such as network bandwidth and CPU utilization) and user operations, avoiding resource waste or poor image quality caused by compression with fixed parameters. For example, when network bandwidth is sufficient, bandwidth resources are fully utilized to improve image quality; when CPU utilization is high, the complexity of the compression algorithm is optimized to ensure stable system operation while achieving high-quality compression.
[0171] Enhanced system environmental adaptability. By comprehensively collecting multi-dimensional data including input device events, system environment parameters, and image-related operations, the system fully perceives the system's operating status and user intent. Whether in the weak network environment of mobile devices, the high-speed network conditions of high-performance servers, or considering different user operating habits, the system can make appropriate compression decisions based on this multi-source data. Testing shows that under different network conditions (such as 2G-5G networks) and device performance (low, medium, and high-configuration devices), the system maintains a stable operating success rate of over 95%.
[0172] Dynamic status updates respond to changes in real time. By dynamically updating the system status, the system can respond promptly to changes in the system environment and user behavior. For example, when network bandwidth suddenly changes or user operation frequency changes, the system can quickly adjust its status and, based on this, re-predict the quality factor and adjust compression parameters to ensure that image compression always adapts to the actual situation.
[0173] Enhance user experience. Based on the user's image manipulation and activity level, provide image quality that meets the user's expectations. For example, when a user frequently zooms in and out of an image, the system can predict the user's focus on image details, thus providing a higher-quality compressed image. Surveys show that in scenarios where users frequently manipulate images, user satisfaction with image quality increases by approximately 35%, enhancing the user experience in image browsing and processing.
[0174] It will be apparent to those skilled in the art that the present invention is not limited to the details of the exemplary embodiments described above, and that the invention can be implemented in other specific forms without departing from its spirit or essential characteristics. Therefore, the embodiments should be considered in all respects as exemplary and non-limiting, and the scope of the invention is defined by the appended claims rather than the foregoing description. Thus, all variations falling within the meaning and scope of equivalents of the claims are intended to be included within the present invention. No reference numerals in the claims should be construed as limiting the scope of the claims.
[0175] Furthermore, it should be understood that although this specification describes embodiments, not every embodiment contains only one independent technical solution. This narrative style is merely for clarity. Those skilled in the art should consider the specification as a whole, and the technical solutions in each embodiment can also be appropriately combined to form other embodiments that can be understood by those skilled in the art.
Claims
1. A JPEG image compression system based on dual Markov chain optimization, characterized in that, The system includes: Receiving / Acquisition Unit: Used to receive device event data, and / or image operation data, and / or system environment data; including: Keyboard and Mouse Event Listener: Used to monitor keyboard and mouse events and collect user input activity data; System Environment Data Acquisition Unit: Used to collect network bandwidth, device CPU utilization, and device memory remaining data; Image Operation Data Acquisition Unit: Used to collect data, including: image scaling ratio, rotation angle, and browsing duration; The device event data includes: user input activity data collected by monitoring keyboard and mouse events using a keyboard and mouse event listener, specifically including: collecting system environment data: collecting the system's network bandwidth and device performance parameters; collecting image operation data: recordings output by monitoring user operations on images and data on the specific operations of users on images; and an activity level analysis unit: analyzing user activity levels based on data from the receiving / acquiring unit. State Update Unit: Used to receive the activity level analysis results from the activity level analysis unit and the historical state information of the system, generate state update information, and update the system state; by obtaining the transition matrix between each state of the entire system, it can ultimately predict which window the user might operate on in the next moment and whether to improve the quality factor of that window. Markov prediction unit: consists of at least two Markov chains, used to receive state update information from the state update unit and perform quality factor prediction; JPEG compression unit: Used to receive the quality factor prediction results from the Markov prediction unit, adjust the JPEG compression parameters according to the final quality factor prediction results, and compress the image. Output image processing unit: Used to output the image processed by the JPEG compression unit.
2. The JPEG image compression system based on dual Markov chain optimization as described in claim 1, characterized in that, After the activity level analysis unit calculates the comprehensive score of the user's activity level, the state update unit dynamically updates the transition matrix as user interaction data accumulates.
3. The JPEG image compression system based on dual Markov chain optimization as described in claim 2, characterized in that, The Markov prediction unit determines the user's activity state based on the user's behavior and predicts the next quality factor based on the state change; the Markov prediction unit has at least two Markov chain models.
4. The JPEG image compression system based on dual Markov chain optimization as described in claim 3, characterized in that, The Markov prediction unit includes a window switching unit and a state space. The state space includes an activity state and a window state. The activity state is divided based on the intensity of user interaction. The window state is determined based on the user's switching between different windows.
5. A JPEG image compression method based on dual Markov chain optimization, applied to the JPEG image compression system based on dual Markov chain optimization as described in any one of claims 1-4, characterized in that, Includes the following steps: Step 1: Receive device event data, and / or image operation data, and / or system environment data; Step 2: Analyze user activity levels based on the received data; Step 3: Based on the activity level analysis results and the system's historical state information, generate state update information and update the system's current state; Step 4: Based on the state update information from Step 3, perform quality factor prediction using at least two Markov chains; Step 5: Compress the image based on the quality factor prediction results; Step 6: Output the compressed image.
6. The JPEG image compression method based on dual Markov chain optimization as described in claim 5, characterized in that, Step 2 includes the following steps: Receive user input activity data, analyze the user's activity level based on input device operations, and output a quantitative score of user input activity level. Based on network bandwidth and equipment performance parameters, analyze the impact of the system environment on user activities and output the environmental impact assessment results; Analyze user needs for images using image manipulation data and output analysis results that reflect the degree of user needs for images. The above results are combined and calculated to obtain a comprehensive score that fully reflects the user's activity level.
7. The JPEG image compression method based on dual Markov chain optimization as described in claim 6, characterized in that, Step 3 further includes: Step 3-1: Input the overall activity level score and historical state data, extract key features from the overall activity level score and historical state data, and output the extracted state feature vector; Step 3-2: Input the state feature vector and state transition rule. Based on the state feature vector and the pre-set state transition rule, determine whether a state transition is needed; output the state transition decision result. Step 3-3: Input the state transition decision result and the target state information. Based on the result of the state transition judgment sub-step, update the current system state and output the updated current system state.
8. The JPEG image compression method based on dual Markov chain optimization as described in claim 7, characterized in that, Step 4 further includes: Step 4-1: Based on the updated current system state, initialize the state and state transition matrix of the first Markov chain; Step 4-2: Input the relevant parameters of the first Markov chain after initialization. The first Markov chain performs preliminary quality factor prediction based on its own state transition matrix and the current state, and outputs the preliminary quality factor prediction results. Step 4-3: Input the preliminary quality factor prediction results and system environment parameters. Combine the preliminary prediction results and system environment parameters to initialize the second Markov chain. Set the initial state and transition matrix of the second Markov chain and output the relevant parameters of the initialized second Markov chain. Step 4-4: Input the initialized parameters of the second Markov chain and the preliminary quality factor prediction results of the first Markov chain. The second Markov chain adjusts and optimizes the preliminary prediction results of the first Markov chain based on its own state transition matrix. Through further state transition calculations, the final quality factor prediction results are output.
Citation Information
Patent Citations
JPEG image double-compression automatic detection method
CN106960435A
Remote desktop video coding method and device
CN107295340A