CN113938614A - Video image zooming method, device, equipment and storage medium - Google Patents

Video image zooming method, device, equipment and storage medium Download PDF

Info

Publication number
CN113938614A
CN113938614A CN202111558097.4A CN202111558097A CN113938614A CN 113938614 A CN113938614 A CN 113938614A CN 202111558097 A CN202111558097 A CN 202111558097A CN 113938614 A CN113938614 A CN 113938614A
Authority
CN
China
Prior art keywords
parameter
camera
determining
focal length
rectangular frame
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202111558097.4A
Other languages
Chinese (zh)
Other versions
CN113938614B (en
Inventor
张瑞
黄岗
周圣强
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Suzhou Wandianzhang Software Technology Co ltd
Original Assignee
Suzhou Wandianzhang Software Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Suzhou Wandianzhang Software Technology Co ltd filed Critical Suzhou Wandianzhang Software Technology Co ltd
Priority to CN202111558097.4A priority Critical patent/CN113938614B/en
Publication of CN113938614A publication Critical patent/CN113938614A/en
Application granted granted Critical
Publication of CN113938614B publication Critical patent/CN113938614B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N23/00Cameras or camera modules comprising electronic image sensors; Control thereof
    • H04N23/60Control of cameras or camera modules
    • H04N23/63Control of cameras or camera modules by using electronic viewfinders
    • H04N23/631Graphical user interfaces [GUI] specially adapted for controlling image capture or setting capture parameters
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N23/00Cameras or camera modules comprising electronic image sensors; Control thereof
    • H04N23/60Control of cameras or camera modules
    • H04N23/67Focus control based on electronic image sensor signals

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Human Computer Interaction (AREA)
  • Studio Devices (AREA)

Abstract

The invention discloses a method, a device, equipment and a storage medium for zooming a video picture; in the scheme, when a user wants to enlarge or reduce a video picture, the user only needs to trigger an operation instruction in the real-time video picture, and then the user can generate an adjusting parameter in a frame selection enlargement mode according to a rectangular frame corresponding to the operation instruction: the up-down panning parameter, the left-right tilting parameter and the first focal length parameter generate an adjusting parameter in a frame selection reduction mode: and the second focal length parameter controls the camera to execute corresponding adjustment operation according to the generated adjustment parameter so as to display the adjusted real-time video picture, and by the mode, a user does not need to execute multiple adjustment operations, so that the operation efficiency and the user experience are improved.

Description

Video image zooming method, device, equipment and storage medium
Technical Field
The present invention relates to the field of video processing technologies, and in particular, to a method, an apparatus, a device, and a storage medium for scaling a video frame.
Background
At present, a dome camera generally supports PTZ control (Pan/Tilt/Zoom, Pan/Tilt omni-directional movement, Zoom control of a lens) based on an Onvif (Open Network Video Interface Forum) protocol, so that a user can use an Onvif test tool to connect with the dome camera and control the picture of the dome camera to realize up-down, left-right movement and a Zoom function through an Onvif instruction. For example: the user locates the position of the upper right corner in the video picture, and at this time, the user needs to perform the following operations: a operates steering right, b operates steering up, and c operates zooming in. It can be seen that, because a certain delay exists between the real-time picture and the real picture of the dome camera, when a certain position is positioned at present, multiple operations are often required to be completed, and in the middle of the operations, a user must wait for the completion of the execution of the previous operation to perform the next operation according to the position of the current real-time picture, so that excessive time is required for realizing the positioning of one position, the user experience is not good, and the operation efficiency is not high; and during this operation, if the operation amplitude in one direction is too large, the reverse fine adjustment is also needed, and the operation efficiency is low. Therefore, how to improve the operation efficiency of the camera PTZ control and improve the user experience is a problem to be solved by those skilled in the art.
Disclosure of Invention
The invention aims to provide a method, a device, equipment and a storage medium for zooming a video picture so as to improve the operation efficiency of PTZ control of a camera and improve the user experience.
In order to achieve the above object, the present invention provides a method for scaling a video frame, comprising:
receiving an operation instruction triggered by a user in a real-time video picture of a camera;
determining a rectangular frame and an operation mode according to the operation instruction; wherein the operation mode comprises a frame selection zoom-out mode or a frame selection zoom-in mode;
if the operation mode is a frame selection amplification mode, determining an up-down panning parameter by using an X-axis parameter of the center coordinate of the rectangular frame and a first weight coefficient of the camera;
determining left and right inclination parameters by utilizing the Y-axis parameter of the central coordinate of the rectangular frame and a second weight coefficient of the camera;
determining a first focal length parameter by using the width information and the height information of the rectangular frame and a third weight coefficient of the camera;
controlling the camera to execute adjustment operation according to the up-down panning parameter, the left-right tilting parameter and the first focal length parameter, and displaying a real-time video picture obtained after the camera is adjusted;
if the operation mode is a frame selection reduction mode, determining a second focal length parameter by using the width information and the height information of the rectangular frame and a third weight coefficient of the camera;
and controlling the camera to execute adjustment operation according to the second focal length parameter, and displaying a real-time video picture obtained after the camera is adjusted.
Wherein the determining the pan-up and-down parameter specifically comprises: if the central point of the rectangular frame is on the right side of the Y axis, the panning up and down parameters are as follows: -a first weight coefficient (X-axis parameter/boundary value of the rectangular box center coordinates); if the central point of the rectangular frame is on the left side of the Y axis, the panning up and down parameters are as follows: a first weight coefficient ((boundary value-X-axis parameter of rectangular box center coordinates)/boundary value);
the determining the left-right inclination parameter specifically comprises: if the central point of the rectangular frame is above the X axis, the left-right inclination parameters are as follows: -second weight coefficients (Y-axis parameters/boundary values of the coordinates of the center of the rectangular box); if the center point of the rectangular frame is below the X axis, the left-right inclination parameters are as follows: a second weight coefficient (((boundary value-Y-axis parameter of rectangular box center coordinates)/boundary value);
the determining the first focal length parameter specifically includes: third weight coefficient ((video pristine area- (width-height))/video pristine area).
Wherein controlling the camera to perform an adjustment operation according to the pan up and down parameter, the tilt left and right parameter, and the first focal length parameter comprises:
and controlling the camera to execute corresponding movement operation by using the up-down panning parameters and the left-right tilting parameters, and adjusting the focal length of the camera by using the first focal length parameter.
Wherein the determining the second focal length parameter specifically includes: -third weight coefficient (video raw state area- (width x height))/video raw state area).
Wherein controlling the camera to perform an adjustment operation according to the second focal length parameter comprises:
and adjusting the focal length of the camera according to the second focal length parameter.
Wherein, the determining the rectangular frame and the operation mode according to the operation instruction comprises:
determining a rectangular frame at the touch position of the real-time video picture according to the operation instruction;
and determining an operation mode according to the touch direction of the operation instruction in the real-time video picture.
To achieve the above object, the present invention further provides a video image scaling apparatus, comprising:
the receiving module is used for receiving an operation instruction triggered by a user in a real-time video picture of the camera;
the first determining module is used for determining a rectangular frame and an operation mode according to the operation instruction; wherein the operation mode comprises a frame selection zoom-out mode or a frame selection zoom-in mode;
the second determining module is used for determining the panning parameters up and down by using the X-axis parameter of the center coordinate of the rectangular frame and the first weight coefficient of the camera when the operation mode is the frame selection amplification mode;
the third determining module is used for determining left and right inclination parameters by utilizing the Y-axis parameter of the central coordinate of the rectangular frame and the second weight coefficient of the camera when the operation mode is the frame selection amplification mode;
a fourth determining module, configured to determine a first focal length parameter by using the width information and the height information of the rectangular frame and a third weight coefficient of the camera when the operation mode is a frame selection amplification mode;
a first control module for controlling the camera to perform an adjustment operation according to the pan up and down parameter, the tilt left and right parameter and the first focal length parameter;
a fifth determining module, configured to determine a second focal length parameter by using the width information and the height information of the rectangular frame and a third weight coefficient of the camera when the operation mode is a frame selection zoom-out mode;
the second control module is used for controlling the camera to execute adjustment operation according to the second focal length parameter;
and the display module is used for displaying the real-time video picture acquired after the camera is adjusted.
Wherein the first determining module comprises:
the first determining unit is used for determining a rectangular frame at the touch position of the real-time video picture according to the operation instruction;
and the second determining unit is used for determining an operation mode in the touch direction of the real-time video picture according to the operation instruction.
To achieve the above object, the present invention further provides an electronic device comprising:
a memory for storing a computer program;
and the processor is used for realizing the steps of the zooming method of the video picture when executing the computer program.
To achieve the above object, the present invention further provides a computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, implements the steps of the above method for scaling a video picture.
According to the scheme, the video image zooming method, the video image zooming device, the video image zooming equipment and the video image zooming storage medium are provided by the embodiment of the invention; in the scheme, when a user wants to enlarge or reduce a video picture, the user only needs to trigger an operation instruction in the real-time video picture, and then the user can generate an adjusting parameter in a frame selection enlargement mode according to a rectangular frame corresponding to the operation instruction: the up-down panning parameter, the left-right tilting parameter and the first focal length parameter generate an adjusting parameter in a frame selection reduction mode: and the second focal length parameter controls the camera to execute corresponding adjustment operation according to the generated adjustment parameter so as to display the adjusted real-time video picture, and by the mode, a user does not need to execute multiple adjustment operations, so that the operation efficiency and the user experience are improved.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
Fig. 1 is a schematic flow chart of a method for scaling a video frame according to an embodiment of the present invention;
FIG. 2 is a flowchart illustrating another method for scaling a video frame according to an embodiment of the present invention;
FIG. 3 is a schematic view of a quadrant structure disclosed in the embodiments of the present invention;
FIG. 4 is a schematic structural diagram of a video frame scaling apparatus according to an embodiment of the present invention;
fig. 5 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The embodiment of the invention discloses a method, a device, equipment and a storage medium for zooming a video picture, which are used for improving the operation efficiency of PTZ control of a camera and improving the user experience.
Referring to fig. 1, a schematic flow chart of a method for scaling a video frame according to an embodiment of the present invention is shown in fig. 1, where the method specifically includes the following steps:
s101, receiving an operation instruction triggered by a user in a real-time video picture of a camera;
it should be noted that the camera in this embodiment is a camera supporting PTZ control based on an Onvif protocol, and after the adjustment parameters are determined in this scheme, the camera image can be controlled by an Onvif instruction to implement functions of up-down movement, left-right movement, and zooming. And the real-time video picture of the camera is displayed through a terminal interface, if a user wants to realize the zooming-in or zooming-out function aiming at a certain position when looking up the real-time video picture through the terminal, the user can trigger an operation instruction in the real-time video picture at the moment.
S102, determining a rectangular frame and an operation mode according to an operation instruction; the operation mode comprises a frame selection reduction mode and a frame selection amplification mode;
specifically, when the operation instruction is triggered in the real-time video picture, the operation instruction can be triggered in various modes, and the operation instruction can be triggered in the real-time video picture through a mouse, for example: if the detected operation instruction is: the user uses the mouse to draw a rectangular frame from the upper left corner to the lower right corner of the real-time video picture, the operation mode corresponding to the operation instruction is a frame selection amplification mode, the rectangular frame corresponding to the operation instruction is the rectangular frame drawn by the user using the mouse, and similarly, if the operation instruction is detected to be: and drawing a rectangular frame from the lower right corner to the upper left corner of the real-time video picture by using the mouse by the user, wherein the operation mode corresponding to the operation instruction is a frame selection reduction mode, and the rectangular frame corresponding to the operation instruction is the rectangular frame drawn by using the mouse by the user. Moreover, the user can also directly trigger an operation instruction in the touch screen, such as: if the detected operation instruction is: the user draws a rectangular frame from the upper left corner to the lower right corner in the real-time video picture of the touch screen, the operation mode corresponding to the operation instruction is a frame selection amplification mode, the rectangular frame corresponding to the operation instruction is the rectangular frame drawn by the user on the touch screen, and similarly, if the operation instruction is detected to be: and drawing a rectangular frame from the lower right corner to the upper left corner in the real-time video picture of the touch screen by the user, wherein the operation mode corresponding to the operation instruction is a frame selection reduction mode, and the rectangular frame corresponding to the operation instruction is the rectangular frame drawn by the user on the touch screen. Of course, the present solution may also trigger the operation instruction by other manners, which is not specifically limited in the present solution as long as the rectangular frame and the operation mode can be identified according to the operation instruction, for example: the operation instruction can also be triggered by combining a mouse and a keyboard.
S103, if the operation mode is the frame selection amplification mode, determining an up-down panning parameter by using an X-axis parameter of a center coordinate of a rectangular frame and a first weight coefficient of the camera; determining left and right inclination parameters by using the Y-axis parameter of the central coordinate of the rectangular frame and the second weight coefficient of the camera; determining a first focal length parameter by using the width information and the height information of the rectangular frame and a third weight coefficient of the camera;
s104, controlling the camera to execute adjustment operation according to the up-down panning parameter, the left-right tilting parameter and the first focal length parameter, and displaying a real-time video picture obtained after the camera is adjusted;
s105, if the operation mode is the frame selection reduction mode, determining a second focal length parameter by using the width information and the height information of the rectangular frame and a third weight coefficient of the camera;
and S106, controlling the camera to execute adjustment operation according to the second focal length parameter, and displaying a real-time video picture obtained after the camera is adjusted.
In this embodiment, the operation mode includes a frame selection zoom-out mode and a frame selection zoom-in mode, where the frame selection zoom-out mode is a mode in which, after a user selects a rectangular frame, the entire frame is zoomed out with a frame in the rectangular frame as a center, thereby implementing a zoom-out function on a video frame; the frame selection amplification mode is a mode in which a user selects a rectangular frame and then amplifies a picture in the rectangular frame, so that the video picture amplification function is realized.
In particular, in different operating modes, different adjustment parameters need to be determined from different base parameters of the rectangular box. The basic parameters of the rectangular frame are used to represent basic information such as the position and size of the rectangular frame, and the user can know how large the rectangular frame is selected at which position in the video picture. After the basic parameters of the rectangular frame are determined, the adjustment parameters can be comprehensively determined by combining the operation modes. In the frame selection amplification mode, the basic parameters to be acquired include: determining an upper panning parameter and a lower panning parameter according to the X-axis parameter of the central coordinate of the rectangular frame, the Y-axis parameter of the central coordinate of the rectangular frame, the width information and the height information of the rectangular frame and the first weight coefficient of the camera; determining left and right inclination parameters by using the Y-axis parameter of the central coordinate of the rectangular frame and the second weight coefficient of the camera; determining a first focal length parameter by using the width information and the height information of the rectangular frame and a third weight coefficient of the camera; in the frame selection zoom-out mode, the basic parameters to be acquired include: and determining a second focal length parameter by using the width information and the height information of the rectangular frame and a third weight coefficient of the camera. The above-mentioned pan up and down parameter, tilt left and right parameter, first focal length parameter and second focal length parameter are the adjusting parameters determined by the basic parameters.
Specifically, after the adjustment parameters in different operation modes are determined in the above manner, the camera may be controlled to execute corresponding adjustment operations according to the adjustment parameters, for example, in the frame selection zoom mode, after the camera is controlled to execute the moving operation and the focal length adjustment operation according to the pan up and down parameter, the tilt left and right parameter, and the first focal length parameter, the camera may be controlled to move and adjust the focal length to zoom in the video picture, and the real-time video picture acquired by the camera at this time is shown as follows: and amplifying the video content of the rectangular frame selected by the user. In the frame selection zoom-out mode, after the camera is controlled to execute the focal length adjustment operation according to the second focal length parameter, the camera can be controlled to adjust the focal length to zoom out the video picture, and the real-time video picture acquired by the camera at the moment is shown as follows: and a reduced picture of the video content of the rectangular frame selected by the user.
As can be seen from the above, in the present solution, when a user wants to zoom in or out a video frame, only an operation instruction needs to be triggered in the real-time video frame, and an adjustment parameter can be generated in a frame selection and amplification mode according to a rectangular frame corresponding to the operation instruction: the up-down panning parameter, the left-right tilting parameter and the first focal length parameter generate an adjusting parameter in a frame selection reduction mode: and the second focal length parameter controls the camera to execute corresponding adjustment operation according to the generated adjustment parameter so as to display the adjusted real-time video picture, and by the mode, a user does not need to execute multiple adjustment operations, so that the operation efficiency and the user experience are improved.
Referring to fig. 2, a schematic flow chart of another method for scaling a video frame according to an embodiment of the present invention is shown in fig. 2, where the method specifically includes the following steps:
s201, receiving an operation instruction triggered by a user in a real-time video picture of a camera;
s202, determining a rectangular frame at the touch position of the real-time video picture according to the operation instruction, and determining an operation mode in the touch direction of the real-time video picture according to the operation instruction; the operation mode comprises a frame selection reduction mode and a frame selection amplification mode;
specifically, the present solution may preset rules for identifying the rectangular frame and the operation mode in the operation command, such as: the rectangular frame can be preset to be determined at the touch position of the real-time video picture according to the operation instruction, the operation mode can be preset to be determined at the touch direction of the real-time video picture according to the operation instruction, and the description is given by taking the example that the mouse triggers the operation instruction in the real-time video picture as an example: if the detected operation instruction is: a user uses a mouse to draw a rectangular frame from the upper left corner to the lower right corner of the real-time video picture, the touch positions are the upper left corner position and the lower right corner position, and the rectangular frame formed by the upper left corner position and the lower right corner position is used as the rectangular frame determined by the operation instruction; if the operation mode corresponding to the touch direction from the upper left corner to the lower right corner is preset as a frame selection amplification mode, and the operation mode corresponding to the touch direction from the lower right corner to the upper left corner is preset as a frame selection reduction mode, when it is detected that a user uses a mouse to draw a rectangular frame from the upper left corner to the lower right corner of the real-time video picture, the operation mode can be automatically determined as the frame selection amplification mode. It should be noted that, in the present embodiment, only the rectangular frame determined by the touch position and the operation mode determined by the touch direction are taken as examples for description, but the present invention is not limited to this, and examples include: after a user uses a mouse to draw a rectangular frame from the upper left corner to the lower right corner of a real-time video picture, the selection of a frame selection zoom-out mode and a frame selection zoom-in mode is completed by combining an upper key and a lower key of a keyboard, the upper key of the keyboard is pressed to select the frame selection zoom-in mode, and the lower key of the keyboard is pressed to select the frame selection zoom-out mode.
S203, judging whether the operation mode is a frame selection amplification mode; if yes, executing S204-S207; if not, executing S208-S209;
s204, determining a panning-up and panning-down parameter by using an X-axis parameter of a central coordinate of the rectangular frame and a first weight coefficient of the camera; if the central point of the rectangular frame is on the right side of the Y axis, the up-down panning parameters are as follows: -a first weight coefficient (X-axis parameter/boundary value of the rectangular box center coordinates); if the center point of the rectangular frame is on the left side of the Y axis, the up-down panning parameters are as follows: a first weight coefficient ((boundary value-X-axis parameter of rectangular box center coordinates)/boundary value);
s205, determining left and right inclination parameters by using the Y-axis parameters of the central coordinates of the rectangular frame and a second weight coefficient of the camera; if the central point of the rectangular frame is above the X axis, the left-right inclination parameters are as follows: -second weight coefficients (Y-axis parameters/boundary values of the coordinates of the center of the rectangular box); if the center point of the rectangular frame is below the X axis, the left-right inclination parameters are as follows: a second weight coefficient (((boundary value-Y-axis parameter of rectangular box center coordinates)/boundary value);
s206, determining a first focal length parameter by using the width information and the height information of the rectangular frame and a third weight coefficient of the camera; the first focal length parameter specifically includes: third weight coefficient ((video pristine area- (width-height))/video pristine area).
S207, controlling the camera to execute corresponding moving operation by using the up-down panning parameters and the left-right tilting parameters, adjusting the focal length of the camera by using the first focal length parameters, and displaying a real-time video picture acquired after the camera is adjusted;
in this embodiment, when the basic parameters of the rectangular frame and the operation mode are used to determine the adjustment parameters, the required basic parameters include the center coordinates, the width information, and the height information of the rectangular frame, so in this embodiment, for the sake of clarity, a coordinate system may be created according to the display resolution of the real-time video frame, and the center coordinates, the width information, and the height information of the rectangular frame may be determined based on the coordinate system.
Specifically, if the fixed display resolution of the video frame on the WEB browser of the terminal is 960 × 560, in the present embodiment, the width and the height are logically divided into 256 equal parts, and the frame is vertically divided into 4 quadrants with the frame center point as the center, as shown in fig. 3, which is a schematic diagram of a quadrant structure provided in the embodiment of the present invention, where the first quadrant value domain is: 0-127 parts of width and 0-127 parts of height; the second quadrant value range is: width 128-; the third quadrant value range is: width 128-; the fourth quadrant value range is: width 0-127, height 128-255. It should be noted that, the above-mentioned dividing the width and height of each quadrant is one of the preferred embodiments of the present solution, and the present solution may also be divided by other manners, for example: the first quadrant value range is: the width is 0-255 parts, the height is 0-255 parts, and other quadrants are divided into equal parts in sequence. Of course, it is not necessary that the divisions be made in multiples of 128, and any number of divisions, such as 100, 200, etc., may be made. Correspondingly, the divided reference is different, and the threshold values compared in the subsequent calculation of the adjustment parameters are also different, so that the adjustment needs to be carried out adaptively. It should be further emphasized that logically dividing the width and height into 256 equal parts in the embodiments of the present invention is only one of the preferred embodiments, and those skilled in the art can logically divide the width and height into other applicable equal parts.
In this scheme, the basic parameters of the rectangular frame include: the parameters of the method comprise a rectangular frame center coordinate (a para1 parameter, a para2 parameter), a width information para3 parameter and a height information para4 parameter, wherein the para1 parameter is an X-axis parameter of the rectangular frame center coordinate, the para2 parameter is a Y-axis parameter of the rectangular frame center coordinate, and the adjusting parameters in the scheme comprise a PAN up-down panning parameter PAN, a TILT left-right parameter TILT and a focal length parameter ZOOM. Further, when the system determines the operation mode according to the operation instruction, the extra parameter cmd may be preset to represent the operation mode, if the operation mode is identified as the frame selection zoom-in mode, the cmd may be set to 22, if the operation mode is identified as the frame selection zoom-out mode, the cmd may be set to 32, of course, the value of the extra parameter cmd is set in the system in a self-defined manner, when the system reads cmd parameter =22, the zoom-in operation is correspondingly performed, and when the cmd parameter =32 is read, the zoom-out operation is correspondingly performed. The customized cmd parameters can be arbitrarily defined and modified, e.g., can be defined as 28,38, etc., as opposed to other meanings of the system cmd parameters.
In the present embodiment, if the operation mode is the frame ZOOM mode, three parameter values, that is, the PAN up and down parameter PAN, the TILT left and right parameter TILT, and the first focal length parameter ZOOM, need to be calculated according to the weights. In this embodiment, in order to distinguish the focal length parameter ZOOM in the frame-selected ZOOM-in mode and the frame-selected ZOOM-out mode, the focal length parameter ZOOM in the frame-selected ZOOM-in mode is taken as the first focal length parameter ZOOM, and the focal length parameter ZOOM in the frame-selected ZOOM-out mode is taken as the second focal length parameter ZOOM.
The calculation process of the PAN up-down panning parameter PAN is as follows:
when the condition [ para1 > = 0 & & para1 < 127 ] is satisfied, representing that the center point of the selected rectangular frame is on the right side of the Y axis, the calculation formula is PAN = -1 [ [ first weight coefficient co _ x ] [ [ para1/127 ]; when the condition [ para1 > = 127 and & para1 < = 255 ] is satisfied, representing that the center point of the selected rectangular frame is on the left side of the Y axis, the calculation formula is PAN =1 [ first weight coefficient co _ x ] [ 127-para 1)/127 ]. Wherein "&" in the scheme means and means that two conditions are simultaneously satisfied. It is understood that since 255 is not selected in the actual use process, the condition [ para1 > = 127 & & para1 < = 255 ] may also be: condition [ para1 > = 127 and & para1 < = 254 ]. Of these, 127 may be referred to as a boundary value.
The left and right TILT parameter TILT is calculated as follows:
when the condition [ para2 > = 0 & & para2 < 127 ] is satisfied, representing that the center point of the selected rectangular box is above the X axis, the formula is calculated as TILT = -1 [ [ second weight coefficient co _ y ] para2/127 ]; when the condition [ para2 > = 127 and & para2 < = 255 ] is satisfied, TILT =1 [ second weight coefficient co _ y ] - [ (127-para 2)/127 ], representing that the center point of the selected rectangular frame is below the X axis. It is understood that since 255 is not selected in the actual use process, the condition [ para2 > = 127 & & para2 < = 255 ] may also be: condition [ para2 > = 127 and & para2 < = 254 ]. Of these, 127 may be referred to as a boundary value.
The calculation process of the first focal length parameter ZOOM is as follows:
(vii) [ ZOOM =1 × third weight coefficient co _ z ] ((960 × 560) - (para3 × para4))/(960 × 560)) ].
It should be noted that, in the above calculation process, it is specifically determined based on the quadrant division manner shown in fig. 3, and if the division is performed by other manners, the above calculation process needs to be adaptively changed, for example: the threshold used for the comparison in the condition needs to be changed adaptively to the extreme value after repartitioning. In addition, 127 in the above calculation formula is a boundary value, and if the quadrant is divided by other forms, the boundary value needs to be adaptively changed to other numerical values, and the description will be given by taking the boundary value as 127 as an example. It should be noted that 960 × 560 is related to the resolution, and is used to calculate the area of the video in the original state, and if the resolution is other values, the area of the video in the original state needs to be calculated by other values, and only the calculation of the area of the video in the original state by 960 × 560 will be described as an example.
After the three parameter values of the PAN up-down panning parameter PAN, the TILT left-right tilting parameter TILT and the focal length parameter ZOOM are determined in the above way, the camera can be controlled to execute corresponding operation according to the parameter values of the three parameters, and the real-time video picture obtained after the camera is adjusted is an amplified video picture.
S208, determining a second focal length parameter by using the width information and the height information of the rectangular frame and a third weight coefficient of the camera; wherein the second focal length parameter specifically is: -a third weight coefficient ((videoraw state area- (width x height))/video raw state area);
s209, adjusting the focal length of the camera according to the second focal length parameter, and displaying a real-time video picture obtained after the camera is adjusted.
In this embodiment, if the operation mode is the frame-selected ZOOM-out mode, the position of the camera does not need to be adjusted, and only the focal length of the camera needs to be adjusted, so that the second focal length parameter ZOOM only needs to be calculated according to the width information para3 and the height information para4 of the rectangular frame.
The calculation process of the second focal length parameter ZOOM is as follows:
[ ZOOM = -1 [ third weight coefficient co _ z ] ((960 × 560) - (para3 × para4))/(960 × 560)) ].
It should be noted that, because there are many manufacturers of dome cameras, although they all support the Onvif protocol, since the hardware difference and the Onvif protocol are relatively wide for the PTZ control specification, when the dome cameras of different manufacturers use the same Onvif protocol PTZ control parameter for control, the executed control results are not uniform. Therefore, in the scheme, a set of different weight coefficients can be taught for each type of dome camera of different manufacturers, namely: the first weight coefficient co _ x, the second weight coefficient co _ y and the third weight coefficient co _ z are used, so that in the scheme, when the para1, the para2, the para3, the para4 and the cmd are the same and the dome camera is different, the weight coefficients can be adjusted to accurate PAN, TILT and ZOOM parameters, and the final motion effects of the dome camera are consistent.
It can be seen from the above contents that, in the present scheme, when a user wants to zoom in or out a video picture, only an operation instruction needs to be triggered in the real-time video picture, an adjustment parameter can be automatically generated according to a rectangular frame and an operation mode corresponding to the operation instruction, and a camera is controlled to execute a corresponding adjustment operation according to the adjustment parameter, so as to display the adjusted real-time video picture.
Specifically, according to the scheme, a rectangular frame can be selected from a video stream picture of the camera by using a mouse frame based on an Onvif protocol, and the frame selection zooming method for enlarging/reducing the rectangular frame to the video picture can be realized by calling the PTZ of the camera in the mode. Wherein: when the image is enlarged, a user firstly opens a real-time image page of the camera, uses a mouse to pull a rectangular frame from the upper left corner to the lower right corner on a video image, and then releases the mouse, so that the camera can enlarge the framed area to the whole image. The larger the rectangular area, the less obvious the amplification effect, and the smaller the rectangular area, the more obvious the amplification effect. When the image is reduced, a user firstly opens a real-time image page of the camera, uses a mouse to pull a rectangular frame from the lower right corner to the upper left corner on a video image, then releases the mouse, the camera can zoom back the image around the area framed by the rectangular frame, so that the visual field is enlarged, and the circled rectangular frame is positioned in the middle area of the image. The larger the rectangular region, the less significant the reduction effect, and the smaller the rectangular region, the more significant the reduction effect. Compared with the operation modes of vertical, horizontal and zooming-in and zooming-out, the frame selection zooming relative ratio is more humanized and easier to operate, and the abstract weight coefficient can be compatible with the ball star cameras of different manufacturers, so that the application range is wider.
The following describes a scaling device, a scaling apparatus, and a storage medium according to embodiments of the present invention, and the scaling device, the scaling apparatus, the storage medium, and the scaling method described above may be referred to each other.
Referring to fig. 4, a schematic structural diagram of a scaling apparatus for a video frame according to an embodiment of the present invention includes:
the receiving module 11 is configured to receive an operation instruction triggered by a user in a real-time video picture of the camera;
a first determining module 12, configured to determine a rectangular frame and an operation mode according to the operation instruction; wherein the operation mode comprises a frame selection zoom-out mode or a frame selection zoom-in mode;
a second determining module 13, configured to determine a panning parameter by using an X-axis parameter of the center coordinate of the rectangular frame and the first weight coefficient of the camera when the operation mode is a frame selection zoom-in mode;
a third determining module 14, configured to determine a left-right tilt parameter by using a Y-axis parameter of the center coordinate of the rectangular frame and the second weight coefficient of the camera when the operation mode is a frame selection zoom-in mode;
a fourth determining module 15, configured to determine a first focal length parameter by using the width information and the height information of the rectangular frame and the third weight coefficient of the camera when the operation mode is the frame selection amplification mode;
a first control module 16, configured to control the camera to perform an adjustment operation according to the pan up and down parameter, the tilt left and right parameter, and the first focal length parameter;
a fifth determining module 17, configured to determine a second focal length parameter by using the width information and the height information of the rectangular frame and a third weight coefficient of the camera when the operation mode is a frame selection zoom-out mode;
a second control module 18, configured to control the camera to perform an adjustment operation according to the second focal length parameter;
and the display module 19 is used for displaying the real-time video picture obtained after the camera is adjusted.
Wherein the first determining module 12 includes:
the first determining unit is used for determining a rectangular frame at the touch position of the real-time video picture according to the operation instruction;
and the second determining unit is used for determining an operation mode in the touch direction of the real-time video picture according to the operation instruction.
Wherein the second determining module 13 is specifically configured to: if the central point of the rectangular frame is on the right side of the Y axis, the panning up and down parameters are as follows: -a first weight coefficient (X-axis parameter/boundary value of the rectangular box center coordinates); if the central point of the rectangular frame is on the left side of the Y axis, the panning up and down parameters are as follows: a first weight coefficient ((boundary value-X-axis parameter of rectangular box center coordinates)/boundary value);
the third determining module 14 is specifically configured to: if the central point of the rectangular frame is above the X axis, the left-right inclination parameters are as follows: -second weight coefficients (Y-axis parameters/boundary values of the coordinates of the center of the rectangular box); if the central point of the rectangular frame is below the X axis, the left-right inclination parameters are as follows: a second weight coefficient (((boundary value-Y-axis parameter of rectangular box center coordinates)/boundary value);
the fourth determining module 15 is specifically configured to: the determining the first focal length parameter specifically includes: third weight coefficient ((video pristine area- (width-height))/video pristine area).
The first control module is specifically configured to: and controlling the camera to execute corresponding movement operation by using the up-down panning parameters and the left-right tilting parameters, and adjusting the focal length of the camera by using the first focal length parameter.
The fifth determining module 17 is specifically configured to: the determining the second focal length parameter specifically includes: -third weight coefficient (video raw state area- (width x height))/video raw state area).
The second control module 18 is specifically configured to: and adjusting the focal length of the camera according to the second focal length parameter.
Referring to fig. 5, an electronic device according to an embodiment of the present invention includes:
a memory for storing a computer program;
a processor for implementing the steps of the method for scaling a video frame according to the above method embodiment when executing the computer program.
In this embodiment, the device may be a PC (Personal Computer), or may be a terminal device such as a smart phone, a tablet Computer, a palmtop Computer, or a portable Computer.
The device may include a memory 21, a processor 22, and a bus 23.
The memory 21 includes at least one type of readable storage medium, which includes a flash memory, a hard disk, a multimedia card, a card type memory (e.g., SD or DX memory, etc.), a magnetic memory, a magnetic disk, an optical disk, and the like. The memory 21 may in some embodiments be an internal storage unit of the device, for example a hard disk of the device. The memory 21 may also be an external storage device of the device in other embodiments, such as a plug-in hard disk, Smart Media Card (SMC), Secure Digital (SD) Card, Flash memory Card (Flash Card), etc. provided on the device. Further, the memory 21 may also include both an internal storage unit of the device and an external storage device. The memory 21 may be used not only to store application software installed in the device and various types of data such as program codes for performing a scaling method, etc., but also to temporarily store data that has been output or is to be output.
The processor 22 may be, in some embodiments, a Central Processing Unit (CPU), controller, microcontroller, microprocessor or other data Processing chip for executing program codes stored in the memory 21 or Processing data, such as program codes for executing a scaling method.
The bus 23 may be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is shown in FIG. 5, but this is not intended to represent only one bus or type of bus.
Further, the device may further include a network interface 24, and the network interface 24 may optionally include a wired interface and/or a wireless interface (e.g., WI-FI interface, bluetooth interface, etc.), which are generally used to establish a communication connection between the device and other electronic devices.
Optionally, the device may further comprise a user interface 25, the user interface 25 may comprise a Display (Display), an input unit such as a Keyboard (Keyboard), and the optional user interface 25 may also comprise a standard wired interface, a wireless interface. Alternatively, in some embodiments, the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, an OLED (Organic Light-Emitting Diode) touch device, or the like. The display, which may also be referred to as a display screen or display unit, is suitable for displaying information processed in the device and for displaying a visualized user interface.
Fig. 5 shows only the device with the components 21-25, and it will be understood by those skilled in the art that the structure shown in fig. 5 does not constitute a limitation of the device, and may comprise fewer or more components than those shown, or some components may be combined, or a different arrangement of components.
The embodiment of the present invention further provides a computer-readable storage medium, where a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the steps of the method for scaling a video frame according to the embodiment of the method are implemented.
Wherein the storage medium may include: various media capable of storing program codes, such as a usb disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
The embodiments in the present description are described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments are referred to each other.
The previous description of the disclosed embodiments is provided to enable any person skilled in the art to make or use the present invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the invention. Thus, the present invention is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims (10)

