A three-dimensional simulation method and system for monitoring camera

By identifying and rendering the visible area of ​​the surveillance camera in a three-dimensional scene, the problem of low installation efficiency and limitations of surveillance cameras in the existing technology is solved, object recognition and installation testing of the three-dimensional simulation software are realized, and the installation efficiency is improved.

CN114241136BActive Publication Date: 2024-09-06SINOMACH IND INTERNET RES INST (HENAN) CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202111571338.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-21
Publication Date
2024-09-06
Estimated Expiration
2041-12-21

AI Technical Summary

Technical Problem

The existing technology lacks mature three-dimensional simulation software, which makes it impossible to effectively conduct location evaluation and feasibility analysis of surveillance cameras during the urban construction and operation and maintenance phase, and cannot perform object recognition, resulting in low installation efficiency and large limitations.

Method used

By obtaining the real object parameters in the target scene, create a 3D model and configure the integer type identification ID, perform color coding and model rendering, use the preset algorithm to determine the visible and invisible areas under the simulated camera perspective, and identify the 3D model pixel by pixel. Realize object recognition and installation testing in three-dimensional scenes.

Benefits of technology

It improves the efficiency of selecting security locations for surveillance cameras, avoids installation limitations caused by inability to identify objects, and enables effective installation testing and location analysis of surveillance cameras in three-dimensional scenes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114241136B
    Figure CN114241136B
Patent Text Reader

Abstract

The present invention proposes a three-dimensional simulation method and system for a monitoring camera, and relates to the field of three-dimensional simulation technology. The method comprises: creating a three-dimensional model according to the parameters of each real object to obtain a three-dimensional scene, and configuring an integer type identification ID for the three-dimensional model. According to the RGBA values ​​of each three-dimensional model, the three-dimensional model under the perspective of the simulation camera is rendered to obtain a rendering result. The screen fragment shot by the simulation camera is obtained according to the shooting perspective of the simulation camera, and the visible area and the invisible area are obtained by using a preset algorithm. The RGBA value in the visible area under the perspective of the simulation camera is obtained pixel by pixel, and the corresponding integer digital index is obtained according to the RGBA value in the visible area, and the corresponding integer type identification ID is obtained according to the corresponding integer digital index. The method and system can identify the three-dimensional model in the visible area while installing and testing the monitoring camera in the three-dimensional scene, so as to avoid limitations in the installation of the monitoring camera.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of three-dimensional simulation, and in particular to a three-dimensional simulation method and system for a monitoring camera. Background Art

[0002] At present, surveillance cameras need to be installed during the operation and maintenance stage of urban construction. In order to reduce the workload of camera security location selection and improve efficiency, it is necessary to conduct simulation in advance, conduct location evaluation and feasibility analysis.

[0003] However, there is a lack of mature simulation software on the market. Even if simulation is possible, it simply uses a simulated camera to output each frame of the image. There is no object recognition function and post-analysis cannot be performed, which has great limitations. Summary of the invention

[0004] The object of the present invention is to provide a three-dimensional simulation method and system for a surveillance camera, which can identify the three-dimensional model in the visible area while performing installation testing on the surveillance camera in a three-dimensional scene, thereby avoiding limitations in the installation of the surveillance camera.

[0005] The embodiment of the present invention is achieved as follows:

[0006] In a first aspect, an embodiment of the present application provides a three-dimensional simulation method for a surveillance camera, which includes the following steps: obtaining all real object parameters in a target scene, creating a three-dimensional model according to each real object parameter to obtain a three-dimensional scene, and configuring an integer type identification ID for the three-dimensional model. According to the integer type identification ID, encapsulate the corresponding three-dimensional model and establish an integer digital index. Based on the integer digital index, color encode the integer type identification ID to obtain a color encoding result, and store the color encoding result according to four bytes of RGBA to obtain the RGBA value corresponding to each three-dimensional model. According to the RGBA value of each three-dimensional model, render the three-dimensional model under the perspective of the simulation camera to obtain a rendering result, and store the rendering result in an offline data buffer. Obtain real camera parameters, and configure simulation camera parameters according to the real camera parameters, the simulation camera parameters including the shooting perspective of the simulation camera. In response to user operations, determine the position of the simulation camera in the three-dimensional scene, and obtain the screen segment shot by the simulation camera according to the shooting perspective of the simulation camera, and obtain the visible area and the invisible area based on the screen segment using a preset algorithm. The visible area is colored with a first preset color, the invisible area is colored with a second preset color, and the colored visible area and invisible area are displayed in the first screen area. Based on the offline data buffer, the RGBA value in the visible area under the perspective of the simulated camera is obtained pixel by pixel, and the corresponding integer digital index is obtained according to the RGBA value in the visible area, and the corresponding integer type identification ID is obtained according to the corresponding integer digital index to identify the three-dimensional model in the visible area.

[0007] In some embodiments of the present invention, the above-mentioned step of obtaining the visible area and the invisible area based on the screen fragment using a preset algorithm includes: obtaining the depth value of each pixel in the screen fragment under the perspective of the simulated camera, that is, the first depth value, and obtaining the depth value of each pixel under the default view, that is, the second depth value. If the first depth value of the pixel is greater than the second depth value of the pixel, the pixel is blocked and belongs to the invisible area. If the first depth value of the pixel is less than the second depth value of the pixel, the pixel is not blocked and belongs to the visible area.

