Method and apparatus for determining the effective area

CN116320617BActive Publication Date: 2025-11-14INSPUR SUZHOU INTELLIGENT TECH CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202310292474.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-03-23
Publication Date
2025-11-14
Estimated Expiration
2043-03-23

AI Technical Summary

Technical Problem

Existing technologies, when processing multiple video streams, often involve multiple algorithms for each stream, resulting in large data volumes and low efficiency for subsequent video-based processing.

Method used

By setting canvas labels in the front-end video playback interface, receiving the coordinates of the effective area, determining the effective area of ​​the original video stream based on the conversion ratio between the video playback interface and the original video stream, and writing the configuration parameters into the camera configuration file, the video stream can be cropped and processed by subsequent algorithms.

Benefits of technology

This reduced the amount of data, improved video processing efficiency, and increased the processing speed of subsequent algorithms.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116320617B_ABST
    Figure CN116320617B_ABST
Patent Text Reader

Abstract

This invention provides a method and apparatus for determining an effective region. The method includes: acquiring the raw video stream from a camera and pushing it to a video playback interface to display the raw video stream; setting a canvas label in the video playback interface and receiving the coordinates of the effective region determined from the canvas label; determining a conversion ratio between the video playback interface and the raw video stream based on the size of the video playback interface and the size of the raw video stream; and determining the effective region of the raw video stream based on the conversion ratio and the coordinates of the effective region. The method and apparatus for determining the effective region provided by this invention converts the coordinates of the effective region in the front-end video playback interface by using the conversion ratio between the front-end video playback interface and the raw video stream, thus achieving rapid and automatic determination of the effective region of the camera's raw video stream. Using the determined effective region of the video stream in subsequent algorithmic processing reduces the amount of data and improves video processing efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of computer technology, and in particular to a method and apparatus for determining an effective area. Background Technology

[0002] With the widespread adoption of security and surveillance systems, video processing for cameras is also rapidly evolving. Existing algorithms typically have their own scheduling programs. Camera configurations and the mapping between cameras and algorithms are written in configuration files, and the scheduling program directly reads information from these files to process the video.

[0003] Existing methods for processing video streams from cameras are relatively easy for handling single-camera video streams. However, when multiple video streams are involved, each requiring multiple algorithms, the large data volume leads to low efficiency in subsequent video-based processing. Summary of the Invention

[0004] This invention provides a method and apparatus for determining an effective region, which solves the technical problem of low efficiency in subsequent video-based algorithm processing when dealing with multiple video streams, each with multiple algorithms, resulting in large data volumes.

[0005] This invention provides a method for determining an effective region, comprising:

[0006] Acquire the raw video stream from the camera and push the raw video stream to the front-end video playback interface so that the video playback interface displays the raw video stream;

[0007] A canvas label is set in the video playback interface, and the coordinates of the valid area determined in the canvas label are received. The size of the video playback interface is the same as the size of the canvas label.

[0008] Based on the size of the video playback interface and the size of the original video stream, determine the conversion ratio between the video playback interface and the original video stream;

[0009] The effective region of the original video stream is determined based on the conversion ratio and the coordinates of the effective region.

[0010] According to a method for determining an effective region provided by the present invention, after determining the effective region of the original video stream, the method further includes:

[0011] Based on the effective area of ​​the original video stream, the configuration parameters corresponding to the effective area are determined, and the configuration parameters are written into the camera's configuration file so that the camera can obtain the video stream after cropping the original video stream based on the configuration file.

[0012] According to a method for determining an effective region provided by the present invention, after obtaining the video stream after cropping the original video stream, the method further includes:

[0013] The cropped video stream is input into the target algorithm to obtain the processing result of the target algorithm.

[0014] According to a method for determining an effective region provided by the present invention, the effective region of the original video stream is determined based on the conversion ratio and the coordinates of the effective region, including:

[0015] Based on the coordinates of the effective area, the effective area in the video playback interface is determined;

[0016] Based on the conversion ratio, the effective area in the video playback interface is converted to obtain the effective area of ​​the original video stream.

