Efficient flow chart publishing method
By identifying the flowchart structure, extracting general patterns, eliminating redundant elements and using lossless compression technology, the problems of large workload, long time and image instability in the existing flowchart processing and release methods are solved, and efficient and fast flowchart release and simplified operations are achieved.
Patent Information
- Application Number
- CN202411839070.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-13
- Publication Date
- 2025-04-08
AI Technical Summary
The existing flowchart processing and publishing methods have problems such as large workload, long time consuming, low efficiency, unstable image and complex operation.
By identifying the flowchart structure, general patterns are extracted using graph theory methods and subgraph isomorphic algorithms, thresholds and filters are introduced to eliminate redundant elements, discrete wavelet transformation and entropy encoding are used for lossless compression, optimize the flowchart size and ensure reversible operation.
Improves the speed and stability of flowchart publishing, reduces file size and maintains image quality, and solves the problem of time-consuming and insufficient stability in traditional methods.
Smart Images

Figure CN119784860A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the technical field of image processing, in particular to an efficient flow chart publishing method. Background Art
[0002] Flowchart files contain a large number of images and videos, some of which are duplicate content and contain unnecessary or redundant graphics. These unnecessary or redundant graphics need to be removed during the publishing process. On the basis of ensuring the integrity of the flowchart and the losslessness of the images and videos, the operations can be recorded to restore the flowchart. However, the existing flowchart processing and publishing methods have the following problems: first, the flowchart processing workload is large, the publishing process is time-consuming and inefficient; second, the image is unstable when the flowchart is published, the processing process is not clear and intuitive, and the operation is complicated.
[0003] Therefore, there is an urgent need to develop a method that can process images and videos efficiently and quickly, quickly publish flowcharts and simplify operations, so as to improve the user experience. Summary of the invention
[0004] To solve the above problems, the purpose of the present invention is to provide an efficient method for publishing flowcharts.
[0005] In order to achieve the above object, the present invention is implemented through the following technical solutions:
[0006] An efficient method for publishing a flowchart includes the following steps:
[0007] ① Identify the flowchart structure. First, use graph theory to parse the flowchart and identify repeated graph elements. Then use the subgraph isomorphism algorithm to quantify the similarity of repeated structures. Based on the similarity measurement results, extract the common patterns and convert them into algorithm logic.
[0008] ②Introduce thresholds and filters to exclude elements that do not meet the repeat element standard to reduce errors and confusion; the exclusion standard of the thresholds and filters is that the number of repeated occurrences of the element exceeds 20% of the total number of elements;
[0009] ③ Use compression algorithm to optimize the size of the flowchart, use discrete wavelet transform and entropy coding to losslessly compress the flowchart into sub-band data;
[0010] ④Storing the compressed sub-band data as a compressed image file;
[0011] ⑤ When the original image needs to be accessed, the compressed file is decompressed, each sub-band is decoded to obtain the original coefficient value, and the original image matrix is reconstructed using the inverse wavelet transform.
[0012] Preferably, in step ②, a batch of graphic elements consisting of multiple graphic elements are processed by parallel computing.
[0013] Preferably, in step ①, the subgraph isomorphism algorithm is used to quantify the similarity of repeated structures, and based on the similarity measurement results, the common patterns are extracted and converted into the specific process of algorithm logic as follows:
[0014] Using Euclidean distance and cosine similarity as similarity metrics, first, the Euclidean distance and cosine similarity of each basic primitive are compared to confirm whether they are the same basic primitive;
[0015] The calculation formula of the Euclidean distance of each basic primitive is:
[0016] \text{Distance}(A,B)=\sqrt{\sum_{i=1}^{n}(A_i-B_i)^2};
[0017] Where A represents a vector, each element of which is denoted by (A_i), and B also represents a vector, each element of which is denoted by (B_i);
[0018] text{Distance}(A,B) is the Euclidean distance between vector (A) and vector (B), sum_{i=1}^{n} represents the sum operation of all elements (i) in the sequence, (A_i-B_i)^2 represents the square of the difference between the element in vector (A) and the element in the corresponding position in vector (B);
[0019] The calculation formula for cosine similarity is:
[0020] \text{Cosine_Sim}(A,B)=\frac{A\cdotB}{|A||B|};
[0021] Where \text{Cosine_Sim}(A,B) is the cosine similarity between vector (A) and vector (B), A\cdot B represents the dot product (inner product) of vector (A) and vector (B); |A| represents the modulus of vector A, and |B| represents the modulus (norm) of vector B;
[0022] Secondly, similar elements are grouped into sets of repeated elements by using the K-means clustering method, which divides the flow chart set into K clusters so that each data point belongs to the center of the nearest cluster, and minimizes the sum of the squares of the distances between the data points and the cluster centers by iteratively optimizing the center positions of the clusters;
[0023] J = \sum_{i=1}^{m}||x^{(i)}-\mu_{c^{(i)}}||^2; where J is the distance, x^{(i)} is the i-th data point, and mu_{c^{(i)}} is the center of the i-th cluster.
[0024] Preferably, the Euclidean distance and the cosine similarity are used as similarity metrics. When the Euclidean distance is less than 0.001 and the cosine similarity is greater than 0.99, the primitive is a repeated primitive.
[0025] Preferably, step ① and step ② are set as reversible operations, and the number and position of repeated graphic elements are recorded in a file. When the runtime flowchart is generated, the original flowchart is restored based on the recorded removal information and duplication information.
[0026] Further preferably, when performing reversible operations, steps ① and ② are performed in a multi-threaded manner to increase the speed of restoring the flowchart.
[0027] Preferably, in step ①, if no repeated graphic elements are found during the process of extracting the repeated parts of the flowchart, the default policy configuration file specifies which shapes, texts, and lines to remove and record all the information of the graphic elements.
[0028] Preferably, in step ③, the discrete wavelet transform is to perform a two-dimensional discrete wavelet transform on the image to obtain frequency sub-bands of different scales; and the entropy coding is to perform Huffman coding on the frequency sub-band data of different scales to express them in a more compact form.
[0029] Preferably, in step ③, the current pixel value is predicted according to the surrounding pixel values during the compression process to reduce the size of the residual data, and the prediction is performed according to the nearest neighbor pixel value, the extracted features are used as input, and the current pixel value is used as output. Specifically,
[0030] Each flowchart element needs to determine the pixel window size for prediction, select a neighborhood area of a fixed size, traverse each pixel in the image, use the pixel values around the pixel as features, and the current pixel value as output, build a training data set, and use the KNN model to model the features; use cross-validation as a test set to evaluate the performance of the model to ensure that the model can accurately predict unseen data; for new images, use the pixel value in the window as input and use the trained model to predict the current pixel value.
[0031] Preferably, in step ③, encoding is performed according to content characteristics of the image or video, and for continuous color blocks, color information only needs to be stored once.
[0032] Compared with the prior art, the present invention has the following advantages:
[0033] The invention discloses an efficient flowchart publishing method, which removes unnecessary elements through an algorithm when processing large-scale flowchart files, and records this operation. When generating a runtime flowchart, it restores the original flowchart, thereby improving the speed and stability of flowchart publishing.
[0034] The invention discloses an efficient flowchart publishing method, which ensures the losslessness and high compression ratio of images by using an optimized compression method for images and videos, and overcomes the problems of long publishing time and insufficient stability of large-file flowcharts in the prior art. For example, it generally takes more than one minute to publish 20 flowcharts of 20 MB in a traditional way, but only 10 seconds to publish them using the method of the invention, which greatly saves network bandwidth and storage space, improves the efficiency of flowchart publishing, solves the limitations of traditional publishing methods, and makes configuration publishing on a larger scale faster and more stable. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] Figure 1 is the original image to be processed;
[0036] Figure 2 This is a schematic diagram of the effect after treatment using Example 3. DETAILED DESCRIPTION
[0037] The purpose of the present invention is to provide an efficient method for publishing a flowchart. The present invention is further described below in conjunction with specific embodiments.
[0038] Example 1
[0039] An efficient method for publishing a flowchart includes the following steps:
[0040] ① Identify the flowchart structure. First, use graph theory to parse the flowchart and identify repeated graph elements. Then use the subgraph isomorphism algorithm to quantify the similarity of repeated structures. Based on the similarity measurement results, extract the common patterns and convert them into algorithm logic.
[0041] Using Euclidean distance and cosine similarity as similarity metrics, first, the Euclidean distance and cosine similarity of each basic primitive are compared to confirm whether they are the same basic primitive;
[0042] The calculation formula of the Euclidean distance of each basic primitive is:
[0043] \text{Distance}(A,B)=\sqrt{\sum_{i=1}^{n}(A_i-B_i)^2};
[0044] Where A represents a vector, each element of which is denoted by (A_i), and B also represents a vector, each element of which is denoted by (B_i);
[0045] text{Distance}(A,B) is the Euclidean distance between vector (A) and vector (B), sum_{i=1}^{n} represents the sum operation of all elements (i) in the sequence, (A_i-B_i)^2 represents the square of the difference between the element in vector (A) and the element in the corresponding position in vector (B);
[0046] The calculation formula for cosine similarity is:
[0047] \text{Cosine_Sim}(A,B)=\frac{A\cdotB}{|A||B|};
[0048] Where \text{Cosine_Sim}(A,B) is the cosine similarity between vector (A) and vector (B), A\cdot B represents the dot product (inner product) of vector (A) and vector (B); |A| represents the modulus of vector A, and |B| represents the modulus (norm) of vector B;
[0049] Secondly, similar elements are grouped into sets of repeated elements by using the K-means clustering method, which divides the flow chart set into K clusters so that each data point belongs to the center of the nearest cluster, and minimizes the sum of the squares of the distances between the data points and the cluster centers by iteratively optimizing the center positions of the clusters;
[0050] J = \sum_{i=1}^{m}||x^{(i)}-\mu_{c^{(i)}}||^2; where J is the distance, x^{(i)} is the i-th data point, and mu_{c^{(i)}} is the center of the i-th cluster;
[0051] When the Euclidean distance is less than 0.001 and the cosine similarity is greater than 0.99, it is a repeated primitive;
[0052] The process contains unnecessary elements (such as repeated shapes, texts, lines or other graphics that do not affect the structure and content of the flowchart). The size, color, position, action and other information of these elements are recorded in the text;
[0053] In the process of extracting the repeated parts of the flowchart, if no repeated elements are found, the default policy configuration file specifies which shapes, texts, and lines to remove and record all the information of the elements. According to the test, this method can reduce the size of the flowchart file by an average of 30%.
[0054] ②Introduce thresholds and filters to exclude elements that do not meet the repeat element standard to reduce errors and confusion; the exclusion standard of the thresholds and filters is that the number of repeated occurrences of the element exceeds 20% of the total number of elements;
[0055] A batch of graphics elements consisting of multiple graphics elements are processed in parallel computing, which improves the speed of the algorithm;
[0056] Steps ① and ② are set as reversible operations, and the number and position of repeated elements are recorded in the file. When the runtime flowchart is generated, the original flowchart is restored based on the recorded removal information and duplication information. Although some elements are removed, the key information is recorded, and the original flowchart can be rebuilt at any time based on the recorded information.
[0057] When performing reversible operations, steps ① and ② are performed in a multi-threaded manner to increase the speed of restoring the flowchart.
[0058] ③ Use compression algorithm to optimize the size of the flowchart, use discrete wavelet transform and entropy coding to losslessly compress the flowchart into sub-band data;
[0059] The discrete wavelet transform is to perform a two-dimensional discrete wavelet transform on the image to obtain frequency sub-bands of different scales; the entropy coding is to perform Huffman coding on the frequency sub-band data of different scales to express them in a more compact form.
[0060] In the compression process, the current pixel value is predicted based on the surrounding pixel values to reduce the size of the residual data. The nearest neighbor pixel value is used for prediction, the extracted features are used as input, and the current pixel value is used as output. Specifically,
[0061] Each flowchart element needs to determine the pixel window size for prediction, select a fixed-size neighborhood area, such as 3x3, 5x5, etc., traverse each pixel in the image, use the pixel values around the pixel as features, and use the current pixel value as output. Build a training data set and use the KNN model to model the features; use cross-validation as a test set to evaluate the performance of the model to ensure that the model can accurately predict unseen data; for new images, use the pixel value in the window as input and use the trained model to predict the current pixel value.
[0062] Encoding is performed according to the content characteristics of the image or video. For continuous color blocks, color information only needs to be stored once.
[0063] ④Storing the compressed sub-band data as a compressed image file;
[0064] ⑤ When the original image needs to be accessed, the compressed file is decompressed, each sub-band is decoded to obtain the original coefficient value, and the original image matrix is reconstructed using the inverse wavelet transform.
[0065] Example 2
[0066] An efficient method for publishing a flowchart includes the following steps:
[0067] ① Identify the flowchart structure. First, use graph theory to parse the flowchart and identify repeated graph elements. Then use the subgraph isomorphism algorithm to quantify the similarity of repeated structures. Based on the similarity measurement results, extract the common patterns and convert them into algorithm logic.
[0068] Euclidean distance and cosine similarity are used as similarity measures. If the Euclidean distance is less than 0.001, for example, and the cosine similarity reaches 0.99, it is considered a duplicate primitive.
[0069] ②Introduce thresholds and filters to exclude elements that do not meet the repeat element standard to reduce errors and confusion; the exclusion standard of the thresholds and filters is that the number of repeated occurrences of the element exceeds 20% of the total number of elements;
[0070] For example, a flowchart containing the following elements, elements A, B, C, D, A, passes the filter and the threshold is greater than 20%, identifying duplicate elements, and the final result is B, C, D, A;
[0071] ③ Use compression algorithm to optimize the size of the flowchart, use discrete wavelet transform and entropy coding to losslessly compress the flowchart into sub-band data;
[0072] The size of the flow chart is optimized, and the compression algorithm of the present invention is used to process the image data.
[0073] Original image matrix: [[200,201,198,199], [203,202,205,204], [197,196,199,198], [201,200,203,202]] Next, we will perform lossless compression on this image using discrete wavelet transform (DWT) and entropy coding.
[0074] Discrete wavelet transform: Perform a two-dimensional discrete wavelet transform on the image to obtain frequency subbands of different scales. Suppose we use Haar wavelet transform and perform a decomposition. We get four subbands: LL (low frequency, low frequency) subband, LH (low frequency, high frequency) subband, HL (high frequency, low frequency) subband, HH (high frequency, high frequency) subband. The decomposed subband data are as follows: LL: [[200,200], [200,202]], LH: [[1,-1], [-1,1]], HL: [[-2,2], [0,0]], HH: [[1,-1], [1,-1]].
[0075] Entropy coding: Entropy coding (such as Huffman coding) is performed on the data in each subband to represent it in a more compact form. Assume that the result after entropy coding is as follows:
[0076] LL: [(200,2), (202,1)]
[0077] LH: [(1,2), (-1,3)]
[0078] HL: [(-2,3), (2,2)]
[0079] HH: [(1,1), (-1,2)]
[0080] Compared with traditional DCT (discrete cosine transform) technology, this algorithm transformation can better preserve the details and contours of the image, thereby achieving higher quality compression results.
[0081] This method performs discrete wavelet transform on the image or video to generate high-frequency and low-frequency coefficients to achieve multi-resolution representation, quantize the coefficients of each sub-band, control the accuracy to balance the compression rate and fidelity, encode the quantized coefficients through entropy coding, etc., reduce data redundancy, and can help reduce the size of images and videos while maintaining visual quality; the lossless compression method involves decomposing the image into sub-bands of different resolutions and frequencies, and then encoding each sub-band to achieve lossless compression, which is suitable for image and video compression, and decomposes the image into sub-bands of different frequencies so that the compressed data has better locality.
[0082] ④Storing the compressed sub-band data as a compressed image file;
[0083] ⑤ When the original image needs to be accessed, the compressed file is decompressed, each sub-band is decoded to obtain the original coefficient value, and the original image matrix is reconstructed using the inverse wavelet transform.
[0084] The image compression standard of the present invention uses wavelet transform to decompose the image and applies bit plane based coding technology. This method is better than traditional JPEG in retaining details. The compression method of the present invention encodes the image or video according to its content characteristics. For example, for continuous color blocks, color information only needs to be stored once, thereby reducing redundant data. Entropy coding technology is used to efficiently encode data. These methods use statistical information in the data to reduce the number of bits required for encoding. In the compression process, the use of context information can improve compression efficiency.
[0085] The current pixel value is predicted based on the surrounding pixel values (prediction based on the nearest neighbor pixel values, with the extracted features as input and the current pixel value as output), thereby reducing the size of the residual data. The combination of these techniques can achieve high-quality image and video compression, ensuring that the details and contours of the original data are preserved as much as possible during the compression process, thereby achieving the purpose of optimizing the size of the flow chart. This method aims to reduce the file size while minimizing the impact on image quality, ensuring that the compressed result has higher clarity and accuracy compared to the original image.
[0086] Example 3
[0087] An efficient method for publishing a flowchart includes the following steps:
[0088] ① Identify the flowchart structure with only basic graphics elements. First, use graph theory to parse the flowchart and identify repeated graphics elements. Then use the subgraph isomorphism algorithm to quantify the similarity of repeated structures. Based on the similarity measurement results, extract the common patterns and convert them into algorithm logic.
[0089] ②Introduce thresholds and filters to exclude elements that do not meet the repeat element standard to reduce errors and confusion; the exclusion standard of the thresholds and filters is that the number of repeated occurrences of the element exceeds 20% of the total number of elements;
[0090] ③ Use compression algorithm to optimize the size of the flowchart, use discrete wavelet transform and entropy coding to losslessly compress the flowchart into sub-band data;
[0091] ④Storing the compressed sub-band data as a compressed image file;
[0092] ⑤ When the original image needs to be accessed, the compressed file is decompressed, each sub-band is decoded to obtain the original coefficient value, and the original image matrix is reconstructed using the inverse wavelet transform.
[0093] An original picture ( Figure 1 ) The effect diagram after the above steps is as follows Figure 2 shown.
[0094] Example 4
[0095] The following process is based on the flowchart processing method of identifying pictures and videos after processing in Example 3.
[0096] ① Identify flowcharts with pictures or videos,
[0097] ②There is a 1000x1000 picture. First, use discrete wavelet transform to convert it into a series of sub-bands of different frequencies, and decompose the picture into low-frequency sub-bands and high-frequency sub-bands.
[0098] ③Next, we can quantize each subband. Quantization refers to the process of converting a digital signal into discrete binary codes. In this case, we can convert each subband into a binary number and use a simple quantization table (such as 8-bit or 16-bit) to map them to the corresponding binary number. In this way, we can reduce data redundancy and maintain the quality of the image.
[0099] ④Finally, we can encode the quantized coefficients using methods such as encoding. Encoding refers to the process of converting digital data into a form that can be stored or transmitted. In this case, we can use lossless compression techniques to compress the quantized coefficients into a smaller file size.
Claims
1. An efficient method for publishing a flowchart, characterized by: The following steps are involved: ① Identify the flowchart structure. First, use graph theory to parse the flowchart and identify repeated graph elements. Then use the subgraph isomorphism algorithm to quantify the similarity of repeated structures. Based on the similarity measurement results, extract the common patterns and convert them into algorithm logic. ②Introduce thresholds and filters to exclude elements that do not meet the repeat element standard to reduce errors and confusion; the exclusion standard of the thresholds and filters is that the number of repeated occurrences of the element exceeds 20% of the total number of elements; ③ Use compression algorithm to optimize the size of the flowchart, use discrete wavelet transform and entropy coding to losslessly compress the flowchart into sub-band data; ④Storing the compressed sub-band data as a compressed image file; ⑤ When the original image needs to be accessed, the compressed file is decompressed, each sub-band is decoded to obtain the original coefficient value, and the original image matrix is reconstructed using the inverse wavelet transform.
2. The method for publishing an efficient flowchart according to claim 1, characterized in that: In step ②, a batch of graphics elements consisting of multiple graphics elements are processed using parallel computing.
3. The method for publishing an efficient flowchart according to claim 1, characterized in that: In step ①, the subgraph isomorphism algorithm is used to quantify the similarity of repeated structures. Based on the similarity measurement results, the common patterns are extracted and converted into algorithm logic. The specific process is as follows: Using Euclidean distance and cosine similarity as similarity metrics, first, the Euclidean distance and cosine similarity of each basic primitive are compared to confirm whether they are the same basic primitive; The calculation formula of the Euclidean distance of each basic primitive is: \text{Distance}(A,B)=\sqrt{\sum_{i=1}^{n}(A_i-B_i)^2}; Where text{Distance}(A,B) is the Euclidean distance between vector (A) and vector (B), sum_{i=1}^{n} represents the sum operation of all elements (i) in the sequence, and (A_i-B_i)^2 represents the square of the difference between the element in vector (A) and the element in the corresponding position in vector (B); The calculation formula for cosine similarity is: \text{Cosine_Sim}(A,B)=\frac{A\cdotB}{|A||B|}; Where \text{Cosine_Sim}(A,B) is the cosine similarity between vector (A) and vector (B), A\cdot B represents the dot product of vector (A) and vector (B); |A| represents the modulus of vector (A), and |B| represents the modulus of vector (B); Secondly, similar elements are grouped into sets of repeated elements by using the K-means clustering method, which divides the flow chart set into K clusters so that each data point belongs to the center of the nearest cluster, and minimizes the sum of the squares of the distances between the data points and the cluster centers by iteratively optimizing the center positions of the clusters; J = \sum_{i=1}^{m}||x^{(i)}-\mu_{c^{(i)}}||^2; where J is the distance, x^{(i)} is the i-th data point, and mu_{c^{(i)}} is the center of the i-th cluster.
4. The method for publishing an efficient flowchart according to claim 3, characterized in that: Euclidean distance and cosine similarity are used as similarity metrics. When the Euclidean distance is less than 0.001 and the cosine similarity is greater than 0.99, it is a repeated primitive.
5. The method for efficiently publishing a flowchart according to claim 1, characterized in that: Steps ① and ② are set as reversible operations, and the number and position of repeated graphics elements are recorded in a file. When the runtime flowchart is generated, the original flowchart is restored based on the recorded removal information and duplication information.
6. The method for efficiently publishing a flowchart according to claim 5, characterized in that: When performing reversible operations, steps ① and ② are performed in a multi-threaded manner.
7. The method for efficiently publishing a flowchart according to claim 1, characterized in that: Step ① If no repeated graphics are found during the extraction of repeated parts of the flowchart, the default policy configuration file specifies which shapes, texts, and lines to remove and record all the information of the graphics.
8. The method for publishing an efficient flowchart according to claim 1, characterized in that: In step ③, the discrete wavelet transform is to perform a two-dimensional discrete wavelet transform on the image to obtain frequency sub-bands of different scales; the entropy coding is to perform Huffman coding on the frequency sub-band data of different scales to express it in a more compact form.
9. The method for efficiently publishing a flowchart according to claim 1, characterized in that: In step ③, the current pixel value is predicted according to the surrounding pixel values during the compression process to reduce the size of the residual data. The prediction is made according to the nearest neighbor pixel value, the extracted features are used as input, and the current pixel value is used as output. Specifically, Each flowchart element needs to determine the pixel window size for prediction, select a neighborhood area of fixed size, traverse each pixel in the image, use the pixel values around the pixel as features, use the current pixel value as output, build a training data set, and use the KNN model to model the features; Cross-validation is used as a test set to evaluate the performance of the model to ensure that the model can accurately predict unseen data; for new images, the pixel value in the window is used as input and the trained model is used to predict the current pixel value.
10. The efficient flowchart publishing method according to claim 1, characterized in that: In step ③, encoding is performed according to the content characteristics of the image or video. For continuous color blocks, the color information only needs to be stored once.