Method and system for displaying and downloading Canvas picture and algorithm frame based on Vue framework

By transferring the image processing tasks to the server and utilizing cloud computing resources, the problem of front-end processing performance degradation and image compression distortion is solved, efficient and reliable image processing and algorithm frame drawing are achieved, and the requirements of complex algorithms and large-scale data are met. Processing requirements.

CN118691948APending Publication Date: 2024-09-24LINEWELL SOFTWARE
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410699725.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-05-31
Publication Date
2024-09-24

AI Technical Summary

Technical Problem

Existing technologies in image processing suffer from performance degradation, poor user experience, and original image compression distortion due to front-end processing, making it difficult to meet the processing needs of complex algorithms and large-scale data.

Method used

Transfer the image processing and algorithm frame drawing tasks from the client to the server side, utilize cloud computing resources for processing, and retain the cleanliness of the original image on the server side to achieve efficient and reliable image processing and algorithm frame drawing.

Benefits of technology

It significantly improves processing efficiency and performance, avoids compression and distortion introduced by front-end rendering, provides a more accurate and reliable data basis, and provides better support for subsequent algorithm tuning.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118691948A
    Figure CN118691948A
Patent Text Reader

Abstract

The invention belongs to the technical field of image processing, and discloses a Canvas picture and algorithm frame displaying and downloading method based on a Vue framework, which realizes the efficient realization of image processing and algorithm frame drawing through the innovative application of the Canvas technology, and provides a flexible and intuitive image processing solution for users. According to the invention, a scheme of transferring image processing and algorithm frame drawing tasks from a client to a server is adopted. According to the method, large-scale image data and complex algorithms are processed by utilizing cloud computing resources, so that the problems of performance reduction and user experience reduction caused by client processing are avoided. According to the invention, the processing efficiency and performance can be obviously improved. The optimization can effectively relieve the problems of performance reduction and user experience reduction caused by the prior art, so that a user can obtain better use experience when processing complex images and large-scale data.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of image processing technology, and in particular, relates to a method for displaying and downloading Canvas images and algorithm boxes based on the Vue framework. The field of image processing technology covers aspects such as digital image processing, graphics, and computer vision, and the present invention focuses on front-end image processing technology implemented using the Vue framework, combining Canvas image processing with algorithm box display, to provide users with an efficient and intuitive image processing and algorithm analysis platform.

[0002] The technical fields involved in the invention of this application are as follows:

[0003] (1) Image processing and front-end development: This technical solution involves processing and displaying images under the front-end development framework Vue. The image drawing and annotation are achieved through Canvas technology, so that image processing and algorithm box display can be completed directly in the user interface, thereby improving user experience and operational efficiency.

[0004] (2) Real-time image processing and streaming media transmission: The technical solution supports real-time image processing and streaming media transmission. Users can instantly obtain and process image data from remote servers and perform algorithm frame drawing and other processing operations without waiting for the transmission to be completed, thus meeting the real-time requirements.

[0005] (3) Image recognition and intelligent algorithm application areas: Through this technical solution, users can identify images and draw algorithm frames, realizing intelligent annotation and display of target areas in images. This involves the application of image recognition algorithms and the drawing of intelligent algorithm frames to support users' rapid understanding and analysis of image content.

[0006] (4) Front-end image processing and machine learning technology: The technical solution combines front-end image processing and machine learning technologies to achieve intelligent recognition and annotation of image content through processing and analysis of image data. This includes steps such as feature extraction of image data, application of machine learning models, and drawing of algorithm boxes to support users' in-depth understanding and application of image information.

[0007] (5) Web front-end and user interface design: The technical solution involves Web front-end development and user interface design. The image processing and display functions of the user interface are realized through the Vue framework and Canvas technology, providing an intuitive and efficient way of image processing and algorithm frame drawing. In addition, the use of JSZip to generate files and folders with algorithm frames further enhances the user's ability to export and share image processing results, improving the usability and flexibility of the system. Background Art

[0008] Traditional image processing technology often relies on server-side processing, while the demand for front-end image processing is increasing. However, existing front-end image processing methods are often limited by performance, interactivity, and flexibility. Therefore, a method for displaying and downloading Canvas images and algorithm boxes based on the Vue framework is needed to solve these problems and meet users' needs for front-end image processing.

[0009] 1. Technical solutions of existing technologies