[0008] In some embodiments of the present invention, the step of coloring the visible area with the first preset color and coloring the invisible area with the second preset color includes: if the pixel point belongs to the visible area, coloring the visible area with the first preset color; if the pixel point belongs to the invisible area, coloring the invisible area with the second preset color.

[0009] In some embodiments of the present invention, after the above-mentioned steps of determining the position of the simulation camera in the three-dimensional scene in response to user operations, and obtaining screen fragments captured by the simulation camera according to the shooting angle of view of the simulation camera, and obtaining visible areas and invisible areas based on the screen fragments using a preset algorithm, the method further includes: based on the three-dimensional model in the visible area, obtaining an offline rendered image of the three-dimensional model under the perspective of the simulation camera, and displaying the offline rendered image in the second screen area.

[0010] In some embodiments of the present invention, before the above-mentioned step of obtaining an offline rendered image of the three-dimensional model under the perspective of a simulated camera based on the three-dimensional model in the visible area, the method also includes: obtaining offline rendered images of each three-dimensional model under the perspective of the simulated camera, and saving all offline rendered images to an offline color buffer.

[0011] In some embodiments of the present invention, after the above-mentioned step of obtaining an offline rendered image of the three-dimensional model under the perspective of the simulation camera based on the three-dimensional model in the visible area, and displaying the offline rendered image in the second screen area, the method also includes: adjusting the position of the simulation camera in response to a user drag operation according to the rendering result displayed in the second screen area.

[0012] In some embodiments of the present invention, the above-mentioned real camera parameters include actual focal length and actual size, and the step of configuring simulation camera parameters according to the real camera parameters includes: calculating the shooting angle of the simulation camera according to the actual focal length and the actual size.

[0013] In the second aspect, the embodiment of the present application provides a three-dimensional simulation system, which includes: a three-dimensional model creation module, which is used to obtain all real object parameters in the target scene, create a three-dimensional model according to each real object parameter to obtain a three-dimensional scene, and configure an integer type identification ID for the three-dimensional model. An integer digital index establishment module, which is used to encapsulate the corresponding three-dimensional model and establish an integer digital index according to the integer type identification ID. An RGBA value acquisition module, which is used to color-code the integer type identification ID based on the integer digital index to obtain a color coding result, and store the color coding result according to the four bytes of RGBA to obtain the RGBA value corresponding to each three-dimensional model. A model rendering module, which is used to render the three-dimensional model under the perspective of the simulation camera according to the RGBA value of each three-dimensional model, obtain the rendering result, and store the rendering result in the offline data buffer. A simulation camera parameter configuration module, which is used to obtain real camera parameters, and configure the simulation camera parameters according to the real camera parameters, and the simulation camera parameters include the shooting perspective of the simulation camera. The region differentiation module is used to determine the position of the simulation camera in the three-dimensional scene in response to user operations, and obtain the screen fragment captured by the simulation camera according to the shooting angle of the simulation camera, and obtain the visible area and the invisible area based on the screen fragment using a preset algorithm. The region coloring module is used to color the visible area with a first preset color, color the invisible area with a second preset color, and display the colored visible area and the invisible area in the first screen area. The three-dimensional model recognition module is used to obtain the RGBA value in the visible area under the perspective of the simulation camera pixel by pixel based on the offline data buffer, obtain the corresponding integer digital index according to the RGBA value in the visible area, and obtain the corresponding integer type identification ID according to the corresponding integer digital index to identify the three-dimensional model in the visible area.

[0014] In some embodiments of the present invention, the above-mentioned area differentiation module includes: a depth value acquisition unit, which is used to obtain the depth value of each pixel in the screen fragment under the perspective of the simulated camera, that is, the first depth value, and obtain the depth value of each pixel in the default view, that is, the second depth value. An invisible area judgment unit, which is used to determine that if the first depth value of a pixel is greater than the second depth value of the pixel, the pixel is blocked and belongs to the invisible area. A visible area judgment unit, which is used to determine that if the first depth value of a pixel is less than the second depth value of the pixel, the pixel is not blocked and belongs to the visible area.

[0015] In some embodiments of the present invention, the region coloring module includes: a first coloring unit, which is used to color the visible region with a first preset color if the pixel point belongs to the visible region; and a second coloring unit, which is used to color the invisible region with a second preset color if the pixel point belongs to the invisible region.

[0016] In some embodiments of the present invention, the three-dimensional simulation system of the above-mentioned monitoring camera also includes: a first perspective display module, which is used to obtain an offline rendered image of the three-dimensional model in the perspective of the simulation camera based on the three-dimensional model in the visible area, and display the offline rendered image in the second screen area.

[0017] In some embodiments of the present invention, the three-dimensional simulation system of the above-mentioned monitoring camera also includes: an offline rendering image saving module, which is used to obtain offline rendering images of each three-dimensional model under the perspective of the simulation camera, and save all offline rendering images to an offline color buffer.

[0018] In some embodiments of the present invention, the three-dimensional simulation system of the monitoring camera further includes: a shooting adjustment module for adjusting the position of the simulation camera in response to a user drag operation according to the rendering result displayed in the second screen area.

[0019] In some embodiments of the present invention, the above-mentioned real camera parameters include actual focal length and actual size, and the above-mentioned simulation camera parameter configuration module includes: a shooting angle calculation unit, which is used to calculate the shooting angle of the simulation camera according to the actual focal length and the actual size.

