JPEG (Joint Photographic Experts Group) image compression method and system based on double Markov chain optimization
By using a JPEG image compression system based on dual Markov chains, which combines dynamic state updates from multi-source data with quality factor prediction, the problem of balancing adaptability and efficiency in complex scenarios for JPEG image compression technology is solved, thereby improving image quality and transmission efficiency and enhancing user experience.
Patent Information
- Application Number
- CN202511501194.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-21
- Publication Date
- 2025-11-18
- 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. It cannot fully utilize multi-dimensional information and struggles to achieve a good balance between image quality and efficiency, especially when the network environment and user needs change in a timely manner.
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. At least two Markov chain models are used to predict the quality factor. Combined with multi-source data, comprehensive analysis and adjustment are performed to optimize the image compression parameters.
Stable operation of image compression was achieved under different network conditions and device performance, improving image quality and transmission efficiency, enhancing system adaptability and user experience, and improving image quality satisfaction by approximately 35%.
Smart Images

Figure CN120980244A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of image compression technology, and particularly relates to a JPEG image compression method and system based on double Markov chain optimization. BACKGROUND
[0002] As an important means widely used in image storage and transmission fields, JPEG image compression technology aims to save image information with as little storage space as possible while maintaining acceptable visual quality. In traditional JPEG compression implementation, the quality factor is the core parameter that determines 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. As a probabilistic random process modeling tool, Markov chain becomes an ideal method for predicting the quality factor due to its memoryless property and effective description of state transitions. At the same time, by setting different quality factors for different time windows or data windows, the adaptability and efficiency of the system can be further improved.
[0003] However, there are some deficiencies in existing JPEG image compression technology based on Markov chain prediction of quality factor. First, in actual application, the system operating environment is complex and variable, not only changing with time or data window, but also possibly affected by many other factors, such as dynamic changes in network bandwidth, differences in device performance, etc. The existing method only considers a single dimension of time or data window to set the quality factor, which cannot fully and accurately adapt to complex actual environments. For example, in the scenario of remote desktop transmission with unstable network, even if the quality factor is set according to the time window, sudden reduction in network bandwidth may cause image transmission to stall, and existing technology cannot respond to such changes in time. Second, the state transition matrix of Markov chain in traditional methods is usually fixed, without considering the dynamic evolution of system state. In actual situations, the system state may change with factors such as changes in user behavior patterns, increases in device usage time, etc. For example, after a user uses a remote desktop for a long time, the operation habits may change, and the original state transition matrix cannot accurately reflect this change, resulting in inaccurate prediction of the quality factor, which in turn affects the image compression effect and system performance. In addition, the existing image compression method analyzes user input activity data in a relatively single way, relying only on keyboard and mouse events to judge the user activity level, ignoring other information that may reflect the user's image requirements, such as the user's zoom operation on the image, the browsing time of the image, etc. This single source of data makes the judgment of user demand not comprehensive enough, and cannot provide more abundant basis for accurate prediction of the quality factor. SUMMARY
[0004] The present application 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 the diverse needs of users and complex system environments. Specifically, the technical problems to be solved include the following aspects: 1. Compression parameter adaptation problem. Traditional JPEG image compression technology usually uses fixed compression parameters, lacking the ability to dynamically adjust according to actual conditions. In different application scenarios, such as network bandwidth, device performance, and user image quality requirements, this fixed parameter compression method is difficult to achieve ideal results.
[0005] 2. Multi-dimensional information utilization problem. Traditional technology limitations: existing image compression technology mostly only focuses on the characteristics of the image itself, such as pixel values, color patterns, etc., ignoring the important influence of multi-dimensional information such as user operation intent and system environment parameters on compression results.
[0006] 3. Complex scene adaptability problem. Actual application scenarios are complex and varied, different device types (such as mobile devices, personal computers, servers, etc.) have different performance characteristics, network environments cover a variety of types from low-speed mobile networks to high-speed wired networks, and user image quality requirements also vary depending on specific tasks. Traditional fixed parameter compression technology is difficult to adapt to such complex and varied scenarios.
[0007] 4. Image quality and efficiency balance problem. Traditional JPEG image compression technology lacks the ability to consider and adapt to multiple factors, making it difficult to achieve a good balance between image quality and efficiency in different scenarios. In some cases, too much image quality is sacrificed in pursuit of high compression ratio, or compression efficiency is not effectively improved to ensure image quality.
[0008] In summary, the present application aims to solve the technical problems of traditional JPEG image compression technology in terms of compression parameter adaptation, multi-dimensional information utilization, complex scene adaptation, and image quality and efficiency balance.
[0009] To solve the above technical problems, the present application provides the following technical solutions: On the one hand, the present application provides a JPEG image compression system based on Markov chain, which includes: Receiving / acquisition unit: for receiving device event data, and / or image operation data, and / or system environment data; Activity level analysis unit: based on data from the receiving / acquisition unit, analyzing user activity level; State update unit: for receiving activity level analysis results from the activity level analysis unit and historical state information of the system, generating state update information, and updating the system state; Markov prediction unit: including at least two Markov chains, for receiving state update information of the state update unit, and performing quality factor prediction; JPEG compression unit: for receiving quality factor prediction results of the Markov prediction unit, and compressing images; Output processing image unit: for outputting images processed by the JPEG compression unit.
[0010] Preferably, the receiving / acquiring unit comprises: Keyboard and mouse event listener: for monitoring keyboard and mouse events, and collecting user input activity data; System environment data acquisition unit: for acquiring network bandwidth, device CPU usage, and device memory remaining data; Image operation data acquisition unit: for acquiring image scaling ratio, rotation angle, and browsing time length data.
[0011] Further, after the activity level detection unit calculates the comprehensive activity level score, the state update unit dynamically updates the transition matrix as the user interaction data accumulates.
[0012] Further, the Markov prediction unit judges the activity state of the user according to the user's behavior, and predicts the next quality factor according to the state change; the Markov prediction unit comprises at least two Markov chain models.
[0013] More preferably, the Markov prediction unit comprises a window switching unit and a state space, the state space comprises an activity state and a window state, the activity state is divided based on the interaction intensity of the user; and the window state is determined according to the switching situation of the user between different windows.
[0014] In another aspect, the application further provides a JPEG image compression method based on double Markov chain optimization, applied to the above-mentioned system, the method comprising the following steps: Step 1: receiving device event data, and / or image operation data, and / or system environment data; Step 2: analyzing the user activity level according to the received data; Step 3: generating state update information according to the activity level analysis result and the historical state information of the system, and updating the current state of the system; Step 4: performing quality factor prediction by using at least two Markov chains based on the state update information of step 3; Step 5: compressing images according to the quality factor prediction results obtained in step 4; Step 6: outputting the compressed images.
[0015] Further, the device event data includes: keyboard and mouse event monitoring using a keyboard and mouse event listener, collecting user input activity data; specifically including: Collecting system environment data: collecting network bandwidth, device performance parameters of the system; Collecting image operation data: monitoring user operations on images and outputting data recording user's specific operations on images.
[0016] Further, the step 2 includes: Integrating the received device event data, and / or image operation data, and / or system environment data to analyze the user activity level; The analysis of the user activity level includes the following steps: Receiving user input activity data, analyzing the user's activity level based on input device operation, and outputting a quantitative user input activity level score; According to the network bandwidth, device performance parameters, analyze the influence of the system environment on the user activity, and output the environmental impact evaluation result; Using image operation data to analyze the specific demand degree of the user for the image, and output the analysis result reflecting the demand degree of the user for the image; Fuse the results of the above analysis to get a comprehensive score reflecting the user activity level.
[0017] The step 3 further includes: Step 3-1: Input activity level comprehensive score and historical state data, extract key features from activity level comprehensive score and system historical state data, and output extracted state feature vector; Step 3-2: Input state feature vector and state transition rule, according to state feature vector, combine pre-set state transition rule, judge whether the system needs to perform state transition, output state transition decision result; Step 3-3: Input state transition decision result and target state information, update the current state of the system according to the result of the state transition judgment sub-step, and output the updated current state of the system.
[0018] The step 4 further includes: Step 4-1: According to the updated current state of the system, initialize the state and state transition matrix of the first Markov chain; Step 4-2: Input the initialized first Markov chain related parameters, the first Markov chain performs preliminary quality factor prediction according to its state transition matrix and current state; output preliminary quality factor prediction result; Step 4-3: input the preliminary quality factor prediction result of the first Markov chain prediction and the system environment parameters, combine the preliminary prediction result of the first Markov chain and the system environment parameters, initialize the second Markov chain, set the initial state and transition matrix of the second Markov chain, and output the related parameters of the initialized second Markov chain; Step 4-4: input the related parameters of the initialized second Markov chain and the preliminary quality factor prediction result of the first Markov chain, and the second Markov chain adjusts and optimizes the preliminary prediction result of the first Markov chain according to its own state transition matrix; through further state transition calculation, the final quality factor prediction result is output.
[0019] The present application has the following technical effects through multi-source data acquisition, double Markov chain prediction and full-process optimization: Optimize the balance between image compression quality and efficiency. The present application uses double Markov chains to accurately predict the quality factor, so that the compression parameters can be flexibly adjusted according to different system environments and user needs. In the case of limited network bandwidth, the image quality can be reasonably reduced to ensure smooth transmission. Tests show that the transmission time can be shortened by about 30% under the premise of ensuring the basic visual quality of the image, effectively reducing the bandwidth occupation. When the device performance is good and the network bandwidth is sufficient, high-quality image compression results can be provided, and the image quality is improved by about 20% in subjective evaluation, achieving a good balance between storage space and image quality.
[0020] Dynamic resource utilization. The present application dynamically adjusts the compression strategy according to system resources (such as network bandwidth, CPU usage, etc.) and user operations, avoiding the problem of resource waste or poor image quality caused by fixed parameter compression. For example, when the network bandwidth is sufficient, the bandwidth resources are fully utilized to improve the image quality; when the CPU usage is high, the compression algorithm complexity is optimized to ensure the stable operation of the system while completing high-quality compression.
[0021] Enhance system environment adaptability. The present application comprehensively collects multi-dimensional data such as input device events, system environment parameters and image-related operations to fully perceive the system running state and user intention. Whether in the weak network environment of mobile devices, in the high-speed network conditions of high-performance servers, or in the face of different user operation habits, the system can make appropriate compression decisions based on these multi-source data. Tests show that under different network conditions (such as 2G-5G network) and device performance (low, medium and high configuration devices), the system stable operation success rate reaches more than 95%.
[0022] Dynamic state update real-time response changes. The present application responds to changes in system environment and user behavior in time by dynamically updating system state. For example, when the network bandwidth suddenly changes or the user operation frequency changes, the system can quickly adjust the state and re-predict the quality factor based on this to adjust the compression parameters, ensuring that the image compression always adapts to the actual situation.
[0023] Enhance user experience. The present application provides image quality that meets user expectations based on user operations and activity levels on images. For example, when the user performs frequent zoom operations on the image, the system can predict the user's attention to image details, thereby providing higher quality compressed images. According to the survey, in the case of frequent user operations on images, the user's satisfaction with image quality is improved by about 35%, enhancing the user's experience in image browsing, processing, etc. BRIEF DESCRIPTION OF DRAWINGS
[0024] Figure 1 The logical diagram of the system provided for the embodiments of the present application.
[0025] Figure 2 The working state diagram of the Markov prediction unit in the embodiments of the present application.
[0026] Figure 3 The flowchart of the method provided in the embodiments of the present application. DETAILED DESCRIPTION
[0027] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be further described in detail below in combination with the drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and do not limit the present application.
[0028] The technical solutions in the embodiments of the present application will be described clearly and completely below in combination with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all.
[0029] Embodiment 1 As shown in Figure 1 The present application provides an adaptive JPEG image compression system based on double Markov chain optimization, which comprises: A receiving / acquiring unit for receiving or acquiring device event data, and / or image operation data, and / or system environment data.
[0030] An activity level analysis unit: receiving data from the receiving / acquiring unit, analyzing user activity level.
[0031] State updating unit: receives activity level analysis results from activity level analysis unit, and historical state information of the system, generates state updating information, and updates the system state.
[0032] Markov prediction unit: receives state updating information from state updating unit, and uses at least two interrelated Markov chains to perform quality factor prediction.
[0033] JPEG compression unit: receives quality factor prediction results from Markov prediction unit, and compresses the image.
[0034] Output processing image unit: outputs the image processed by the JPEG compression unit.
[0035] The interaction and information transmission of these units determine the selection of the final image quality factor.
[0036] In a preferred embodiment of the present application, the receiving / acquiring unit comprises a keyboard and mouse event listener for monitoring keyboard and mouse events and collecting user input activity data.
[0037] Mouse events are an important way for users to interact with computers. In an adaptive compression system, mouse activity can reflect the degree of user attention. When the 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 effect.
[0038] Keyboard events are also an important indicator of user interaction strength. Users often need to concentrate for a longer time when typing, so the system can capture keyboard events to determine whether the user is in a high activity state. The keyboard event listener is also connected to the activity level detection module, indicating that keyboard input will affect the increase in activity level.
[0039] The system can quickly respond and adjust the compression quality factor by monitoring keyboard input in real time. Mouse and keyboard events are monitored in real time through a hook mechanism. Information is recorded each time an event occurs. Event types such as mouse clicks, movements, keyboard presses, etc. are recorded, as well as the time of event occurrence for frequency calculation. Mouse coordinates and corresponding window handles are also recorded.
[0040] Preferably, the receiving / acquiring unit further comprises a system environment data acquisition unit for acquiring data such as network bandwidth (Mbps), device CPU usage rate (%), device memory remaining amount (GB), etc. For example, when image compression is performed on a mobile device, network bandwidth can change at different base station coverage areas, such as from 10 Mbps to 50 Mbps when switching from a 4G network to a Wi-Fi network. Meanwhile, after the device runs multiple applications, the CPU usage rate can increase from 30% to 70%, and the memory remaining amount can decrease from 2 GB to 1 GB. Changes in these parameters have important influences on image compression and transmission strategies.
[0041] Preferably, the receiving / acquiring unit further comprises an image operation data acquisition unit for acquiring data such as image zooming scale, rotation angle, browsing time length, etc. For example, when a user views a map image, the user zooms the image by 200% and rotates the image by 90 degrees, and the browsing time length is 30 seconds. These operations reflect the user's attention to specific information of the image, and provide a basis for analyzing the user's demand for the image.
[0042] The activity level analysis unit analyzes the user activity level according to the data of the receiving / acquiring unit.
[0043] In an illustrative embodiment, the user interaction events monitored by a keyboard and mouse monitor can be used to calculate the activity level. First, the user interaction events in a unit time are counted. For example, 10 mouse clicks and 5 keyboard inputs in 1 second are counted to calculate the event probability. These statistical data are used as basic inputs of the user activity to help the system judge the user's interaction intensity. Generally, a higher number of mouse clicks and keyboard inputs indicates that the user is at a higher activity level, and vice versa. In addition to mouse clicks and keyboard inputs, mouse movement is also an important indicator of user activity intensity. In the system, the mouse movement speed is usually calculated by the coordinate change of the mouse. The mouse movement speed represents the displacement of the mouse in a unit time, usually in pixels / second. A faster mouse movement speed means that the user is quickly browsing or performing complex operations, which usually indicates a higher activity level; while a slower mouse movement speed indicates that the user can be in a low activity state, or is performing simple browsing and operations. The calculation method of the mouse movement speed is:
[0044] wherein, is the mouse movement speed, is the mouse movement distance, and are the movement time lengths, , , , ) represents the screen coordinates. Finally, different types of user interaction events are assigned weights (for example, keyboard input weight is higher than mouse movement), resulting in an activity level value between 0 and 1, and the closer the score is to 1, the higher the user's interaction intensity, and the system dynamically adjusts the quality factor of the image according to this score. The calculation method is as follows:
[0045] wherein, , , is the weight, is the activity level, represents the mouse click frequency per unit time, that is, the number of times the user clicks the mouse in a statistical period (such as 1 second), directly reflecting the frequency of mouse click operation; is the mouse movement speed, which measures the speed of the user's mouse operation, and reflects the dynamic characteristics of the mouse operation; is the keyboard input frequency per unit time, that is, the number of times the user strikes the keyboard in a statistical period, reflecting the activity level of keyboard interaction.
[0046] In a more preferred embodiment, multi-dimensional activity level analysis can be performed.
[0047] 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 are assigned different weights, such as copy and paste operation weight 0.8, and ordinary key weight 0.2. In an embodiment, in a text editing scenario, the user frequently performs text input (ordinary key operation frequency 50 times / min) and copy and paste operation (operation frequency 10 times / min). According to the set weight, the user input activity level score is calculated as follows: =0.2x50+0.8x10=10+8=18.
[0048] In an embodiment, the weight distribution of system environment data can also be different, such as bandwidth influence coefficient (set according to different bandwidth intervals, for example, the coefficient is set to 0.5 when the bandwidth is less than 1 Mbps, the coefficient is 0.8 in the 1 to 10 Mbps interval, and the coefficient is 1 when the bandwidth exceeds 10 Mbps) and device performance influence coefficient (based on the comprehensive evaluation of CPU usage and memory remaining amount). In a specific case, if the network bandwidth is 5 Mbps, the bandwidth influence coefficient is 0.8. The device CPU usage is 60%, and the memory remaining amount is 1.5 GB, so the device performance influence coefficient is 0.7. The comprehensive evaluation of the influence of system environment on user activity is the product of the two coefficients, that is, 0.8x0.7=0.56.
[0049] In terms of image operation data, the zoom parameter can be set with a weight (e.g. 1.2 for zoom-in operation and 0.8 for zoom-out operation), the rotation parameter can be set with a weight (1.5 for rotation angle exceeding 90 degrees and 1 for rotation angle not exceeding 90 degrees), and the browsing time parameter can be set with a weight (1.3 for browsing time exceeding 60 seconds and 1 for browsing time not exceeding 60 seconds). For example, the user performs a 200% zoom-in operation (zoom parameter is 1.2), a 45-degree rotation operation (rotation parameter is 1), and a 40-second browsing time (browsing time parameter is 1). Accordingly, the demand degree analysis result of the user for the image is the product of the above parameters, i.e. 1.2 x 1 = 1.2. The activity level analysis unit 2 can set the user input activity weight (0.5), the system environment influence weight (0.3), and the image operation demand weight (0.2) when calculating the comprehensive activity level. Given that the user input activity level score is 18, the system environment influence evaluation result is 0.56, and the image operation demand degree analysis result is 1.2, the calculation method of the comprehensive activity level score is as follows: comprehensive score = 0.5 x 18 + 0.3 x 0.56 + 0.2 x 1.2 = 9 + 0.168 + 0.24 = 9.408. Of course, this embodiment is only illustrative and not limiting to the present application.
[0050] When the user activity level comprehensive score is obtained, the state updating unit updates the state and the Markov prediction unit updates the transition matrix, and the quality factor is predicted when the transition matrix is stable.
[0051] Preferably, the activity level comprehensive score is mapped to a discrete state space X = {0, 1, 2}, and the mapping rule is as follows: ; wherein, : represents the updated discrete state, which takes the value range X = {0, 1, 2}, and is the result of finally mapping to the discrete state space.
[0052] : i.e. the previously calculated activity level value (activity level comprehensive score), which is a continuous value, reflecting the user's interaction intensity.
[0053] : the floor symbol, taking the integer part of the result of 3.
[0054] : taking the smaller value.
[0055] This step ensures that No more than the maximum value 2 of the discrete state space X = {0, 1, 2}, so that the result conforms to the predetermined discrete state range. The above mapping operation maps the continuous activity level value to the discrete state space X = {0, 1, 2} by scaling, rounding and limiting operations, providing a discrete state input for subsequent state update, transition matrix update and quality factor prediction.
[0056] 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, finding the best balance between image quality and compression efficiency, optimizing user experience and system performance.
[0057] The state space is the activity level of the user, which is discretized into a finite number of states, for example , representing low activity, medium activity and high activity, respectively.
[0058] In the low activity state, the user has little interaction with a window of the system, and the activity level of the window is very low. This state usually occurs when the user is inactive or stationary for a long time, representing the idle state of the window. The window can reduce resource consumption by reducing the quality factor. For example, when displaying static images, or when the user is viewing non-essential information (such as file lists or icons), the compression quality does not need to be high, and a lower quality factor can be selected to improve compression efficiency, for example, the quality factor is 30 to 50.
[0059] The medium activity state represents occasional user interaction, usually when the user is browsing the web, reading articles or performing some light work. At this time, the user's input frequency is relatively low, but still shows some activity. For such states, the system should ensure the quality of the image while maintaining relatively low resource consumption. The quality factor of the medium activity state is usually set at a medium level to balance quality and efficiency, for example, the quality factor is 50 to 75.
[0060] In the high activity state, the user frequently performs interactive operations such as typing, clicking, dragging, sliding, etc. This state usually occurs in highly focused tasks such as video editing, gaming or program development, etc. In this case, the system needs to provide the best image quality, so a higher quality factor should be selected to ensure clear details and realistic images. However, due to the high interaction in this state, which may require more computing resources, the system needs to ensure that the selection of the quality factor is within the acceptable range of resource consumption, for example, the quality factor is 75 to 95. These states reflect the intensity and frequency of user interaction, such as no operation, occasional clicking or frequent input.
[0061] The state update unit generates a state transition matrix. Illustratively, for a state space of n = 3, the transition matrix A can be initially uniformly distributed, i.e.: ; After the activity level detection unit calculates the activity level value, the state update unit dynamically updates the transition matrix as the user interaction data accumulates. Through counting the number of transitions and normalizing, the state distribution can converge to a stationary distribution after multiple iterations.
[0062] When the system reaches a steady state, there is a probability vector that satisfies: , , is the probability of state transition.
[0063] By solving the linear equation system = 0, the specific value of can be obtained, is the identity matrix.
[0064] This means that after a long run, the probability of the system in each state remains unchanged. Although the quality factor cannot be obtained directly by Markov, the quality factor is usually a certain function based on the historical state and transition matrix. In the steady state, the quality factor can be determined by the weighted combination of the stationary distribution and the transition matrix.
[0065] In a more preferred embodiment, the state is calculated first:
[0066] Then the expected value of the quality factor based on the state distribution is calculated :
[0067] where represents the state vector at time , n is the power of the transition matrix; 1, 2, …, n is a weight coefficient representing the contribution of different historical time to the quality factor. represents the quality factor at time , which is a quantity related to the state of the system, reflecting the quality characteristics of the system at that time. represents the state of the system at time , ( probability of the system being in state i at time t, which reflects the distribution of the system at different time. represents the quality factor corresponding to the state ( =0,1,2) of the system, i.e. the specific quality factor value associated with each discrete state i.
[0068] To predict the user activity state in the next few seconds or steps and adjust the quality factor in advance accordingly, it is suitable for scenarios that require forward-looking optimization (such as adjusting the quality factor in advance in high-latency networks), and the expected value can be used to calculate the state distribution after multiple-step transitions.
[0069] The Markov prediction unit determines the activity state of the user according to the user's behavior, and predicts the quality factor of the next step according to the state change. In a single-layer Markov chain model, the system can usually only focus on the state change of one dimension, for example, focusing on the activity level of the user, and dynamically adjusting the compression quality factor of the image based on the transition of these activity states. However, simply focusing on one state change cannot predict the changes in different windows, and the global quality factor cannot predict the local quality factor of each window. The behavior of the user is not only reflected in the activity state, but the switching of the window also has an important influence on the quality factor of the image compression. For example, the user switches from window A (low activity) to window B (high activity), which will affect the adjustment of the compression quality. The single-layer model cannot capture this change. Therefore, the double-layer Markov chain model (i.e. introducing window switching prediction) can more accurately reflect the user's behavior pattern and make more accurate predictions on the adjustment of the quality factor.
[0070] Therefore, preferably, the Markov prediction unit described in the present application adopts multi-Markov prediction, which includes at least one Markov chain model. As an illustrative description, the following uses two Markov chains as an illustrative description, and those skilled in the art should understand that more Markov chains can be similarly extended.
[0071] The Markov prediction unit includes a window switching unit, which increases the prediction of the window activity state by introducing window switching, so that the state transition depends not only on the user's interaction intensity, but also on the user's switching between different windows. This enhancement enables the model to understand the user's operation behavior more finely, and thus provides more flexible and accurate quality factor prediction and adjustment.
[0072] In a single-layer Markov chain model, the activity state is the only state dimension. Usually, the activity state of the user is discretized into three main states (low activity state, medium activity state and high activity state), and the system adjusts the quality factor of image compression through these states. The transition matrix is a a matrix representing transition probabilities between states, for example, the probability of transitioning from a low activity state to a high activity state.
[0073] Unlike the single-layer model, the Markov prediction unit described in the present application also includes a state space, which is expanded to two dimensions, i.e., activity state and window state, by introducing a hierarchy of window states. The first layer, activity state (low, medium, high activity), is divided based on the intensity of user interaction. The second layer, window state (window A, window B, window C, etc.), is determined according to the user's switching between different windows. Each window has its corresponding activity state, for example, window A may be in a low activity state, and window B in a high activity state. Through this structure, the prediction model not only adjusts the image quality factor according to the activity intensity of the user, but also considers the user's switching between different windows, so the state space is expanded to a combination state of multiple windows.
[0074] If the system has two windows (A and B), and each window has three activity states, then the state space becomes , representing the high, medium, and low states of window A and the high, medium, and low states of window B, respectively. The transition matrix is also expanded to a matrix, which records the transition probabilities between each window state.
[0075] In the Markov prediction unit described in the present application, the state space consists of two parts: activity state space and window state space. For better illustration, some definitions are made in the present application.
[0076] is the activity state space, where each state represents a different activity level (e.g., low activity, medium activity, high activity).
[0077] is the window state space, where each window represents a different window (e.g., window A, window B).
[0078] The state of the system can be represented as a two-tuple , where represents the activity state, represents the window state.
[0079] The activity state transition matrix records the transition probabilities from one activity state to another. The size of this matrix is , where represents the probability of transitioning from activity state to activity state .
[0080] ; Window state transition matrix Records the transition probabilities from one window state to another. The size of this matrix is where denotes the probability of transitioning from window state to the active state .
[0081] ; Since the state of the system is a pair of the active state and the window state, the transition matrix of the 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. The size of the joint transition probability matrix is , i.e. it records the transition probabilities between all possible pairs of states, which can be expressed as: ; where denotes the probability of transitioning from the current state to the next state .
[0082] The update of the joint transition matrix is based on the transition frequencies of the active state and the window state. Each user behavior (e.g. window switching, active state change) will affect the corresponding value in the joint transition matrix.
[0083]
[0084] where denotes the transition probability from state to , is the total frequency of transitioning from state to any other state.
[0085] The working state of the Markov prediction unit is shown in Figure 2 . When the switching frequency is collected enough, when editing in the word document at time t, the probability of predicting that the next time will transition to the browser window and the high active state is 0.8, then the quality factor of the browser window will be adjusted in advance, so as to reduce the delay and improve the experience.
[0086] Embodiment 2 As shown in Figure 3As shown, the present application provides an adaptive JPEG image compression method based on double Markov chain optimization, which comprises the following steps: Step 1: receiving device event data, and / or image operation data, and / or system environment data.
[0087] Step 2: analyzing the user activity level according to the received data.
[0088] Step 3: updating the current state of the system according to the activity level analysis results and historical state information of the system.
[0089] Step 4: quality factor prediction using at least two interrelated Markov chains.
[0090] Step 5: compressing the image according to the quality factor prediction results obtained by the prediction of the at least two interrelated Markov chains.
[0091] Step 6: outputting the compressed image.
[0092] Step 1: collecting multi-dimensional data related to user operation and system environment, specifically including the following steps: Collecting input device events: using keyboard and mouse event listeners to monitor keyboard and mouse events, collecting user input activity data such as key frequency, mouse movement trajectory, etc. Here the input is the original event signal generated by the keyboard and mouse, which is processed by the listener and output as user input activity data that can be recorded and analyzed, which will be used for subsequent user activity level analysis.
[0093] It also includes collecting system environment data: collecting system network bandwidth, device performance and other environmental parameters. Collecting original parameter signals from network interface and device performance monitoring modules, and outputting standardized system environment parameter data after processing, which will provide the basis for subsequent state updating.
[0094] Collecting image operation data: monitoring user operations on images such as zooming, rotating, browsing duration, etc., and outputting related data recording user specific operations on images to assist in analyzing the demand level of users for images and providing reference for quality factor prediction.
[0095] Step 2: multi-dimensional activity level analysis, comprehensively analyzing user activity level from multiple sources. The analysis includes: User input activity level analysis: receiving user input activity data collected from input device events, analyzing user activity level based on input device operation through specific algorithms (such as setting different operation weights, calculating activity level score according to operation frequency and complexity), and outputting quantitative user input activity level comprehensive score, which is used for comprehensive activity level calculation.
[0096] System environment impact analysis: Based on the network bandwidth, device performance, and other data collected from system environment parameters, analyze the possible impact of the system environment on user activity (for example, when the network bandwidth is low, the user may prefer to receive low-quality but fast-transmitted images), and output the environmental impact assessment results, which are used for comprehensive activity level calculation.
[0097] Image operation demand analysis: Use the operation data collected from image-related operations to analyze the user's specific demand for images (such as frequent image scaling, which may indicate a higher demand for image details), and output the analysis results reflecting the user's image demand level, which are used for comprehensive activity level calculation.
[0098] Comprehensive activity level calculation: Fuse the three analysis results (for example, through weighted average, with different weights set according to different scenarios) to obtain a comprehensive score that reflects the user's activity level. Input the user's input activity level comprehensive score, environmental impact assessment results, and user image demand level analysis results, and output the comprehensive activity level comprehensive score, which will be used for state updating.
[0099] Step 3: Dynamic state updating, based on the multi-dimensional activity level analysis results and the system's historical state information, dynamically update the current state of the system. This step further includes: Step 3-1: State feature extraction: Input the comprehensive activity level comprehensive score and historical state data, extract key features (such as the trend of the activity level comprehensive score, the frequency of historical state transitions, etc.) from the comprehensive activity level comprehensive score and the system's historical state data, and output the extracted state feature vector, which is used for state transition judgment.
[0100] Step 3-2: State transition judgment: Input the state feature vector and state transition rules, based on the state feature vector, combine the pre-set state transition rules (which can be trained according to a large amount of actual data, for example, when the activity level comprehensive score suddenly rises 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"), judge whether the system needs to transition, and output the state transition decision result.
[0101] Step 3-3: State update execution: Input the state transition decision result and target state information (if transition is needed, determine the target state according to the rules), update the current state of the system according to the result of state transition judgment, and output the updated current state of the system, which will be used for Markov prediction.
[0102] The purpose of recording state transition is to calculate the probability by P=(A state transitions to B state times) / total times, so as to obtain the transition matrix between each state of the whole system, because when the data is sufficient, the final transition matrix tends to be relatively stable, so as to finally achieve predicting which window the user is likely to operate at the next moment and whether to improve the quality factor of the window, so as to achieve better image effect of the window. Therefore, whether the state transition is performed or not will be recorded in the early stage, and the early stage is definitely unstable and does not conform to all habits of the user. The prediction result of the Markov chain is compared with the actual situation at t time, and when the set accuracy is reached, the target is reached. The significance of this lies in that the user will go to which window and the activity degree at t+1 time can be predicted in advance at t time, so as to improve the quality factor in advance, reduce delay and fuzzy perception, and prevent noise such as mis-click or sliding. Obviously, the probability matrix is different, and it can be ignored to avoid unnecessary adjustment.
[0103] Step 4: double Markov chain cooperative prediction, using two interrelated Markov chains to predict the quality factor. This step includes: Step 4-1: initialization of the first Markov chain: according to the updated current state of the system, the state and state transition matrix of the first Markov chain are initialized. Preferably, the updated current state of the system is input, the initial state and state transition matrix of the first Markov chain are generated by a specific algorithm (such as setting different initial states and transition probabilities according to different categories of system states), and the initialized first Markov chain related parameters are output, which are used for prediction of the first Markov chain.
[0104] Step 4-2: first Markov chain prediction: the initialized first Markov chain related parameters are input, and the first Markov chain performs preliminary quality factor prediction according to its own state transition matrix and current state. The output preliminary quality factor prediction result will be used for adjustment of the second Markov chain.
[0105] Step 4-3: initialization of the second Markov chain: the first Markov chain preliminary quality factor prediction result and system environment parameters are input, and the second Markov chain is initialized by combining the first Markov chain preliminary prediction result and system environment parameters and other additional information. The initial state and transition matrix of the second Markov chain are set by considering the influence of environmental factors on the quality factor (such as appropriately increasing the predicted quality factor when the network bandwidth is high). The output initialized second Markov chain related parameters are used for adjustment of the second Markov chain.
[0106] 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 calculation (combining the dynamic changes of environmental factors to fine-tune the prediction results), the final quality factor prediction results are output, which will be used for image compression.
[0107] Step 5: Adaptive image compression, according to the quality factor prediction results obtained by the collaborative prediction of the double Markov chains, the image is adaptively compressed. This step further includes: Step 5-1: Image preprocessing: Preprocess the original image, such as color space conversion, noise removal, etc. Input the original image data, after processing by the corresponding algorithm (such as using Gaussian filter to remove noise, selecting appropriate color space conversion method according to image type), output the preprocessed image, which is used for compression parameter adjustment.
[0108] Step 5-2: Compression parameter adjustment: Input the final quality factor prediction results and default JPEG compression parameters, adjust the compression parameters through specific mapping relationship (for example, the higher the quality factor, the more detailed the quantization table), adjust the related parameters of JPEG compression algorithm (such as quantization table, entropy coding parameter, etc.) according to the final quality factor prediction results, output the adjusted compression parameters, which are used for JPEG compression execution sub-step.
[0109] Step 5-3: JPEG compression execution: Input the preprocessed image and the adjusted compression parameters, use the adjusted compression parameters to perform JPEG compression on the preprocessed image, output the compressed image data, which will be used for image output.
[0110] Step 6: Optimize image output, post-process and output the compressed image. Specifically includes: Image post-processing: Post-process the compressed image, such as sharpening to enhance image edges, adjusting brightness and contrast, etc. Input the compressed image data, process it through the corresponding image processing algorithm (such as Laplace sharpening algorithm, histogram equalization to adjust brightness and contrast), output the post-processed image, which is used for image quality evaluation sub-step.
[0111] Image quality evaluation: After the post-processing of the image, the quality evaluation is carried out, and indicators such as peak signal-to-noise ratio (PSNR) and structural similarity (SSIM) are used for quantitative evaluation. The post-processed image is input, and the image quality evaluation result is output, which is used to judge whether the compression parameter needs to be adjusted. If the evaluation result does not meet the preset standard, it is fed back to the compression parameter adjustment sub-step of the adaptive image compression step, and the parameter is adjusted for compression again; if the standard is met, it enters the image output execution sub-step.
[0112] Image output execution: The image after post-processing and quality evaluation is output. The input is the image that passes the quality evaluation, and the output is the final image that can be used, such as remote desktop display, storage to local, etc.
[0113] The present application has achieved remarkable technical effects in the field of image compression through multi-source data acquisition, double Markov chain prediction and full-process optimization: Optimize the balance between image compression quality and efficiency. With the help of double Markov chain, the quality factor is accurately predicted, so that the compression parameter can be flexibly adjusted according to different system environment and user demand. In the limited network bandwidth scenario, the image quality can be reasonably reduced to ensure the smoothness of transmission. According to the test, the transmission time can be shortened by about 30% under the premise of ensuring the basic visual quality of the image, effectively reducing the bandwidth occupation. When the device performance is good and the network bandwidth is sufficient, high-quality image compression results can be provided, and the image quality is improved by about 20% in subjective evaluation, realizing a good balance between storage space and image quality.
[0114] Dynamic resource utilization. According to the system resources (such as network bandwidth, CPU usage, etc.) and user operation, the compression strategy is dynamically adjusted, avoiding the waste of resources or poor image quality caused by fixed parameter compression. For example, when the network bandwidth is sufficient, the bandwidth resources are fully utilized to improve the image quality; when the CPU usage is high, the compression algorithm complexity is optimized to ensure the stable operation of the system while completing high-quality compression.
[0115] Enhance the adaptability of the system environment. Comprehensive collection of multi-dimensional data such as input device events, system environment parameters and image-related operations, comprehensive perception of system running state and user intention. Whether in the weak network environment of mobile devices, or in the high-speed network conditions of high-performance servers, or in the face of different user operation habits, the system can make appropriate compression decisions based on these multi-source data. According to the test, under different network conditions (such as 2G-5G network) and device performance (low, medium and high configuration devices), the system stable operation success rate reaches more than 95%.
[0116] Dynamic state updating responds to changes in real time. By dynamically updating the system state, the system can respond to changes in the system environment and user behavior in a timely manner. For example, when the network bandwidth suddenly changes or the user's operation frequency changes, the system can quickly adjust the state and re-predict the quality factor based on this to adjust the compression parameters, ensuring that the image compression always adapts to the actual situation.
[0117] Enhance user experience. According to the user's operation and activity level on the image, provide image quality that meets the user's expectations. For example, when the user performs frequent zoom operations on the image, the system can predict the user's attention to image details and provide higher quality compressed images. According to the survey, in the scene where the user frequently operates the image, the user's satisfaction with the image quality is improved by about 35%, enhancing the user's experience in image browsing, processing, etc.
[0118] It is apparent to those skilled in the art that the present application is not limited to the details of the foregoing exemplary embodiments, and that the present application can be implemented in other specific forms without departing from the spirit or essential characteristics of the present application. Therefore, the embodiments should be considered in all respects as illustrative and not restrictive, and the scope of the present application should be defined by the appended claims rather than the above description, and it is intended to include all changes falling within the meaning and range of equivalents of the claims. Any reference signs in the claims should not be considered as limiting the claims involved.
[0119] Furthermore, it should be understood that, although the present specification is described in terms of embodiments, not every embodiment contains only one independent technical solution, and the description of the specification is only for the sake of clarity, and those skilled in the art should consider the specification as a whole, and the technical solutions in each embodiment can be appropriately combined to form other embodiments that those skilled in the art can understand.
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; Activity Level Analysis Unit: Analyzes user activity levels based on data from the receiving / acquisition unit; 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; 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 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, The receiving / acquisition unit includes: Keyboard and mouse event listeners: used to monitor keyboard and mouse events and collect user input activity data; System environment data acquisition unit: used to collect data on network bandwidth, device CPU utilization, and remaining device memory; Image manipulation data acquisition unit: used to acquire data, including: image scaling ratio, rotation angle, and browsing time.
3. The JPEG image compression system based on dual Markov chain optimization as described in claim 2, 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.
4. The JPEG image compression system based on dual Markov chain optimization as described in claim 3, 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.
5. The JPEG image compression system based on dual Markov chain optimization as described in claim 4, 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.
6. 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-5, 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.
7. The JPEG image compression method based on dual Markov chain optimization as described in claim 6, characterized in that, 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: Collect system environment data: Collect system network bandwidth and device performance parameters; Image operation data acquisition: Records output by monitoring user operations on images, as well as data on the specific operations performed by the user on the images.
8. The JPEG image compression method based on dual Markov chain optimization as described in claim 7, 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.
9. The JPEG image compression method based on dual Markov chain optimization as described in claim 8, 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.
10. The JPEG image compression method based on dual Markov chain optimization as described in claim 9, 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
Display method and electronic equipment
CN104572407A
JPEG image double-compression automatic detection method
CN106960435A
Remote desktop video coding method and device
CN107295340A
Robot control method and device, electronic equipment and storage medium
CN115933643A
Systems and methods for unobtrusively displaying media content on portable devices
US20230009540A1