[0017] According to a method for determining an effective area provided by the present invention, receiving the coordinates of the effective area determined in the canvas label includes:

[0018] Listen for click events in the canvas label;

[0019] Obtain the coordinates of the click event in the canvas label, and use the coordinates of the click event in the canvas label as the coordinates of the valid area determined in the canvas label.

[0020] According to a method for determining an effective area provided by the present invention, a canvas label is set in the video playback interface, including:

[0021] Based on the method of covering the video playback interface with canvas labels, canvas labels are set in the front-end video playback interface.

[0022] The present invention also provides an apparatus for determining an effective area, comprising:

[0023] The acquisition module is used to acquire the raw video stream from the camera and push the raw video stream to the front-end video playback interface so that the video playback interface displays the raw video stream.

[0024] The setting module is used to set a canvas label in the video playback interface and receive the valid area coordinates determined in the canvas label. The size of the video playback interface is the same as the size of the canvas label.

[0025] The conversion ratio determination module is used to determine the conversion ratio between the video playback interface and the original video stream based on the size of the video playback interface and the size of the original video stream.

[0026] The effective region determination module is used to determine the effective region of the original video stream based on the conversion ratio and the effective region coordinates.

[0027] The present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor, when executing the computer program, implements any of the above-described methods for determining an effective region.

[0028] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements any of the above-described methods for determining an effective region.

[0029] The present invention also provides a computer program product, including a computer program that, when executed by a processor, implements the method for determining the effective region as described above.

[0030] The present invention provides a method and apparatus for determining the effective area. By setting canvas labels in the front-end video playback interface displaying the original video stream, receiving the coordinates of the effective area determined from the canvas labels, and transforming the coordinates of the effective area in the front-end video playback interface based on the conversion ratio between the front-end video playback interface and the original video stream, the invention achieves rapid and automatic determination of the effective area of ​​the camera's original video stream. After determining the effective area of ​​the camera's original video stream, the video stream of the determined effective area is used in subsequent algorithm processing, reducing the amount of data and improving video processing efficiency. Attached Figure Description

[0031] To more clearly illustrate the technical solutions in this invention or the prior art, the accompanying drawings used in the description of the embodiments or the prior art will be briefly described below. Obviously, the accompanying drawings described below are some embodiments of this invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0032] Figure 1 This is a flowchart illustrating the method for determining the effective area provided by the present invention;

[0033] Figure 2 This is a schematic diagram of the device structure for applying the method for determining the effective area provided by the present invention;

[0034] Figure 3 This is a schematic diagram of the effective area drawing process provided by the present invention;

[0035] Figure 4 This is a schematic diagram of the structure of the effective area determination device provided by the present invention;

[0036] Figure 5This is a schematic diagram of the structure of the electronic device provided by the present invention. Detailed Implementation

[0037] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of this invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this invention. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without creative effort are within the scope of protection of this invention.

[0038] This invention proposes a method for determining an effective region. Figure 1 A flowchart illustrating the method for determining the effective region provided by this invention. (Refer to...) Figure 1 The method for determining the effective functional region provided by the present invention may include:

[0039] Step 110: Obtain the raw video stream from the camera and push the raw video stream to the front-end video playback interface so that the video playback interface displays the raw video stream;

[0040] Step 120: Set a canvas label in the video playback interface and receive the valid area coordinates determined in the canvas label. The size of the video playback interface is the same as the size of the canvas label.

[0041] Step 130: Determine the conversion ratio between the video playback interface and the original video stream based on the size of the video playback interface and the size of the original video stream;

[0042] Step 140: Determine the effective area of ​​the original video stream based on the conversion ratio and the effective area coordinates.

[0043] The subject executing the method for determining the effective area provided by this invention can be an electronic device, a component within the electronic device, an integrated circuit, or a chip. The electronic device can be a mobile electronic device or a non-mobile electronic device. For example, a mobile electronic device can be a mobile phone, tablet computer, laptop computer, PDA, ultra-mobile personal computer (UMPC), netbook, or personal digital assistant (PDA), etc., while a non-mobile electronic device can be a server, network attached storage (NAS), or personal computer (PC), etc. This invention does not impose specific limitations.