[0020] In a third aspect, an embodiment of the present application provides an electronic device, comprising a memory for storing one or more programs and a processor. When the one or more programs are executed by the processor, any method in the first aspect is implemented.

[0021] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements a method as described in any one of the first aspects above.

[0022] Compared with the prior art, the embodiments of the present invention have at least the following advantages or beneficial effects:

[0023] The present invention provides a three-dimensional simulation method and system for a monitoring camera, which comprises the following steps: obtaining all real object parameters in a target scene, creating a three-dimensional model according to the parameters of each real object to obtain a three-dimensional scene, and configuring an integer type identification ID for the three-dimensional model. According to the integer type identification ID, encapsulating the corresponding three-dimensional model and establishing an integer digital index. Based on the integer digital index, color coding is performed on the integer type identification ID to obtain a color coding result, and the color coding result is stored according to four bytes of RGBA to obtain the RGBA value corresponding to each three-dimensional model. According to the RGBA value of each three-dimensional model, the three-dimensional model under the perspective of the simulation camera is rendered to obtain a rendering result, and the rendering result is stored in an offline data buffer. The real camera parameters are obtained, and the simulation camera parameters are configured according to the real camera parameters, and the simulation camera parameters include the shooting perspective of the simulation camera. In response to the user operation, the position of the simulation camera in the three-dimensional scene is determined, and the screen fragment shot by the simulation camera is obtained according to the shooting perspective of the simulation camera, and based on the screen fragment, a preset algorithm is used to obtain a visible area and an invisible area. The visible area is colored with a first preset color, the invisible area is colored with a second preset color, and the colored visible area and invisible area are displayed in the first screen area. Based on the offline data buffer, the RGBA value in the visible area under the perspective of the simulated camera is obtained pixel by pixel, and the corresponding integer digital index is obtained according to the RGBA value in the visible area, and the corresponding integer type identification ID is obtained according to the corresponding integer digital index to identify the three-dimensional model in the visible area.

[0024] The method and system use the RGBA values ​​of each 3D model to render the 3D model under the perspective of the simulation camera, so as to convert the integer type identification ID of each 3D model into rendering data, so that when the simulation camera shoots in the 3D scene, the screen fragment shot by the simulation camera is first obtained according to the shooting perspective of the simulation camera, and based on the screen fragment, the visible area and the invisible area are obtained by using a preset algorithm, and the visible area and the invisible area after coloring are displayed in the first screen area to facilitate the user to view the visible area and the invisible area. Then, the RGBA value in the visible area under the perspective of the simulation camera is obtained, and the RGBA value is parsed to obtain the integer type identification ID, and then the 3D model shot by the simulation camera is obtained. Through this method and system, not only can the real camera be simulated to be installed in the target scene, and the monitoring camera can be installed and tested in the 3D scene, but the user can also analyze the installation position of the real camera according to the recognition result of the simulation camera on the 3D model in the visible area, which greatly reduces the workload of selecting the security position of the monitoring camera and improves the efficiency of installation implementation, while avoiding the user's inability to perform installation analysis due to the inability to identify the object, thereby causing limitations in installing the monitoring camera. BRIEF DESCRIPTION OF THE DRAWINGS

[0025] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for use in the embodiments are briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present invention and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without creative work.

[0026] Figure 1 A flowchart of a three-dimensional simulation method of a surveillance camera provided by an embodiment of the present invention;

[0027] Figure 2 A structural block diagram of a three-dimensional simulation system of a surveillance camera provided by an embodiment of the present invention;

[0028] Figure 3 A three-dimensional simulation effect display diagram of a surveillance camera provided by an embodiment of the present invention;

[0029] Figure 4 A calculation flow chart for distinguishing visible areas from invisible areas provided by an embodiment of the present invention;

[0030] Figure 5 A schematic structural block diagram of an electronic device provided by an embodiment of the present invention.

[0031] Icons: 100 - 3D simulation system of monitoring camera; 110 - 3D model creation module; 120 - integer index establishment module; 130 - RGBA value acquisition module; 140 - model rendering module; 150 - simulation camera parameter configuration module; 160 - region distinction module; 170 - region coloring module; 180 - 3D model recognition module; 101 - memory; 102 - processor; 103 - communication interface. DETAILED DESCRIPTION

[0032] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments. The components of the embodiments of the present application described and shown in the drawings here can be arranged and designed in various different configurations.

[0033] Therefore, the following detailed description of the embodiments of the present application provided in the accompanying drawings is not intended to limit the scope of the present application for which protection is sought, but merely represents selected embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without creative work are within the scope of protection of the present application.

[0034] It should be noted that similar reference numerals and letters represent similar items in the following drawings, so once an item is defined in one drawing, it does not need to be further defined and explained in the subsequent drawings. At the same time, in the description of this application, if the terms "first", "second", etc. appear, they are only used to distinguish the description and cannot be understood as indicating or implying relative importance.

[0035] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, if the terms "include", "comprise" or any other variant thereof appear, it is intended to cover non-exclusive inclusion, so that the process, method, article or equipment including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or equipment. In the absence of further restrictions, if an element defined by the sentence "comprises a..." appears, it does not exclude the presence of other identical elements in the process, method, article or equipment including the element.