1. A method for scaling a video frame, comprising:
receiving an operation instruction triggered by a user in a real-time video picture of a camera;
determining a rectangular frame and an operation mode according to the operation instruction; wherein the operation mode comprises a frame selection zoom-out mode or a frame selection zoom-in mode;
if the operation mode is a frame selection amplification mode, determining an up-down panning parameter by using an X-axis parameter of the center coordinate of the rectangular frame and a first weight coefficient of the camera;
determining left and right inclination parameters by utilizing the Y-axis parameter of the central coordinate of the rectangular frame and a second weight coefficient of the camera;
determining a first focal length parameter by using the width information and the height information of the rectangular frame and a third weight coefficient of the camera;
controlling the camera to execute adjustment operation according to the up-down panning parameter, the left-right tilting parameter and the first focal length parameter, and displaying a real-time video picture obtained after the camera is adjusted;
if the operation mode is a frame selection reduction mode, determining a second focal length parameter by using the width information and the height information of the rectangular frame and a third weight coefficient of the camera;
and controlling the camera to execute adjustment operation according to the second focal length parameter, and displaying a real-time video picture obtained after the camera is adjusted.
2. Scaling method according to claim 1,
the determining of the pan up and down parameter specifically includes: if the central point of the rectangular frame is on the right side of the Y axis, the panning up and down parameters are as follows: -a first weight coefficient (X-axis parameter/boundary value of the rectangular box center coordinates); if the central point of the rectangular frame is on the left side of the Y axis, the panning up and down parameters are as follows: a first weight coefficient ((boundary value-X-axis parameter of rectangular box center coordinates)/boundary value);
the determining the left-right inclination parameter specifically comprises: if the central point of the rectangular frame is above the X axis, the left-right inclination parameters are as follows: -second weight coefficients (Y-axis parameters/boundary values of the coordinates of the center of the rectangular box); if the central point of the rectangular frame is below the X axis, the left-right inclination parameters are as follows: a second weight coefficient (((boundary value-Y-axis parameter of rectangular box center coordinates)/boundary value);
the determining the first focal length parameter specifically includes: third weight coefficient ((video pristine area- (width-height))/video pristine area).
3. The zooming method of claim 2, wherein controlling the camera to perform an adjustment operation according to the pan parameter, the tilt parameter, and the first focal length parameter comprises:
and controlling the camera to execute corresponding movement operation by using the up-down panning parameters and the left-right tilting parameters, and adjusting the focal length of the camera by using the first focal length parameter.
4. The zooming method of claim 1, wherein the determining the second focal length parameter specifically comprises: -third weight coefficient (video raw state area- (width x height))/video raw state area).
5. The zooming method of claim 4, wherein controlling the camera to perform an adjustment operation according to the second focal length parameter comprises:
and adjusting the focal length of the camera according to the second focal length parameter.
6. The scaling method according to any one of claims 1 to 5, wherein the determining a rectangular frame and an operation mode according to the operation instruction comprises:
determining a rectangular frame at the touch position of the real-time video picture according to the operation instruction;
and determining an operation mode according to the touch direction of the operation instruction in the real-time video picture.
7. An apparatus for scaling a video frame, comprising:
the receiving module is used for receiving an operation instruction triggered by a user in a real-time video picture of the camera;
the first determining module is used for determining a rectangular frame and an operation mode according to the operation instruction; wherein the operation mode comprises a frame selection zoom-out mode or a frame selection zoom-in mode;
the second determining module is used for determining the panning parameters up and down by using the X-axis parameter of the center coordinate of the rectangular frame and the first weight coefficient of the camera when the operation mode is the frame selection amplification mode;
the third determining module is used for determining left and right inclination parameters by utilizing the Y-axis parameter of the central coordinate of the rectangular frame and the second weight coefficient of the camera when the operation mode is the frame selection amplification mode;
a fourth determining module, configured to determine a first focal length parameter by using the width information and the height information of the rectangular frame and a third weight coefficient of the camera when the operation mode is a frame selection amplification mode;
a first control module for controlling the camera to perform an adjustment operation according to the pan up and down parameter, the tilt left and right parameter and the first focal length parameter;
a fifth determining module, configured to determine a second focal length parameter by using the width information and the height information of the rectangular frame and a third weight coefficient of the camera when the operation mode is a frame selection zoom-out mode;
the second control module is used for controlling the camera to execute adjustment operation according to the second focal length parameter;
and the display module is used for displaying the real-time video picture acquired after the camera is adjusted.
8. The scaling apparatus of claim 7, wherein the first determining module comprises:
the first determining unit is used for determining a rectangular frame at the touch position of the real-time video picture according to the operation instruction;
and the second determining unit is used for determining an operation mode in the touch direction of the real-time video picture according to the operation instruction.
9. An electronic device, comprising:
a memory for storing a computer program;
processor for implementing the steps of the method for scaling a video picture according to any of claims 1 to 6 when executing said computer program.
10. A computer-readable storage medium, characterized in that a computer program is stored thereon, which computer program, when being executed by a processor, carries out the steps of the method for scaling a video picture according to any one of claims 1 to 6.
CN202111558097.4A 2021-12-20 2021-12-20 Video image zooming method, device, equipment and storage medium Active CN113938614B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111558097.4A CN113938614B (en) 2021-12-20 2021-12-20 Video image zooming method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111558097.4A CN113938614B (en) 2021-12-20 2021-12-20 Video image zooming method, device, equipment and storage medium