[0010] 1. The known technologies of the present invention include:

[0011] (1) Front-end image processing technology: In Web front-end development, images are processed and displayed through technologies such as Canvas.

[0012] (2) Real-time image processing and display technology: Real-time display and processing of images to meet users' real-time needs.

[0013] (3) Application of image algorithms under the front-end framework: Use the front-end framework to implement image processing algorithm results, such as recognition, display, and annotation.

[0014] (4) Web front-end and user interface design technology: Use the Vue framework and Canvas technology to implement the interactive functions of the front-end user interface, including but not limited to image processing and algorithm frame drawing.

[0015] (5) File download technology: Use tools such as JSZip to generate files or folders and download the images drawn by Canvas and the ROI algorithm box on the front end. By encapsulating the data of the image and algorithm box into files or folders, the processing results can be exported and shared, which improves the user's operational flexibility and data portability.

[0016] 2. The technical solution in the prior art that is closest to the invention of this application:

[0017] The patent with publication number CN117130611A proposes a method based on svg and html2canvas technology to achieve front-end point drawing and screenshot. The svg tag is used to draw points on the picture and output the coordinate values ​​of the points; the html2canvas component is used to realize the function of capturing the page and generating pictures; through the operation of the svg tag, the front-end developers can complete the requirements such as drawing ROI by using only the front-end development language.

[0018] The patent with publication number CN115623167A proposes a Canvas-based image annotation method and system, which relates to the field of image processing technology. The method includes the following steps: obtaining the image to be annotated according to the image display instruction, and displaying the image to be annotated in the Canvas canvas; monitoring the mouse click events in the Canvas canvas in real time, obtaining the mouse click event set, and drawing the annotated image according to the mouse click event set; monitoring the mouse click events in the Canvas canvas in real time, and moving, scaling or showing and hiding the annotated image; and labeling the annotated image by manual annotation or image recognition.

[0019] 2. Disadvantages of the prior art and technical problems to be solved by the present invention

[0020] (1) Disadvantages of existing technologies for drawing images and tracing points using Canvas to draw ROI frames: Although using Canvas to draw images and tracing points to draw ROI frames can achieve image annotation and processing, there are some limitations. First, since all processing occurs on the client side, performance will be degraded when processing large-scale image data, especially when processing complex algorithms and large amounts of data, the computing and memory resources of the client device are insufficient to meet the requirements. Secondly, since the results of front-end drawing are completely dependent on the computing power and browser performance of the client, when dealing with complex image processing requirements and large-scale data, it will lead to a decline in user experience, such as slow processing speed, high response delay and other problems. In addition, front-end drawing will cause a certain degree of compression and distortion to the original image, which is not conducive to the subsequent algorithm tuning based on the generated image.

[0021] (2) Technical problem to be solved by the present invention: The present invention aims to solve the limitations and shortcomings of the existing ROI frame drawing technology using Canvas to draw pictures and trace points. By transferring the tasks of image processing and algorithm frame drawing from the client to the server, and utilizing cloud computing resources to process large-scale image data and complex algorithms, the processing efficiency and performance can be significantly improved. At the same time, by retaining the cleanliness of the original image on the server side, the compression and distortion introduced in the front-end drawing process are avoided, which is beneficial for subsequent algorithm tuning based on the original image. In this way, the present invention aims to provide a more efficient and reliable image processing and algorithm frame drawing solution to meet the needs of subsequent algorithms for algorithm tuning based on the collected image data.

[0022] Through the above analysis, the problems and defects of the prior art are as follows:

[0023] Although image annotation and processing can be achieved by using Canvas to draw pictures and draw ROI boxes, there are some limitations.

[0024] First, since all processing occurs on the client side, performance will be degraded when processing large-scale image data, especially when dealing with complex algorithms and large amounts of data, the computing and memory resources of the client device are insufficient to meet the requirements.

[0025] Secondly, since the front-end rendering results are completely dependent on the client's computing power and browser performance, when dealing with complex image processing requirements and large-scale data, it will lead to a decline in user experience, such as slow processing speed, high response delay and other problems.

[0026] In addition, front-end drawing will cause a certain degree of compression and distortion to the original image, which is not conducive to the subsequent algorithm to adjust according to the generated image. Summary of the invention