[0036] In the description of the present application, it should be noted that if the terms "upper", "lower", "inside", "outside", etc. appear to indicate an orientation or position relationship, they are based on the orientation or position relationship shown in the drawings, or are the orientation or position relationship in which the product of the application is usually placed when used. This is only for the convenience of describing the present application and simplifying the description, and does not indicate or imply that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as a limitation on the present application.

[0037] In the description of this application, it is also necessary to explain that, unless otherwise clearly specified and limited, the terms "set" and "connection" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection, or it can be an indirect connection through an intermediate medium, or it can be the internal connection of two components. For ordinary technicians in this field, the specific meanings of the above terms in this application can be understood according to specific circumstances.

[0038] In conjunction with the accompanying drawings, some embodiments of the present application are described in detail below. In the absence of conflict, the following embodiments and features in the embodiments can be combined with each other.

[0039] Example

[0040] Please refer to Figure 1 , Figure 1The flowchart of a three-dimensional simulation method of a monitoring camera provided in an embodiment of the present application is shown. A three-dimensional simulation method of a monitoring camera comprises the following steps:

[0041] S110: Acquire all real object parameters in the target scene, create a three-dimensional model according to the real object parameters to obtain a three-dimensional scene, and configure an integer type identifier ID for the three-dimensional model;

[0042] Specifically, in the process of creating a three-dimensional model, each three-dimensional model is given a unique integer type identification ID, which is equivalent to the identity card number of each three-dimensional model to distinguish each three-dimensional model.

[0043] Among them, integer type identification ID configuration can be performed for all three-dimensional models according to integer type identification IDs from 1 to n.

[0044] S120: encapsulating the corresponding three-dimensional model and establishing an integer digital index according to the integer type identifier ID;

[0045] S130: Based on the integer digital index, the integer type identifier ID is color-coded to obtain a color coding result, and the color coding result is stored according to four bytes of RGBA to obtain the RGBA value corresponding to each three-dimensional model;

[0046] Specifically, all integer type identification IDs are color-coded one by one, and the color coding results are stored according to four bytes of RGBA, so as to find the corresponding integer type identification ID according to the RGBA value.

[0047] S140: Rendering the three-dimensional model under the perspective of the simulation camera according to the RGBA value of each three-dimensional model to obtain a rendering result, and storing the rendering result in an offline data buffer;

[0048] Specifically, the RGBA values ​​of each 3D model are used to render the 3D model under the perspective of the simulation camera, so as to convert the integer type identification ID of each 3D model into rendering data. When the simulation camera shoots in the 3D scene, the image captured by the simulation camera can be obtained through the simulation camera. The RGBA value under the perspective of the simulation camera is obtained, and the RGBA value is then parsed to obtain the integer type identification ID, and then the 3D model captured by the simulation camera is obtained.

[0049] S150: Acquire real camera parameters, and configure simulation camera parameters according to the real camera parameters, where the simulation camera parameters include the shooting angle of the simulation camera;

[0050] For example, the parameters of real cameras in the prior art mainly include the size and focal length of CCD / CMOS. The sizes of CCD / CMOS are 1 / 1.2 and 1 / 1.7, and the size of CCD / CMOS corresponds to the aspect ratio of the simulated camera imaging.

[0051] Specifically, the above-mentioned real camera parameters include the actual focal length and actual size. According to the actual focal length and actual size, the shooting angle of the simulated camera can be calculated. Among them, the visual range of the real camera is mainly determined by the chip size and the actual focal length. The calculation pseudo code is as follows:

[0052] vFovy=(180 / Math.PI)*2.0*Math.tan2(height, 2*focus);

[0053] vFovx=(180 / Math.PI)*2.0*Math.tan2(width, 2*focus);

[0054] Among them, vFovy is the vertical angle of the simulated camera, vFovx is the horizontal angle of the simulated camera; height is the height of the imaging chip of the real camera, width is the width of the imaging chip of the real camera, and focus is the current focal length of the real camera.

[0055] S160: determining the position of the simulation camera in the three-dimensional scene in response to the user operation, and obtaining a screen segment captured by the simulation camera according to the shooting angle of the simulation camera, and obtaining a visible area and an invisible area based on the screen segment using a preset algorithm;

[0056] Specifically, the user randomly clicks on any point on the software operation plane to select the position of the simulation camera, and drags and adjusts the operation on the software operation plane to select the shooting direction of the simulation camera. Since the visibility of the area in the scene is based on the shadow generation technology in the three-dimensional rendering, the three-dimensional model will be blocked under the shooting angle of the simulation camera. The preset algorithm can be used to analyze the shooting picture of the simulation camera segment by segment to distinguish the visible area from the invisible area.

[0057] The above preset algorithm may be a ShadowMap algorithm. Figure 4 , Figure 4The figure shows a calculation flow chart for distinguishing visible areas from invisible areas provided by an embodiment of the present invention. After the simulation camera is placed, multiple screen fragments taken by the simulation camera are obtained, and the pixels of the multiple screen fragments are judged one by one. For each pixel, the simulation camera space depth buffer is first obtained, and then the simulation camera NDC coordinate system is transformed to query the depth value of the pixel in the screen fragment under the perspective of the simulation camera, that is, the first depth value d1. Then the default depth buffer of the user's computer screen is obtained, and the depth value of the pixel in the default view, that is, the user's computer screen, that is, the second depth value d2 is queried. "d1>d2" is judged. If "d1>d2" is false, the pixel is judged to be a visible fragment. If "d1>d2" is true, the pixel is judged to be an invisible fragment. Thus, the multiple screen fragments taken by the simulation camera are judged fragment by fragment.