Publications (2)

Publication Number Publication Date
CN113938614A true CN113938614A (en) 2022-01-14
CN113938614B CN113938614B (en) 2022-03-22

Family

ID=79289342

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111558097.4A Active CN113938614B (en) 2021-12-20 2021-12-20 Video image zooming method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN113938614B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117082345A (en) * 2023-10-17 2023-11-17 智广海联(天津)大数据技术有限公司 PTZ camera frame selection screen control holder method and device

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20090126697A (en) * 2008-06-05 2009-12-09 엘지전자 주식회사 Apparatus and method for controlling camera photographing
CN101710944A (en) * 2008-12-30 2010-05-19 上海领世通信技术发展有限公司 Method for controlling all-around zoom and focus of device without all-around zoom and focus function
CN106797429A (en) * 2014-10-10 2017-05-31 佳能株式会社 Control device, the methods and procedures being controlled to control device
CN110456829A (en) * 2019-08-07 2019-11-15 深圳市维海德技术股份有限公司 Positioning and tracing method, device and computer readable storage medium
CN111210472A (en) * 2019-12-31 2020-05-29 山东信通电子股份有限公司 3D positioning method, device, equipment and medium for video picture

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20090126697A (en) * 2008-06-05 2009-12-09 엘지전자 주식회사 Apparatus and method for controlling camera photographing
CN101710944A (en) * 2008-12-30 2010-05-19 上海领世通信技术发展有限公司 Method for controlling all-around zoom and focus of device without all-around zoom and focus function
CN106797429A (en) * 2014-10-10 2017-05-31 佳能株式会社 Control device, the methods and procedures being controlled to control device
CN110456829A (en) * 2019-08-07 2019-11-15 深圳市维海德技术股份有限公司 Positioning and tracing method, device and computer readable storage medium
CN111210472A (en) * 2019-12-31 2020-05-29 山东信通电子股份有限公司 3D positioning method, device, equipment and medium for video picture

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117082345A (en) * 2023-10-17 2023-11-17 智广海联(天津)大数据技术有限公司 PTZ camera frame selection screen control holder method and device

