Disclosure of Invention
The disclosure is in part intended to introduce concepts in a simplified form that are further described below in the detailed description. The disclosure is not intended to identify key features or essential features of the claimed subject matter, nor is it intended to be used to limit the scope of the claimed subject matter.
Some embodiments of the present disclosure propose a method, an apparatus, and a terminal device for planning a path on a video frame, to solve one or more of the technical problems mentioned in the background section above.
In a first aspect, some embodiments of the present disclosure provide a method of planning a path on a video frame, the method comprising: acquiring a target image to be processed, a starting point coordinate and an ending point coordinate, wherein the target image is a camera picture image, and the starting point coordinate and the ending point coordinate are pixel coordinates in the target image; generating a target starting point coordinate and a target ending point coordinate based on the starting point coordinate and the ending point coordinate, wherein the target starting point coordinate and the target ending point coordinate are the earth coordinates in the physical space; generating a target path coordinate sequence based on the target starting point coordinate and the target ending point coordinate; generating an image path coordinate sequence based on the target path coordinate sequence; and transmitting the target image and the image path coordinate sequence to a target device with a display function, wherein the target device displays the target image and the image path coordinate sequence.
In some embodiments, the generating the target start point coordinates and target end point coordinates based on the start point coordinates and the end point coordinates includes:
generating a target start point coordinate based on the start point coordinate using the following formula:
wherein, (u) 1 ,v 1 ) For the start point coordinates, the right lower corner 1 characterizes the start point, (X) 1 ,Y 1 ) For the target starting point coordinates, R is a rotation matrix, t is a translation matrix, R and t are predetermined matrices, s is a predetermined camera depth value, and M is a predetermined camera parameter matrix;
generating target endpoint coordinates based on the endpoint coordinates using:
wherein, (u) 2 ,v 2 ) For the termination point coordinates, the lower right corner mark 2 characterizes the termination point, (X) 2 ,Y 2 ) For the target end point coordinates, R is a rotation matrix, t is a translation matrix, R and t are predetermined matrices, s is a predetermined camera depth value, and M is a predetermined camera parameter matrix.
In some embodiments, the converting the target path coordinates to image path coordinates includes:
the target path coordinates are converted to image path coordinates using the following equation:
wherein, (u) i ,v i ) For image path coordinates, the lower right corner i characterizes the target path, (X) i ,Y i ) For the target path coordinates, R is a rotation matrix, t is a translation matrix, R and t are predetermined matrices, s is a predetermined camera depth value, and M is a predetermined camera parameter matrix.
In a second aspect, some embodiments of the present disclosure provide an apparatus for planning an optimal path on a video frame, the apparatus comprising: the receiving unit is configured to acquire a target image to be processed, a starting point coordinate and an ending point coordinate, wherein the target image is a camera picture image, and the starting point coordinate and the ending point coordinate are pixel coordinates in the target image; a first generation unit configured to generate a target start point coordinate and a target end point coordinate based on the start point coordinate and the end point coordinate, wherein the target start point coordinate and the target end point coordinate are earth coordinates in a physical space; a second generation unit configured to generate a target path coordinate sequence based on the target start point coordinate and the target end point coordinate; a third generation unit configured to generate an image path coordinate sequence based on the target path coordinate sequence; and a display unit configured to transmit the target image and the image path coordinate sequence to a target device having a display function, wherein the target device displays the target image and the image path coordinate sequence.
In a third aspect, some embodiments of the present disclosure provide a terminal device, including: one or more processors; a storage device having one or more programs stored thereon, which when executed by one or more processors, cause the one or more processors to implement the method as in any of the first aspects.
In a fourth aspect, some embodiments of the present disclosure provide a computer readable storage medium having a computer program stored thereon, wherein the program when executed by a processor implements a method as in any of the first aspects.
The above embodiments of the present disclosure have the following advantageous effects: according to the method for planning the optimal path on the video picture, disclosed by some embodiments, the target path coordinate sequence can be generated according to the starting point coordinates and the ending point coordinates in the target image, the target path coordinate sequence is converted into the image path coordinate sequence, the target image and the image path coordinate sequence are directly displayed by using the target equipment, so that the path planning in the video picture image to be processed is directly planned, and the path planning efficiency is improved. In particular, the inventors found that the reason why the best path cannot be planned on real-time video and the route track is displayed superimposed on the video layer is that: in the prior art, only path planning is performed in a two-dimensional/three-dimensional map model, and a starting point and an ending point cannot be set directly on a real-time video picture. Based on this, first, some embodiments of the present disclosure acquire a target image to be processed, a start point coordinate, an end point coordinate. The target image is a camera picture image captured in real time, and the starting point coordinates and the ending point coordinates are pixel coordinates in the target image. And secondly, generating a target starting point coordinate and a target ending point coordinate based on the starting point coordinate and the ending point coordinate. Wherein the target start point coordinates and the target end point coordinates are earth coordinates in physical space. And generating a target path coordinate sequence based on the target start point coordinate and the target end point coordinate, so as to generate the target path coordinate sequence in the earth space after converting the start point coordinate and the end point coordinate in the two-dimensional/three-dimensional map model into the earth coordinate in the physical space. Then, an image path coordinate sequence is generated based on the target path coordinate sequence. The shortest path in the geospatial is converted back to the shortest path in the two-dimensional/three-dimensional map model. And finally, transmitting the target image and the image path coordinate sequence to target equipment with a display function. Wherein the target device displays the target image and the image path coordinate sequence. The target device displays the route track in a superposition manner on the video layer, so that the problem of determining and displaying the shortest path in the video directly is solved, and the user experience is improved.
Detailed Description
Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While certain embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be embodied in various forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete. It should be understood that the drawings and embodiments of the present disclosure are for illustration purposes only and are not intended to limit the scope of the present disclosure.
It should be noted that, for convenience of description, only the portions related to the present invention are shown in the drawings. Embodiments of the present disclosure and features of embodiments may be combined with each other without conflict.
It should be noted that the terms "first," "second," and the like in this disclosure are merely used to distinguish between different devices, modules, or units and are not used to define an order or interdependence of functions performed by the devices, modules, or units.
It should be noted that references to "one", "a plurality" and "a plurality" in this disclosure are intended to be illustrative rather than limiting, and those of ordinary skill in the art will appreciate that "one or more" is intended to be understood as "one or more" unless the context clearly indicates otherwise.
The present disclosure will be described in detail below with reference to the accompanying drawings in conjunction with embodiments.
Fig. 1 illustrates an exemplary system architecture 100 to which an embodiment of a method of planning a path on a video picture of the present disclosure may be applied.
As shown in fig. 1, a system architecture 100 may include terminal devices 101, 102, 103, a network 104, and a server 105. The network 104 is used as a medium to provide communication links between the terminal devices 101, 102, 103 and the server 105. The network 104 may include various connection types, such as wired, wireless communication links, or fiber optic cables, among others.
The user may interact with the server 105 via the network 104 using the terminal devices 101, 102, 103 to receive or send messages or the like. Various communication client applications, such as a data processing application, an information generating application, a path planning application, etc., may be installed on the terminal devices 101, 102, 103.
The terminal devices 101, 102, 103 may be hardware or software. When the terminal devices 101, 102, 103 are hardware, they may be various terminal devices with display screens including, but not limited to, smartphones, tablets, laptop and desktop computers, and the like. When the terminal apparatuses 101, 102, 103 are software, they can be installed in the above-listed terminal apparatuses. Which may be implemented as a plurality of software or software modules (e.g., to provide an initial sequence of information and a set of candidate information, etc.), or as a single software or software module. The present invention is not particularly limited herein.
The server 105 may be a server that provides various services, such as a server that stores a target image to be processed, a start point coordinate, an end point coordinate, and the like, which are input by the terminal devices 101, 102, 103. The server may process the received target image to be processed, the start point coordinates, and the end point coordinates, and feed back the processing result (e.g., the target path coordinate sequence) to the terminal device.
It should be noted that, the method for planning a path on a video frame provided by the embodiment of the present disclosure may be performed by the server 105 or the terminal device.
It should be noted that, the local area of the server 105 may also directly store the target image to be processed, the start point coordinate, and the end point coordinate, and the server 105 may directly extract the local target image to be processed, the start point coordinate, and the end point coordinate, and obtain the image path coordinate sequence after processing, where the exemplary system architecture 100 may not include the terminal devices 101, 102, 103, and the network 104.
It should also be noted that the terminal devices 101, 102, 103 may also have installed therein a path planning application on the video screen, in which case the processing method may also be performed by the terminal devices 101, 102, 103. At this point, the exemplary system architecture 100 may also not include the server 105 and the network 104.
The server 105 may be hardware or software. When the server 105 is hardware, it may be implemented as a distributed server cluster formed by a plurality of servers, or as a single server. When the server is software, it may be implemented as a plurality of software or software modules (e.g., to provide path planning services over video pictures), or as a single software or software module. The present invention is not particularly limited herein.
It should be understood that the number of terminal devices, networks and servers in fig. 1 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
With continued reference to fig. 2, a flow 200 of some embodiments of a method of planning a path on a video frame in accordance with the present disclosure is shown. The method for planning the path on the video picture comprises the following steps:
step 201, obtaining a target image to be processed, a starting point coordinate and an ending point coordinate.
In some embodiments, an execution subject (e.g., a server shown in fig. 1) of a method of planning a path on a video frame acquires a target image to be processed, a start point coordinate, and an end point coordinate. The target image is a camera picture image, and the starting point coordinates and the ending point coordinates are pixel coordinates in the target image. Specifically, the target image may be a frame of image captured by capturing in real time from video played by the camera. The start point coordinates and the end point coordinates may be coordinates in an image coordinate system.
Step 202, generating a target start point coordinate and a target end point coordinate based on the start point coordinate and the end point coordinate.
In some embodiments, the execution body generates the target start point coordinates and the target end point coordinates based on the start point coordinates and the end point coordinates. Specifically, the angular offset of the start point coordinate and the end point coordinate in the camera mirror surface can be calculated according to the light path tracking mode, and the three-dimensional transmitted light and the three-dimensional penetration calculation of the earth model can be realized through the position, the height, the gesture and the angular deviation of the camera, so that the earth coordinate position of the intersection point can be determined. Specifically, the target start point coordinates and the target end point coordinates may be coordinates in the earth coordinate system.
Specifically, the target start point coordinates may be generated based on the start point coordinates using the following equation:
wherein, (u) 1 ,v 1 ) The right lower corner mark 1 characterizes the starting point as the starting point coordinate. (X) 1 ,Y 1 ) For the coordinates of the starting point of the object, R is a rotation matrix, t is a translation matrix, and R and t are predeterminedS is a predetermined camera depth value. M is a predetermined matrix of camera parameters. Specifically, R, t, s, and M are all camera-related predetermined parameters, determined by the particular video camera.
Specifically, the target endpoint coordinates may be generated based on the endpoint coordinates using the following equation:
wherein, (u) 2 ,v 2 ) The lower right corner mark 2 characterizes the termination point as termination point coordinates. (X) 2 ,Y 2 ) For the target end point coordinates, R is the rotation matrix, t is the translation matrix, R and t are predetermined matrices, and s is a predetermined camera depth value. M is a predetermined matrix of camera parameters. Specifically, R, t, s, and M are all camera-related predetermined parameters, determined by the particular video camera.
Specifically, the target starting point and the target ending point may be generated by using a coordinate conversion method in the image space and the physical space in consideration of the distortion effect of the camera.
In step 203, a target path coordinate sequence is generated based on the target start point coordinates and the target end point coordinates.
In some embodiments, the execution body generates the target path coordinate sequence based on the target start point coordinates and the target end point coordinates.
Optionally, for each pixel point in the target image, determining a target pixel coordinate of the pixel point to obtain a target pixel set. And deleting the target starting point coordinates from the target pixel set. Specifically, the target pixel set is obtained by deleting the target starting point. The set of target pixels includes pixels of the target image other than the target starting point.
Optionally, a first coordinate sequence is generated. Wherein the first coordinate sequence is an empty set. And placing the coordinates of the starting point of the target into the first coordinate sequence. The set of target pixels is determined as a second sequence of coordinates. Selecting a first coordinate from the first coordinate sequence, and executing the following step one:
step one: and determining candidate first coordinates according to the first coordinate and the second coordinate sequence. The candidate first coordinates are coordinates with the shortest distance from the first coordinates, and the candidate first coordinates are coordinates in the second coordinate sequence. Candidate first coordinates are deleted from the second coordinate sequence. The candidate first coordinates are placed into a first coordinate sequence. In response to the target termination point coordinates being placed in the first coordinate sequence, the first coordinate sequence is determined as a target path coordinate sequence. Specifically, the candidate first coordinates may be determined by a disco tesla algorithm, or may be determined by a veronide algorithm. Specifically, the candidate first coordinates may be coordinates satisfying the driving line requirements, and the candidate first coordinates may also be coordinates satisfying the driving line requirements. The candidate first coordinates may also be coordinates that meet the pedestrian route requirements.
Step 204, generating an image path coordinate sequence based on the target path coordinate sequence.
In some embodiments, the execution body generates the image path coordinate sequence based on the target path coordinate sequence. Optionally, for each target path coordinate in the sequence of target path coordinates, the target path coordinate is converted to an image path coordinate to obtain the sequence of image path coordinates. For each target path coordinate in the sequence of target path coordinates, the target path coordinate is converted to an image path coordinate using the following equation:
wherein, (u) i ,v i ) For image path coordinates, the lower right corner i characterizes the target path. (X) i ,Y i ) For the target path coordinates, R is a rotation matrix, t is a translation matrix, and R and t are predetermined matrices. s is a predetermined camera depth value and M is a predetermined camera parameter matrix. Specifically, R, t, s and M are all camera-related predetermined parameters, determined by a particular beatAnd (5) video camera determination.
The optional content in steps 202-204 above is: the "technical content of generating an image path coordinate sequence according to a start point and an end point directly defined in a video" is taken as an invention point of an embodiment of the present disclosure, which solves the second technical problem mentioned in the background art, and the direct definition of the start point and the end point in the video only obtains the node position in the video/image, and cannot meet the shortest path application requirement in the real world. ". Factors that lead to failure to meet the demand for shortest path applications in the real world are often as follows: in the prior art, only path planning is performed in a two-dimensional/three-dimensional map model, and the application of path planning in the video playing process cannot be met. If the above factors are solved, the effect of improving the application level of the path planning can be achieved. To achieve this, the present disclosure introduces path planning in the manner of image coordinate system to earth coordinate system conversion. First, the start point coordinates and the end point coordinates in the image coordinate system are converted into target start point coordinates and target end point coordinates in the earth coordinate system. Then, a target path coordinate sequence is determined according to the target start point coordinates and the target end point coordinates. The target path coordinate sequence is the shortest path in the earth coordinate system. Finally, the target path coordinate sequence is converted into an image path coordinate sequence. The image path coordinate sequence is the shortest path in the image coordinate system, which can be subsequently used for direct overlay display in video. The coordinates in the image coordinate system and the earth coordinate system are converted, so that the shortest path can be determined in the image intercepted in real time in the video of the camera, the path planning in the video playing process is met, the application level of the path planning is improved, and the second technical problem is solved.
Step 205, the target image and the image path coordinate sequence are sent to a target device with a display function.
Optionally, the execution subject sends the target image and the image path coordinate sequence to a target device having a display function. Wherein the target device displays the target image and the image path coordinate sequence. Optionally, the target device displays lines corresponding to the image path coordinates in the image path coordinate sequence in the target image in a mode of overlapping the image layers. Specifically, the layer overlapping may be to overlap the image path coordinate sequence according to the brightness of the target image, so as to form the overlapped display effect. Specifically, the image path coordinate sequence and the target image can be combined into one image layer for display through an intersecting, combining or erasing method.
One embodiment, as illustrated in fig. 2, has the following beneficial effects: acquiring a target image to be processed, a starting point coordinate and an ending point coordinate, wherein the target image is a camera picture image; generating a target starting point coordinate and a target ending point coordinate based on the starting point coordinate and the ending point coordinate; generating a target path coordinate sequence; generating an image path coordinate sequence based on the target path coordinate sequence; and transmitting the target image and the image path coordinate sequence to target equipment with a display function. According to the method, a target path coordinate sequence is generated according to the starting point coordinates and the ending point coordinates in the target image, the target path coordinate sequence is converted into an image path coordinate sequence, and the target image and the image path coordinate sequence are directly displayed by using target equipment, so that a path is directly planned in a camera picture image to be processed, and the path planning efficiency is improved.
With further reference to fig. 3, as an implementation of the above method for each of the above figures, the present disclosure provides some embodiments of an apparatus for planning an optimal path on a video frame, which apparatus embodiments correspond to those method embodiments described above in fig. 2, and which apparatus is particularly applicable to various terminal devices.
As shown in fig. 3, an apparatus 300 for planning an optimal path on a video frame according to some embodiments includes: receiving section 301, first generating section 302, second generating section 303, third generating section 304, and display section 305. Wherein the receiving unit 301 is configured to acquire a target image to be processed, a start point coordinate, and an end point coordinate. The target image is a camera picture image, and the starting point coordinates and the ending point coordinates are pixel coordinates in the target image. The first generating unit 302 is configured to generate a target start point coordinate and a target end point coordinate based on the start point coordinate and the end point coordinate. Wherein the target start point coordinates and the target end point coordinates are earth coordinates in physical space. The second generating unit 303 is configured to generate a target path coordinate sequence based on the target start point coordinates and the target end point coordinates. The third generating unit 304 is configured to generate an image path coordinate sequence based on the target path coordinate sequence. The display unit 305 is configured to transmit the target image and the image path coordinate sequence to a target device having a display function. Wherein the target device displays the target image and the image path coordinate sequence.
It will be appreciated that the elements described in the apparatus 300 correspond to the various steps in the method described with reference to fig. 2. Thus, the operations, features and resulting benefits described above with respect to the method are equally applicable to the apparatus 300 and the units contained therein, and are not described in detail herein.
Referring now to FIG. 4, there is illustrated a schematic diagram of a computer system 400 suitable for use in implementing the terminal device of an embodiment of the present disclosure. The terminal device shown in fig. 4 is only one example, and should not impose any limitation on the functions and scope of use of the embodiments of the present disclosure.
As shown in fig. 4, the computer system 400 includes a central processing unit (CPU, central Processing Unit) 401, which can perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM) 402 or a program loaded from a storage section 406 into a random access Memory (RAM, random Access Memory) 403. In RAM403, various programs and data required for the operation of system 400 are also stored. The CPU 401, ROM 402, and RAM403 are connected to each other by a bus 404. An Input/Output (I/O) interface 405 is also connected to bus 404.
The following components are connected to the I/O interface 405: a storage section 406 including a hard disk and the like; and a communication section 407 including a network interface card such as a LAN (local area network ) card, a modem, or the like. The communication section 407 performs communication processing via a network such as the internet. The driver 408 is also connected to the I/O interface 405 as needed. Removable media 409, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like, is installed as needed in drive 408, so that a computer program read therefrom is installed as needed in storage section 406.
In particular, according to embodiments of the present disclosure, the processes described above with reference to flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method shown in the flowcharts. In such an embodiment, the computer program may be downloaded and installed from a network via the communication portion 407, and/or installed from the removable medium 409. The above-described functions defined in the method of the present disclosure are performed when the computer program is executed by a Central Processing Unit (CPU) 401. It should be noted that the computer readable medium described in the present disclosure may be a computer readable signal medium or a computer readable storage medium, or any combination of the two. The computer readable storage medium can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples of the computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this disclosure, a computer-readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In the present disclosure, however, the computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, with the computer-readable program code embodied therein. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, fiber optic cable, RF, etc., or any suitable combination of the foregoing.
Computer program code for carrying out operations of the present disclosure may be written in one or more programming languages, including an object oriented programming language such as Java, smalltalk, C ++ and conventional procedural programming languages, such as the C-language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computer (for example, through the Internet using an Internet service provider).
The flowcharts and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The foregoing description is only of the preferred embodiments of the present disclosure and description of the principles of the technology being employed. It will be appreciated by those skilled in the art that the scope of the invention referred to in this disclosure is not limited to the specific combination of features described above, but encompasses other embodiments in which features described above or their equivalents may be combined in any way without departing from the spirit of the invention. Such as those described above, are mutually substituted with the technical features having similar functions disclosed in the present disclosure (but not limited thereto).