[0027] In view of the problems existing in the prior art, the present invention provides a method for displaying and downloading Canvas images and algorithm frames based on the Vue framework. The present invention implements the whole process of front-end image processing and algorithm analysis based on the Vue framework through the following steps, solves the problems of the prior art in terms of performance, interactivity and flexibility, and has high innovation and practicality.

[0028] The present invention is implemented in this way: a Canvas picture and algorithm frame display and download method based on Vue framework includes:

[0029] Step 1: Bind the Dom element. In the Vue component, write the img and canvas tags, combine the for loop to generate the Dom element to be displayed, and dynamically bind a unique id class name to each canvas tag. This binding method makes each canvas tag correspond to the backend data and algorithm box display, realizing the needs of dynamic display and operation.

[0030] Step 2: Get backend data: Send a request to the backend server through HTTP service to get the image, original size, algorithm identification information, ROI type and orientation and other related data. This step ensures that the front end can obtain the necessary data related to image processing and algorithm analysis, providing a basis for subsequent operations.

[0031] Step 3: operate the Dom element according to the encapsulation method; use the encapsulation method of the present invention to draw the corresponding algorithm box on the img tag according to the input list data and the Dom element id. This step realizes the effective operation and control of the Dom element through the data binding feature provided by the Vue framework, so that the image and algorithm box can be updated and displayed in real time.

[0032] Step 4: Data echo: Since the size of the image displayed on the page is different from the original image, it is necessary to calculate the scaling ratio based on the data of the original image and the size of the canvas, and adjust the position of the algorithm box according to the scaling ratio to achieve accurate presentation of the data on the front-end interface. This step ensures the visual display of the image processing results on the front-end interface and improves the user experience.

[0033] Step 5: Download files and folders. After getting the image address from the backend, create an image object and use canvas in the onload event to draw the algorithm box on the image. After drawing, convert the canvas into a blob object, create and click a download link to trigger the download of the file or folder. This step meets the user's demand for downloading processed images and data, providing more application scenarios and flexibility.

[0034] Furthermore, the binding of Dom elements: writing img and canvas tags in the Vue component, using a for loop to generate the Dom elements to be displayed, and dynamically binding a unique id class name to each canvas tag according to the subscript.

[0035] Furthermore, the backend data is obtained by first obtaining the image and its original size, algorithm identification information, ROI type, and ROI orientation from the backend server through the http service.

[0036] Furthermore, the Dom element is operated according to the encapsulation method: the encapsulation method of the present invention is used to draw a corresponding algorithm frame on the img tag using the canvas tag according to the input list data and the Dom element id.

[0037] Further, the data echo: Since the size of the image displayed on the page is much smaller than the original image, it is necessary to calculate the scaling ratio based on the data on the original image and the canvas size when drawing the algorithm frame, and divide the width and height of the canvas by the width and height of the original image to get the corresponding x- and y-axis scaling ratios. When drawing, multiply the points of the algorithm frame by the corresponding scaling ratio to obtain the position of each point on the front-end interface, and thus present it.

[0038] Furthermore, the file and folder download: get the image address from the backend, create a new image object, use canvas in the oload event of this object to draw the algorithm box on the image; after the drawing work is completed, convert the canvas into a blob object, create and click the download link, and the corresponding file / folder download window will pop up on the page.

[0039] The present invention also provides a Canvas image and algorithm frame display and download system based on the Vue framework, including:

[0040] Binding module, used to bind Dom elements;

[0041] Acquisition module, used to obtain backend data;

[0042] Encapsulation module, used to operate Dom elements according to the encapsulation method;

[0043] Echo module, used for data echo;

[0044] Download module, used for downloading files and folders.

[0045] The present invention also provides a computer device, characterized in that the computer device includes a memory and a processor, the memory stores a computer program, and when the computer program is executed by the processor, the processor executes the steps of the Canvas image and algorithm box display and download method based on the Vue framework.

[0046] The present invention also provides a computer-readable storage medium storing a computer program. When the computer program is executed by a processor, the processor executes the steps of the method for displaying and downloading a Canvas image and an algorithm frame based on a Vue framework.

[0047] The present invention also provides an information data processing terminal, which is used to implement the Canvas image and algorithm frame display and download system based on the Vue framework.

[0048] In combination with the above technical solutions and the technical problems solved, please analyze the advantages and positive effects of the technical solutions to be protected by the present invention from the following aspects:

[0049] First, the invention of this application has completely changed the traditional way of image processing and algorithm frame drawing by introducing innovative Canvas technology applications, fundamentally solving a series of difficult problems existing in the prior art, providing users with an efficient and flexible image processing solution, and at the same time bringing a series of innovative technical effects.

[0050] First of all, the present invention adopts a solution of server-side processing and original image retention, making full use of cloud computing resources and avoiding the problems of performance degradation and user experience degradation caused by limited client resources in traditional front-end processing technology. By moving the image processing task to the server and retaining the clarity of the original image, the compression and distortion problems introduced by the front-end drawing are successfully solved, providing a more reliable data foundation for subsequent algorithm tuning. The innovation of this solution is that it breaks the constraints of the traditional image processing model and brings a new processing method to the field of image processing.

[0051] Secondly, the subsequent algorithm tuning solution provided by the present invention greatly improves the efficiency and accuracy of image data processing by users. By retaining the cleanliness of the original image on the server side, a more accurate data basis is provided for subsequent algorithms, effectively solving the data distortion problem introduced by traditional front-end drawing, thereby improving the accuracy and efficiency of algorithm tuning. The innovation of this solution lies in providing users with more convenient and efficient image processing and algorithm optimization methods, and providing users with a more satisfactory service experience.

[0052] Finally, by optimizing the processing flow and making full use of cloud computing resources, the present invention achieves a significant improvement in processing efficiency and performance, providing users with faster and more reliable processing results. Users can obtain image processing results more quickly and get a higher quality service experience. The innovation of this technical effect is that it fully utilizes the advantages of modern cloud computing technology, bringing new opportunities and challenges to the development of the image processing field.

[0053] Second, considering the technical solution as a whole or from the perspective of the product, the technical effects and advantages of the technical solution to be protected by the present invention are described in detail as follows:

[0054] (1) Efficiency and quick response:

[0055] The present invention transfers the image processing and algorithm frame drawing tasks to the server side, and uses cloud computing resources for processing, which greatly improves the processing efficiency and performance. Compared with the traditional front-end processing method, the present invention can respond to user requests more quickly, realize fast processing and real-time display, thereby improving the product's response speed and user experience.

[0056] (2) Ensuring data integrity and accuracy:

[0057] By retaining the cleanliness of the original image on the server side, compression and distortion introduced by front-end drawing are avoided, thus ensuring the integrity and accuracy of the data. In this way, subsequent algorithms can be accurately analyzed and tuned based on the original image, improving the accuracy and stability of the algorithm and providing users with more reliable processing results.

[0058] (3) Flexibility and scalability:

[0059] The present invention adopts the combination of front-end technology based on Vue framework and cloud computing resources, which has high flexibility and scalability. The product can be flexibly adjusted and upgraded according to user needs and market changes, supports more functions and application scenarios, meets the needs of different user groups, and has strong market competitiveness.

[0060] (4) Cost saving and resource optimization:

[0061] By transferring the image processing task from the client to the server, we can make full use of cloud computing resources, avoid the limitations of user device computing power and browser performance, and save users' costs and resource consumption. At the same time, by optimizing the processing flow and algorithm design, we can further reduce the operating costs of the product and improve the economic benefits of the enterprise.

[0062] (5) Innovation and competitive advantage:

[0063] The present invention adopts an innovative technical solution, combining the advantages of front-end technology and cloud computing resources, successfully solving the problems of existing technologies in performance, data integrity and user experience, etc. It has high technical content and commercial value, bringing more business opportunities and market space to enterprises, and enhancing the competitive advantage and market position of products.

[0064] Third, as auxiliary evidence of the inventiveness of the claims of the present invention, it is also reflected in the following important aspects:

[0065] (1) The expected benefits and commercial value of the technical solution of the present invention after transformation are:

[0066] The present invention adopts an innovative technical solution, combining the advantages of front-end technology and cloud computing resources, successfully solving the problems of existing technologies in performance, data integrity and user experience, etc. It has high technical content and commercial value, bringing more business opportunities and market space to enterprises, and enhancing the competitive advantage and market position of products.

[0067] (2) The technical solution of the present invention fills the technical gap in the industry at home and abroad:

[0068] As image data continues to grow, traditional front-end image processing technology faces the challenge of processing large-scale image data. The present invention solves the limitations of traditional front-end processing technology in processing large-scale image data by utilizing cloud computing resources to process large-scale image data and complex algorithms.