Also Published As

Publication number Publication date
CN113938614B (en) 2022-03-22

Similar Documents

Publication Publication Date Title
US9619861B2 (en) Apparatus and method for improving quality of enlarged image
KR100940971B1 (en) Providing area zoom functionality for a camera
JP6071866B2 (en) Display control device, display device, imaging system, display control method, and program
CN106028117A (en) Image processing method and device
US20230370720A1 (en) Focusing method and apparatus, electronic device, and medium
CN112954193B (en) Shooting method, shooting device, electronic equipment and medium
CN113938614B (en) Video image zooming method, device, equipment and storage medium
CN111385607A (en) Resolution determination method and device, storage medium, client and server
JP2005318177A (en) Material presentation apparatus
JP2016096481A (en) Control apparatus, photographing system, control method, and program
CN111835972B (en) Shooting method and device and electronic equipment
JP2024504159A (en) Photography methods, equipment, electronic equipment and readable storage media
KR100624473B1 (en) Apparatus and method for processing image
WO2017024954A1 (en) Method and device for image display
JPWO2014034137A1 (en) Image processing apparatus, image processing method, and image processing program
JP5042251B2 (en) Image processing apparatus and image processing method
US8040388B2 (en) Indicator method, system, and program for restoring annotated images
JP6341924B2 (en) Handheld display zoom function
JP2018097310A (en) Display control program, display control method and display control device
CN112601004B (en) Method, device and system for previewing acquired image and computer readable storage medium
JP4834497B2 (en) Display device
US9530183B1 (en) Elastic navigation for fixed layout content
CN111652799A (en) Image processing method and device, electronic equipment and readable storage medium
JP2021135482A (en) Display device and image display method
CN112911362A (en) Video image moving and zooming method and device, electronic equipment and readable storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant