A method and device for cross-recognition of rays where camera 2D points are located
By generating tubular objects and identifying the collision relationship between rays and these objects, the problem of high complexity in the ray cross recognition calculation in the prior art is solved, and a more efficient cross recognition process is achieved.
Patent Information
- Application Number
- CN202111118043.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-09-23
- Publication Date
- 2025-04-18
- Estimated Expiration
- 2041-09-23
AI Technical Summary
The prior art when identifying whether there is a crossing situation in the ray where the camera 2D point is located, the calculation complexity is high. It is necessary to first calculate the intersection position of the ray and the triangle and then verify whether it falls inside the triangle.
By generating the tubular objects corresponding to each 2D point and numbering and binding each tubular object, first identify whether the rays collide with other tubular objects. If they collide, record and calculate the cross position.
The calculation complexity is reduced, and the identification efficiency is improved by first verifying the intersection relationship and then calculating the intersection position.
Smart Images

Figure CN113902843B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of ray intersection recognition, and in particular to a method, device, computer equipment and storage medium for cross-recognition of rays where a camera 2D point is located. Background Art
[0002] In the field of camera imaging applications, the 3D reconstruction process refers to the process of regenerating the captured 3D points (i.e. 3D pixels) from several related 2D points (i.e. 2D pixels) using multi-view geometry. An important step is to identify whether there is an intersection between several rays corresponding to several 2D points and to further obtain the specific intersection position. In the prior art, the Ray-Triangle intersection detection algorithm is usually used to implement this, that is, to determine whether the ray where a 2D point is located intersects with the triangle where another 2D point is located. However, this method needs to first calculate the intersection position of the ray and the plane where the triangle is located, and then further verify whether the intersection position falls inside the triangle to determine the final intersection relationship. In comparison, the calculation process is more complicated. Summary of the invention
[0003] The purpose of the present invention is to overcome the shortcomings of the prior art and provide a method, device, computer equipment and storage medium for identifying the intersection of rays where a camera 2D point is located, which can realize the orderly execution of the process of first verifying the intersection relationship and then further calculating the intersection position, thereby reducing the calculation complexity.
[0004] In order to solve at least one of the above technical problems, an embodiment of the present invention provides a method for identifying the intersection of rays where a camera 2D point is located, the method comprising:
[0005] When N 2D points with different numbers are formed in the camera, a corresponding tubular object is generated in the spatial scene for each 2D point, and then each tubular object is bundled with a corresponding number;
[0006] Starting from i=1, obtain the i-th ray generated by the i-th 2D point, and then identify whether the i-th ray collides with at least one of the other N-1 tubular objects with different numbers;
[0007] If yes, then record the numbers of the K (1≤K≤N-1) tubular objects that collide with the i-th ray, and then calculate the intersection position of the i-th ray with each of the tubular objects;
[0008] Assign i+1 to i, and if i≤N, return to perform the collision recognition operation of the ray generated by the next 2D point.
[0009] Preferably, generating a corresponding tubular object for each 2D point in the spatial scene comprises:
[0010] The optical center position of the camera is obtained as c, and the closest distance allowed to capture the ray generated by any 2D point in the space scene is t min and the farthest distance is t max , and the direction information of the ray generated by the i-th 2D point is d i ;
[0011] Define the distance error value when the rays generated by any two 2D points intersect, and create a basic circle with the distance error value as the radius;
[0012] The basic circle is stretched to obtain a tubular object corresponding to the i-th 2D point. At this time, the center position of one end face in the tubular object is defined as c+t min d i And the center position of the other end face is c+t max d i .
[0013] Preferably, the step of identifying whether the i-th ray collides with at least one tubular object among N-1 tubular objects with different numbers comprises:
[0014] Starting from j=1, create a spatial bounding box for the j-th tubular object;
[0015] Taking the XOY plane in the spatial scene as a reference, the spatial bounding box is flattened and expanded in a cross shape, thereby obtaining a fixed boundary interval to cover the sizes of each plane of the spatial bounding box in the expanded state;
[0016] After identifying whether the i-th ray intersects the fixed boundary interval, j+1 is assigned to j, and when it is determined that j≤N-1, the operation of returning to perform a collision identification operation between the i-th ray and the next tubular object is performed.
[0017] Preferably, when the spatial bounding box is unfolded on the XOY plane, the fixed boundary interval limits the coordinate position of any point on the four planes placed closely horizontally to fall within the range of [y0, y1] along the y-axis, and limits the coordinate position of any point on the three planes placed closely vertically to fall within the range of [x0, x1].
[0018] Preferably, the step of identifying whether the i-th ray intersects the fixed boundary interval comprises:
[0019] Based on the fact that the fixed boundary interval has four boundary lines, the distance value t when the i-th ray intersects with the boundary line x=x0 is calculated respectively. x0 , the distance value when the i-th ray intersects the boundary line x=x1 is tx1 , the distance value when the i-th ray intersects the boundary line y=y0 is t y0 And the distance value when the i-th ray intersects the boundary line y=y1 is t y1 ;
[0020] Determine whether the above four distance values satisfy max(t x0 ,t y0 ) <min(t x1 ,t y1 ) conditions;
[0021] If yes, it is determined that the i-th ray intersects the fixed boundary interval, and the j-th tubular object is marked and distinguished;
[0022] If not, it is determined that the i-th ray does not intersect the fixed boundary interval.
[0023] Preferably, calculating the intersection position of the i-th ray and each of the tubular objects comprises:
[0024] Based on the fact that any ray is emitted in parallel from the center of the tubular object with the corresponding number, when the i-th ray collides with the j-th tubular object, the j-th ray with the same number as the j-th tubular object is obtained;
[0025] Extract a point P1 from the i-th ray and a point Q1 from the j-th ray, and make the line segment formed between point P1 and point Q1 the shortest distance between the i-th ray and the j-th ray;
[0026] According to the coordinate position of point P1 and the coordinate position of point Q1, the center point of the line segment formed between point P1 and point Q1 is obtained, and the coordinate position of the center point is defined as the intersection position of the i-th ray and the j-th tubular object.
[0027] Preferably, after identifying whether the i-th ray collides with at least one tubular object among other N-1 tubular objects with different numbers, the method further includes:
[0028] If not, assign i+1 to i, and return to perform the collision identification operation of the ray generated by the next 2D point when it is judged that i≤N.
[0029] In addition, an embodiment of the present invention further provides a device for identifying intersections of rays where a camera 2D point is located, the device comprising:
[0030] A generation module, used for generating a corresponding tubular object in the space scene for each 2D point when N 2D points with different numbers are formed in the camera, and then bundling each tubular object with a corresponding number;
[0031] an identification module, for obtaining the i-th ray generated by the i-th 2D point starting from i=1, and then identifying whether the i-th ray collides with at least one tubular object among N-1 tubular objects with different numbers;
[0032] A calculation module, for, when recognizing that the ith ray collides with at least one tubular object among N-1 tubular objects with different numbers, recording the numbers corresponding to the K (1≤K≤N-1) tubular objects that collide with the ith ray, and then calculating the intersection position between the ith ray and each of the tubular objects;
[0033] The return module is used to assign i+1 to i, and return to perform the collision recognition operation of the ray generated by the next 2D point when it is judged that i≤N.
[0034] In addition, an embodiment of the present invention further provides a computer device, which includes: a memory, a processor, and an application stored in the memory and executable on the processor, and the processor implements the steps of any of the above-mentioned method embodiments when executing the application.
[0035] In addition, an embodiment of the present invention further provides a computer-readable storage medium on which an application is stored. When the application is executed by a processor, the steps of the method in any of the above embodiments are implemented.
[0036] In an embodiment of the present invention, based on two rays generated by any two 2D points, the intersection recognition process between the two rays is converted into a collision recognition process between a ray and a tubular object created by another ray, and then further converted into an intersection judgment process between the two-dimensional plane of the spatial bounding box formed by the ray and the tubular object in the expanded state, thereby achieving reliable verification of the intersection relationship between the two rays; and by calculating their intersection positions under the condition of ensuring that the two rays intersect, the calculation complexity can be reduced. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] Figure 1 is a schematic flow chart of a method for cross-identifying rays where a camera 2D point is located in an embodiment of the present invention;
[0038] Figure 2 is a schematic diagram of a spatial bounding box in a flattened state according to an embodiment of the present invention;
[0039] Figure 3 is a schematic structural diagram of a device for identifying intersections of rays where a camera 2D point is located in an embodiment of the present invention;
[0040] Figure 4 It is a schematic diagram of the structural composition of a computer device in an embodiment of the present invention. DETAILED DESCRIPTION
[0041] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments 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 creative work are within the scope of protection of the present invention.
[0042] The embodiment of the present invention provides a method for identifying the intersection of rays where a camera 2D point is located. Figure 1 As shown, the method comprises the following steps:
[0043] S101, when N 2D points with different numbers are formed in the camera, a corresponding tubular object is generated in the spatial scene for each 2D point, and then each tubular object is bundled with a corresponding number;
[0044] The implementation process of the present invention includes:
[0045] (1) The optical center position of the camera is c, and the shortest distance allowed for the ray generated by any 2D point in the spatial scene is t. min and the farthest distance is t max , and the direction information of the ray generated by the i-th 2D point is d i , where the direction information d i It actually refers to the direction information of the i-th 2D point pointing to the optical center position;
[0046] (2) defining a distance error value when rays generated by any two 2D points intersect, and creating a basic circle with the distance error value as the radius, wherein the distance error value is the accuracy value of the 3D model required after subsequent reconstruction;
[0047] (3) The basic circle is stretched to obtain a tubular object corresponding to the i-th 2D point. At this time, the center position of one end face of the tubular object is defined as c+t min d i And the center position of the other end face is c+t max d i .
[0048] It should be noted that the tubular object corresponding to any 2D point is obtained by stretching the basic circle, and the direction information of the ray generated by the 2D point is used to ultimately define the stretching length and the placement position in the space scene.
[0049] S102, starting from i=1, obtaining the i-th ray generated by the i-th 2D point, and then identifying whether the i-th ray collides with at least one tubular object among N-1 tubular objects with different numbers;
[0050] The implementation process of the present invention includes:
[0051] (1) Starting from j=1, create a spatial bounding box for the j-th tubular object, and the spatial bounding box here is preferably an axis-aligned bounding box;
[0052] (2) Taking the XOY plane in the spatial scene as a reference, the spatial bounding box is flattened and expanded in a cross shape, thereby obtaining a fixed boundary interval to cover the sizes of each plane of the spatial bounding box in the expanded state;
[0053] More specifically, when the spatial bounding box is expanded on the XOY plane, Figure 2 From the schematic diagram of the spatial bounding box in the flattened state, it can be seen that the fixed boundary interval limits the coordinate position of any point on the four planes placed closely horizontally to fall within the range of [y0, y1] along the y-axis, and limits the coordinate position of any point on the three planes placed closely vertically to fall within the range of [x0, x1] along the x-axis, thereby achieving the purpose of covering the sizes of each plane of the spatial bounding box in the expanded state.
[0054] (3) After identifying whether the i-th ray intersects with the fixed boundary interval, assign j+1 to j, and when it is determined that j≤N-1, return to perform a collision identification operation between the i-th ray and the next tubular object.
[0055] More specifically, the identification of whether the i-th ray intersects the fixed boundary interval includes: first, based on the fact that the fixed boundary interval has four boundary lines, respectively calculating the distance value t when the i-th ray intersects the boundary line x=x0 x0 , the distance value when the i-th ray intersects the boundary line x=x1 is t x1 , the distance value when the i-th ray intersects the boundary line y=y0 is t y0 And the distance value when the i-th ray intersects the boundary line y=y1 is t y1 ; Secondly, determine whether the above four distance values satisfy max(t x0 ,t y0 ) <min(t x1 ,t y1), the corresponding judgment results are as follows: if the condition is satisfied, it is determined that the i-th ray intersects with the fixed boundary interval, that is, it is indicated that the i-th ray collides with the j-th tubular object, and the j-th tubular object is marked and distinguished; if the condition is not satisfied, it is determined that the i-th ray does not intersect with the fixed boundary interval, that is, it is indicated that the i-th ray does not collide with the j-th tubular object.
[0056] The calculation formulas for the above four distance values are as follows:
[0057]
[0058] Where: x i is the coordinate value of the 2D point corresponding to the i-th ray on the x-axis, y i is the coordinate value of the 2D point on the y-axis corresponding to the i-th ray, d ix (d ix ≠0) is the direction value of the i-th ray on the x-axis, d iy (d iy ≠0) is the direction value of the i-th ray on the y-axis.
[0059] It should be noted that after the above steps (1) to (3) are looped and executed N-1 times, if K (1≤K≤N-1) marked tubular objects are identified, step S103 is continued to be executed; on the contrary, if it is identified that there is no marked tubular object, the execution jumps to step S104.
[0060] S103, recording the numbers corresponding to the K (1≤K≤N-1) tubular objects that collide with the i-th ray, and then calculating the intersection position between the i-th ray and each of the tubular objects;
[0061] The implementation process of the present invention includes: first, based on the assumption that any ray is emitted in parallel from the center of a tubular object with a corresponding number, when the i-th ray collides with the j-th tubular object, the j-th ray with the same number as the j-th tubular object is obtained; secondly, a point P1 is extracted from the i-th ray and a point Q1 is extracted from the j-th ray, and a line segment formed between the point P1 and the point Q1 is made to be the shortest distance between the i-th ray and the j-th ray; finally, according to the coordinate position of the point P1 and the coordinate position of the point Q1, the center point of the line segment formed between the point P1 and the point Q1 is obtained, and the coordinate position of the center point is defined as the intersection position of the i-th ray and the j-th tubular object.
[0062] More specifically, the extraction process for point P1 in the i-th ray and point Q1 in the j-th ray is as follows:
[0063] (1) The coordinate expressions of point P1 and point Q1 are defined as:
[0064]
[0065] Among them, P0 is the coordinate information of the 2D point corresponding to the i-th ray, P C is the scalar value corresponding to point P1, d i is the direction information of the i-th ray, Q0 is the coordinate information of the 2D point corresponding to the j-th ray, Q C is the scalar value corresponding to point Q1, d j is the direction information of the jth ray;
[0066] (2) Based on the above two coordinate expressions, the direction information from point Q1 to point P1 is determined as:
[0067] w1=P1-Q1=w0+P C ·d i -Q C ·d j
[0068] Wherein, w0 is the direction information from the 2D point corresponding to the jth ray to the 2D point corresponding to the ith ray, that is, w0 = P0-Q0;
[0069] (3) When the i-th ray and the j-th ray are not parallel to each other in the spatial scene, there exists a line segment formed between point P1 and point Q1 that is perpendicular to the i-th ray and the j-th ray respectively, so the following relationship exists:
[0070]
[0071] To reduce complexity, set a = d i ·d i 、b=d i ·d j 、c=d j ·d j 、d=d i w0 and e=d j ·w0, then the above relationship can be simplified to:
[0072]
[0073] Then solve the simplified equations above and get:
[0074]
[0075] Finally, the above solution results are substituted into the two coordinate expressions of step (1) to obtain the coordinate position of point P1: P1 = P0 + [(be-cd) / (ac-b 2 )]·di , and the coordinate position of point Q1 is Q1 = Q0 + [(ae-bd) / (ac-b 2 )]·d j .
[0076] S104, assign i+1 to i, and when it is determined that i≤N, return to perform a collision identification operation of the ray generated by the next 2D point.
[0077] In an embodiment of the present invention, based on two rays generated by any two 2D points, the intersection recognition process between the two rays is converted into a collision recognition process between a ray and a tubular object created by another ray, and then further converted into an intersection judgment process between the two-dimensional plane of the spatial bounding box formed by the ray and the tubular object in the expanded state, thereby achieving reliable verification of the intersection relationship between the two rays; and by calculating their intersection positions under the condition of ensuring that the two rays intersect, the calculation complexity can be reduced.
[0078] In one embodiment, the present invention further provides a device for identifying the intersection of the rays where the camera 2D point is located, such as Figure 3 As shown, the device comprises:
[0079] A generating module 201 is used for generating a corresponding tubular object in a spatial scene for each 2D point when N 2D points with different numbers are formed in the camera, and then bundling each tubular object with a corresponding number;
[0080] The identification module 202 is used to obtain the i-th ray generated by the i-th 2D point starting from i=1, and then identify whether the i-th ray collides with at least one tubular object among N-1 tubular objects with different numbers;
[0081] The calculation module 203 is used to record the numbers corresponding to the K (1≤K≤N-1) tubular objects that collide with the i-th ray when it is identified that the i-th ray collides with at least one tubular object among the N-1 tubular objects with different numbers, and then calculate the intersection position between the i-th ray and each of the tubular objects;
[0082] The return module 204 is used to assign i+1 to i, and return to perform the collision identification operation of the ray generated by the next 2D point when it is judged that i≤N.
[0083] For the specific definition of a device for cross-identifying rays where a camera 2D point is located, please refer to the definition of a method for cross-identifying rays where a camera 2D point is located above, which will not be repeated here. Each module in the above-mentioned device for cross-identifying rays where a camera 2D point is located can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
[0084] An embodiment of the present invention provides a computer-readable storage medium, on which an application is stored. When the program is executed by a processor, a method for cross-identifying rays where a camera 2D point is located is implemented in any of the above embodiments. The computer-readable storage medium includes, but is not limited to, any type of disk (including floppy disk, hard disk, optical disk, CD-ROM, and magneto-optical disk), ROM (Read-Only Memory), RAM (Random Access Memory), EPROM (Erasable Programmable Read-Only Memory), EEPROM (Electrically Erasable Programmable Read-Only Memory), flash memory, magnetic card or optical card. That is, the storage device includes any medium that stores or transmits information in a readable form by a device (for example, a computer, a mobile phone), which can be a read-only memory, a disk or an optical disk, etc.
[0085] also, Figure 4 It is a schematic diagram of the structural composition of a computer device in an embodiment of the present invention.
[0086] The embodiment of the present invention also provides a computer device, such as Figure 4 The computer device includes a processor 302, a memory 303, an input unit 304, a display unit 305 and other devices. Those skilled in the art will understand that Figure 4The device structure device shown does not constitute a limitation on all devices, and may include more or fewer components than shown, or combine certain components. The memory 303 can be used to store the application 301 and various functional modules, and the processor 302 runs the application 301 stored in the memory 303, thereby executing various functional applications and data processing of the device. The memory can be an internal memory or an external memory, or include both internal and external memories. The internal memory may include a read-only memory (ROM), a programmable ROM (PROM), an electrically programmable ROM (EPROM), an electrically erasable programmable ROM (EEPROM), a flash memory, or a random access memory. The external memory may include a hard disk, a floppy disk, a ZIP disk, a U disk, a magnetic tape, etc. The memory disclosed in the present invention includes but is not limited to these types of memories. The memory disclosed in the present invention is only used as an example and not as a limitation.
[0087] The input unit 304 is used to receive the input of the signal and the keyword input by the user. The input unit 304 may include a touch panel and other input devices. The touch panel can collect the user's touch operation on or near it (such as the user's operation on or near the touch panel using any suitable object or accessory such as a finger, stylus, etc.), and drive the corresponding connection device according to a pre-set program; other input devices may include but are not limited to one or more of a physical keyboard, a function key (such as a playback control key, a switch key, etc.), a trackball, a mouse, a joystick, etc. The display unit 305 can be used to display the information input by the user or the information provided to the user and various menus of the terminal device. The display unit 305 can be in the form of a liquid crystal display, an organic light emitting diode, etc. The processor 302 is the control center of the terminal device, which uses various interfaces and lines to connect the various parts of the entire device, and executes various functions and processes data by running or executing software programs and / or modules stored in the memory 303, and calling the data stored in the memory.
[0088] As an embodiment, the computer device includes: one or more processors 302, a memory 303, and one or more applications 301, wherein the one or more applications 301 are stored in the memory 303 and are configured to be executed by the one or more processors 302, and the one or more applications 301 are configured to execute a method for intersection identification of rays where a camera 2D point is located in any of the above embodiments.
[0089] In addition, the above is a detailed introduction to the cross-recognition method, device, computer equipment and storage medium for the rays where the camera 2D point is located provided in an embodiment of the present invention. Specific examples are used herein to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea; at the same time, for those skilled in the art, according to the idea of the present invention, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.
Claims
1. A method for cross-recognition of rays where a camera 2D point is located, characterized in that: The method comprises: When N 2D points with different numbers are formed in the camera, a corresponding tubular object is generated in the spatial scene for each 2D point, and then each tubular object is bundled with a corresponding number; Starting from i=1, obtain the i-th ray generated by the i-th 2D point, and then identify whether the i-th ray collides with at least one of the other N-1 tubular objects with different numbers; If yes, record the numbers of the K tubular objects that collide with the i-th ray, and then calculate the intersection position of the i-th ray with each of the tubular objects, where 1≤K≤N-1; Assign i+1 to i, and return to perform the collision recognition operation of the ray generated by the next 2D point if i≤N; The step of generating a corresponding tubular object for each 2D point in the spatial scene includes: The optical center position of the camera is obtained as c, and the closest distance allowed to capture the ray generated by any 2D point in the space scene is t min and the farthest distance is t max , and the direction information of the ray generated by the i-th 2D point is d i ; Define the distance error value when the rays generated by any two 2D points intersect, and create a basic circle with the distance error value as the radius; The basic circle is stretched to obtain a tubular object corresponding to the i-th 2D point. At this time, the center position of one end face in the tubular object is defined as c+t min d i And the center position of the other end face is c+t max d i ; The step of identifying whether the i-th ray collides with at least one tubular object among N-1 tubular objects with different numbers comprises: Starting from j=1, create a spatial bounding box for the j-th tubular object; Taking the XOY plane in the spatial scene as a reference, the spatial bounding box is flattened and expanded in a cross shape, thereby obtaining a fixed boundary interval to cover the sizes of each plane of the spatial bounding box in the expanded state; After identifying whether the i-th ray intersects the fixed boundary interval, j+1 is assigned to j, and when it is determined that j≤N-1, the operation of returning to perform a collision identification operation between the i-th ray and the next tubular object is performed.
2. The method for cross-recognition of rays where camera 2D points are located according to claim 1, characterized in that: When the spatial bounding box is unfolded on the XOY plane, the fixed boundary interval limits the coordinate position of any point on the four planes placed closely horizontally to fall within the range of [y0, y1] on the y-axis direction, and limits the coordinate position of any point on the three planes placed closely vertically to fall within the range of [x0, x1] on the x-axis direction.
3. The method for cross-recognition of rays where camera 2D points are located according to claim 2, characterized in that: The identifying whether the i-th ray intersects the fixed boundary interval includes: Based on the fact that the fixed boundary interval has four boundary lines, the distance value when the i-th ray intersects with the boundary line x=x0 is calculated as t. x0 , the distance value when the i-th ray intersects the boundary line x=x1 is t x1 , the distance value when the i-th ray intersects the boundary line y=y0 is t y0 And the distance value when the i-th ray intersects the boundary line y=y1 is t y1 ; Determine whether the above four distance values satisfy max(t x0 ,t y0 ) <min(t x1 ,t y1 ) conditions; If yes, it is determined that the i-th ray intersects the fixed boundary interval, and the j-th tubular object is marked and distinguished; If not, it is determined that the i-th ray does not intersect the fixed boundary interval.
4. The method for cross-recognition of rays where camera 2D points are located according to claim 1, characterized in that: The step of calculating the intersection position between the i-th ray and each of the tubular objects comprises: Based on the fact that any ray is emitted in parallel from the center of the tubular object with the corresponding number, when the i-th ray collides with the j-th tubular object, the j-th ray with the same number as the j-th tubular object is obtained; Extract a point P1 from the i-th ray and a point Q1 from the j-th ray, and make the line segment formed between point P1 and point Q1 the shortest distance between the i-th ray and the j-th ray; According to the coordinate position of point P1 and the coordinate position of point Q1, the center point of the line segment formed between point P1 and point Q1 is obtained, and the coordinate position of the center point is defined as the intersection position of the i-th ray and the j-th tubular object.
5. The method for cross-recognition of rays where camera 2D points are located according to claim 1, characterized in that: After identifying whether the i-th ray collides with at least one tubular object among other N-1 tubular objects with different numbers, the method further includes: If not, assign i+1 to i, and return to perform the collision identification operation of the ray generated by the next 2D point when it is judged that i≤N.
6. A device for identifying the intersection of rays where a camera 2D point is located, characterized in that: The device comprises: A generation module, used for generating a corresponding tubular object in the space scene for each 2D point when N 2D points with different numbers are formed in the camera, and then bundling each tubular object with a corresponding number; an identification module, for obtaining the i-th ray generated by the i-th 2D point starting from i=1, and then identifying whether the i-th ray collides with at least one tubular object among N-1 tubular objects with different numbers; A calculation module, for recording the numbers of the K tubular objects that collide with the i-th ray when it is identified that the i-th ray collides with at least one tubular object among N-1 tubular objects with different numbers, and then calculating the intersection position of the i-th ray with each of the tubular objects, where 1≤K≤N-1; The return module is used to assign i+1 to i, and return to perform the collision recognition operation of the ray generated by the next 2D point when it is judged that i≤N; The step of generating a corresponding tubular object for each 2D point in the spatial scene includes: The optical center position of the camera is obtained as c, and the closest distance allowed to capture the ray generated by any 2D point in the space scene is t min and the farthest distance is t max , and the direction information of the ray generated by the i-th 2D point is d i ; Define the distance error value when the rays generated by any two 2D points intersect, and create a basic circle with the distance error value as the radius; The basic circle is stretched to obtain a tubular object corresponding to the i-th 2D point. At this time, the center position of one end face in the tubular object is defined as c+t min d i And the center position of the other end face is c+t max d i ; The step of identifying whether the i-th ray collides with at least one tubular object among N-1 tubular objects with different numbers comprises: Starting from j=1, create a spatial bounding box for the j-th tubular object; Taking the XOY plane in the spatial scene as a reference, the spatial bounding box is flattened and expanded in a cross shape, thereby obtaining a fixed boundary interval to cover the sizes of each plane of the spatial bounding box in the expanded state; After identifying whether the i-th ray intersects the fixed boundary interval, j+1 is assigned to j, and when it is determined that j≤N-1, the operation of returning to perform a collision identification operation between the i-th ray and the next tubular object is performed.
7. A computer device comprising a memory, a processor, and an application program stored in the memory and executable on the processor, characterized in that: When the processor executes the application, the steps of the method according to any one of claims 1 to 5 are implemented.
8. A computer-readable storage medium having an application program stored thereon, characterized in that: When the application is executed by a processor, the steps of the method according to any one of claims 1 to 5 are implemented.
Citation Information
Patent Citations
Method and device for detecting collision between colliders in real-time virtual scene
CN105488851A
Virtual scene data processing method and device, equipment and readable storage medium
CN111921202A