[0069] Traditional front-end image processing technology is often limited by the computing power of the client device and the browser performance, resulting in low processing efficiency and poor user experience. However, the present invention can improve processing efficiency and performance by transferring the image processing task to the server, achieving fast response and real-time display, thereby significantly improving user experience and processing efficiency.

[0070] Traditional front-end image processing technology will cause a certain degree of compression and distortion to the original image during the drawing process, affecting the accuracy and stability of subsequent algorithms. However, the present invention retains the cleanliness of the original image on the server side, avoids the compression and distortion introduced by the front-end drawing, and ensures the integrity and accuracy of the data. BRIEF DESCRIPTION OF THE DRAWINGS

[0071] Figure 1 It is a flow chart of a method for displaying and downloading a Canvas image and an algorithm frame based on a Vue framework provided by an embodiment of the present invention.

[0072] Figure 2 It is a detailed flow chart of a method for displaying and downloading Canvas images and algorithm frames based on a Vue framework provided in an embodiment of the present invention.

[0073] Figure 3 It is a structural block diagram of a Canvas image and algorithm frame display and download system based on a Vue framework provided in an embodiment of the present invention.

[0074] Figure 4 This is an example effect diagram of use in a project provided by an embodiment of the present invention.

[0075] Figure 5 According to an embodiment of the present invention, a picture can be downloaded by clicking a save icon at the lower right corner of a picture on a page to obtain a picture with algorithm information. DETAILED DESCRIPTION

[0076] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.

[0077] The difference between the present invention and the patent with publication number CN117130611A is that the present invention uses the canvas tag to draw pictures and algorithm frames, while the front-end point drawing and frame forming of the patent with publication number CN117130611A is operated with the svg tag, which will lead to performance degradation when processing a large number of graphics, especially on mobile devices, thereby limiting the feasibility of using multiple terminal platforms.

[0078] The difference between the present invention and the patent with publication number CN115623167A is that the present invention automatically draws the picture overlay algorithm box and the logo echo according to the ROI coordinate system returned by the back end, while the patent with publication number CN115623167A draws the image by annotating it according to the mouse click event.

[0079] The shortcomings of the prior art and the technical problems to be solved by the present invention are as follows:

[0080] (1) Disadvantages of existing technologies for drawing images and tracing points using Canvas to draw ROI frames: Although using Canvas to draw images and tracing points to draw ROI frames can achieve image annotation and processing, there are some limitations. First, since all processing occurs on the client side, performance will be degraded when processing large-scale image data, especially when processing complex algorithms and large amounts of data, the computing and memory resources of the client device are insufficient to meet the requirements. Secondly, since the results of front-end drawing are completely dependent on the computing power and browser performance of the client, when dealing with complex image processing requirements and large-scale data, it will lead to a decline in user experience, such as slow processing speed, high response delay and other problems. In addition, front-end drawing will cause a certain degree of compression and distortion to the original image, which is not conducive to the subsequent algorithm tuning based on the generated image.

[0081] (2) Technical problem to be solved by the present invention: The present invention aims to solve the limitations and shortcomings of the existing ROI frame drawing technology using Canvas to draw pictures and trace points. By transferring the tasks of image processing and algorithm frame drawing from the client to the server, and utilizing cloud computing resources to process large-scale image data and complex algorithms, the processing efficiency and performance can be significantly improved. At the same time, by retaining the cleanliness of the original image on the server side, the compression and distortion introduced in the front-end drawing process are avoided, which is beneficial for subsequent algorithm tuning based on the original image. In this way, the present invention aims to provide a more efficient and reliable image processing and algorithm frame drawing solution to meet the needs of subsequent algorithms for algorithm tuning based on the collected image data.

[0082] like Figure 1 , 2 As shown, a method for displaying and downloading a Canvas image and an algorithm frame based on a Vue framework provided by an embodiment of the present invention includes the following steps:

[0083] S101, bind Dom elements;

[0084] S102, obtaining backend data;

[0085] S103, operating the Dom element according to the encapsulation method;

[0086] S104, data echo;

[0087] S105, downloading files and folders.

[0088] The Canvas image and algorithm frame display and download method of the Vue framework, the following are two specific application examples:

[0089] Embodiment 1: Medical image processing system