[0044] The technical solution of the present invention will be described in detail below using the method for determining the effective region provided by the present invention, which is executed by a computer.

[0045] In step 110, the raw video stream from the camera is acquired and pushed to the front-end video playback interface. After receiving the raw video stream, the front-end video playback interface plays the raw video stream.

[0046] The camera's raw video stream is the video footage directly captured by the camera. After capturing the camera's video footage, it needs to be displayed on the front-end video playback interface. The front-end video playback interface plays the video based on the video playback tags in the front-end. The front-end video playback interface displays the corresponding frames from the captured video stream.

[0047] Based on the method of acquiring the raw video stream from the camera, the acquired raw video stream is pushed to the front-end video playback interface, thereby realizing the display of the raw video stream from the camera.

[0048] Optionally, a webcam can be used. However, the RTSP (Real Time Streaming Protocol) stream from a webcam does not support direct display on a webpage, so ffmpeg is needed for stream conversion. A backend script is then invoked to push and forward the webcam stream address (the one from which the video needs to be displayed) to a specified HTTP (Hypertext Transfer Protocol) port, thus pushing the raw video stream from the webcam to the frontend video playback interface.

[0049] In step 120, a canvas label with the same size as the front-end video playback interface is set in the front-end video playback interface. The coordinates of the valid area determined in the canvas label are received.

[0050] The canvas tag is used to define the coordinates of a valid area within the front-end video playback interface. The canvas tag's size is the same as the front-end video playback interface's size. The canvas tag can be set within the front-end video playback interface.

[0051] Understandably, developers can view the video stream playing on the front-end video playback interface using a transparent canvas label overlaid on it. By clicking and connecting points on the canvas label, they can define the valid area within the video playback interface. Based on the coordinates of points within this valid area, and by connecting these points with lines, the valid area can be delineated.

[0052] Optionally, the canvas tag can be the `canvas` tag in HTML, used for drawing graphics. Obtain a canvas tag of the same size as the one in the front-end video playback interface and overlay it onto the video playback interface. Developers can determine the coordinates of the valid area within the canvas tag based on mouse clicks, thus enabling selection of the valid area in the video playback interface. For mouse clicks, the coordinates of the valid area within the canvas tag can be obtained by listening to mouse click events on the canvas tag.

[0053] Since the size of the front-end video playback interface is the same as the size of the canvas label, the coordinates of the valid area in the received canvas label are the coordinates of the valid area of ​​the front-end video playback interface.

[0054] In step 130, the size of the front-end playback interface and the size of the original video stream are obtained. Based on the size of the front-end video playback interface and the size of the original video stream, the conversion ratio between the front-end video playback interface and the original video stream is determined.

[0055] It is understandable that the obtained valid area coordinates are the valid area coordinates displayed in the front-end video playback interface, not the valid area coordinates of the original video stream, so the obtained valid area coordinates need to be converted.

[0056] Based on the size of the front-end video playback interface and the size of the original video stream, the conversion ratio between the front-end video playback interface and the original video stream is determined. This ratio can be used to convert the effective area in the front-end video playback interface to obtain the effective area of ​​the original video stream.

[0057] In step 140, the effective area of ​​the original video stream is determined based on the conversion ratio determined in step 130 and the effective area coordinates determined in step 120.

[0058] It is understandable that the obtained valid area coordinates are the valid area coordinates displayed in the front-end video playback interface, not the valid area coordinates of the original video stream, so the obtained valid area coordinates need to be converted.

[0059] Based on the determined conversion ratio between the front-end video playback interface and the original video stream, the effective area coordinates of the video playback interface are converted to obtain the effective area of ​​the original video stream.

