A picture automatic fitting preview method based on Pearson formula
By using a method based on Pearson's formula to calculate the attribute coefficients of the image and the preview adapter, and selecting the most suitable preview method, the problems of inconsistent image preview effects and high complexity in existing technologies are solved, achieving a more economical, accurate, and efficient image preview effect.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- GANSU WANWEI INFORMATION TECH CO LTD
- Filing Date
- 2022-12-15
- Publication Date
- 2026-07-14
AI Technical Summary
Existing online image preview methods suffer from inconsistent preview effects, high complexity, and insufficient cost and accuracy, making it difficult to achieve a unified and efficient image preview method.
Using a method based on the Pearson formula, the matching degree is derived by calculating the attribute coefficients of the image and the preview adapter and using the Pearson correlation coefficient calculation formula. The most suitable preview method is selected, including parsing image attributes, calculating the coefficients of each attribute, calculating the preview adapter coefficients, and finally selecting the preview method with better economy, accuracy and efficiency.
It achieves more economical, accurate, and efficient image previews, reduces preview complexity, and improves the consistency of preview effects.
Smart Images

Figure SMS_9 
Figure SMS_10 
Figure SMS_11
Abstract
Description
Technical Field
[0001] This invention relates to the field of image data processing technology, specifically a method for automatic image adaptation and preview based on the Pearson correlation coefficient calculation formula. Background Technology
[0002] With the advent of the big data era, the dissemination and use of internet images have become increasingly frequent. However, when images are disseminated and used online, we often need to view their specific content but don't want to download them to our local computers, generating a lot of storage junk and occupying local computer disk space. This is where online image preview becomes particularly important. With the development of the computer software industry, there are many ways to implement online preview, and factors such as implementation methods, preview effects, open-source / closed-source nature, and complexity vary greatly. For example, large images may not be well supported by certain preview methods; image pixels and resolution also affect the preview effects of different preview methods; different preview methods also vary in usage and complexity. To unify image preview methods and adapt preview methods more economically, accurately, and efficiently, this paper provides a method that uses formulas to calculate attribute coefficients for image attributes and preview method attributes. Based on the Elson correlation coefficient formula, the formula is further optimized and derived for coefficient adaptation calculation. Based on the coefficient calculation results, a more economical, accurate, and efficient preview method is selected for image preview, greatly reducing the complexity and implementation process of image preview. Summary of the Invention
[0003] The purpose of this invention is to use an algorithm to automatically adapt the preview method of images, so as to preview images in a more economical, accurate and efficient way.
[0004] An automatic image adaptation and preview method based on Pearson's formula includes the following steps:
[0005] a. Analyze the various attribute values of the image based on the preview image, including: size, format, resolution, and sharpness;
[0006] b. Calculate the coefficient for each attribute based on the image's attribute values.
[0007] Formula for calculating attribute format coefficient:
[0008]
[0009] Formula for calculating attribute clarity factor:
[0010]
[0011] Formula for calculating attribute size coefficient:
[0012]
[0013] c. Calculate the final coefficients of the image based on the attribute coefficient values M1, M2, and M3. The calculation formula is as follows:
[0014]
[0015] d. Calculate the attribute coefficients for the preview image method.
[0016] Formula for calculating business attribute coefficient:
[0017]
[0018] Supported image format attribute coefficient calculation formula:
[0019]
[0020] Supported image size attribute coefficient calculation formula:
[0021]
[0022] r: final calculated result value, F: parameter value: formula to calculate business attribute coefficient, F indicates a preview mode (e.g., kkFileView file preview mode).
[0023] e. Calculate the final coefficients of the preview adapter based on the attribute coefficient values F1, F2, and F3 of the preview adapter. The formula for calculating the preview adapter coefficients is as follows:
[0024]
[0025] f. Based on the final coefficients of the preview adapter and the final coefficients of the image, calculate the final coefficient matching degree using the Pearson correlation coefficient derivation formula. Calculate the matching degree of the final coefficients of each preview method and the final coefficients of the preview image sequentially using the derivation formula.
[0026] The matching degree calculation formula derived from the Pearson correlation formula:
[0027]
[0028] g. The matching degree values D calculated sequentially by the matching degree calculation formula are: kkFileView preview adapter D1, openoffice preview adapter D2, and Yongzhong preview adapter D3. Finally, the matching degree value D is used to determine which preview method is more suitable. The smaller the D value and the closer it is to 0, the more suitable the preview method is.
[0029] This invention calculates coefficients for each attribute of the previewable image, such as format, size, and preview effect. Then, based on the preview adapter's attribute coefficients, it calculates the final preview adapter coefficients. Next, it calculates coefficients for different dimensions of the image's attributes, including format, size, resolution, and clarity, and then calculates the final image attribute coefficients based on these image attribute coefficients. Finally, based on the final adapter coefficient values and the final image coefficient values, it calculates the correlation coefficient between each preview adapter and the preview image using a matching degree formula derived from the Pearson correlation coefficient calculation formula. The preview method is selected based on the calculated results. Preview methods with results closer to 0 are considered more suitable, thus evaluating and selecting a more accurate, economical, and efficient preview method. Attached Figure Description
[0030] Figure 1 This is a schematic diagram of the preview adapter matching process of the present invention. Detailed Implementation
[0031] This invention mainly utilizes an automatic image adaptation and preview method based on Pearson's formula, including the following steps:
[0032] a. Parse the image's various attribute values based on the preview image, including: size, format, resolution, and sharpness. Obtaining attributes like size, format, and resolution is relatively simple and can be achieved through the Java API. Sharpness is obtained using the Laplacian gradient method and the Tenengrad gradient method.
[0033] b. Calculate the coefficient for each attribute based on the image's attribute values.
[0034] Formula for calculating attribute format coefficient:
[0035]
[0036] r: final calculated result value, M: parameter value: such as image format, image size, etc.
[0037] Formula for calculating attribute clarity factor:
[0038]
[0039] Formula for calculating attribute size coefficient:
[0040]
[0041] c. Calculate the final coefficients of the image based on the attribute coefficient values M1, M2, and M3. The calculation formula is as follows:
[0042]
[0043] d. Calculate the attribute coefficients for the preview image method.
[0044] Formula for calculating business attribute coefficient:
[0045]
[0046] Supported image format attribute coefficient calculation formula:
[0047]
[0048] Supported image size attribute coefficient calculation formula:
[0049]
[0050] e. Calculate the final coefficients of the preview adapter based on the attribute coefficient values F1, F2, and F3 of the preview adapter. The formula for calculating the preview adapter coefficients is as follows:
[0051]
[0052] f. Based on the final coefficients of the preview adapter and the final coefficients of the image, calculate the final coefficient matching degree using the Pearson correlation coefficient derivation formula. This involves calculating the matching degree of the final coefficients of each preview method and the final coefficients of the preview image sequentially using the derivation formula.
[0053] The matching degree calculation formula derived from the Pearson correlation formula:
[0054]
[0055] g. The matching degree values D calculated sequentially by the matching degree calculation formula are: kkFileView preview adapter D1, openoffice preview adapter D2, and Yongzhong preview adapter D3. Finally, the matching degree value D is used to determine which preview method is more suitable. The smaller the D value and the closer it is to 0, the more suitable the preview method is.
[0056] The preview method is compatible with most of the preview methods on the market. It adopts the adapter design pattern and encapsulates each preview method into a preview adapter, including the reference to the open source tool kkFileView preview, openoffice preview, and the commercial Yongzhong preview.
[0057] First: Based on the attributes of each preview adapter, including commercial attributes, supported image format attributes, supported image size attributes, etc., calculate the attribute coefficient for each adapter (see the preview adapter coefficient calculation method below for specific calculation methods). Then, based on the calculated coefficient for each attribute, calculate the final preview adapter coefficient (see the preview adapter coefficient calculation method below for the calculation method).
[0058] Then: Calculate the coefficients of the image attributes based on the preview image's properties. For example, calculate the coefficients for different dimensions of attributes based on the preview image's format, size, resolution, and clarity (refer to the preview image coefficient calculation method for specific calculation methods). Finally, calculate the final image attribute coefficients based on the image's attribute coefficients (refer to the preview image coefficient calculation method below for calculation methods).
[0059] Finally: Based on the final coefficient values of the adapters and the images, the correlation coefficient between each preview adapter and the preview image is calculated using the matching degree calculation formula derived from the Pearson correlation coefficient calculation formula. The preview method is then selected based on the calculated results. The closer the result value is to 0, the more suitable the preview method, thus allowing for the evaluation and selection of a more accurate, economical, and efficient preview method.
[0060] 1. Preview the adapter coefficient calculation method:
[0061] Both kkFileView and the OpenOffice Preview Adapter are open-source preview methods. kkFileView supports eight image formats: JPG, JPEG, PNG, GIF, PCD, DXF, SVG, and PSD. OpenOffice supports four formats: JPG, JPEG, PNG, GIF, BMP, and PSD, but it's more complex to use and requires plugins. Yongzhong Preview Adapter is a commercial preview method that supports JPG, JPEG, PNG, GIF, BMP, PSD, AVIF, APNG, SVG, PCD, and DXF. kkFileView previews images up to 2MB with good results; the quality drops significantly for images larger than 2MB. OpenOffice previews images up to 1MB with good results. Yongzhong previews images up to 5MB with excellent performance.
[0062] Based on the known attribute parameters above, derive the formula for calculating the adapter coefficient.
[0063] Formula for calculating business attribute coefficient:
[0064]
[0065] Where: 'a' indicates that the preview adapter is an open-source preview method. If it is an open-source preview method, then:
[0066] a = 1; otherwise infinitesimal;
[0067] 'b' indicates that the preview adapter is a closed-source preview method. If it is a closed-source preview method, then:
[0068] b = 1; otherwise infinitesimal;
[0069] 0.75 refers to a matching factor, the purpose of which is to improve the matching accuracy of open-source preview methods and reduce costs.
[0070] Supported image format attribute coefficient calculation formula:
[0071]
[0072] Where: X indicates the number of preview image formats supported by the preview adapter.
[0073] Y indicates whether the preview adapter supports the format of the preview image. If it supports the preview image format, then:
[0074] Y = 1; otherwise infinitesimal;
[0075] The number 12 refers to the fact that kkFileView, openoffice, and Yongzhong Preview Adapter support a total of 12 image preview formats.
[0076] Preview image size supports the following attribute coefficient calculation formula:
[0077]
[0078] Where: S represents the size of the current preview image, and the image size is in KB;
[0079] X indicates whether the preview image is within the size range supported by the preview adapter. If it is within the supported preview size range, then:
[0080] X = 1; otherwise infinitesimal;
[0081] M represents the size of the preview image supported by the preview adapter. For example, the preview adapter supports a preview image size of 2M=2048KB, so M=2048; the preview adapter supports a preview image size of 1M=1024KB, so M=1024; and the preview adapter supports a preview image size of 5M=5120KB, so M=5120.
[0082] Preview adapter coefficient calculation method:
[0083]
[0084] Finally, based on the preview adapter attribute coefficients F1, F2, and F3, the coefficient x for each preview adapter is calculated.
[0085] 2. Preview image coefficient calculation method:
[0086] Common storage formats include 12 types: JPG, JPEG, PNG, GIF, BMP, PSD, AVIF, APNG, SVG, PCD, DXF, and PSD. In daily life and work, the most commonly used image formats are JPG, PNG, GIF, and SVG, a total of 4 formats. Therefore, the range of image formats that exist is likely to fall within the range of the 4 most commonly used formats, or among the 10 least commonly used formats. This leads to the derivation of a formula for calculating image format coefficients.
[0087] Method for calculating image file format attribute coefficients:
[0088]
[0089] Where X and Y refer to image format variables. If the image format is one of the four commonly used image formats, then:
[0090] X = 1; otherwise infinitesimal;
[0091] If the image format is one of the 10 least commonly used image formats; then:
[0092] Y = 1; otherwise infinitesimal
[0093] Method for calculating the image file sharpness attribute coefficient:
[0094] Currently, two methods are used to calculate image sharpness: the Laplacian gradient method and the Tenengrad gradient method. Then, image sharpness is obtained by converting each of these methods, and finally, a sharpness conversion factor formula is applied.
[0095]
[0096] Where T refers to the sharpness calculated by the Tenengrad gradient method, and L refers to the sharpness calculated by the Laplacian gradient method.
[0097] Method for calculating image size attribute coefficients:
[0098] Taking the size of an image attribute as an example to convert the coefficient, the coefficient is defined to be between 0 and 1. If we define a 5MB image as having a coefficient infinitely close to the maximum coefficient (coefficient value of 1), then the formula for calculating the coefficient based on image size is:
[0099]
[0100] Where: 's' refers to the file size, and 1024 refers to the file size unit in the conversion base, as shown below:
[0101] 1G = 1024M 1M = 1024KB 1KB = 1024K;
[0102] 5120 refers to the conversion of a 5M image size into KB units, i.e., 5M = 5120KB, which serves as the base for calculating the image size attribute coefficient.
[0103] Preview image coefficient calculation method:
[0104]
[0105] Finally, the preview image coefficient y is calculated based on the preview image attribute coefficients M1, M2, and M3.
[0106] 3. Method for calculating the correlation coefficient between preview images and preview adapters:
[0107] In statistics, the Pearson correlation is used to measure the correlation (linear correlation) between two variables X and Y, and its value ranges between -1 and 1. The formula is as follows:
[0108]
[0109] Explanation: The Pearson correlation coefficient between two variables is defined as the quotient of the covariance and standard deviation of the two variables, which, after simplification, yields:
[0110]
[0111] From the formula, we can see that there are two variables, X and Y. The product of variables X and Y is XY, which is the sum of the squares of X and Y.
[0112] Preview image and preview adapter calculation method:
[0113] By simplifying the formula for calculating the Pearson correlation coefficient, the formula for calculating the matching between the preview adapter and the preview image is derived as follows:
[0114]
[0115] Where: x refers to the coefficient x calculated by the preview adapter; y refers to the coefficient y calculated by the preview image.
[0116] Then: calculate the matching degree value D based on the preview adapter coefficient x and the preview image coefficient y;
[0117]
[0118] Ultimately, the most suitable preview method is determined by the matching degree values D (D1, D2, D3) calculated based on the preview adapter coefficient and the preview image coefficient. The smaller the D value, the closer it is to 0, the more suitable the preview method is.
[0119] Technical source explanation
[0120] kkFileView preview: https: / / kkfileview.keking.cn / zh-cn / docs / home.html
[0121] OpenOffice preview: https: / / www.officeweb365.com /
[0122] Preview of Yozodcs: https: / / www.yozodcs.com / .
Claims
1. A method for automatic image adaptation and preview based on Pearson's formula, characterized in that... Includes the following steps: a. Analyze the various attribute values of the image based on the preview image, including: size, format, resolution, and sharpness; b. Calculate the coefficient for each attribute based on the image's attribute values. Formula for calculating attribute format coefficient: Formula for calculating attribute clarity factor: Formula for calculating attribute size coefficient: c. Calculate the final coefficients of the image based on the attribute coefficient values M1, M2, and M3. The calculation formula is as follows: d. Calculate the attribute coefficients for the preview image method. Formula for calculating business attribute coefficient: Supported image format attribute coefficient calculation formula: Supported image size attribute coefficient calculation formula: e. Calculate the final coefficients of the preview adapter based on the attribute coefficient values F1, F2, and F3 of the preview adapter. The formula for calculating the preview adapter coefficients is as follows: f. Based on the final coefficients of the preview adapter and the final coefficients of the image, calculate the final coefficient matching degree using the Pearson correlation coefficient derivation formula. Calculate the matching degree of the final coefficients of each preview method and the final coefficients of the preview image sequentially using the derivation formula. The matching degree calculation formula derived from the Pearson correlation formula: g. The matching degree values D calculated sequentially by the matching degree calculation formula are: kkFileView preview adapter D1, openoffice preview adapter D2, and Yongzhong preview adapter D3. Finally, the matching degree value D is used to determine which preview method is more suitable. The smaller the D value and the closer it is to 0, the more suitable the preview method is.