[0090] In medical image processing systems, doctors often need to view and analyze patients' X-rays, CT or MRI images and apply different algorithms to detect and mark lesions. This system uses the Vue framework combined with Canvas to achieve this requirement.

[0091] 1) Step 1: Bind Dom elements

[0092] In the Vue component, the `v-for` directive is used to traverse the patient image list returned by the backend, and for each image, an `img` tag is created to display the image and a `canvas` tag is created to draw the algorithm box. Each `canvas` tag is bound to a unique `id`.

[0093] 2) Step 2: Get backend data

[0094] Send a request to the backend server through Axios or Fetch API to obtain the patient's image data, original size, lesion recognition results (algorithm box position, size, etc.) and other information.

[0095] 3) Step 3: Operate Dom elements according to the encapsulation method

[0096] Using the Vue encapsulation method, the image list is traversed, and the algorithm frame of the lesion is drawn on the corresponding `canvas` according to the algorithm frame data of each image.

[0097] 4) Step 4: Data echo

[0098] Since the image size displayed on the front end is different from the original size, it is necessary to calculate the scaling ratio and adjust the position and size of the algorithm frame according to the ratio to ensure that the algorithm frame can be accurately displayed on the image.

[0099] 5) Step 5: Download files and folders

[0100] Users can choose to download images with algorithm boxes or the entire patient's image folder. The system requests the image data address from the backend, and then uses the `canvas.toDataURL()` method to convert the image with algorithm boxes into a Blob object and create a download link for users to click to download. If you need to download the entire folder, you can package multiple Blob objects into a ZIP file and download it.

[0101] Example 2: Online image processing tool

[0102] The online image processing tool allows users to upload pictures and apply various image processing algorithms (such as filters, cropping, rotation, etc.). The system also uses the Vue framework and Canvas to implement these functions.

[0103] 1) Step 1: Bind Dom elements

[0104] In the Vue component, create an `input` tag for users to upload pictures, an `img` tag for displaying pictures, and a `canvas` tag for drawing processed pictures.

[0105] 2) Step 2: Get backend data (uploaded pictures)

[0106] After the user selects and uploads an image through the `input` tag, the system uploads the image to the backend server and returns the URL or Base64 encoding of the image.

[0107] 3) Step 3: Operate Dom elements according to the encapsulation method

[0108] After the user selects the image processing algorithm to be applied, the system processes the image on the `canvas` according to the algorithm type and updates the `img` tag in real time to display the processed image.

[0109] 4) Step 4: Data echo (this step is not required)

[0110] Since online image processing tools usually display the processed images directly, there is no need for an additional data echo step. However, if you need to compare the original image and the processed image, you can add this step to display the two images at the same time.

[0111] 5) Step 5: Download the file

[0112] The user can choose to download the processed image. The system uses the `canvas.toDataURL()` method to convert the image on the `canvas` into a Blob object and creates a download link for the user to click to download.

[0113] The binding Dom element provided by the embodiment of the present invention is:

[0114] Write img and canvas tags in the Vue component, use a for loop to generate the Dom elements to be displayed, and dynamically bind a unique id class name to each canvas tag according to the subscript.

[0115] The backend data acquisition provided by the embodiment of the present invention requires first obtaining the image and its original size, algorithm recognition information (the point corresponding to each detected ROI, the recognition result), ROI type, and ROI orientation from the backend server through the http service.

[0116] The encapsulation method provided in the embodiment of the present invention operates the Dom element: the encapsulation method of the present invention is used to draw the corresponding algorithm box on the img tag using the canvas tag according to the input list data and the Dom element id.

[0117] The data echo provided by the embodiment of the present invention: Since the size of the picture displayed on the page is much smaller than the original picture, it is necessary to calculate the scaling ratio based on the data on the original picture and the canvas size when drawing the algorithm frame, and divide the width and height of the canvas by the width and height of the original picture to obtain the corresponding x-axis and y-axis scaling ratios. When drawing, the point position (proportion) of the algorithm frame is multiplied by the corresponding scaling ratio to obtain the position of each point on the front-end interface, and thus present it.

[0118] The file and folder download provided by the embodiment of the present invention: get the image address from the backend, create a new image object, and use canvas in the oload event of this object to draw the algorithm box on the image (if there are multiple images that need to be downloaded, convert all image objects into Promise objects to ensure that all images and their corresponding algorithms can be displayed correctly); after the drawing work is completed, convert the canvas into a blob object, create and click a download link, and the corresponding file / folder download window will pop up on the page.

