Image processing method and apparatus
By generating the target image and obtaining the parameters of the selected area, combined with the control parameters of the image acquisition device for processing, the problem of the algorithm not being widely used due to pan-tilt rotation and focal length expansion is solved, and automatic adaptation of ROI and accurate image recognition are achieved.
Patent Information
- Application Number
- CN202010543686.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-06-15
- Publication Date
- 2025-10-10
- Estimated Expiration
- 2040-06-15
AI Technical Summary
The algorithms caused by pan/tilt rotation and focal length expansion in the existing technology cannot be widely used and cannot achieve accurate ROI marking and image recognition.
By generating a target image, obtaining parameters of the selected area, and performing image processing on the selected area in combination with control parameters of the image acquisition device, automatic adaptation of the ROI is achieved.
The applicable scenarios of the ROI automatic adaptation algorithm have been expanded, solving the problem that the algorithm cannot be widely used due to pan-tilt rotation and focal length expansion, and realizing the technical effects of pan-tilt rotation and focal length expansion based on the ball camera.
Smart Images

Figure CN113807345B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of Internet technology, and in particular to an image processing method and device. Background Art
[0002] With the construction of smart cities in China and the coverage of Skynet surveillance, more and more cameras have been used in the streets and alleys of cities. At the same time, in recent years of urban development, relevant departments in various places have adopted camera video streams for image recognition to monitor violations on urban roads, highways and other locations.
[0003] In practice, a camera's field of view is relatively large. To ensure accurate recognition, a region of interest (ROI) is often used to mark specific areas. This helps differentiate desired locations for different image recognition tasks. Currently, the popular ROI method is only suitable for marking fixed-body cameras.
[0004] With respect to the above-mentioned problem that the algorithm cannot be widely used due to the pan-tilt rotation and focal length expansion in the prior art, no effective solution has been proposed yet. Summary of the Invention
[0005] The embodiments of the present invention provide an image processing method and apparatus to at least solve the technical problem that algorithms in the prior art cannot be widely used due to pan / tilt rotation and focal length expansion.
[0006] According to one aspect of an embodiment of the present invention, there is provided an image processing method, which includes: generating a target image from pictures captured from at least one angle; wherein the target image is used to display an image of a specified area composed of pictures from at least one angle; acquiring a selected area based on the target image, and acquiring area parameters from the selected area; acquiring control parameters of an image acquisition device, and performing image processing on the selected area in combination with the area parameters to obtain an image of the processed selected area.
[0007] Optionally, generating a target image from pictures captured at at least one angle includes: capturing pictures at at least one angle at a preset focal length by a specified image capture device; generating a target image based on the pictures at at least one angle, and setting an initial angle in the target image.
[0008] Further, optionally, the designated image acquisition device includes: a dome camera image acquisition device.
[0009] Optionally, obtaining a selected area based on a target image and obtaining area parameters from the selected area includes: obtaining the selected area based on the target image and obtaining each vertex and coordinates of each vertex of a calibrated polygon; marking the selected area to obtain a marked image.
[0010] Furthermore, optionally, control parameters of the image acquisition device are obtained, and image processing is performed on the selected area in combination with the area parameters to obtain an image of the processed selected area, including: performing projection calculation on the marked image according to the control parameters to obtain an image corresponding to the control parameters; and obtaining a list of marked vertices based on the image of the control parameters.
[0011] Optionally, obtaining the selected area based on the target image and obtaining area parameters from the selected area includes: obtaining the selected area based on the target image, and obtaining each vertex of the calibrated polygon and the coordinates of each vertex; performing coordinate conversion on the coordinates of each vertex in the target image to obtain the spherical coordinates of each vertex in the selected area.
[0012] Furthermore, optionally, control parameters of the image acquisition device are obtained, and image processing is performed on the selected area in combination with the area parameters to obtain an image of the processed selected area, including: taking the image corresponding to the control parameters as the center of the visible area, calculating through the field of view angle and focal length of the image acquisition device to obtain the visible area range corresponding to the control parameters; restoring the spherical coordinates of each vertex in the selected area to the central screen coordinate system; and performing intersection calculation on the visible area range corresponding to the control parameters and the central screen coordinates to obtain an image of the selected area within the visible range.
[0013] According to another aspect of an embodiment of the present invention, an image processing method is provided, which includes: generating a target image from pictures collected from at least one angle; wherein the target image is used to display an image of a specified area composed of pictures from at least one angle; obtaining a selected area based on the target image, and obtaining each vertex of a calibrated polygon and the coordinates of each vertex; marking the selected area to obtain a marked image; performing projection calculation on the marked image based on control parameters of an image acquisition device to obtain an image corresponding to the control parameters; and obtaining a marked vertex list based on the image of the control parameters.
[0014] According to another aspect of an embodiment of the present invention, an image processing method is provided, which includes: generating a target image from pictures collected from at least one angle; wherein the target image is used to display an image of a specified area composed of pictures from at least one angle; obtaining a selected area based on the target image, and obtaining each vertex of a calibrated polygon and the coordinates of each vertex; performing coordinate conversion on the coordinates of each vertex in the target image to obtain spherical coordinates of each vertex in the selected area; using an image corresponding to a control parameter of an image acquisition device as the center of a visible area, and calculating through the field of view angle and focal length of the image acquisition device to obtain a visible area range corresponding to the control parameter; restoring the spherical coordinates of each vertex in the selected area to a central screen coordinate system; performing intersection calculation on the visible area range corresponding to the control parameter and the central screen coordinate to obtain an image of the selected area within the visible range.
[0015] According to one aspect of another embodiment of the present invention, an image processing device is further provided, which includes: an acquisition module for generating a target image from pictures acquired from at least one angle; wherein the target image is used to display an image of a specified area composed of pictures from at least one angle; an acquisition module for acquiring a selected area based on the target image, and obtaining area parameters from the selected area; and an image processing module for acquiring control parameters of the image acquisition device, and performing image processing on the selected area in combination with the area parameters to obtain an image of the processed selected area.
[0016] According to another aspect of another embodiment of the present invention, an image processing device is further provided, which includes: an acquisition module for generating a target image from pictures acquired from at least one angle; wherein the target image is used to display an image of a specified area composed of pictures from at least one angle; a first acquisition module for acquiring a selected area based on the target image, and acquiring each vertex of a calibrated polygon and the coordinates of each vertex; a marking module for marking the selected area to obtain a marked image; a calculation module for performing projection calculation on the marked image based on control parameters of the image acquisition device to obtain an image corresponding to the control parameters; and a second acquisition module for acquiring a marked vertex list based on the image of the control parameters.
[0017] According to another aspect of another embodiment of the present invention, an image processing device is further provided, which includes: an acquisition module for generating a target image from pictures acquired from at least one angle; wherein the target image is used to display an image of a specified area composed of pictures from at least one angle; an acquisition module for acquiring a selected area based on the target image, and acquiring each vertex of a calibrated polygon and the coordinates of each vertex; a coordinate conversion module for performing coordinate conversion on the coordinates of each vertex in the target image to obtain the spherical coordinates of each vertex in the selected area; a first calculation module for using the image corresponding to the control parameters of the image acquisition device as the center of the visible area, and performing calculations based on the field of view angle and focal length of the image acquisition device to obtain the visible area range corresponding to the control parameters; a restoration module for restoring the spherical coordinates of each vertex in the selected area to the central screen coordinate system; and a second calculation module for performing intersection calculation on the visible area range corresponding to the control parameters and the central screen coordinates to obtain an image of the selected area within the visible range.
[0018] According to another embodiment of the present invention, a storage medium is provided, wherein the storage medium includes a stored program, wherein when the program is executed, the device where the storage medium is located is controlled to execute the above-mentioned image processing method.
[0019] According to one aspect of yet another embodiment of the present invention, a processor is further provided, wherein the processor is configured to run a program, wherein the program executes the above-mentioned image processing method when it is run.
[0020] In an embodiment of the present invention, a target image is generated by collecting pictures from at least one angle; a selected area is obtained based on the target image, and area parameters are obtained from the selected area; control parameters of an image acquisition device are obtained, and image processing is performed on the selected area in combination with the area parameters to obtain an image of the processed selected area. This achieves the purpose of expanding the applicable scenarios of the ROI automatic adaptation algorithm, thereby realizing the technical effects of pan-tilt rotation and focal length expansion based on a ball camera, and further solving the technical problem that the algorithm cannot be widely used due to pan-tilt rotation and focal length expansion in the prior art. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of this application. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:
[0022] Figure 1 This is a hardware structure block diagram of a computer terminal for an image processing method according to an embodiment of the present invention;
[0023] Figure 2 is a flowchart of an image processing method according to embodiment 1 of the present invention;
[0024] Figure 3 is a flowchart of an image processing method according to a second embodiment of the present invention;
[0025] Figure 4 is a schematic diagram of ROI adaptation in an image processing method according to embodiment 2 of the present invention;
[0026] Figure 5 is a flowchart of an image processing method according to a third embodiment of the present invention;
[0027] Figure 6 is a schematic diagram of ROI adaptation in an image processing method according to embodiment 3 of the present invention;
[0028] Figure 7 is a schematic diagram of an image processing device according to a fourth embodiment of the present invention;
[0029] Figure 8 is a schematic diagram of an image processing device according to a fifth embodiment of the present invention;
[0030] Figure 9 is a schematic diagram of an image processing device according to a sixth embodiment of the present invention. DETAILED DESCRIPTION
[0031] In order to enable those skilled in the art to better understand the solutions of the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the embodiments described are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts should fall within the scope of protection of the present invention.
[0032] It should be noted that the terms "first", "second", etc. in the description and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that the numbers used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0033] Technical terms involved in this application:
[0034] ROI: The full name is "Region of Interest". In machine vision and image processing, the area to be processed is outlined in the image being processed using a box, circle, ellipse, irregular polygon, etc., which is called the region of interest.
[0035] PTZ: It is the abbreviation of Pan / Tilt / Zoom, which represents the full range (left and right / up and down) movement of the pan / tilt and the lens zoom and zoom control.
[0036] Spherical panorama: A spherical panorama maps the longitude and latitude coordinates of a sphere directly to horizontal and vertical coordinates. The height of the image is approximately twice its width. Spherical panoramas can display a full 360-degree horizontal and vertical panorama.
[0037] The convex hull is a concept in computational geometry (graphics). It refers to a set X in a real vector space V. The intersection S of all convex sets that contain X is called the convex hull of X. Simply put, the convex hull is a convex polygon formed by connecting the outermost points of a point set on a two-dimensional plane. It contains all the points in the set.
[0038] There are many Graham convex hull algorithms, and the Graham Scan algorithm is one of them, which can find the convex hull in O(nlogn) time.
[0039] SIFT, or Scale-invariant feature transform (SIFT), is a description used in image processing. This description is scale-invariant and can detect key points in an image, acting as a local feature description.
[0040] Gnomonic Projection is also known as "sundial projection" or "great ring projection". It places the viewpoint at the center of the earth, the shadow plane is tangent to the earth's surface, and the projection plane is perpendicular to the diameter passing through the viewpoint.
[0041] Example 1
[0042] According to an embodiment of the present invention, an image processing method embodiment is also provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0043] The method embodiment provided in the first embodiment of the present application can be executed in a mobile terminal, a computer terminal or a similar computing device. Taking running on a computer terminal as an example, Figure 1is a hardware structure block diagram of a computer terminal of an image processing method of an embodiment of the present application. As shown in Figure 1 , the computer terminal 10 can include one or more (only one is shown in the figure) processors 102 (the processor 102 can include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA), a memory 104 for storing data, and a transmission module 106 for communication functions. Those skilled in the art can understand that Figure 1 The structure shown is only schematic, which does not limit the structure of the above-mentioned electronic device. For example, the computer terminal 10 can include more or fewer components than those shown in Figure 1 , or have a different configuration from Figure 1 .
[0044] The memory 104 can be used to store software programs and modules of application software, such as program instructions / modules corresponding to the image processing method of the embodiment of the present application. The processor 102 executes various functional applications and data processing by running the software programs and modules stored in the memory 104, that is, implements the image processing method of the above-mentioned application program. The memory 104 can include a high-speed random access memory, and can also include a non-volatile memory such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memories. In some examples, the memory 104 can further include a memory remotely arranged with respect to the processor 102, which can be connected to the computer terminal 10 through a network. Examples of the above-mentioned network include but are not limited to the Internet, an intranet, a local area network, a mobile communication network, and a combination thereof.
[0045] The transmission device 106 is used to receive or send data via a network. Specific examples of the above-mentioned network can include a wireless network provided by a communication provider of the computer terminal 10. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 106 can be a radio frequency (Radio Frequency, RF) module, which is used to communicate with the Internet in a wireless manner.
[0046] Under the above-mentioned operating environment, the present application provides an image processing method as shown in Figure 2 . Figure 2 is a flowchart of the image processing method according to the first embodiment of the present application. The image processing method provided by the embodiment of the present application is as follows:
[0047] Step S202: generating a target image from the pictures collected from at least one angle; wherein the target image is used to display an image of a designated area composed of the pictures from at least one angle;
[0048] In the above step S202 of the present application, the image processing method provided in the embodiment of the present application can be applied to a dome camera, or a dome-shaped camera mounted on a pan / tilt head, to capture images of at least one angle at a preset focal length through a designated image acquisition device; a target image is generated based on the images of at least one angle, and an initial angle in the target image is set. The target image is composed of images of at least one angle to obtain a full-range viewing angle image of the designated area; in the embodiment of the present application, the display method of the target image can include a panoramic image. For example, if a panoramic image of road section A is required, it can be obtained by capturing images of at least one angle through at least one dome camera.
[0049] Among them, the designated image acquisition equipment includes: a ball camera image acquisition device.
[0050] Specifically, taking a dome camera as an example, pictures are collected from various angles of the dome camera at one focal length, usually every 10° horizontally and vertically. The target image is generated from the collected pictures using a tool or SIFT algorithm. The initial angle of the target image needs to be set during the generation.
[0051] Step S204, obtaining a selected area according to the target image, and obtaining area parameters from the selected area;
[0052] In the above step S204 of the present application, in the embodiment of the present application, the selected area may be a ROI area (i.e., Region Of Interest);
[0053] In the embodiment of the present application, obtaining the area parameters from the selected area may include the following methods:
[0054] Method 1:
[0055] The selected area is obtained according to the target image, and each vertex of the calibrated polygon and the coordinates of each vertex are obtained; the selected area is marked to obtain a marked image.
[0056] Specifically, each vertex of the calibrated polygon and the corresponding image coordinates are obtained, and then the ROI area is dyed into a specified color or marked by processing the image.
[0057] Method 2:
[0058] The selected area is obtained according to the target image, and each vertex of the calibrated polygon and the coordinates of each vertex are obtained; the coordinates of each vertex are converted in the target image to obtain the spherical coordinates of each vertex in the selected area.
[0059] Specifically, the vertices of the calibrated polygon and the corresponding image coordinates are obtained. Then, the ROI automatic adaptation service converts the coordinates of each vertex of the selected ROI from the target image to the spherical coordinates, obtains the spherical coordinates of each vertex of the ROI, and saves them.
[0060] Step S206 , obtaining control parameters of the image acquisition device, and performing image processing on the selected area in combination with the area parameters to obtain a processed image of the selected area.
[0061] The above-mentioned step S206 of the present application, based on the two methods of step S204, includes the following methods in the process of obtaining the control parameters of the image acquisition device and performing image processing on the selected area in combination with the area parameters to obtain the processed image of the selected area:
[0062] Method 1:
[0063] Corresponding to the first method in step S204, step S206 obtains the control parameters of the image acquisition device, and performs image processing on the selected area in combination with the area parameters, and obtains the processed image of the selected area including:
[0064] Projection calculation is performed on the marked image according to the control parameters to obtain an image corresponding to the control parameters; and a marked vertex list is obtained according to the image of the control parameters.
[0065] Specifically, the real-time PTZ data of the ball camera (i.e., the control parameters in the embodiment of the present application) is collected through the ONVIF protocol, and combined with the stained target image, the PTZ is used as the core parameter, and the viewing angle image under the current PTZ angle is calculated through the spherical center projection algorithm;
[0066] Combined with the color information on the viewing angle image, the Graham algorithm is used to calculate the colored ROI vertex list.
[0067] Method 2:
[0068] Corresponding to the second method in step S204, step S206 obtains the control parameters of the image acquisition device, and performs image processing on the selected area in combination with the area parameters, and obtains the processed image of the selected area including:
[0069] Taking the image corresponding to the control parameter as the center of the visible area, the field of view angle and focal length of the image acquisition device are used for calculation to obtain the range of the visible area corresponding to the control parameter; the spherical coordinates of each vertex in the selected area are restored to the central screen coordinate system; the intersection of the visible area range corresponding to the control parameter and the central screen coordinates is calculated to obtain the image of the selected area within the visible range.
[0070] Specifically, the ROI automatic adaptation service collects the real-time PTZ data of the dome camera (i.e., the control parameters in the embodiment of this application) through the ONVIF protocol, uses the angle as the center of the visible area, and calculates the visible area range under the current PTZ angle based on the camera's FOV and focal length information. At the same time, it also restores the previously saved ROI spherical coordinate vertices to the screen coordinate system centered on the current angle;
[0071] The intersection of the current angle visible area range and the screen coordinates of the ROI vertex is calculated to calculate the ROI area within the visible range.
[0072] It should be noted that the target image provided in the embodiment of the present application is illustrated using a spherical target image as an example. In addition, other target images can also be used for calculation, such as a cylindrical target image and a hexahedral target image. By doing the same type of coordinate derivation, similar output can be obtained.
[0073] The above examples provided in the embodiments of the present application are only examples, and are based on the image processing method provided in the embodiments of the present application, and are not specifically limited.
[0074] In an embodiment of the present invention, a target image is generated by collecting pictures from at least one angle; a selected area is obtained based on the target image, and area parameters are obtained from the selected area; control parameters of an image acquisition device are obtained, and image processing is performed on the selected area in combination with the area parameters to obtain an image of the processed selected area. This achieves the purpose of expanding the applicable scenarios of the ROI automatic adaptation algorithm, thereby realizing the technical effects of pan-tilt rotation and focal length expansion based on a ball camera, and further solving the technical problem that the algorithm cannot be widely used due to pan-tilt rotation and focal length expansion in the prior art.
[0075] Example 2
[0076] According to another aspect of the present invention, an image processing method is provided. Figure 3 is a flow chart of an image processing method according to the second embodiment of the present invention. Figure 3 As shown, the image processing method provided in the embodiment of the present application includes:
[0077] Step S302: Generate a target image from the pictures collected from at least one angle; wherein the target image is used to display an image of a designated area composed of the pictures from at least one angle;
[0078] Step S304, obtaining a selected area according to the target image, and obtaining each vertex of the calibrated polygon and the coordinates of each vertex;
[0079] Step S306, marking the selected area to obtain a marked image;
[0080] Step S308, performing projection calculation on the marked image according to the control parameters of the image acquisition device to obtain an image corresponding to the control parameters;
[0081] Step S310 , obtaining a marked vertex list according to the image of the control parameter.
[0082] Specifically, in combination with step S302 to step S310, Figure 4 is a schematic diagram of ROI adaptation in the image processing method according to the second embodiment of the present invention, such as Figure 4 As shown, the image processing method provided in the embodiment of the present application is specifically as follows:
[0083] The image processing method provided in the embodiment of the present application can be applied to a dome camera, or a dome camera placed on a pan / tilt platform. Taking the dome camera as an example:
[0084] In step 1, the user collects pictures from various angles of the dome camera at one focal length, usually every 10° horizontally and vertically. The collected pictures are used to generate the target image through the SIFT algorithm. The initial angle of the target image needs to be set during the generation. The target image is composed of pictures from at least one angle to obtain a full-range viewing angle of the specified area. In the embodiment of the present application, the display method of the target image can include a panoramic image. For example, if a panoramic image of road section A is required, it can be obtained by collecting pictures from at least one angle through at least one dome camera.
[0085] In Step 2, the user selects the ROI area based on the target image, obtains the vertices of the calibrated polygon and the corresponding image coordinates, and then dyes the ROI area into a specified color or marks it by processing the image.
[0086] Step 3: Collect the real-time PTZ data of the camera through the ONVIF protocol, combine it with the stained target image, use the PTZ as the core parameter, and calculate the viewing angle image under the current PTZ angle through the spherical center projection algorithm.
[0087] Step 4: Combine the color information on the viewing angle image and calculate the colored ROI vertex list using the Graham algorithm.
[0088] In an embodiment of the present invention, a target image is generated by acquiring a picture acquired from at least one angle; a selected area is acquired based on the target image, and each vertex of a calibrated polygon and the coordinates of each vertex are acquired; the selected area is marked to obtain a marked image; a projection calculation is performed on the marked image based on control parameters of an image acquisition device to obtain an image corresponding to the control parameters; and a list of marked vertices is acquired based on the image of the control parameters, thereby achieving the purpose of expanding the applicable scenarios of the ROI automatic adaptation algorithm, thereby realizing the technical effect of pan / tilt rotation and focal length expansion based on a ball camera, and further solving the technical problem that the algorithm cannot be widely used due to pan / tilt rotation and focal length expansion in the prior art.
[0089] Example 3
[0090] According to another aspect of the embodiment of the present invention, an image processing method is provided. Figure 5 is a flowchart of an image processing method according to a third embodiment of the present invention. Figure 5 As shown, the image processing method provided in the embodiment of the present application includes:
[0091] Step S502: generating a target image from the pictures collected from at least one angle; wherein the target image is used to display an image of a designated area composed of the pictures from at least one angle;
[0092] Step S504, obtaining a selected area according to the target image, and obtaining each vertex of the calibrated polygon and the coordinates of each vertex;
[0093] Step S506 , performing coordinate conversion on the coordinates of each vertex in the target image to obtain the spherical coordinates of each vertex in the selected area;
[0094] Step S508, taking the image corresponding to the control parameter of the image acquisition device as the center of the visible area, and calculating the range of the visible area corresponding to the control parameter by using the field of view angle and focal length of the image acquisition device;
[0095] Step S510, restoring the spherical coordinates of each vertex in the selected area to the central screen coordinate system;
[0096] Step S512 , performing intersection calculation on the visible area range corresponding to the control parameter and the center screen coordinates to obtain an image of the selected area within the visible area.
[0097] Specifically, in combination with step S502 to step S512, Figure 6 FIG. 1 is a schematic diagram of ROI adaptation in an image processing method according to Embodiment 3 of the present invention. Figure 6 As shown, the image processing method provided in the embodiment of the present application is specifically as follows:
[0098] The image processing method provided in the embodiment of the present application can be applied to a dome camera, or a dome camera placed on a pan / tilt platform. Taking the dome camera as an example:
[0099] In Step 1, the user collects images from various angles of the dome camera at one focal length, usually every 10° horizontally and vertically. The target image is generated from the collected images using a tool or SIFT algorithm. The initial angle of the target image needs to be set during the generation.
[0100] The target image is composed of images from at least one angle, resulting in a full-view image of the designated area. In this embodiment of the present application, the target image can be displayed as a panoramic image. For example, if a panoramic image of road section A is required, it can be obtained by capturing images from at least one angle using at least one dome camera.
[0101] In Step 2, the user selects the ROI area based on the target image, obtains the vertices of the calibrated polygon and the corresponding image coordinates, and then the ROI automatic adaptation service converts the coordinates of each vertex of the selected ROI from the target image to the spherical coordinates, obtains the spherical coordinates of each vertex of the ROI, and saves them.
[0102] In Step 3, the ROI auto-adaptation service collects the camera's real-time PTZ data via the ONVIF protocol, uses that angle as the center of the visible area, and calculates the visible area at the current PTZ angle using the camera's FOV and focal length information. It also restores the previously saved ROI spherical coordinate vertices to the screen coordinate system centered on the current angle.
[0103] Step 4: Calculate the intersection of the current angle visible area range and the screen coordinates of the ROI vertex to calculate the ROI area within the visible range.
[0104] In an embodiment of the present invention, a target image is generated by collecting pictures from at least one angle; a selected area is obtained based on the target image, and each vertex of the calibrated polygon and the coordinates of each vertex are obtained; the coordinates of each vertex are converted in the target image to obtain the spherical coordinates of each vertex in the selected area; the image corresponding to the control parameters of the image acquisition device is used as the center of the visible area, and the visible area range corresponding to the control parameters is calculated through the field of view angle and focal length of the image acquisition device; the spherical coordinates of each vertex in the selected area are restored to the central screen coordinate system; the intersection calculation of the visible area range corresponding to the control parameters and the central screen coordinates is performed to obtain the image of the selected area within the visible range, thereby achieving the purpose of expanding the applicable scenarios of the ROI automatic adaptation algorithm, thereby realizing the technical effect of pan-tilt rotation and focal length telescoping based on the ball camera, and further solving the technical problem that the algorithm cannot be widely used due to pan-tilt rotation and focal length telescoping in the prior art.
[0105] It should be noted that for the aforementioned method embodiments, for simplicity of description, they are all expressed as a series of action combinations. However, those skilled in the art should be aware that the present invention is not limited by the order of the actions described, because according to the present invention, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in this specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present invention.
[0106] Through the description of the above embodiments, those skilled in the art can clearly understand that the image processing method according to the above embodiments can be implemented by means of software plus the necessary general hardware platform, or of course by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product. The computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a number of instructions for enabling a terminal device (which can be a mobile phone, computer, server, or network device, etc.) to execute the methods of various embodiments of the present invention.
[0107] Example 4
[0108] According to an embodiment of the present invention, a device for implementing the above image processing method is also provided. Figure 7 is a schematic diagram of an image processing device according to a fourth embodiment of the present invention. Figure 7 As shown, the image processing device provided by the embodiment of the present application includes: an acquisition module 72, which is used to generate a target image from pictures collected from at least one angle; wherein the target image is used to display an image of a specified area composed of pictures from at least one angle; an acquisition module 74, which is used to acquire a selected area based on the target image, and obtain area parameters from the selected area; an image processing module 76, which is used to acquire control parameters of the image acquisition device, and perform image processing on the selected area in combination with the area parameters to obtain an image of the processed selected area.
[0109] It should be noted that the acquisition module 72, acquisition module 74, and image processing module 76 described above correspond to steps S202 to S206 in Example 1. The examples and application scenarios implemented by the three modules and the corresponding steps are the same, but are not limited to the contents disclosed in Example 1. It should be noted that the above modules, as part of the device, can be run in the computer terminal 10 provided in Example 1.
[0110] Example 5
[0111] According to an embodiment of the present invention, a device for implementing the above image processing method is also provided. Figure 8 is a schematic diagram of an image processing device according to a fifth embodiment of the present invention. Figure 8 As shown, the image processing device provided by the embodiment of the present application includes: an acquisition module 80, which is used to generate a target image from pictures collected at at least one angle; wherein the target image is used to display an image of a specified area composed of pictures at at least one angle; a first acquisition module 82, which is used to acquire a selected area based on the target image, and acquire each vertex of the calibrated polygon and the coordinates of each vertex; a marking module 84, which is used to mark the selected area to obtain a marked image; a calculation module 86, which is used to perform projection calculation on the marked image according to the control parameters of the image acquisition device to obtain an image corresponding to the control parameters; a second acquisition module 88, which is used to acquire a marked vertex list based on the image of the control parameters.
[0112] It should be noted here that the above-mentioned acquisition module 80, the first acquisition module 82, the marking module 84, the calculation module 86 and the second acquisition module 88 correspond to steps S302 to S310 in Example 2. The three modules and the corresponding steps implement the same instances and application scenarios, but are not limited to the contents disclosed in the above-mentioned Example 1.
[0113] Example 6
[0114] According to an embodiment of the present invention, a device for implementing the above image processing method is also provided. Figure 9 FIG. 1 is a schematic diagram of an image processing device according to a sixth embodiment of the present invention. Figure 9 As shown, the image processing device provided in the embodiment of the present application includes:
[0115] The acquisition module 91 is used to generate a target image from images acquired from at least one angle; wherein the target image is used to display an image of a specified area composed of images from at least one angle; the acquisition module 92 is used to acquire the selected area based on the target image, and acquire the vertices of the calibrated polygon and the coordinates of each vertex; the coordinate conversion module 93 is used to convert the coordinates of each vertex in the target image to obtain the spherical coordinates of each vertex in the selected area; the first calculation module 94 is used to use the image corresponding to the control parameters of the image acquisition device as the center of the visible area, and calculate through the field of view angle and focal length of the image acquisition device to obtain the visible area range corresponding to the control parameters; the restoration module 95 is used to restore the spherical coordinates of each vertex in the selected area to the central screen coordinate system; the second calculation module 96 is used to perform intersection calculation on the visible area range corresponding to the control parameters and the central screen coordinates to obtain the image of the selected area within the visible range.
[0116] It should be noted that the above acquisition module 91, the acquisition module 92, the coordinate conversion module 93, the first calculation module 94, the restoration module 95 and the second calculation module 96 correspond to steps S502 to S512 in Embodiment 3, and the three modules have the same instances and application scenarios as the corresponding steps, but are not limited to the above-mentioned embodiment 1.
[0117] Embodiment 7
[0118] According to an aspect of yet another embodiment of the present application, there is also provided a storage medium, wherein the storage medium comprises a stored program, wherein the program, when executed, controls a device in which the storage medium is located to perform the image processing method of any one of the above-mentioned embodiments 1 to 3.
[0119] Embodiment 8
[0120] According to an aspect of yet another embodiment of the present application, there is also provided a processor, wherein the processor is configured to execute a program, wherein the program, when executed, performs the image processing method of any one of the above-mentioned embodiments 1 to 3.
[0121] Embodiment 9
[0122] The embodiments of the present application also provide a storage medium. Optionally, in the present embodiment, the above-mentioned storage medium can be used to save the program code executed by the image processing method provided in the above-mentioned embodiment 1.
[0123] Optionally, in the present embodiment, the above-mentioned storage medium can be located in any one of the computer terminals in a computer terminal group in a computer network, or in any one of the mobile terminals in a mobile terminal group.
[0124] Optionally, in the present embodiment, the storage medium is configured to store program code for performing the following steps: generating a target image from the pictures collected at the at least one angle; wherein the target image is used to display the image of the specified region composed of the pictures at the at least one angle; obtaining a selected region according to the target image, and obtaining a region parameter from the selected region; obtaining a control parameter of the image acquisition device, and performing image processing on the selected region in combination with the region parameter to obtain an image of the processed selected region.
[0125] Optionally, in the present embodiment, the storage medium is configured to store program code for performing the following steps: generating a target image from the pictures collected at the at least one angle comprises: collecting the pictures at the at least one angle by a specified image acquisition device at a preset focal length; generating the target image according to the pictures at the at least one angle, and setting an initial angle in the target image.
[0126] Further, optionally, in the embodiment, the storage medium is configured to store program code for performing the following step: the image acquisition device comprises a spherical camera image acquisition device.
[0127] Optionally, in the embodiment, the storage medium is configured to store program code for performing the following step: the selected region is obtained according to the target image, and the region parameter is obtained from the selected region, comprising: the selected region is obtained according to the target image, and each vertex of the calibrated polygon and the coordinates of each vertex are obtained; the selected region is marked to obtain a marked image.
[0128] Further, optionally, in the embodiment, the storage medium is configured to store program code for performing the following step: the control parameter of the image acquisition device is obtained, and the selected region is image-processed in combination with the region parameter to obtain an image of the processed selected region, comprising: the marked image is projected and calculated according to the control parameter to obtain an image corresponding to the control parameter; the vertex list of the mark is obtained according to the image of the control parameter.
[0129] Optionally, in the embodiment, the storage medium is configured to store program code for performing the following step: the selected region is obtained according to the target image, and the region parameter is obtained from the selected region, comprising: the selected region is obtained according to the target image, and each vertex of the calibrated polygon and the coordinates of each vertex are obtained; the coordinates of each vertex are converted in the target image to obtain the spherical coordinates of each vertex in the selected region.
[0130] Further, optionally, in the embodiment, the storage medium is configured to store program code for performing the following step: the control parameter of the image acquisition device is obtained, and the selected region is image-processed in combination with the region parameter to obtain an image of the processed selected region, comprising: the image corresponding to the control parameter is taken as the center of the visual region, and the field of view angle and the focal length of the image acquisition device are calculated to obtain the visual region range corresponding to the control parameter; the spherical coordinates of each vertex in the selected region are restored to the central screen coordinate system; the visual region range corresponding to the control parameter and the central screen coordinate are intersected to obtain the image of the selected region in the visual range.
[0131] The above-mentioned serial numbers of the embodiments of the application are only for description, and do not represent the advantages and disadvantages of the embodiments.
[0132] In the above-mentioned embodiments of the application, the description of each embodiment has its own emphasis, and the parts not described in detail in a certain embodiment can be referred to the related description of other embodiments.
[0133] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.
[0134] The units described as separate components may or may not be physically separate, and 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 these units may be selected to achieve the purpose of this embodiment according to actual needs.
[0135] In addition, the functional units in the various embodiments of the present invention may be integrated into a single processing unit, each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.
[0136] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for enabling a computer device (which can be a personal computer, server or network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, magnetic disk or optical disk, etc. Various media that can store program codes.
[0137] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present invention. These improvements and modifications should also be regarded as within the scope of protection of the present invention.
Claims
1. An image processing method, wherein: include: Generate a target image from the pictures collected at at least one angle, wherein the target image is used to display a full-range image of a designated area composed of the pictures at the at least one angle; Acquire a selected area according to the target image, and acquire each vertex of the calibrated polygon and the coordinates of each vertex, wherein the selected area is selected by a user based on the target image; Performing coordinate conversion on the coordinates of each vertex in the target image to obtain the spherical coordinates of each vertex in the selected area; Taking the image corresponding to the control parameter of the image acquisition device as the center of the visible area, calculating the range of the visible area corresponding to the control parameter by using the field of view angle and focal length of the image acquisition device; Restoring the spherical coordinates of each vertex in the selected area to the central screen coordinate system; An intersection calculation is performed on the visible area range corresponding to the control parameter and the center screen coordinates to obtain an image of the selected area within the visible area.
2. The method according to claim 1, wherein Generating a target image from pictures collected from at least one angle includes: Capture images of at least one angle at a preset focal length using a designated image acquisition device; The target image is generated according to the picture of the at least one angle, and an initial angle in the target image is set.
3. The method according to claim 2, wherein: The designated image acquisition equipment includes: a ball camera image acquisition device.
4. An image processing device, wherein: include: An acquisition module, configured to generate a target image from images acquired from at least one angle; wherein the target image is configured to display a full-range image of a designated area composed of the images acquired from at least one angle; an acquisition module, configured to acquire a selected area according to the target image, and acquire each vertex of the calibrated polygon and the coordinates of each vertex, wherein the selected area is selected by a user based on the target image; A coordinate conversion module, configured to convert the coordinates of each vertex in the target image to obtain the spherical coordinates of each vertex in the selected area; a first calculation module, configured to use an image corresponding to a control parameter of an image acquisition device as the center of a visible area and calculate, using the field of view angle and focal length of the image acquisition device, to obtain a range of the visible area corresponding to the control parameter; a restoration module, configured to restore the spherical coordinates of each vertex in the selected area to a central screen coordinate system; The second calculation module is used to perform intersection calculation on the visible area range corresponding to the control parameter and the center screen coordinates to obtain an image of the selected area within the visible range.
5. A storage medium, wherein: The storage medium includes a stored program, wherein when the program is executed, the device where the storage medium is located is controlled to execute the image processing method according to any one of claims 1 to 3.
6. A processor, wherein: The processor is configured to run a program, wherein the program executes the image processing method according to any one of claims 1 to 3 when running.
Citation Information
Patent Citations
Imaging processing method and device
CN105100577A