[0060] The method for determining the effective area provided in this invention achieves rapid and automatic determination of the effective area of ​​the camera's original video stream by setting canvas labels in the front-end video playback interface displaying the original video stream, receiving the coordinates of the effective area determined in the canvas labels, and transforming the coordinates of the effective area in the front-end video playback interface based on the conversion ratio between the front-end video playback interface and the original video stream. After determining the effective area of ​​the camera's original video stream, the video of the determined effective area is used in subsequent algorithm processing, reducing the amount of data and improving video processing efficiency.

[0061] In one embodiment, after determining the effective region of the original video stream, the method further includes: determining the configuration parameters corresponding to the effective region based on the effective region of the original video stream, and writing the configuration parameters into the camera's configuration file, so that the camera can obtain a video stream after cropping the original video stream based on the configuration file.

[0062] After determining the valid region of the original video stream, configuration parameters corresponding to the defined valid region are generated and written to the camera's configuration file. After acquiring the original video stream, the camera, based on the determined configuration file, crops the original video stream to obtain the cropped video stream.

[0063] It's understandable that the configuration parameters corresponding to the effective region are written into the camera's configuration file. After acquiring the video stream, the camera can directly perform automatic cropping of the original video stream based on the configuration file. The cropped video is the video of the effective region. Using the cropped video for subsequent algorithms such as recognition or classification can greatly reduce the amount of data input to the algorithm and improve the algorithm's processing efficiency.

[0064] The method for determining the effective region provided in this invention generates a configuration file corresponding to the defined effective region after determining the effective region of the original video stream. After acquiring the video stream, the camera can directly perform automatic cropping of the original video stream based on the configuration file. The cropped video is the video of the effective region. Using the cropped video for subsequent algorithms such as recognition or classification can greatly reduce the amount of data input to the algorithm and improve the algorithm's processing efficiency.

[0065] In one embodiment, after obtaining the video stream after cropping the original video stream, the method further includes: inputting the cropped video stream into a target algorithm to obtain the processing result of the target algorithm.

[0066] Among them, the target algorithm is an algorithm that processes the video stream from the camera, and can be a target recognition algorithm, motion detection algorithm, or intelligent classification algorithm, etc.

[0067] It's understandable that the configuration file corresponding to the effective region is written to the camera. After acquiring the video stream, the camera can directly perform automatic cropping of the original video stream based on the configuration file. The cropped video is the video of the effective region. Using the cropped video for subsequent algorithms such as recognition or classification can greatly reduce the amount of data input to the algorithm and improve the algorithm's processing efficiency.

[0068] The method for determining the effective region provided in this invention generates a configuration file corresponding to the defined effective region after determining the effective region of the original video stream. After acquiring the video stream, the camera can directly perform automatic cropping of the original video stream based on the configuration file. The cropped video is the video of the effective region. Using the cropped video for subsequent algorithms such as recognition or classification can greatly reduce the amount of data input to the algorithm and improve the algorithm's processing efficiency.

[0069] In one embodiment, determining the effective region of the original video stream based on the conversion ratio and the effective region coordinates includes: determining the effective region in the video playback interface based on the effective region coordinates; and converting the effective region in the video playback interface based on the conversion ratio to obtain the effective region of the original video stream.

[0070] After determining the conversion ratio between the front-end video playback interface and the original video stream, as well as the effective area coordinates of the front-end video playback interface, the conversion can be performed using these effective area coordinates. Based on these effective area coordinates, the effective area within the video playback interface is determined.

[0071] Since the size of the front-end video playback interface is the same as the size of the canvas label, the coordinates of the valid area in the received canvas label are the coordinates of the valid area of ​​the front-end video playback interface.

[0072] Based on the determined conversion ratio between the front-end video playback interface and the original video stream, the effective area in the video playback interface is converted to obtain the effective area of ​​the original video stream.

[0073] It is understandable that the obtained valid area coordinates are the valid area coordinates displayed in the front-end video playback interface, not the valid area coordinates of the original video stream, so the obtained valid area coordinates need to be converted.