[0058] S170: coloring the visible area with a first preset color, coloring the invisible area with a second preset color, and displaying the colored visible area and invisible area in the first screen area;

[0059] Please refer to Figure 3 , Figure 3 The figure shows a three-dimensional simulation effect display diagram of a surveillance camera provided by an embodiment of the present invention. The first preset color may be green, and the second preset color may be non-green. For the visible area, it is colored with green in the shader, and for the invisible area, it is colored with non-green in the shader. The colored visible area and invisible area are displayed in the first screen area to facilitate the user to view the visible area and the invisible area.

[0060] in, Figure 3 The rightmost frame displays the data parameters of the current simulation process, such as: simulation camera model, horizontal viewing angle, vertical viewing angle, viewing distance and focal length, etc. The first screen area is Figure 3 For a picture with a larger image range, the first screen area is a third-person perspective, that is, the user can clearly see the approximate range of the visible area and the invisible area through the picture displayed in the first screen area. Figure 3 The second screen area is the first-person perspective, that is, the user can clearly understand the shooting picture under the shooting perspective of the simulation camera through the picture displayed in the second screen area. The first-person perspective can be used as a first-person visual window by creating a screen-mounted quadrilateral geometric primitive, and the first-person visual window can display each frame of the shooting picture. By combining the first-person perspective with the third-person perspective, not only can the position of the current simulation camera be fine-tuned, but also the linkage of three-dimensional images and two-dimensional images can be provided to users.

[0061] S180: Based on the offline data buffer, the RGBA value in the visible area under the perspective of the simulated camera is obtained pixel by pixel, a corresponding integer digital index is obtained according to the RGBA value in the visible area, and a corresponding integer type identification ID is obtained according to the corresponding integer digital index to identify the three-dimensional model in the visible area.

[0062] Specifically, since the offline data buffer stores the rendering results of all three-dimensional models under the perspective of the simulated camera, the corresponding integer digital index can be obtained through the RGBA value in the visible area, and the corresponding integer type identification ID can be obtained, thereby achieving the purpose of identifying the three-dimensional model in the visible area, and then providing a basis for users to select the installation location of the real camera. This method can not only simulate the installation of a real camera in the target scene and perform installation tests on the surveillance camera in the three-dimensional scene, but users can also analyze the installation location of the real camera based on the recognition results of the three-dimensional model in the visible area by the simulated camera, which greatly reduces the workload of selecting the security location of the surveillance camera and improves the efficiency of installation implementation. At the same time, it avoids the inability of users to perform installation analysis due to the inability to identify objects, thereby causing limitations in installing surveillance cameras.

[0063] During the above implementation process, the user can select the model and installation location of the simulation camera according to the actual situation to better suit the user's actual situation.

[0064] In some implementations of the present embodiment, the above-mentioned step of obtaining the visible area and the invisible area based on the screen fragment using a preset algorithm includes: obtaining the depth value of each pixel in the screen fragment under the perspective of the simulation camera, that is, the first depth value, and obtaining the depth value of each pixel in the default view, that is, the second depth value. If the first depth value of the pixel is greater than the second depth value of the pixel, the pixel is blocked and belongs to the invisible area. If the first depth value of the pixel is less than the second depth value of the pixel, the pixel is not blocked and belongs to the visible area. Specifically, the picture taken by the simulation camera needs to be judged fragment by fragment. For each pixel, first obtain the simulation camera space depth buffer, and then transform the simulation camera NDC coordinate system to query the depth value of the pixel in the screen fragment under the perspective of the simulation camera, that is, the first depth value d1. Then obtain the default depth buffer of the user's computer screen, and query the depth value of the pixel in the default view, that is, the second depth value d2 on the user's computer screen. "d1>d2" is judged. If "d1>d2" is false, the pixel is judged as a visible fragment. If "d1>d2" is true, the pixel is judged as an invisible fragment.

[0065] In some implementations of this embodiment, the steps of coloring the visible area with the first preset color and coloring the invisible area with the second preset color include: if the pixel point belongs to the visible area, coloring the visible area with the first preset color. If the pixel point belongs to the invisible area, coloring the invisible area with the second preset color. Specifically, for each pixel point, when it is determined that a certain pixel point belongs to the visible area and the invisible area, the pixel point is immediately colored with the corresponding color in the shader, so as to achieve the purpose of coloring a pixel point when the pixel point is determined.

[0066] In some implementations of this embodiment, after the above steps of determining the position of the simulated camera in the three-dimensional scene in response to the user operation, obtaining the screen fragment captured by the simulated camera according to the shooting angle of the simulated camera, and obtaining the visible area and the invisible area based on the screen fragment using a preset algorithm, the method further includes: obtaining an offline rendered image of the three-dimensional model under the perspective of the simulated camera based on the three-dimensional model in the visible area, and displaying the offline rendered image in the second screen area. Specifically, firstly, according to the image parameters of the real object, each three-dimensional model is rendered under the perspective of the simulated camera to obtain the offline rendered image of the three-dimensional model under the perspective of the simulated camera, and the offline rendered image can provide each frame of the image for the first-person perspective.