[0119] like Figure 3 As shown, a Canvas image and algorithm frame display and download system based on the Vue framework provided by an embodiment of the present invention includes:

[0120] Binding module, used to bind Dom elements;

[0121] Acquisition module, used to obtain backend data;

[0122] Encapsulation module, used to operate Dom elements according to the encapsulation method;

[0123] Echo module, used for data echo;

[0124] Download module, used for downloading files and folders.

[0125] The embodiment of the present invention describes a method for displaying and downloading Canvas images and algorithm frames based on the Vue framework. The following is a detailed working principle:

[0126] 1) Bind Dom elements (S101):

[0127] -The Vue framework provides instructions and data binding functions, which can bind DOM elements to data or methods of Vue instances. In this step, you will use Vue instructions (such as `v-bind` or `v-model`) to bind Canvas elements to relevant data or methods in Vue instances.

[0128] 2) Obtaining backend data (S102):

[0129] -Through Vue's asynchronous request library (such as axios) or methods in the Vue instance, send a request to the backend to obtain the required data. These data are the raw data used to generate pictures or algorithm boxes.

[0130] 3) Operate Dom element (S103):

[0131] -Use encapsulated methods, which are methods in Vue components or Vue instances, to operate on DOM elements. This includes dynamically generating images or algorithm boxes on Canvas based on acquired data.

[0132] 4) Data display (S104):

[0133] -Echoing the processed data on the Canvas means drawing the acquired image data on the Canvas and drawing the corresponding frame according to the data of the algorithm frame.

[0134] 5) Downloading files and folders (S105):

[0135] -The download function of files and folders needs to be implemented. This can be achieved by using the browser's native download function or with the help of a front-end library. For image downloads, the image data drawn on the Canvas can be converted into a file stream and a download link can be provided; for folder downloads, multiple files need to be packaged into a compressed file and a download link can be provided.

[0136] The whole process involves data interaction between the front-end and back-end, DOM operation, Canvas drawing, file processing and other technologies. In the Vue framework, these functions can be implemented more conveniently by utilizing its features such as data binding, componentization and asynchronous requests.

[0137] A computer device, characterized in that the computer device includes a memory and a processor, the memory stores a computer program, and when the computer program is executed by the processor, the processor executes the steps of the Canvas image and algorithm box display and download method based on the Vue framework.

[0138] A computer-readable storage medium stores a computer program. When the computer program is executed by a processor, the processor executes the steps of the Canvas image and algorithm frame display and download method based on the Vue framework.

[0139] An information data processing terminal, characterized in that the information data processing terminal is used to implement the Canvas image and algorithm frame display and download system based on the Vue framework.

[0140] It should be noted that the embodiments of the present invention can be implemented by hardware, software, or a combination of software and hardware. The hardware part can be implemented using dedicated logic; the software part can be stored in a memory and executed by an appropriate instruction execution system, such as a microprocessor or dedicated design hardware. It can be understood by a person of ordinary skill in the art that the above-mentioned devices and methods can be implemented using computer executable instructions and / or contained in a processor control code, such as a carrier medium such as a disk, CD or DVD-ROM, a programmable memory such as a read-only memory (firmware), or a data carrier such as an optical or electronic signal carrier. Such code is provided on the carrier medium. The device and its modules of the present invention can be implemented by hardware circuits such as very large-scale integrated circuits or gate arrays, semiconductors such as logic chips, transistors, etc., or programmable hardware devices such as field programmable gate arrays, programmable logic devices, etc., can also be implemented by software executed by various types of processors, and can also be implemented by a combination of the above-mentioned hardware circuits and software, such as firmware.

[0141] Example of use in a project: After entering the inference result page on the front-end page, initiate a data request to the back-end to obtain the image captured by the camera when the event occurs and the corresponding algorithm information (including the original image size, the coordinates of the algorithm frame, the recognition result, etc.). After obtaining the data, use canvas to draw the image according to the method in this patent, and echo the data to the page. Figure 4 Click the save icon in the lower right corner of the image on the page to download the image and get the image with algorithm information, as shown in Figure 5 shown.