[0074] Based on the determined conversion ratio between the front-end video playback interface and the original video stream, the effective area coordinates of the video playback interface are converted to obtain the effective area of ​​the original video stream.

[0075] The method for determining the effective area provided in this embodiment of the invention transforms the coordinates of the effective area of ​​the video playback interface based on a determined conversion ratio between the front-end video playback interface and the original video stream, thereby obtaining the effective area of ​​the original video stream and realizing the determination of the effective area of ​​the original video stream.

[0076] In one embodiment, receiving the valid area coordinates determined in the canvas label includes: listening to a click event in the canvas label; obtaining the coordinates of the click event in the canvas label, and using the coordinates of the click event in the canvas label as the valid area coordinates determined in the canvas label.

[0077] After setting a canvas label in the front-end video playback interface, listen for click events on the canvas label. If a click event is received on the canvas label, use the coordinates of the click event within the canvas label as the coordinates of the valid area defined within the canvas label.

[0078] Since the size of the front-end video playback interface is the same as the size of the canvas label, the coordinates of the valid area in the received canvas label are the coordinates of the valid area of ​​the front-end video playback interface.

[0079] The method for determining the effective area provided in this invention involves setting a canvas label in the front-end video playback interface and listening for click events on the canvas label. If a click event is received on the canvas label, the coordinates of the click event on the canvas label are used as the coordinates of the effective area within the canvas label, thus determining the coordinates of the effective area within the canvas label.

[0080] In one embodiment, setting a canvas label in the video playback interface includes: setting a canvas label in the front-end video playback interface based on the way the canvas label covers the video playback interface.

[0081] Set a canvas label on the front-end video playback interface. The size of the canvas label should be the same as the size of the video playback interface. This method of placing the canvas label over the video playback interface achieves the goal of setting the canvas label within the front-end video playback interface.

[0082] Understandably, developers can view the video stream playing on the front-end video playback interface using a transparent canvas label overlaid on it. By clicking and connecting lines within the canvas label, they can determine the coordinates of a valid area within the video playback interface, thus identifying the effective region.

[0083] The method for determining the effective area provided in this embodiment of the invention sets a canvas label in the front-end video playback interface by covering the video playback interface with a canvas label, thus providing a basis for determining the effective area of ​​the subsequent original video stream.

[0084] The following is a schematic diagram of a device structure applying the method for determining the effective area provided by this invention. Figure 2 Taking an example, we will illustrate the technical solution provided by this invention.

[0085] The device includes: a camera management module 210, an algorithm configuration module 220, a streaming media management module 230, and a region drawing module 240.

[0086] The camera management module 210 manages network cameras. To facilitate later management, camera categories have been added. A new camera category is created in the camera management module 210, and then camera-related fields are added to this category, including camera name, manufacturer, status, and stream address. The camera management module 210 can also modify, delete, and disable camera information. Disabling means that the algorithm will no longer retrieve the video stream from this camera for inference.

[0087] The algorithm configuration module 220 is used to query existing algorithms on the server. It can configure and start algorithms for cameras, and also cancel the configuration of algorithms for cameras. This module also has a raw video preview function, which can display the raw video from the selected camera.

[0088] The streaming media management module 230 serves as a prelude to the area rendering module 240. Since most of the cameras used are network cameras, their RTSP streams cannot be directly displayed on a webpage; therefore, ffmpeg is needed for stream conversion. The main function of the streaming media management module 230 is to call backend scripts to push and forward the camera stream addresses that need to display camera video to the specified HTTP port on the frontend. It also supports canceling the push operation.