[0067] In some implementations of this embodiment, before the step of obtaining an offline rendered image of the three-dimensional model in the simulated camera view based on the three-dimensional model in the visible area, the method further includes: obtaining an offline rendered image of each three-dimensional model in the simulated camera view, and saving all offline rendered images to an offline color buffer, so as to facilitate the retrieval of offline rendered images from the offline color buffer.

[0068] In some implementations of the present embodiment, after the above-mentioned step of obtaining an offline rendered image of the three-dimensional model under the perspective of the simulation camera based on the three-dimensional model in the visible area, and displaying the offline rendered image in the second screen area, the method further includes: adjusting the position of the simulation camera in response to a user drag operation according to the rendering result displayed in the second screen area.

[0069] In some implementations of this embodiment, the above-mentioned real camera parameters include actual focal length and actual size, and the step of configuring the simulation camera parameters according to the real camera parameters includes: calculating the shooting angle of the simulation camera according to the actual focal length and the actual size.

[0070] Please refer to Figure 2 , Figure 2The structure block diagram of a three-dimensional simulation system 100 of a surveillance camera provided by an embodiment of the present invention is shown. The embodiment of the present application provides a three-dimensional simulation system 100, which includes: a three-dimensional model creation module 110, which is used to obtain all real object parameters in the target scene, create a three-dimensional model according to the parameters of each real object to obtain a three-dimensional scene, and configure an integer type identification ID for the three-dimensional model. An integer digital index establishment module 120 is used to encapsulate the corresponding three-dimensional model and establish an integer digital index according to the integer type identification ID. An RGBA value acquisition module 130 is used to color-code the integer type identification ID based on the integer digital index to obtain a color coding result, and store the color coding result according to the four bytes of RGBA to obtain the RGBA value corresponding to each three-dimensional model. A model rendering module 140 is used to render the three-dimensional model under the perspective of the simulation camera according to the RGBA values ​​of each three-dimensional model, obtain a rendering result, and store the rendering result in an offline data buffer. A simulation camera parameter configuration module 150 is used to obtain real camera parameters and configure simulation camera parameters according to the real camera parameters. The simulation camera parameters include the shooting perspective of the simulation camera. The region distinguishing module 160 is used to determine the position of the simulated camera in the three-dimensional scene in response to the user operation, and obtain the screen segment captured by the simulated camera according to the shooting angle of the simulated camera, and obtain the visible area and the invisible area based on the screen segment using a preset algorithm. The region coloring module 170 is used to color the visible area with a first preset color, color the invisible area with a second preset color, and display the colored visible area and the invisible area in the first screen area. The three-dimensional model identification module 180 is used to obtain the RGBA value in the visible area under the perspective of the simulated camera pixel by pixel based on the offline data buffer, obtain the corresponding integer digital index according to the RGBA value in the visible area, and obtain the corresponding integer type identification ID according to the corresponding integer digital index to identify the three-dimensional model in the visible area.

[0071] Specifically, the system uses the RGBA values ​​of each 3D model to render the 3D model under the perspective of the simulation camera, so as to convert the integer type identification ID of each 3D model into rendering data, so that when the simulation camera shoots in the 3D scene, the screen fragment shot by the simulation camera is first obtained according to the shooting perspective of the simulation camera, and based on the screen fragment, the visible area and the invisible area are obtained by using a preset algorithm, and the visible area and the invisible area after coloring are displayed in the first screen area to facilitate the user to view the visible area and the invisible area. Then, by obtaining the RGBA value in the visible area under the perspective of the simulation camera, the RGBA value is parsed to obtain the integer type identification ID, and then the 3D model shot by the simulation camera is obtained. Through this system, not only can the real camera be simulated to be installed in the target scene, and the monitoring camera can be installed and tested in the 3D scene, but the user can also analyze the installation position of the real camera according to the recognition result of the simulation camera on the 3D model in the visible area, which greatly reduces the workload of selecting the security position of the monitoring camera and improves the efficiency of installation implementation, while avoiding the user's inability to perform installation analysis due to the inability to identify the object, thereby causing limitations in installing the monitoring camera.

[0072] In some implementations of this embodiment, the above-mentioned area differentiation module 160 includes: a depth value acquisition unit, which is used to obtain the depth value of each pixel in the screen fragment under the perspective of the simulation camera, that is, the first depth value, and obtain the depth value of each pixel in the default view, that is, the second depth value. An invisible area judgment unit, which is used to determine that if the first depth value of the pixel is greater than the second depth value of the pixel, the pixel is blocked and belongs to the invisible area. A visible area judgment unit, which is used to determine that if the first depth value of the pixel is less than the second depth value of the pixel, the pixel is not blocked and belongs to the visible area. Specifically, the picture taken by the simulation camera needs to be judged fragment by fragment. For each pixel, first obtain the simulation camera space depth buffer, and then transform the simulation camera NDC coordinate system to query the depth value of the pixel in the screen fragment under the perspective of the simulation camera, that is, the first depth value d1. Then obtain the default depth buffer of the user's computer screen, and query the depth value of the pixel in the default view, that is, the second depth value d2 on the user's computer screen. "d1>d2" is judged. If "d1>d2" is false, the pixel is judged as a visible fragment. If "d1>d2" is true, the pixel is judged as an invisible fragment.