[0142] The present invention has been applied in the Hunan Valin factory. Through the implementation of the present invention, the following positive effects have been achieved: the efficiency and accuracy of front-end image processing and algorithm analysis have been significantly improved. The user interactivity and experience have been improved, so that administrators can understand and handle illegal operations more intuitively. The flexibility and scalability of the system have been enhanced, and the needs of production application scenarios such as work clothes, safety helmets, masks, and personnel intrusion detection have been met.

[0143] The lightweight and responsive design of the Vue framework enables the front-end pages to load and render faster. The Vue framework provides data binding and componentization features, making the user interface more intuitive and friendly. Combined with Canvas technology, real-time image processing and algorithm analysis can be performed on the client, thereby improving overall performance. By reducing frequent communications with the server, real-time image processing and algorithm analysis can be performed on the client, reducing network latency and server load, and further improving performance.

[0144] The above description is only a specific implementation mode of the present invention, but the protection scope of the present invention is not limited thereto. Any modifications, equivalent substitutions and improvements made by any technician familiar with the technical field within the technical scope disclosed by the present invention and within the spirit and principle of the present invention should be covered by the protection scope of the present invention.

Claims

1. A method for displaying and downloading Canvas images and algorithm frames based on the Vue framework, characterized in that: The Vue framework-based Canvas image and algorithm frame display and download method comprises the following steps: Step 1: Bind the Dom element; Step 2: Get backend data; Step 3: Operate the Dom element according to the encapsulation method; Step 4: data echo; Step 5: Download files and folders.

2. The method for displaying and downloading Canvas images and algorithm frames based on the Vue framework as claimed in claim 1, characterized in that: The binding Dom element: write img and canvas tags in the Vue component, use a for loop to generate the Dom elements to be displayed, and dynamically bind a unique id class name to each canvas tag according to the subscript.

3. The method for displaying and downloading Canvas images and algorithm frames based on the Vue framework as claimed in claim 1, characterized in that: The backend data acquisition: the image and original size, algorithm identification information, ROI type, and ROI orientation need to be acquired from the backend server through the http service.

4. The method for displaying and downloading Canvas images and algorithm frames based on the Vue framework as claimed in claim 1, characterized in that: The method for operating the Dom element according to the encapsulation method is as follows: using the encapsulation method of the present invention to draw a corresponding algorithm frame on the img tag using the canvas tag according to the input list data and the Dom element id.

5. The method for displaying and downloading Canvas images and algorithm frames based on the Vue framework as claimed in claim 1, characterized in that: The data echo: Since the size of the picture displayed on the page is much smaller than the original picture, it is necessary to calculate the scaling ratio based on the data on the original picture and the canvas size when drawing the algorithm frame. The width and height of the canvas are divided by the width and height of the original picture to get the corresponding x- and y-axis scaling ratios. When drawing, the points of the algorithm frame are multiplied by the corresponding scaling ratio to obtain the position of each point on the front-end interface, and then presented.

6. The method for displaying and downloading Canvas images and algorithm frames based on the Vue framework as claimed in claim 1, characterized in that: The file and folder download: get the image address from the backend, create a new image object, use canvas in the oload event of this object to draw the algorithm box on the image; after the drawing work is completed, convert the canvas into a blob object, create and click the download link, and the corresponding file / folder download window will pop up on the page.

7. A Vue-based Canvas image and algorithm frame display and download system implementing the Vue-based Canvas image and algorithm frame display and download method as described in any one of claims 1 to 6, characterized in that: The Canvas image and algorithm frame display and download system based on the Vue framework includes: Binding module, used to bind Dom elements; Acquisition module, used to obtain backend data; Encapsulation module, used to operate Dom elements according to the encapsulation method; Echo module, used for data echo; Download module, used for downloading files and folders.

8. A computer device, characterized in that: The computer device includes a memory and a processor, the memory stores a computer program, and when the computer program is executed by the processor, the processor executes the steps of the Canvas image and algorithm box display and download method based on the Vue framework as described in any one of claims 1-6.

9. A computer-readable storage medium storing a computer program. When the computer program is executed by a processor, the processor executes the steps of the method for displaying and downloading a Canvas image and an algorithm box based on a Vue framework as described in any one of claims 1 to 6.

10. An information data processing terminal, characterized in that: The information data processing terminal is used to implement the Canvas image and algorithm frame display and download system based on the Vue framework as described in claim 7.