[0089] The region drawing module 240 is used to configure the effective region for a specified algorithm on a specified camera. The specific execution flow is as follows: Figure 3 The schematic diagram of the effective area drawing process provided by this invention shows that flv.js is used to play the original video stream ejected from the camera in the front-end browser, and then a canplay event listener is added. When the video starts playing in the video playback interface of the front-end browser, the video tag is obtained. <video>The height and width of the original video stream, as well as the height and width of the original video stream. Then create a new one. <canvas>The label, set the height and width of this label to be the same as the height and width of the label. <video>Consistent tags and using <canvas>Labels covered <video>The top layer of the label. Following that is... <canvas>A click event listener is added to the tag. Each click draws a point at the clicked location and stores its coordinates in an array. If it's not the first click, a line is drawn between the current clicked point and the previous clicked point to facilitate displaying the area effect. After drawing is complete, clicking submit scales the coordinates in the array according to the original video stream size and the browser's actual size, converting each coordinate point to coordinates corresponding to the original video stream size. Finally, the submission is sent to the backend, which writes these coordinates into the corresponding configuration file.

[0090] Figure 4 A schematic diagram of the structure of the device for determining the effective area provided by the present invention is shown below. Figure 4 As shown, the device includes:

[0091] The acquisition module 410 is used to acquire the raw video stream from the camera and push the raw video stream to the front-end video playback interface so that the video playback interface displays the raw video stream.

[0092] The camera's raw video stream is the video footage directly captured by the camera. After capturing the camera's video footage, it needs to be displayed on the front-end video playback interface. The front-end video playback interface plays the video based on the video playback tags in the front-end. The front-end video playback interface displays the corresponding frames from the captured video stream.

[0093] Based on the method of acquiring the raw video stream from the camera, the acquired raw video stream is pushed to the front-end video playback interface, thereby realizing the display of the raw video stream from the camera.

[0094] Optionally, a webcam can be used. Since the RTSP stream from a webcam cannot be directly displayed on a webpage, ffmpeg is required for stream conversion. A backend script is then invoked to push and forward the webcam stream address (the one from which the video needs to be displayed) to a specified HTTP port, thereby pushing the raw video stream from the webcam to the frontend video playback interface.

[0095] The setting module 420 is used to set a canvas label in the video playback interface and receive the coordinates of a valid area determined in the canvas label. The size of the video playback interface is the same as the size of the canvas label.

[0096] The canvas tag is used to define the coordinates of a valid area within the front-end video playback interface. The canvas tag's size is the same as the front-end video playback interface's size. The canvas tag can be set within the front-end video playback interface.

[0097] Understandably, developers can view the video stream playing on the front-end video playback interface using a transparent canvas label overlaid on it. By clicking and connecting points on the canvas label, they can define the valid area within the video playback interface. Based on the coordinates of points within this valid area, and by connecting these points with lines, the valid area can be delineated.

[0098] Optionally, the canvas tag can be the `canvas` tag in HTML, used for drawing graphics. Obtain a canvas tag of the same size as the one in the front-end video playback interface and overlay it onto the video playback interface. Developers can determine the coordinates of the valid area within the canvas tag based on mouse clicks, thus enabling selection of the valid area in the video playback interface. For mouse clicks, the coordinates of the valid area within the canvas tag can be obtained by listening to mouse click events on the canvas tag.

[0099] Since the size of the front-end video playback interface is the same as the size of the canvas label, the coordinates of the valid area in the received canvas label are the coordinates of the valid area of ​​the front-end video playback interface.

[0100] The conversion ratio determination module 430 is used to determine the conversion ratio between the video playback interface and the original video stream based on the size of the video playback interface and the size of the original video stream.

[0101] It is understandable that the obtained valid area coordinates are the valid area coordinates displayed in the front-end video playback interface, not the valid area coordinates of the original video stream, so the obtained valid area coordinates need to be converted.

[0102] Based on the size of the front-end video playback interface and the size of the original video stream, the conversion ratio between the front-end video playback interface and the original video stream is determined. This ratio can be used to convert the effective area in the front-end video playback interface to obtain the effective area of ​​the original video stream.

[0103] The effective region determination module 440 is used to determine the effective region of the original video stream based on the conversion ratio and the effective region coordinates.

[0104] It is understandable that the obtained valid area coordinates are the valid area coordinates displayed in the front-end video playback interface, not the valid area coordinates of the original video stream, so the obtained valid area coordinates need to be converted.