[0073] In some implementations of this embodiment, the above-mentioned area coloring module 170 includes: a first coloring unit, which is used to color the visible area with a first preset color if the pixel point belongs to the visible area. A second coloring unit, which is used to color the invisible area with a second preset color if the pixel point belongs to the invisible area. Specifically, for each pixel point, when it is determined that a certain pixel point belongs to the visible area and the invisible area, the pixel point is immediately colored with the corresponding color in the shader, so as to achieve the purpose of coloring a pixel point when the pixel point is determined.

[0074] In some implementations of this embodiment, the three-dimensional simulation system 100 of the monitoring camera further includes: a first perspective display module, which is used to obtain an offline rendering image of the three-dimensional model in the perspective of the simulation camera based on the three-dimensional model in the visible area, and display the offline rendering image in the second screen area. Specifically, firstly, each three-dimensional model is rendered in the perspective of the simulation camera according to the image parameters of the real object to obtain an offline rendering image of the three-dimensional model in the perspective of the simulation camera, and the offline rendering image can provide each frame of the image for the first person perspective.

[0075] In some implementations of this embodiment, the three-dimensional simulation system 100 of the monitoring camera further includes: an offline rendering image saving module, which is used to obtain offline rendering images of each three-dimensional model under the perspective of the simulation camera, and save all offline rendering images to an offline color buffer, so as to facilitate the retrieval of offline rendering images from the offline color buffer.

[0076] In some implementations of this embodiment, the three-dimensional simulation system 100 of the monitoring camera further includes: a shooting adjustment module, which is used to adjust the position of the simulation camera in response to a user drag operation according to the rendering result displayed in the second screen area.

[0077] In some implementations of this embodiment, the above-mentioned real camera parameters include actual focal length and actual size, and the above-mentioned simulation camera parameter configuration module 150 includes: a shooting angle calculation unit, which is used to calculate the shooting angle of the simulation camera according to the actual focal length and the actual size.

[0078] See also Figure 5 , Figure 5A schematic structural block diagram of an electronic device provided in an embodiment of the present application. The electronic device includes a memory 101, a processor 102 and a communication interface 103, and the memory 101, the processor 102 and the communication interface 103 are electrically connected to each other directly or indirectly to realize data transmission or interaction. For example, these elements can be electrically connected to each other through one or more communication buses or signal lines. The memory 101 can be used to store software programs and modules, such as program instructions / modules corresponding to a three-dimensional simulation system 100 of a surveillance camera provided in an embodiment of the present application. The processor 102 executes various functional applications and data processing by executing the software programs and modules stored in the memory 101. The communication interface 103 can be used to communicate signaling or data with other node devices.

[0079] Among them, the memory 101 can be, but is not limited to, a random access memory (RAM), a read only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable read-only memory (EEPROM), etc.

[0080] The processor 102 may be an integrated circuit chip with signal processing capability. The processor 102 may be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it may also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.

[0081] Understandably, Figure 5 The structure shown is for illustration only. The electronic device may also include Figure 5 More or fewer components as shown, or with Figure 5 Different configurations shown. Figure 5 Each component shown in the figure can be implemented by hardware, software or a combination thereof.

[0082] In the embodiments provided in the present application, it should be understood that the disclosed devices and methods can also be implemented in other ways. The device embodiments described above are merely schematic. For example, the flowcharts and block diagrams in the accompanying drawings show the possible architecture, functions and operations of the devices, methods and computer program products according to the multiple embodiments of the present application. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of a code, and the module, a program segment or a part of a code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or the flowchart, and the combination of boxes in the block diagram and / or the flowchart can be implemented with a dedicated hardware-based system that performs a specified function or action, or can be implemented with a combination of dedicated hardware and computer instructions.

[0083] In addition, the functional modules in the various embodiments of the present application may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.

[0084] If the functions are implemented in the form of software function modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application can be essentially or partly embodied in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.

[0085] The above description is only the preferred embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.

[0086] It will be apparent to those skilled in the art that the present application is not limited to the details of the exemplary embodiments described above, and that the present application can be implemented in other specific forms without departing from the spirit or essential features of the present application. Therefore, the embodiments should be considered exemplary and non-limiting in all respects, and the scope of the present application is defined by the appended claims rather than the above description, and it is intended that all changes falling within the meaning and scope of the equivalent elements of the claims be included in the present application. Any reference numeral in a claim should not be considered as limiting the claim to which it relates.

Claims

1. A three-dimensional simulation method for a surveillance camera, characterized in that: The steps include: Acquire all real object parameters in the target scene, create a three-dimensional model according to the real object parameters to obtain a three-dimensional scene, and configure an integer type identifier ID for the three-dimensional model; According to the integer type identification ID, the corresponding three-dimensional model is encapsulated and an integer digital index is established; Based on the integer digital index, the integer type identifier ID is color-coded to obtain a color coding result, and the color coding result is stored according to four bytes of RGBA to obtain the RGBA value corresponding to each of the three-dimensional models; Rendering the three-dimensional model under the perspective of the simulation camera according to the RGBA value of each three-dimensional model to obtain a rendering result, and storing the rendering result in an offline data buffer; Acquire real camera parameters, and configure simulation camera parameters according to the real camera parameters, wherein the simulation camera parameters include a shooting angle of the simulation camera; In response to a user operation, determining the position of the simulated camera in the three-dimensional scene, and acquiring a screen segment captured by the simulated camera according to the shooting angle of the simulated camera, and obtaining a visible area and an invisible area based on the screen segment using a preset algorithm; Coloring the visible area with a first preset color, coloring the invisible area with a second preset color, and displaying the colored visible area and the invisible area in the first screen area; Based on the offline data buffer, the RGBA values ​​in the visible area under the perspective of the simulated camera are obtained pixel by pixel, a corresponding integer digital index is obtained according to the RGBA value in the visible area, and a corresponding integer type identification ID is obtained according to the corresponding integer digital index to identify the three-dimensional model in the visible area.

