CN111242842B - Image conversion method, terminal and storage medium - Google Patents

Image conversion method, terminal and storage medium Download PDF

Info

Publication number
CN111242842B
CN111242842B CN202010044761.2A CN202010044761A CN111242842B CN 111242842 B CN111242842 B CN 111242842B CN 202010044761 A CN202010044761 A CN 202010044761A CN 111242842 B CN111242842 B CN 111242842B
Authority
CN
China
Prior art keywords
image
coordinates
pixel points
pixel
aerial view
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202010044761.2A
Other languages
Chinese (zh)
Other versions
CN111242842A (en
Inventor
罗年
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Jiangsu Zhongtian Anchi Technology Co ltd
Original Assignee
Jiangsu Zhongtian Anchi Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Jiangsu Zhongtian Anchi Technology Co ltd filed Critical Jiangsu Zhongtian Anchi Technology Co ltd
Priority to CN202010044761.2A priority Critical patent/CN111242842B/en
Publication of CN111242842A publication Critical patent/CN111242842A/en
Application granted granted Critical
Publication of CN111242842B publication Critical patent/CN111242842B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T3/00Geometric image transformations in the plane of the image
    • G06T3/04Context-preserving transformations, e.g. by using an importance map
    • G06T3/047Fisheye or wide-angle transformations
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/80Analysis of captured images to determine intrinsic or extrinsic camera parameters, i.e. camera calibration
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/30Subject of image; Context of image processing
    • G06T2207/30248Vehicle exterior or interior
    • G06T2207/30252Vehicle exterior; Vicinity of vehicle

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Image Processing (AREA)

Abstract

The invention discloses an image conversion method, a terminal and a storage medium, wherein the image conversion method comprises the following steps: calibrating the camera to obtain a perspective transformation matrix; obtaining a corresponding relation between the coordinates of the pixels in the first aerial view image of the first image and the coordinates of the pixels in the first image according to the perspective transformation matrix, the preset resolution and the coordinates of the pixels in the first image acquired by the camera; establishing a first coordinate conversion table according to the corresponding relation between the coordinates of the pixel points in the first aerial view image and the coordinates of the pixel points in the first image; and acquiring a second image in real time through the camera, and acquiring a second aerial view image of the second image according to the second image and the first coordinate conversion table. The method realizes image conversion by a table look-up method, saves the image conversion time and meets the requirement of real-time.

Description

Image conversion method, terminal and storage medium
Technical Field
The invention relates to the technical field of automatic driving and auxiliary driving of automobiles, in particular to an image conversion method, a terminal and a storage medium.
Background
At present, in the field of automatic driving and auxiliary driving of automobiles, a positioning method based on a camera mainly comprises the steps of shooting an original image through the camera and obtaining a bird's-eye view image through image conversion, and positioning and analyzing the automobile according to the original image and the bird's-eye view image.
The foregoing is provided merely for the purpose of facilitating understanding of the technical solutions of the present invention and is not intended to represent an admission that the foregoing is prior art.
Disclosure of Invention
The invention mainly aims to provide an image conversion method, a terminal and a storage medium, and aims to solve the problems of low image conversion speed and low instantaneity in an automatic driving and auxiliary driving system of an automobile.
In order to achieve the above object, the image conversion method according to the present invention includes the steps of:
calibrating the camera to obtain a perspective transformation matrix;
obtaining a corresponding relation between the coordinates of the pixels in the first aerial view image of the first image and the coordinates of the pixels in the first image according to the perspective transformation matrix, the preset resolution and the coordinates of the pixels in the first image acquired by the camera;
establishing a first coordinate conversion table according to the corresponding relation between the coordinates of the pixel points in the first aerial view image and the coordinates of the pixel points in the first image;
and acquiring a second image in real time through the camera, and acquiring a second aerial view image of the second image according to the second image and the first coordinate conversion table.
Optionally, the step of obtaining the correspondence between the coordinates of the pixel point in the first aerial view image and the coordinates of the pixel point in the first image according to the perspective transformation matrix, the coordinates of the pixel point in the first image acquired by the camera, and the preset resolution includes:
Obtaining world coordinates corresponding to the coordinates of the pixel points in the first image according to the perspective transformation matrix and the coordinates of the pixel points in the first image;
obtaining coordinates of pixel points in the first aerial view image according to world coordinates corresponding to the coordinates of the pixel points in the first image and preset resolution;
and obtaining the corresponding relation between the coordinates of the pixels in the first aerial view image and the coordinates of the pixels in the first image according to the coordinates of the pixels in the first aerial view image and the coordinates of the pixels in the first image.
Optionally, the step of establishing the first coordinate conversion table according to the correspondence between the coordinates of the pixel points in the first aerial view image and the coordinates of the pixel points in the first image includes:
according to the coordinates of the pixel points and the total number of the pixel points in the first aerial view image, a first initial coordinate conversion table is established, wherein the positions of all the cells in the first initial coordinate conversion table are in one-to-one correspondence with the coordinates of the pixel points in the first aerial view image;
according to the corresponding relation between the coordinates of the pixel points in the first aerial view image and the coordinates of the pixel points in the first image and the corresponding relation between the positions of all the cells in the first initial coordinate conversion table and the coordinates of the pixel points in the first aerial view image, taking the coordinates of the pixel points in the first image as the numerical values of the corresponding cells in the first initial coordinate conversion table;
The first initial coordinate conversion table, each cell having a corresponding value, is taken as the first coordinate conversion table.
Optionally, the step of taking the coordinates of the pixel point in the first image as the numerical value of the corresponding cell in the first initial coordinate conversion table according to the correspondence between the coordinates of the pixel point in the first aerial image and the coordinates of the pixel point in the first image and the correspondence between the positions of each cell in the first initial coordinate conversion table and the coordinates of the pixel point in the first aerial image includes:
converting coordinates of pixel points in the first image into corresponding hexadecimal values according to a preset shift algorithm, wherein the preset shift algorithm is that A= ((u &0 xffff) < < 16) | (v &0 xffff), (u, v) are coordinates of the pixel points in the first image, and A is the hexadecimal values corresponding to the coordinates (u, v) of the pixel points in the first image;
and taking a hexadecimal value corresponding to the coordinates of the pixel point in the first image as the numerical value of the corresponding cell in the first initial coordinate conversion table according to the corresponding relation between the coordinates of the pixel point in the first aerial view image and the coordinates of the pixel point in the first image and the corresponding relation between the positions of each cell in the first initial coordinate conversion table and the coordinates of the pixel point in the first aerial view image.
Optionally, the step of acquiring the second image in real time through the camera, and obtaining the second aerial view image corresponding to the second image according to the second image and the established first coordinate conversion table includes:
inquiring and obtaining coordinates of pixel points in a second image corresponding to the coordinates of the pixel points in a second aerial view image of the second image from the first coordinate conversion table;
obtaining a pixel value corresponding to the pixel point in the second aerial view image according to the coordinate of the pixel point in the second image corresponding to the coordinate of the pixel point in the obtained second aerial view image and the pixel value corresponding to the pixel point in the second image;
and obtaining the second aerial view image according to the coordinates of each pixel point in the second aerial view image and the corresponding pixel value.
Optionally, the step of obtaining the correspondence between the coordinates of the pixel point in the first aerial view image and the coordinates of the pixel point in the first image according to the perspective transformation matrix, the preset resolution and the coordinates of the pixel point in the first image acquired by the camera further includes:
establishing a second conversion numerical value table according to the coordinates of the pixel points in the first aerial view image and the coordinates of the pixel points in the first image;
acquiring a third aerial view image;
inquiring and obtaining coordinates of pixel points in the third aerial view image corresponding to the coordinates of the pixel points in the original image of the third aerial view image from the first coordinate conversion table;
Obtaining a pixel value corresponding to a pixel point in the original image according to the obtained coordinate of the pixel point in the third aerial view image corresponding to the coordinate of the pixel point in the original image and the pixel value corresponding to the pixel point in the third aerial view image;
and obtaining the original image according to the coordinates of the pixel points in the original image and the corresponding pixel values.
Optionally, the step of establishing the second conversion value table according to the coordinates of each pixel point in the first aerial view image and the coordinates of each pixel point in the first image includes:
establishing a second initial coordinate conversion table according to the coordinates of the pixel points in the first image and the total number of the pixel points, wherein the positions of all the cells in the second initial coordinate conversion table are in one-to-one correspondence with the coordinates of the pixel points in the first image;
according to the corresponding relation between the coordinates of the pixel points in the first aerial view image and the coordinates of the pixel points in the first image and the corresponding relation between the positions of all the cells in the second initial coordinate conversion table and the coordinates of the pixel points in the first image, taking the coordinates of the pixel points in the first aerial view image as the numerical values of the corresponding cells in the second initial coordinate conversion table;
and taking the second initial coordinate conversion table with corresponding numerical values of each cell as a second coordinate conversion table.
Optionally, the step of taking the coordinates of the pixel point in the first aerial view image as the numerical value of the corresponding cell in the second initial coordinate conversion table according to the correspondence between the coordinates of the pixel point in the first aerial view image and the coordinates of the pixel point in the first image and the correspondence between the positions of each cell in the second initial coordinate conversion table and the coordinates of the pixel point in the first image includes:
according to a preset shift algorithm, converting coordinates of the pixel points in the first aerial view image into corresponding hexadecimal values, wherein the preset shift algorithm is B= ((w &0 xffff) < < 16) | (h &0 xffff), (w, h) are coordinates of the pixel points in the first image, and B is the hexadecimal value corresponding to the coordinates (w, h) of the pixel points in the first aerial view image;
and taking a hexadecimal value corresponding to the coordinates of the pixel point in the first aerial view image as the numerical value of the corresponding cell in the second initial coordinate conversion table according to the corresponding relation between the coordinates of the pixel point in the first aerial view image and the coordinates of the pixel point in the first image and the corresponding relation between the positions of each cell in the second initial coordinate conversion table and the coordinates of the pixel point in the first image.
To achieve the above object, the present invention also proposes a terminal comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the steps of the image conversion method as described above when executing the program.
To achieve the above object, the present invention also proposes a storage medium having stored thereon a computer program which, when executed by a processor, implements the steps of the image conversion method as described above.
In the image conversion method, a perspective transformation matrix is obtained by calibrating a camera; obtaining a corresponding relation between the coordinates of the pixels in the first aerial view image of the first image and the coordinates of the pixels in the first image according to the perspective transformation matrix, the preset resolution and the coordinates of the pixels in the first image acquired by the camera; establishing a first coordinate conversion table according to the corresponding relation between the coordinates of the pixel points in the first aerial view image and the coordinates of the pixel points in the first image; the second image is acquired in real time through the camera, and a second aerial view image of the second image is obtained according to the second image and the first coordinate conversion table, so that the quick conversion can be realized through a table lookup method when the original image is converted into the aerial view, the time consumption when the images are mutually converted is effectively reduced, and the performances of the automatic driving and auxiliary driving system are greatly improved.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings that are required in the embodiments or the description of the prior art will be briefly described, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and other drawings may be obtained according to the structures shown in these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a schematic diagram of a terminal structure of a hardware operating environment according to an embodiment of the present invention;
FIG. 2 is a flowchart of a first embodiment of an image conversion method according to the present invention;
FIG. 3 is a detailed flowchart of step S200 in the first embodiment of the image conversion method of the present invention;
FIG. 4 is a detailed flowchart of step S300 in the first embodiment of the image conversion method of the present invention;
FIG. 5 is a flowchart illustrating the refinement of step S400 in the first embodiment of the image conversion method according to the present invention;
fig. 6 is a flowchart of a second embodiment of the image conversion method of the present invention.
The achievement of the objects, functional features and advantages of the present invention will be further described with reference to the accompanying drawings, in conjunction with the embodiments.
Detailed Description
The following description of the embodiments of the present invention will be made clearly and fully with reference to the accompanying drawings, in which it is evident that the embodiments described are only some, but not all embodiments of the invention. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
The embodiment of the invention provides an image conversion method, a terminal and a storage medium.
As shown in fig. 1, the method of the present invention is applicable to a terminal, which may be an automobile. The terminal may include: a processor 1001, such as a CPU, a communication bus 1002, a user interface 1003, a network interface 1004, and a memory 1005. Wherein the communication bus 1002 is used to enable connected communication between these components. The user interface 1003 may include a touch pad, touch screen, keyboard, and the optional user interface 1003 may also include a standard wired interface, wireless interface. The network interface 1004 may optionally include a standard wired interface, a wireless interface (e.g., WI-FI interface). The memory 1005 may be a flash RAM memory or a stable memory (non-volatile memory), such as a disk memory. The memory 1005 may also optionally be a storage device separate from the processor 1001 described above. The terminal further comprises a camera, wherein the camera is used for acquiring images of a preset scene area in real time.
Optionally, the terminal may also include RF (Radio Frequency) circuitry, audio circuitry, wiFi modules, and the like. Of course, the terminal may also be configured with other sensors such as gyroscopes, barometers, hygrometers, thermometers, and the like, which are not described herein.
It will be appreciated by those skilled in the art that the terminal structure shown in fig. 1 is not limiting of the terminal and may include more or fewer components than shown, or may combine certain components, or a different arrangement of components.
As shown in fig. 1, an operating system, a network communication module, a user interface module, and a computer program may be included in the memory 1005, which is a type of computer storage medium.
In the terminal shown in fig. 1, the processor 1001 may be configured to call an image conversion program stored in the memory 1005 and perform the following operations:
calibrating the camera to obtain a perspective transformation matrix;
obtaining a corresponding relation between the coordinates of the pixels in the first aerial view image of the first image and the coordinates of the pixels in the first image according to the perspective transformation matrix, the preset resolution and the coordinates of the pixels in the first image acquired by the camera;
establishing a first coordinate conversion table according to the corresponding relation between the coordinates of the pixel points in the first aerial view image and the coordinates of the pixel points in the first image;
and acquiring a second image in real time through the camera, and acquiring a second aerial view image of the second image according to the second image and the first coordinate conversion table.
Further, the processor 1001 may call a computer program stored in the memory 1005, and further perform the following operations:
obtaining world coordinates corresponding to the coordinates of the pixel points in the first image according to the perspective transformation matrix and the coordinates of the pixel points in the first image;
obtaining coordinates of pixel points in the first aerial view image according to world coordinates corresponding to the coordinates of the pixel points in the first image and preset resolution;
and obtaining the corresponding relation between the coordinates of the pixels in the first aerial view image and the coordinates of the pixels in the first image according to the coordinates of the pixels in the first aerial view image and the coordinates of the pixels in the first image.
Further, the processor 1001 may call a computer program stored in the memory 1005, and further perform the following operations:
according to the coordinates of the pixel points and the total number of the pixel points in the first aerial view image, a first initial coordinate conversion table is established, wherein the positions of all the cells in the first initial coordinate conversion table are in one-to-one correspondence with the coordinates of the pixel points in the first aerial view image;
according to the corresponding relation between the coordinates of the pixel points in the first aerial view image and the coordinates of the pixel points in the first image and the corresponding relation between the positions of all the cells in the first initial coordinate conversion table and the coordinates of the pixel points in the first aerial view image, taking the coordinates of the pixel points in the first image as the numerical values of the corresponding cells in the first initial coordinate conversion table;
The first initial coordinate conversion table, each cell having a corresponding value, is taken as the first coordinate conversion table.
Further, the processor 1001 may call a computer program stored in the memory 1005, and further perform the following operations:
converting coordinates of pixel points in the first image into corresponding hexadecimal values according to a preset shift algorithm, wherein the preset shift algorithm is that A= ((u &0 xffff) < < 16) | (v &0 xffff), (u, v) are coordinates of the pixel points in the first image, and A is the hexadecimal values corresponding to the coordinates (u, v) of the pixel points in the first image;
and taking a hexadecimal value corresponding to the coordinates of the pixel point in the first image as the numerical value of the corresponding cell in the first initial coordinate conversion table according to the corresponding relation between the coordinates of the pixel point in the first aerial view image and the coordinates of the pixel point in the first image and the corresponding relation between the positions of each cell in the first initial coordinate conversion table and the coordinates of the pixel point in the first aerial view image.
Further, the processor 1001 may call a computer program stored in the memory 1005, and further perform the following operations:
inquiring and obtaining coordinates of pixel points in a second image corresponding to the coordinates of the pixel points in a second aerial view image of the second image from the first coordinate conversion table;
Obtaining a pixel value corresponding to the pixel point in the second aerial view image according to the coordinate of the pixel point in the second image corresponding to the coordinate of the pixel point in the obtained second aerial view image and the pixel value corresponding to the pixel point in the second image;
and obtaining the second aerial view image according to the coordinates of each pixel point in the second aerial view image and the corresponding pixel value.
Further, the processor 1001 may call a computer program stored in the memory 1005, and further perform the following operations:
establishing a second conversion numerical value table according to the coordinates of the pixel points in the first aerial view image and the coordinates of the pixel points in the first image;
acquiring a third aerial view image;
inquiring and obtaining coordinates of pixel points in the third aerial view image corresponding to the coordinates of the pixel points in the original image of the third aerial view image from the first coordinate conversion table;
obtaining a pixel value corresponding to a pixel point in the original image according to the obtained coordinate of the pixel point in the third aerial view image corresponding to the coordinate of the pixel point in the original image and the pixel value corresponding to the pixel point in the third aerial view image;
and obtaining the original image according to the coordinates of the pixel points in the original image and the corresponding pixel values.
Further, the processor 1001 may call a computer program stored in the memory 1005, and further perform the following operations:
Establishing a second initial coordinate conversion table according to the coordinates of the pixel points in the first image and the total number of the pixel points, wherein the positions of all the cells in the second initial coordinate conversion table are in one-to-one correspondence with the coordinates of the pixel points in the first image;
according to the corresponding relation between the coordinates of the pixel points in the first aerial view image and the coordinates of the pixel points in the first image and the corresponding relation between the positions of all the cells in the second initial coordinate conversion table and the coordinates of the pixel points in the first image, taking the coordinates of the pixel points in the first aerial view image as the numerical values of the corresponding cells in the second initial coordinate conversion table;
and taking the second initial coordinate conversion table with corresponding numerical values of each cell as a second coordinate conversion table.
Further, the processor 1001 may call a computer program stored in the memory 1005, and further perform the following operations:
according to a preset shift algorithm, converting coordinates of the pixel points in the first aerial view image into corresponding hexadecimal values, wherein the preset shift algorithm is B= ((w &0 xffff) < < 16) | (h &0 xffff), (w, h) are coordinates of the pixel points in the first image, and B is the hexadecimal value corresponding to the coordinates (w, h) of the pixel points in the first aerial view image;
And taking a hexadecimal value corresponding to the coordinates of the pixel point in the first aerial view image as the numerical value of the corresponding cell in the second initial coordinate conversion table according to the corresponding relation between the coordinates of the pixel point in the first aerial view image and the coordinates of the pixel point in the first image and the corresponding relation between the positions of each cell in the second initial coordinate conversion table and the coordinates of the pixel point in the first image.
Based on the above hardware structure, various embodiments of the image conversion method in the present application are presented.
Referring to fig. 2, a first embodiment of the present application provides an image conversion method including:
step S100, calibrating a camera to obtain a perspective transformation matrix;
in this embodiment, in this scheme, at least one camera disposed in front of the vehicle is mounted on the vehicle, and of course, the cameras may be mounted on other mounting positions on the vehicle, and the number and mounting positions of the cameras may also be changed. For example, four wide-angle cameras are erected in the front, back, left and right directions of the vehicle, including a front camera, a rear camera, a left camera and a right camera, so that the cameras can cover all view field areas around the vehicle. For example, a front camera is arranged above an exhaust fan of the vehicle and is positioned in the center of the width of the vehicle, and the shooting angle of the front camera is a scene which is inclined downwards and outwards from the vehicle body; the right camera is arranged below the right rearview mirror, and the shooting angle of the right camera is inclined downwards to the outside of the vehicle body; the left camera is arranged below the left rearview mirror, and the shooting angle of the left camera is inclined downwards to the outside of the vehicle body; the rear camera is arranged above the license plate and positioned at the center of the width of the vehicle, and the shooting angle of the rear camera is a scene obliquely downwards towards the outside of the vehicle body. The adopted cameras are wide-angle cameras with the visual field larger than 180 degrees, so that the scene collected by the cameras can be ensured to effectively cover a 360-degree visual field area around a vehicle body, and guarantee is provided for subsequent panoramic stitching. Of course, in other embodiments, the number of cameras and the mounting locations may also be varied, as long as the cameras cover a 360 ° field of view area around the vehicle body.
Before a first image is acquired through a camera, calibrating the camera to obtain a perspective transformation matrix.
Step S200, according to the perspective transformation matrix, the preset resolution and the coordinates of the pixel points in the first image acquired by the camera, obtaining the corresponding relation between the coordinates of the pixel points in the first aerial view image of the first image and the coordinates of the pixel points in the first image;
and obtaining the corresponding relation between the coordinates of the pixel points in the first aerial view image of the first image and the coordinates of the pixel points in the first image through the perspective transformation matrix obtained after the calibration of the camera, the preset resolution and the coordinates of the pixel points in the first image acquired by the camera.
It should be noted that, before the step of obtaining the correspondence between the coordinates of the pixels in the first aerial view image of the first image and the coordinates of the pixels in the first image according to the perspective transformation matrix, the preset resolution and the coordinates of the pixels in the first image collected by the camera, the range width of the first original image collected by the camera, which needs to be converted into aerial view, is limited because the collection range of the camera is relatively wide and relatively far, for example, the road image collected by the camera, wherein a part of the first original image is a region not belonging to the road but belonging to the two sides of the road, and these regions do not provide useful information for the recognition of the road scene, and some areas in the first original image reflect places far from the vehicle, the pixels of the areas are blurred, and the provided useful information is less, so after the first original image is acquired by the camera, the terminal can cut the acquired first original image according to a preset coordinate range, the cut image is taken as the first image acquired by the camera, for example, the acquired image is 640 x 480, the upper left corner of the image is taken as the origin, the preset coordinate range comprises an abscissa range and an ordinate range, the abscissa range is 80-560, the ordinate range is 320-640, and the acquired image is cut according to the preset coordinate range, so that the images in the preset coordinate ranges can be stored.
Specifically, referring to fig. 3, fig. 3 is a detailed schematic diagram of a flow of step S200 in an embodiment of the present application, and based on the above embodiment, the step S200 specifically includes:
step S210, world coordinates corresponding to the coordinates of the pixel points in the first image are obtained according to the perspective transformation matrix and the coordinates of the pixel points in the first image;
step S220, obtaining coordinates of pixel points in the first aerial view image according to world coordinates corresponding to the coordinates of the pixel points in the first image and preset resolution;
in step S230, a correspondence between the coordinates of the pixels in the first aerial image and the coordinates of the pixels in the first image is obtained according to the coordinates of the pixels in the first aerial image and the coordinates of the pixels in the first image.
Firstly, the coordinates of each pixel point in the first image are converted by the obtained perspective transformation matrix, and world coordinates corresponding to the coordinates of each pixel point in the obtained first image, for example, the obtained perspective transformation formula is:
the coordinates of the pixel point of the first image are (u, v), and the world coordinates corresponding to the coordinates of the pixel point of the first image are (u, v) and (i, j).
After world coordinates corresponding to the coordinates of each pixel point in the first image are obtained, the world coordinates corresponding to the coordinates of each pixel point in the first image are converted into coordinates of each pixel point in the first aerial view image according to the world coordinates corresponding to the coordinates of each pixel point in the first image and a preset resolution, for example, the preset resolution comprises a horizontal resolution and a vertical resolution, the horizontal resolution and the vertical resolution are respectively 50 and 200, the world coordinates corresponding to the coordinates (330, 280) of a certain pixel point in the obtained first image are respectively 5000 and 6000, and then the horizontal direction coordinate value and the vertical direction coordinate value in the world coordinates are respectively divided by the horizontal resolution and the vertical resolution, so that the coordinates of a certain pixel point in the first aerial view image of the first image corresponding to the coordinates (330, 280) of the pixel point in the first image are respectively 100 and 30.
The coordinates of each pixel point in the first aerial view image are obtained by converting the coordinates of the pixel points in the first image through a perspective transformation matrix and a preset resolution, namely, the coordinates of each pixel point in the first aerial view image correspond to the coordinates of a unique pixel point in the first image, so that the corresponding relation between the coordinates of the pixel points in the first aerial view image and the coordinates of the pixel points in the first image is obtained according to the coordinates of the pixel points in the first aerial view image and the coordinates of the pixel points in the first image.
The coordinates of a plurality of pixels in the first bird's eye image may correspond to the coordinates of the same pixel in the first image.
Step S300, a first coordinate conversion table is established according to the corresponding relation between the coordinates of the pixel points in the first aerial view image and the coordinates of the pixel points in the first image;
after the terminal obtains the corresponding relation between the coordinates of the pixel points in the first aerial view image and the coordinates of the pixel points in the first image, a first coordinate conversion table is established according to the relation, and the first coordinate conversion table is used for quickly inquiring the coordinates of the pixel points in the original image corresponding to the aerial view image to be generated according to the coordinates of the pixel points in the aerial view image to be generated.
Specifically, referring to fig. 4, fig. 4 is a detailed schematic diagram of the flow of step S300 in the embodiment of the present application, and based on the above embodiment, the step S300 specifically includes:
step S310, a first initial coordinate conversion table is established according to the coordinates of the pixel points in the first aerial view image and the total number of the pixel points, wherein the positions of all the cells in the first initial coordinate conversion table are in one-to-one correspondence with the coordinates of the pixel points in the first aerial view image;
step S320, taking the coordinates of the pixel points in the first image as the numerical values of the corresponding cells in the first initial coordinate conversion table according to the corresponding relation between the coordinates of the pixel points in the first aerial view image and the coordinates of the pixel points in the first image and the corresponding relation between the positions of each cell in the first initial coordinate conversion table and the coordinates of the pixel points in the first aerial view image;
in step S330, the first initial coordinate conversion table with each cell having a corresponding value is used as the first coordinate conversion table.
The terminal firstly builds a first initial coordinate conversion table according to the coordinates of pixel points and the total number of pixel points in the first aerial view image, wherein the total number of the cells of the first initial coordinate conversion table is the same as the total number of the pixel points in the first aerial view image, the total number of the cells in each row of the first initial coordinate conversion table is the same as the number of the pixel points in the horizontal direction in the first aerial view image, the total number of the cells in each column of the first initial coordinate conversion table is the same as the number of the pixel points in the vertical direction in the first aerial view image, for example, the first aerial view image is 128 x 100, the total number of the pixel points is 12800, the total number of the cells of the first initial coordinate conversion table is 12800, the total number of the cells in each row of the first initial coordinate conversion table is 128, and the total number of the cells in each column of the first initial coordinate conversion table is 100. And the positions of the cells of the first initial coordinate conversion table, that is, the rows and columns where the cells are located are in one-to-one correspondence with the coordinates of the pixel points in the first aerial image, for example, the coordinates of the pixel points in the first aerial image corresponding to the cells of the 100 th row and 30 th column in the first initial coordinate conversion table are (100, 30).
After the terminal establishes the first initial coordinate conversion table, the coordinate of the pixel point in the first aerial image is determined according to the corresponding relation between the position of each cell in the first initial coordinate conversion table and the coordinate of the pixel point in the first aerial image, then the coordinate of the pixel point in the first aerial image is determined according to the corresponding relation between the coordinate of the pixel point in the first aerial image and the coordinate of the pixel point in the first image, finally the coordinate of the pixel point in the first image is used as the numerical value of the corresponding cell in the first initial coordinate conversion table, for example, the coordinate of the pixel point in the first aerial image corresponding to the coordinate of the pixel point in the first aerial image in the 100 th row and 30 th row in the first initial coordinate conversion table is (100, 30), the coordinate of the pixel point in the first aerial image corresponding to the coordinate of the pixel point in the first aerial image (280) is the coordinate of the pixel point in the first aerial image, and the coordinate of the pixel point in the first aerial image corresponding to the coordinate of the pixel point in the first row (280) is the coordinate of the first initial row (280), and the coordinate of the pixel point in the first aerial image corresponding to the coordinate of the pixel point in the first initial row (280) is the coordinate of the first initial row (330).
After the terminal gives a numerical value to each unit combat in the first initial coordinate conversion table, the first initial coordinate conversion table with the corresponding numerical value of each unit is used as the first coordinate conversion table, namely the first coordinate conversion table is built.
Step S400, acquiring a second image in real time through a camera, and obtaining a second aerial view image of the second image according to the second image and the first coordinate conversion table.
After the terminal establishes the first coordinate conversion table, after the subsequent terminal acquires the second image in real time through the camera, the coordinates of the pixel points in the second image corresponding to the pixel points in the second aerial view image of the second image are queried according to the first coordinate conversion table, then the pixel values of the pixel points corresponding to the coordinates in the second image are acquired according to the queried coordinates of the pixel points in the corresponding second image, the pixel values are used as the pixel values of the corresponding pixel points in the second aerial view image, and finally, all the pixel points in the second aerial view image are endowed with certain pixel values, so that the second aerial view image of the second image is finally obtained.
Specifically, referring to fig. 5, fig. 5 is a detailed schematic diagram of the flow of step S400 in the embodiment of the present application, and based on the above embodiment, the step S400 specifically includes:
Step S410, inquiring and obtaining coordinates of pixel points in the second image corresponding to the coordinates of the pixel points in the second aerial view image of the second image from the first coordinate conversion table;
step S420, obtaining a pixel value corresponding to a pixel point in the second aerial view image according to the obtained coordinates of the pixel point in the second aerial view image corresponding to the coordinates of the pixel point in the second image and the pixel value corresponding to the pixel point in the second image;
in step S430, a second aerial view image is obtained according to the coordinates of each pixel point in the second aerial view image and the corresponding pixel value.
The terminal queries and obtains the coordinates of the pixel points in the second image corresponding to the coordinates of each pixel point in the second aerial view image of the second image from the first coordinate conversion table, then obtains the pixel value of the pixel point corresponding to the coordinates in the second image according to the coordinates of the pixel points in the second image corresponding to the coordinates of each pixel point in the obtained second aerial view image, takes the pixel as the pixel value of the corresponding pixel point in the second aerial view image, and finally obtains the pixel value corresponding to each pixel point in the second aerial view image; and the terminal spells the second aerial view image of the second image according to the coordinates of each pixel point in the second aerial view image and the pixel value corresponding to each pixel point. For example, the coordinates (100, 30) of the pixel point in the second bird's-eye view image correspond to the cells of the 100 th row and 30 th column in the first coordinate conversion table, then the numerical value of the cells of the 100 th row and 30 th column in the first coordinate conversion table is queried as (330, 280), the numerical value represents the coordinates (330, 280) of the pixel point in the second image, so the coordinates (100, 30) of the pixel point in the second bird's-eye view image correspond to the coordinates (330, 280) of the pixel point in the second image, and the terminal then takes the pixel value of the pixel point of the coordinates (330, 280) in the second image as the pixel value of the pixel point in the second bird's-eye view image.
In the embodiment, a perspective transformation matrix is obtained by calibrating a camera; obtaining a corresponding relation between the coordinates of the pixels in the first aerial view image of the first image and the coordinates of the pixels in the first image according to the perspective transformation matrix, the preset resolution and the coordinates of the pixels in the first image acquired by the camera; establishing a first coordinate conversion table according to the corresponding relation between the coordinates of the pixel points in the first aerial view image and the coordinates of the pixel points in the first image; and acquiring a second image in real time through the camera, and acquiring a second aerial view image of the second image according to the second image and the first coordinate conversion table. The method realizes the quick conversion by a table look-up method when the original image is converted into the aerial view, effectively reduces the time consumption when the images are converted mutually, and greatly improves the performance of the automatic driving and auxiliary driving system.
Further, a second embodiment is proposed based on the first embodiment, referring to fig. 6, fig. 6 is a schematic diagram of a refinement flow of step S320, and in this embodiment, the step S320 includes:
step S321, converting coordinates of a pixel point in the first image into corresponding hexadecimal values according to a preset shift algorithm, wherein the preset shift algorithm is A= ((u &0 xffff) < < 16) | (v &0 xffff), (u, v) are coordinates of the pixel point in the first image, and A is the hexadecimal value corresponding to the coordinates (u, v) of the pixel point in the first image;
Step S322, taking the hexadecimal value corresponding to the coordinate of the pixel point in the first image as the numerical value of the corresponding cell in the first initial coordinate conversion table according to the corresponding relation between the coordinate of the pixel point in the first aerial view image and the coordinate of the pixel point in the first image and the corresponding relation between the position of each cell in the first initial coordinate conversion table and the coordinate of the pixel point in the first aerial view image.
Since each cell in the first coordinate conversion table directly stores the coordinates of the pixel points in the first image, the coordinates are represented by two numerical values, the storage amount is larger, and particularly, the larger the total number of the pixel points of the first aerial view image of the first image is, the larger the total number of the cells in the first coordinate conversion table is, the larger the storage amount is. In order to reduce the storage amount of the first initial coordinate conversion table, the present example converts the coordinates of the pixel point in the first image to be stored into a numerical value, and then uses the numerical value as the numerical value of the corresponding cell, thereby reducing the storage amount thereof. The specific process is as follows: and converting the coordinates of the pixel points in the first image into corresponding hexadecimal values according to a preset displacement algorithm A= ((u &0 xffff) < < 16) | (v &0 xffff), wherein (u, v) is the coordinates of the pixel points in the first image, and A is the hexadecimal values corresponding to the coordinates (u, v) of the pixel points in the first image. For example, the coordinate of a certain pixel point in the first image is (330, 280), and then the coordinate is converted into hexadecimal value 0x014a0118 by a displacement algorithm a= ((330 &0 xffff) < <16| (280 &0 xffff))=0x014 a0118.
The terminal determines the coordinates of the pixel point in the first aerial image corresponding to each cell in the first initial coordinate conversion table according to the corresponding relation between the position of each cell in the first initial coordinate conversion table and the coordinates of the pixel point in the first aerial image, then determines the coordinates of the pixel point in the first image corresponding to each cell in the first initial coordinate conversion table according to the corresponding relation between the coordinates of the pixel point in the first aerial image and the coordinates of the pixel point in the first image, finally takes the hexadecimal value corresponding to the coordinates of the pixel point in the first image as the numerical value of the corresponding cell in the first initial coordinate conversion table, for example, the coordinates of the pixel point in the first aerial image corresponding to the 100 th row and 30 th column in the first initial coordinate conversion table are (100, 30), and the coordinates of the pixel point in the first aerial image corresponding to the pixel point in the first image (100, 30) are (330, 280), so the coordinates of the pixel point in the first aerial image corresponding to the 100 th row and the pixel point in the first aerial image corresponding to the first row and the coordinate of the first aerial image are (330, 280), and finally takes the hexadecimal value corresponding to the coordinate value of the pixel point in the first initial coordinate conversion table as the numerical value of the first initial coordinate table (330, 280 x, and the hexadecimal value of the pixel point in the first aerial image corresponding to the first aerial image to the pixel point in the first aerial image.
It should be noted that, if the numerical value of each cell in the first coordinate conversion table is the hexadecimal value of the coordinate of the corresponding pixel in the first image, then the subsequent process of querying the first coordinate conversion table to obtain the coordinate of the pixel in the second image corresponding to the coordinate of the pixel in the second aerial view image of the second image includes: inquiring and obtaining hexadecimal values corresponding to the coordinates of the pixel points in the second aerial view image of the second image from the first coordinate conversion table, and then converting the hexadecimal values into the coordinates of the pixel points in the second image according to preset shift inverse operation, wherein the shift inverse operation u= (A > > 16) &0xffff, v=A &0xffff, wherein A is the numerical value of a cell in the first coordinate conversion table, and (u, v) is the coordinates of the pixel points in the second image. For example, the hexadecimal value corresponding to the coordinates (100, 30) of the pixel point in the second aerial image of the second image is 0x014a0118, and the coordinates (100, 30) of the pixel point of the second aerial image corresponding to the coordinates (330, 280) of the pixel point in the second image are finally obtained according to the shift inverse operation u= (0 x014a0118> > 16) &0 xffff=0 x014 a=330, v=0 x014a0118&0 xffff=0 x 0118=280.
Further, a third embodiment is proposed based on the second embodiment, and in this embodiment, the step S200 further includes:
Step S500, a second conversion value table is established according to the coordinates of the pixel points in the first aerial view image and the coordinates of the pixel points in the first image;
after the terminal obtains the corresponding relation between the coordinates of the pixel points in the first aerial view image and the coordinates of the pixel points in the first image, a second coordinate conversion table is established according to the relation, and the second coordinate conversion table is used for quickly inquiring the coordinates of the pixel points in the aerial view image corresponding to the original image to be converted according to the coordinates of the pixel points in the original image to be converted.
Specifically, based on the above embodiment, the step S500 specifically includes:
step S510, a second initial coordinate conversion table is established according to the coordinates of the pixel points in the first image and the total number of the pixel points, wherein the positions of all the cells in the second initial coordinate conversion table are in one-to-one correspondence with the coordinates of the pixel points in the first image;
the terminal firstly builds a second initial coordinate conversion table according to the coordinates of the pixels and the total number of the pixels in the first image, the total number of the cells of the second initial coordinate conversion table is the same as the total number of the pixels in the first image, the total number of the cells in each row of the second initial coordinate conversion table is the same as the number of the pixels in the horizontal direction in the first image, the total number of the cells in each column of the second initial coordinate conversion table is the same as the number of the pixels in the vertical direction in the first image, for example, the first image is 640 x 480, the total number of the pixels is 307200, the total number of the cells in each row of the second initial coordinate conversion table is 307200, and the total number of the cells in each column of the second initial coordinate conversion table is 480. And the positions of the cells of the second initial coordinate conversion table, that is, the rows and columns of the cells are in one-to-one correspondence with the coordinates of the pixels in the first image, for example, the coordinates of the pixels in the first image corresponding to the cells of the 330 th row and 280 th column in the second initial coordinate conversion table are (330, 280).
Step S520, taking the coordinates of the pixel points in the first aerial view image as the numerical values of the corresponding cells in the second initial coordinate conversion table according to the corresponding relation between the coordinates of the pixel points in the first aerial view image and the coordinates of the pixel points in the first image and the corresponding relation between the positions of each cell in the second initial coordinate conversion table and the coordinates of the pixel points in the first image;
after the terminal establishes the second initial coordinate conversion table, the coordinate of the pixel point in the first image corresponding to each cell in the second initial coordinate conversion table is determined according to the corresponding relation between the position of each cell in the second initial coordinate conversion table and the coordinate of the pixel point in the first image, then the coordinate (100, 30) of the pixel point in the first aerial view image is determined according to the corresponding relation between the coordinate of the pixel point in the first aerial view image and the coordinate of the pixel point in the first image, the coordinate of the pixel point in the first aerial view image corresponding to each cell in the second initial coordinate conversion table is determined, finally the coordinate of the pixel point in the first aerial view image is used as the numerical value of the corresponding cell in the second initial coordinate conversion table, for example, the coordinate of the pixel point in the first line 330 corresponding to the pixel point in the first image in the second initial coordinate conversion table is (330, 280), the coordinate (100, 30) of the pixel point in the first aerial view image corresponds to the coordinate (280), and the coordinate (280) of the pixel point in the first aerial view image is converted into the coordinate of the first line 330, and the coordinate of the pixel point in the first aerial view image is converted into the coordinate of the first line 280 (30) in the first aerial view image, and the coordinate of the pixel point in the first line 280 corresponds to the coordinate of the first line 280 in the first initial coordinate image is converted into the coordinate.
Specifically, based on the above embodiment, the step S520 specifically includes:
step S521, converting the coordinates of the pixel points in the first aerial view image into corresponding hexadecimal values according to a preset shift algorithm, wherein the preset shift algorithm is b= ((w &0 xffff) < < 16) | (h &0 xffff), (w, h) is the coordinates of the pixel points in the first image, and B is the hexadecimal value corresponding to the coordinates (w, h) of the pixel points in the first aerial view image;
step S522, taking the hexadecimal value corresponding to the coordinate of the pixel point in the first aerial view image as the numerical value of the corresponding cell in the second initial coordinate conversion table according to the corresponding relation between the coordinate of the pixel point in the first aerial view image and the coordinate of the pixel point in the first image and the corresponding relation between the position of each cell in the second initial coordinate conversion table and the coordinate of the pixel point in the first image.
Since each cell in the second coordinate conversion table directly stores the coordinates of the pixel points in the first aerial view image, the coordinates are represented by two numerical values, the storage amount is larger, and particularly, the larger the total number of the pixel points of the first image is, the larger the total number of the cells in the second coordinate conversion table is, and the larger the storage amount is. In order to reduce the storage amount of the second initial coordinate conversion table, the present example converts the coordinates of the pixel point in the first bird's eye image of the first image to be stored into a numerical value, and then uses the numerical value as the numerical value of the corresponding cell, thereby reducing the storage amount thereof. The specific process is as follows: and converting the coordinates of the pixel points in the first aerial view image into corresponding hexadecimal values according to a preset displacement algorithm B= ((w &0 xffff) < < 16) | (h &0 xffff), wherein (w, h) is the coordinates of the pixel points in the first image, and B is the hexadecimal values corresponding to the coordinates (w, h) of the pixel points in the first aerial view image. For example, the coordinate of a certain pixel point in the first aerial view image is (100, 30), and then the coordinate is converted into a hexadecimal value 0x00e4001e by a displacement algorithm b= ((100 &0 xffff) < <16| (30 &0 xffff))=0x00 e4001e.
The terminal determines the coordinates of the pixel points in the first image corresponding to each cell in the second initial coordinate conversion table according to the corresponding relation between the positions of the cells in the second initial coordinate conversion table and the coordinates of the pixel points in the first image, then determines the coordinates of the pixel points in the first aerial image corresponding to each cell in the second initial coordinate conversion table according to the corresponding relation between the coordinates of the pixel points in the first aerial image and the coordinates of the pixel points in the first image, finally takes the hexadecimal value corresponding to the coordinates of the pixel points in the first aerial image as the numerical value of the corresponding cell in the second initial coordinate conversion table, for example, the coordinates of the pixel points in the first image corresponding to the 280 th row in the 330 th row in the second initial coordinate conversion table are (330, 280), and the coordinates of the pixel points in the first aerial image corresponding to the coordinates of the pixel points in the first image are (330, 280), so that the coordinates of the pixel points in the first aerial image corresponding to the first aerial image in the first row 330 st row are the coordinates of the first aerial image are (330, and the coordinates of the pixel points in the first aerial image are corresponding to the coordinates of the pixel points in the first image, and finally takes the hexadecimal value of the pixel points in the first row 330 to be the coordinates of the pixel points in the first row 30 as the coordinates of the first initial coordinate table (100, and the hexadecimal value of the pixel points in the first coordinate table is the pixel point in the first coordinate table, and the coordinate of the pixel point in the first coordinate table is the pixel point in the pixel point).
In step S530, the second initial coordinate conversion table with each cell having a corresponding value is used as the second coordinate conversion table.
After the terminal gives a numerical value to each unit combat in the second initial coordinate conversion table, the second initial coordinate conversion table with the corresponding numerical value of each unit plot is used as the second coordinate conversion table, namely the establishment of the second coordinate conversion table is completed.
Step S600, obtaining a third aerial view image;
step S700, inquiring and obtaining coordinates of pixel points in the third aerial view image corresponding to the coordinates of the pixel points in the original image of the third aerial view image from the first coordinate conversion table;
step S800, obtaining a pixel value corresponding to a pixel point in the original image according to the obtained coordinate of the pixel point in the third aerial view image corresponding to the coordinate of the pixel point in the original image and the pixel value corresponding to the pixel point in the third aerial view image;
step S900, obtaining the original image according to the coordinates of the pixel points in the original image and the corresponding pixel values.
After the terminal establishes the second coordinate conversion table, after the subsequent terminal obtains the third aerial image, the terminal needs to convert the third aerial image into a corresponding original image, the terminal queries coordinates of pixel points in the third aerial image corresponding to all pixel points in the original image of the third aerial image according to the second coordinate conversion table, then obtains pixel values of the pixel points corresponding to the coordinates in the third aerial image according to the queried coordinates of the pixel points in the corresponding third aerial image, and takes the pixel values as pixel values of the corresponding pixel points in the original image of the third aerial image, and finally each pixel point in the original image of the third aerial image is endowed with a certain pixel value, so that the original image of the third aerial image is finally obtained.
Specifically, the terminal queries the coordinates of the pixel points in the third aerial view image corresponding to the coordinates of each pixel point in the original image of the obtained third aerial view image from the second coordinate conversion table, then obtains the pixel value of the pixel point corresponding to the coordinates in the third aerial view image according to the coordinates of the pixel points in the third aerial view image corresponding to the coordinates of each pixel point in the obtained original image of the third aerial view image, takes the pixel value as the pixel value of the corresponding pixel point in the original image of the third aerial view image, and finally obtains the pixel value corresponding to each pixel point in the original image of the third aerial view image; and the terminal spells the original image of the third aerial view image according to the coordinates of each pixel point in the original image of the third aerial view image and the pixel value corresponding to each pixel point. For example, the coordinates (330, 280) of the pixel point in the original image of the third bird's-eye view image correspond to the cell of the second coordinate conversion table of the 330 th row and 280 th column, then the numerical value of the cell of the second coordinate conversion table of the 330 th row and 280 th column is queried as (100, 30), and the numerical value represents that the coordinates of the pixel point in the third bird's-eye view image are (100, 30), so the coordinates (330, 280) of the pixel point in the original image of the third bird's-eye view image correspond to the coordinates of the pixel point in the third bird's-eye view image are (100, 30), and the terminal then takes the pixel value of the pixel point of the third bird's-eye view image with the coordinates of (100, 30) as the pixel value of the pixel point in the original image of the third bird's-eye view image.
In the embodiment, a perspective transformation matrix is obtained by calibrating a camera; obtaining a corresponding relation between the coordinates of the pixels in the first aerial view image of the first image and the coordinates of the pixels in the first image according to the perspective transformation matrix, the preset resolution and the coordinates of the pixels in the first image acquired by the camera; establishing a second coordinate conversion table according to the corresponding relation between the coordinates of the pixel points in the first aerial view image and the coordinates of the pixel points in the first image; the obtained third bird's-eye view image is converted into an original image by the second coordinate conversion table. The method has the advantages that the method directly realizes the rapid conversion by a table look-up method when the bird's eye view is converted into the original image, effectively reduces the time consumption when the images are mutually converted, and greatly improves the performance of an automatic driving and auxiliary driving system.
Furthermore, the present invention provides a storage medium having stored thereon a computer program which, when executed by a processor, implements the steps of the image conversion method as described above.
The specific embodiments of the storage medium of the present invention are substantially the same as the embodiments of the image conversion method described above, and are not described herein.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or system that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or system. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article, or system that comprises the element.
The foregoing embodiment numbers of the present invention are merely for the purpose of description, and do not represent the advantages or disadvantages of the embodiments.
From the above description of the embodiments, it will be clear to those skilled in the art that the above-described embodiment method may be implemented by means of software plus a necessary general hardware platform, but of course may also be implemented by means of hardware, but in many cases the former is a preferred embodiment. Based on such understanding, the technical solution of the present invention may be embodied essentially or in a part contributing to the prior art in the form of a software product stored in a storage medium (e.g. ROM/RAM, magnetic disk, optical disk) as described above, including several instructions for causing a terminal (which may be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to perform the method according to the embodiments of the present invention.
The foregoing description is only of the preferred embodiments of the present invention, and is not intended to limit the scope of the invention, but rather is intended to cover any equivalents of the structures or equivalent processes disclosed herein or in the alternative, which may be employed directly or indirectly in other related arts.

Claims (7)

1. An image conversion method, characterized by comprising the steps of:
calibrating the camera to obtain a perspective transformation matrix;
obtaining a corresponding relation between coordinates of pixel points in a first aerial view image of a first image and coordinates of pixel points in the first image according to a perspective transformation matrix, a preset resolution and coordinates of pixel points in the first image acquired by a camera, wherein the first image is an image obtained by cutting an acquired first original image according to a preset coordinate range, and the first image provides information for identifying a road scene;
establishing a first coordinate conversion table according to the corresponding relation between the coordinates of the pixel points in the first aerial view image and the coordinates of the pixel points in the first image;
acquiring a second image in real time through a camera, and acquiring a second aerial view image of the second image according to the second image and the first coordinate conversion table;
The step of obtaining the corresponding relation between the coordinates of the pixel points in the first aerial view image and the coordinates of the pixel points in the first image according to the perspective transformation matrix, the coordinates of the pixel points in the first image acquired by the camera and the preset resolution comprises the following steps:
obtaining world coordinates corresponding to the coordinates of the pixel points in the first image according to the perspective transformation matrix and the coordinates of the pixel points in the first image;
obtaining coordinates of pixel points in the first aerial view image according to world coordinates corresponding to the coordinates of the pixel points in the first image and preset resolution;
obtaining a corresponding relation between the coordinates of the pixels in the first aerial view image and the coordinates of the pixels in the first image according to the coordinates of the pixels in the first aerial view image and the coordinates of the pixels in the first image;
the step of establishing a first coordinate conversion table according to the corresponding relation between the coordinates of the pixel points in the first aerial view image and the coordinates of the pixel points in the first image comprises the following steps:
according to the coordinates of the pixel points and the total number of the pixel points in the first aerial view image, a first initial coordinate conversion table is established, wherein the positions of all the cells in the first initial coordinate conversion table are in one-to-one correspondence with the coordinates of the pixel points in the first aerial view image;
According to the corresponding relation between the coordinates of the pixel points in the first aerial view image and the coordinates of the pixel points in the first image and the corresponding relation between the positions of all the cells in the first initial coordinate conversion table and the coordinates of the pixel points in the first aerial view image, taking the coordinates of the pixel points in the first image as the numerical values of the corresponding cells in the first initial coordinate conversion table;
taking a first initial coordinate conversion table with corresponding numerical values of each cell as a first coordinate conversion table;
the step of taking the coordinates of the pixel point in the first image as the numerical value of the corresponding cell in the first initial coordinate conversion table according to the corresponding relation between the coordinates of the pixel point in the first aerial view image and the coordinates of the pixel point in the first image and the corresponding relation between the positions of each cell in the first initial coordinate conversion table and the coordinates of the pixel point in the first aerial view image comprises:
converting coordinates of pixel points in the first image into corresponding hexadecimal values according to a preset shift algorithm, wherein the preset shift algorithm is that A= ((u &0 xffff) < < 16) | (v &0 xffff), (u, v) are coordinates of the pixel points in the first image, and A is the hexadecimal values corresponding to the coordinates (u, v) of the pixel points in the first image;
And taking a hexadecimal value corresponding to the coordinates of the pixel point in the first image as the numerical value of the corresponding cell in the first initial coordinate conversion table according to the corresponding relation between the coordinates of the pixel point in the first aerial view image and the coordinates of the pixel point in the first image and the corresponding relation between the positions of each cell in the first initial coordinate conversion table and the coordinates of the pixel point in the first aerial view image.
2. The image conversion method according to claim 1, wherein the step of acquiring the second image in real time by the camera, and obtaining the second bird's-eye image corresponding to the second image according to the second image and the established first coordinate conversion table comprises:
inquiring and obtaining coordinates of pixel points in a second image corresponding to the coordinates of the pixel points in a second aerial view image of the second image from the first coordinate conversion table;
obtaining a pixel value corresponding to the pixel point in the second aerial view image according to the coordinate of the pixel point in the second image corresponding to the coordinate of the pixel point in the obtained second aerial view image and the pixel value corresponding to the pixel point in the second image;
and obtaining the second aerial view image according to the coordinates of each pixel point in the second aerial view image and the corresponding pixel value.
3. The image conversion method according to claim 2, wherein the step of obtaining the correspondence between the coordinates of the pixels in the first bird's-eye view image and the coordinates of the pixels in the first image according to the perspective transformation matrix, the preset resolution, and the coordinates of the pixels in the first image acquired by the camera further comprises:
Establishing a second conversion numerical value table according to the coordinates of the pixel points in the first aerial view image and the coordinates of the pixel points in the first image;
acquiring a third aerial view image;
inquiring and obtaining coordinates of pixel points in the third aerial view image corresponding to the coordinates of the pixel points in the original image of the third aerial view image from the first coordinate conversion table;
obtaining a pixel value corresponding to a pixel point in the original image according to the obtained coordinate of the pixel point in the third aerial view image corresponding to the coordinate of the pixel point in the original image and the pixel value corresponding to the pixel point in the third aerial view image;
and obtaining the original image according to the coordinates of the pixel points in the original image and the corresponding pixel values.
4. The image conversion method according to claim 3, wherein the step of creating the second conversion value table based on the coordinates of each pixel in the first bird's eye image and the coordinates of each pixel in the first image includes:
establishing a second initial coordinate conversion table according to the coordinates of the pixel points in the first image and the total number of the pixel points, wherein the positions of all the cells in the second initial coordinate conversion table are in one-to-one correspondence with the coordinates of the pixel points in the first image;
according to the corresponding relation between the coordinates of the pixel points in the first aerial view image and the coordinates of the pixel points in the first image and the corresponding relation between the positions of all the cells in the second initial coordinate conversion table and the coordinates of the pixel points in the first image, taking the coordinates of the pixel points in the first aerial view image as the numerical values of the corresponding cells in the second initial coordinate conversion table;
And taking the second initial coordinate conversion table with corresponding numerical values of each cell as a second coordinate conversion table.
5. The method of claim 4, wherein the step of using the coordinates of the pixel point in the first bird's-eye view image as the numerical value of the corresponding cell in the second initial coordinate conversion table according to the correspondence between the coordinates of the pixel point in the first bird's-eye view image and the coordinates of the pixel point in the first image and the correspondence between the positions of each cell in the second initial coordinate conversion table and the coordinates of the pixel point in the first image comprises:
according to a preset shift algorithm, converting coordinates of the pixel points in the first aerial view image into corresponding hexadecimal values, wherein the preset shift algorithm is B= ((w &0 xffff) < < 16) | (h &0 xffff), (w, h) are coordinates of the pixel points in the first image, and B is the hexadecimal value corresponding to the coordinates (w, h) of the pixel points in the first aerial view image;
and taking a hexadecimal value corresponding to the coordinates of the pixel point in the first aerial view image as the numerical value of the corresponding cell in the second initial coordinate conversion table according to the corresponding relation between the coordinates of the pixel point in the first aerial view image and the coordinates of the pixel point in the first image and the corresponding relation between the positions of each cell in the second initial coordinate conversion table and the coordinates of the pixel point in the first image.
6. A terminal comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the steps of the image conversion method according to any one of claims 1 to 5 when the program is executed.
7. A storage medium having stored thereon a computer program which, when executed by a processor, implements the steps of the image conversion method according to any one of claims 1 to 5.
CN202010044761.2A 2020-01-15 2020-01-15 Image conversion method, terminal and storage medium Active CN111242842B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010044761.2A CN111242842B (en) 2020-01-15 2020-01-15 Image conversion method, terminal and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010044761.2A CN111242842B (en) 2020-01-15 2020-01-15 Image conversion method, terminal and storage medium

Publications (2)

Publication Number Publication Date
CN111242842A CN111242842A (en) 2020-06-05
CN111242842B true CN111242842B (en) 2023-11-10

Family

ID=70879578

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010044761.2A Active CN111242842B (en) 2020-01-15 2020-01-15 Image conversion method, terminal and storage medium

Country Status (1)

Country Link
CN (1) CN111242842B (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111986257A (en) * 2020-07-16 2020-11-24 南京模拟技术研究所 Bullet point identification automatic calibration method and system supporting variable distance
CN112132829A (en) * 2020-10-23 2020-12-25 北京百度网讯科技有限公司 Vehicle information detection method and device, electronic equipment and storage medium
CN112468716B (en) * 2020-11-02 2022-07-19 航天信息股份有限公司 Camera visual angle correction method and device, storage medium and electronic equipment
CN113689413A (en) * 2021-08-30 2021-11-23 深圳市睿达科技有限公司 Alignment correction method and device and computer readable storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105894549A (en) * 2015-10-21 2016-08-24 乐卡汽车智能科技(北京)有限公司 Panorama assisted parking system and device and panorama image display method
CN106373091A (en) * 2016-09-05 2017-02-01 山东省科学院自动化研究所 Automatic panorama parking aerial view image splicing method, system and vehicle
CN106856000A (en) * 2015-12-09 2017-06-16 广州汽车集团股份有限公司 A kind of vehicle-mounted panoramic image seamless splicing processing method and system
CN107424120A (en) * 2017-04-12 2017-12-01 湖南源信光电科技股份有限公司 A kind of image split-joint method in panoramic looking-around system

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105894549A (en) * 2015-10-21 2016-08-24 乐卡汽车智能科技(北京)有限公司 Panorama assisted parking system and device and panorama image display method
CN106856000A (en) * 2015-12-09 2017-06-16 广州汽车集团股份有限公司 A kind of vehicle-mounted panoramic image seamless splicing processing method and system
CN106373091A (en) * 2016-09-05 2017-02-01 山东省科学院自动化研究所 Automatic panorama parking aerial view image splicing method, system and vehicle
CN107424120A (en) * 2017-04-12 2017-12-01 湖南源信光电科技股份有限公司 A kind of image split-joint method in panoramic looking-around system

Also Published As

Publication number Publication date
CN111242842A (en) 2020-06-05

Similar Documents

Publication Publication Date Title
CN111242842B (en) Image conversion method, terminal and storage medium
US10726579B1 (en) LiDAR-camera calibration
JP4931831B2 (en) Infrared camera system and method
CN110341597B (en) Vehicle-mounted panoramic video display system and method and vehicle-mounted controller
CN116723392A (en) Image processing method and image processing system
JP5262976B2 (en) In-vehicle display device
JP2009017020A (en) Image processor and method for generating display image
CN111656144A (en) Sensor device, electronic device, sensor system, and control method
CN111010545A (en) Vehicle driving decision method, system, terminal and storage medium
US20220366606A1 (en) Methods for calibrating image acquiring devices, electronic devices and storage media
CN107172349B (en) Mobile terminal shooting method, mobile terminal and computer readable storage medium
WO2014155954A1 (en) Vehicle display control device
CN110443245A (en) Localization method, device and the equipment of a kind of license plate area under unrestricted scene
JP6260174B2 (en) Surveillance image presentation system
CN114881863A (en) Image splicing method, electronic equipment and computer readable storage medium
US11425355B2 (en) Depth image obtaining method, image capture device, and terminal
CN110827314B (en) Single-target tracking method and related equipment
CN113034621B (en) Combined calibration method, device, equipment, vehicle and storage medium
CN113674138B (en) Image processing method, device and system
CN117541517B (en) Dual-curvature imaging method, device, computer equipment and storage medium of CMS
CN108009981B (en) Method and device for optimizing distortion parameter and computer readable storage medium
JP2015166835A (en) Image display device and image display system
CN114429502A (en) Method, system, device, vehicle and storage medium for calibrating panoramic camera
CN117710941A (en) Image processing method, device, vehicle and computer readable storage medium
CN115883754A (en) Image processing method, image processing apparatus, vehicle, and computer-readable storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
CB02 Change of applicant information

Address after: 14 / F, Beidou building, 6 Huida Road, Jiangbei new district, Nanjing, Jiangsu Province 210000

Applicant after: Jiangsu Zhongtian Anchi Technology Co.,Ltd.

Address before: 3 / F and 5 / F, building 2, Changyuan new material port, building B, Changyuan new material port, science and Technology Park community, Yuehai street, Nanshan District, Shenzhen, Guangdong 518000

Applicant before: SHENZHEN ZHONGTIAN ANCHI Co.,Ltd.

CB02 Change of applicant information
GR01 Patent grant
GR01 Patent grant