[0105] Based on the determined conversion ratio between the front-end video playback interface and the original video stream, the effective area coordinates of the video playback interface are converted to obtain the effective area of ​​the original video stream.

[0106] The effective area determination device provided in this invention, by setting canvas labels in the front-end video playback interface displaying the original video stream, receives the effective area coordinates determined in the canvas labels, and transforms the effective area coordinates in the front-end video playback interface based on the conversion ratio between the front-end video playback interface and the original video stream, achieves rapid and automatic determination of the effective area of ​​the camera's original video stream. After determining the effective area of ​​the camera's original video stream, the video stream of the determined effective area is used in subsequent algorithm processing, reducing the amount of data and improving video processing efficiency.

[0107] In one embodiment, the effective region determination module 440 is specifically used for:

[0108] After determining the effective region of the original video stream, the method further includes:

[0109] Based on the effective area of ​​the original video stream, the configuration parameters corresponding to the effective area are determined, and the configuration parameters are written into the camera's configuration file so that the camera can obtain the video stream after cropping the original video stream based on the configuration file.

[0110] In one embodiment, the effective region determination module 440 is further configured to:

[0111] After obtaining the video stream after cropping the original video stream, the process further includes:

[0112] The cropped video stream is input into the target algorithm to obtain the processing result of the target algorithm.

[0113] In one embodiment, the effective region determination module 440 is further configured to:

[0114] Determining the effective region of the original video stream based on the conversion ratio and the effective region coordinates includes:

[0115] Based on the coordinates of the effective area, the effective area in the video playback interface is determined;

[0116] Based on the conversion ratio, the effective area in the video playback interface is converted to obtain the effective area of ​​the original video stream.

[0117] In one embodiment, the setting module 420 is specifically used for:

[0118] Receiving the coordinates of the valid area determined from the canvas label includes:

[0119] Listen for click events in the canvas label;

[0120] Obtain the coordinates of the click event in the canvas label, and use the coordinates of the click event in the canvas label as the coordinates of the valid area determined in the canvas label.

[0121] In one embodiment, the setting module 420 is further configured to:

[0122] Setting canvas labels in the video playback interface includes:

[0123] Based on the method of covering the video playback interface with canvas labels, canvas labels are set in the front-end video playback interface.

[0124] Figure 5 An example is a schematic diagram of the physical structure of an electronic device, such as... Figure 5 As shown, the electronic device may include: a processor 510, a communication interface 520, a memory 530, and a communication bus 540, wherein the processor 510, the communication interface 520, and the memory 530 communicate with each other through the communication bus 540. The processor 510 can call logical instructions in the memory 530 to execute a method for determining a valid region, the method including:

[0125] Acquire the raw video stream from the camera and push the raw video stream to the front-end video playback interface so that the video playback interface displays the raw video stream;

[0126] A canvas label is set in the video playback interface, and the coordinates of the valid area determined in the canvas label are received. The size of the video playback interface is the same as the size of the canvas label.

[0127] Based on the size of the video playback interface and the size of the original video stream, determine the conversion ratio between the video playback interface and the original video stream;

[0128] The effective region of the original video stream is determined based on the conversion ratio and the coordinates of the effective region.

[0129] Furthermore, the logical instructions in the aforementioned memory 530 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, essentially, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0130] On the other hand, the present invention also provides a computer program product, the computer program product comprising a computer program stored on a non-transitory computer-readable storage medium, the computer program comprising program instructions, wherein when the program instructions are executed by a computer, the computer is capable of executing the method for determining the effective region provided by the above methods, the method comprising:

[0131] Acquire the raw video stream from the camera and push the raw video stream to the front-end video playback interface so that the video playback interface displays the raw video stream;

[0132] A canvas label is set in the video playback interface, and the coordinates of the valid area determined in the canvas label are received. The size of the video playback interface is the same as the size of the canvas label.

[0133] Based on the size of the video playback interface and the size of the original video stream, determine the conversion ratio between the video playback interface and the original video stream;

[0134] The effective region of the original video stream is determined based on the conversion ratio and the coordinates of the effective region.