2. The three-dimensional simulation method of a surveillance camera according to claim 1, characterized in that: Based on the screen fragment, the step of obtaining the visible area and the invisible area by using a preset algorithm includes: Obtaining a depth value of each pixel in the screen fragment under the perspective of the simulated camera, that is, a first depth value, and obtaining a depth value of each pixel in the default view, that is, a second depth value; If the first depth value of the pixel is greater than the second depth value of the pixel, the pixel is blocked and belongs to the invisible area; If the first depth value of the pixel is less than the second depth value of the pixel, the pixel is not blocked and belongs to the visible area.

3. The three-dimensional simulation method of a surveillance camera according to claim 2, characterized in that: The steps of coloring the visible area with a first preset color and coloring the invisible area with a second preset color include: If the pixel point belongs to a visible area, coloring the visible area with a first preset color; If the pixel point belongs to the invisible area, the invisible area is colored with a second preset color.

4. The three-dimensional simulation method of a surveillance camera according to claim 1, characterized in that: After the steps of determining the position of the simulated camera in the three-dimensional scene in response to a user operation, obtaining a screen segment captured by the simulated camera according to the shooting angle of the simulated camera, and obtaining a visible area and an invisible area based on the screen segment using a preset algorithm, the method further includes: Based on the three-dimensional model in the visible area, an offline rendering image of the three-dimensional model in the perspective of the simulation camera is obtained, and the offline rendering image is displayed in the second screen area.

5. The three-dimensional simulation method of a surveillance camera according to claim 4, characterized in that: Before the step of obtaining an offline rendered image of the three-dimensional model in the visual area under the perspective of a simulation camera based on the three-dimensional model, the method further includes: Obtain offline rendering images of each 3D model under the perspective of the simulation camera, and save all offline rendering images to an offline color buffer.

6. The three-dimensional simulation method of a surveillance camera according to claim 4, characterized in that: After the step of acquiring an offline rendered image of the three-dimensional model in the visual area under the perspective of a simulation camera based on the three-dimensional model in the visible area, and displaying the offline rendered image in the second screen area, the method further includes: According to the rendering result displayed in the second screen area, the position of the simulation camera is adjusted in response to the user's drag operation.

7. The three-dimensional simulation method of a surveillance camera according to claim 1, characterized in that: The real camera parameters include actual focal length and actual size, and the step of configuring the simulation camera parameters according to the real camera parameters includes: The shooting angle of the simulated camera is calculated according to the actual focal length and the actual size.

8. A three-dimensional simulation system, characterized in that: include: A three-dimensional model creation module is used to obtain all real object parameters in the target scene, create a three-dimensional model according to the real object parameters to obtain a three-dimensional scene, and configure an integer type identifier ID for the three-dimensional model; An integer digital index establishment module, used to encapsulate the corresponding three-dimensional model and establish an integer digital index according to the integer type identification ID; An RGBA value obtaining module, for color-coding the integer type identification ID based on the integer digital index to obtain a color coding result, and storing the color coding result according to four bytes of RGBA to obtain the RGBA value corresponding to each of the three-dimensional models; The model rendering module is used to render the three-dimensional model under the perspective of the simulation camera according to the RGBA value of each three-dimensional model, obtain the rendering result, and store the rendering result in the offline data buffer; A simulation camera parameter configuration module, used to obtain real camera parameters and configure simulation camera parameters according to the real camera parameters, wherein the simulation camera parameters include the shooting angle of the simulation camera; A region distinguishing module, for determining the position of the simulated camera in the three-dimensional scene in response to a user operation, and obtaining a screen segment taken by the simulated camera according to the shooting angle of the simulated camera, and obtaining a visible region and an invisible region based on the screen segment using a preset algorithm; an area coloring module, configured to color the visible area with a first preset color, color the invisible area with a second preset color, and display the colored visible area and the invisible area in a first screen area; The three-dimensional model recognition module is used to obtain the RGBA value in the visible area under the perspective of the simulated camera pixel by pixel based on the offline data buffer, obtain the corresponding integer digital index according to the RGBA value in the visible area, and obtain the corresponding integer type identification ID according to the corresponding integer digital index to identify the three-dimensional model in the visible area.

9. An electronic device, characterized in that: include: A memory for storing one or more programs; processor; When the one or more programs are executed by the processor, the method according to any one of claims 1 to 7 is implemented.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.

Citation Information

Patent Citations

  • Real-time spatial positioning method for mobile monitoring target in geographical scene

    CN103226838A

  • Visual illusion type naked eye 3D content manufacturing method and device

    CN113516761A

  • Method and device for determining a pose

    EP3882856A1

  • Method for optimizing camera layout for area surveillance and apparatus employing the method

    US20210287400A1