[0135] In another aspect, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, is implemented to perform the methods for determining the effective regions provided above, the method comprising:

[0136] Acquire the raw video stream from the camera and push the raw video stream to the front-end video playback interface so that the video playback interface displays the raw video stream;

[0137] A canvas label is set in the video playback interface, and the coordinates of the valid area determined in the canvas label are received. The size of the video playback interface is the same as the size of the canvas label.

[0138] Based on the size of the video playback interface and the size of the original video stream, determine the conversion ratio between the video playback interface and the original video stream;

[0139] The effective region of the original video stream is determined based on the conversion ratio and the coordinates of the effective region.

[0140] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.

[0141] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.

[0142] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.< / canvas> < / video> < / canvas> < / video> < / canvas> < / video>

Claims

1. A method for determining an effective region, characterized in that, The method includes: Acquire the raw video stream from the camera and push the raw video stream to the front-end video playback interface so that the video playback interface displays the raw video stream; A canvas label is set in the video playback interface, and the coordinates of the valid area determined in the canvas label are received. The size of the video playback interface is the same as the size of the canvas label. Based on the size of the video playback interface and the size of the original video stream, determine the conversion ratio between the video playback interface and the original video stream; Based on the conversion ratio and the effective region coordinates, the effective region of the original video stream is determined; After determining the effective region of the original video stream, the method further includes: Based on the effective area of ​​the original video stream, the configuration parameters corresponding to the effective area are determined, and the configuration parameters are written into the camera's configuration file so that the camera can obtain the video stream after cropping the original video stream based on the configuration file.

2. The method for determining the effective region according to claim 1, characterized in that, After obtaining the video stream after cropping the original video stream, the process further includes: The cropped video stream is input into the target algorithm to obtain the processing result of the target algorithm.

3. The method for determining the effective region according to claim 1, characterized in that, Determining the effective region of the original video stream based on the conversion ratio and the effective region coordinates includes: Based on the coordinates of the effective area, the effective area in the video playback interface is determined; Based on the conversion ratio, the effective area in the video playback interface is converted to obtain the effective area of ​​the original video stream.

4. The method for determining the effective region according to claim 1, characterized in that, Receiving the valid region coordinates determined from the canvas label includes: Listen for click events in the canvas label; Obtain the coordinates of the click event in the canvas label, and use the coordinates of the click event in the canvas label as the coordinates of the valid area determined in the canvas label.

5. The method for determining the effective region according to claim 1, characterized in that, Setting canvas labels in the video playback interface includes: Based on the method of covering the video playback interface with canvas labels, canvas labels are set in the front-end video playback interface.

6. A device for determining an effective area, characterized in that, include: The acquisition module is used to acquire the raw video stream from the camera and push the raw video stream to the front-end video playback interface so that the video playback interface displays the raw video stream. The setting module is used to set a canvas label in the video playback interface and receive the valid area coordinates determined in the canvas label. The size of the video playback interface is the same as the size of the canvas label. The conversion ratio determination module is used to determine the conversion ratio between the video playback interface and the original video stream based on the size of the video playback interface and the size of the original video stream. The effective region determination module is used to determine the effective region of the original video stream based on the conversion ratio and the effective region coordinates. After determining the effective region of the original video stream, the method further includes: Based on the effective area of ​​the original video stream, the configuration parameters corresponding to the effective area are determined, and the configuration parameters are written into the camera's configuration file so that the camera can obtain the video stream after cropping the original video stream based on the configuration file.

7. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the method for determining the effective region as described in any one of claims 1 to 5.

8. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the method for determining the effective region as described in any one of claims 1 to 5.

9. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by the processor, it implements the method for determining the effective region as described in any one of claims 1 to 5.

Citation Information

Patent Citations

  • Interception method and device of video images

    CN106412691A

  • Image processing method, device and system based on canvas label and storage medium

    CN109634703A

  • Display screen image acquisition method, device and system and computer readable storage medium

    CN114584699A