Fisheye camera data generation method and device, storage medium and electronic equipment
By projecting the normal camera image on the hemispherical surface and projecting it to the plane according to the preset distortion center, the problem of obtaining fisheye camera data is solved, and the fisheye image is quickly and conveniently acquired, and the flexibility of data acquisition is improved.
Patent Information
- Application Number
- CN202510107476.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-22
- Publication Date
- 2025-05-23
AI Technical Summary
It is difficult to quickly and conveniently obtain fisheye camera data, especially fisheye image data, which is very rare and requires a lot of manpower and material resources.
By projecting the images collected by a normal camera on the hemispherical surface and then projecting them onto the plane according to the preset distortion center to obtain the fish eye image, the fish eye image can be obtained easily and quickly, and the degree of distortion of the fish eye image can be controlled.
It realizes convenient and fast acquisition of fisheye images, improves the flexibility of obtaining fisheye image data, and reduces the cost and difficulty of data acquisition.
Smart Images

Figure CN120031709A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and more specifically, to a fisheye camera data generation method, device, storage medium and electronic device in the field of computer technology. Background Art
[0002] Fisheye images refer to images taken with a fisheye camera. Since fisheye cameras have an extremely wide viewing angle, fisheye images can show a wider field of view than images captured by ordinary cameras. They can be applied to surveillance imaging, security fields, etc., and can also be used to create interesting visual effects in artistic photography. Due to the unique visual effects and wide application scenarios of fisheye images, people need to study and analyze fisheye images, but research and analysis often requires a large amount of fisheye image data, while common open source data is of normal images, and fisheye image data is very rare. If a fisheye camera is used to re-collect data, it will cost a lot of manpower and material resources. It is necessary to provide a fast and convenient method for generating fisheye camera data. Summary of the invention
[0003] The embodiments of the present application provide a fisheye camera data generation method, device, storage medium and electronic device. The method can obtain a fisheye image by projecting an image captured by a normal camera onto a hemispherical surface, and then mapping the image coordinates of the hemispherical surface to a fisheye plane map, thereby obtaining a fisheye image conveniently and quickly, and can control the degree of distortion of the fisheye image, further improving the flexibility of fisheye image data acquisition.
[0004] In a first aspect, an embodiment of the present application provides a method for generating fisheye camera data, the method comprising:
[0005] Acquire the target image captured by a normal camera;
[0006] Projecting each pixel point of the target image onto a hemispherical surface of a unit sphere hemisphere to obtain a hemispherical image;
[0007] Based on a preset distortion center, each pixel point is projected onto the bottom plane of the hemisphere to obtain a fisheye image corresponding to the target image.
[0008] Through the above technical solution, the image captured by the normal camera can be projected onto a hemispherical surface, and then projected onto a plane according to a preset distortion center to obtain a fisheye image, thereby obtaining the fisheye image conveniently and quickly, and the degree of distortion of the fisheye image can be controlled, further improving the flexibility of fisheye image data acquisition.
[0009] In combination with the first aspect, in some possible implementations, projecting each pixel point of the target image onto a hemispherical surface of a unit sphere hemisphere to obtain a hemispherical image includes:
[0010] Obtaining the first coordinate of each pixel point on the target image;
[0011] Determine the longitude value of each pixel point on the hemisphere of the unit sphere based on the first coordinate and the target radius of the unit sphere;
[0012] A hemispherical image is obtained based on the longitude value of each pixel point.
[0013] Through the above technical solution, the projection of each pixel point can be completed through the longitude value of each pixel point, thereby improving the accuracy of the projection process and the accuracy of the hemispherical image.
[0014] In combination with the first aspect, in some possible implementations, obtaining a first coordinate of each pixel point on the target image includes:
[0015] Converting the target image into a square image with a side length twice the target radius;
[0016] The first coordinate of each pixel point on the square image is obtained.
[0017] Through the above technical solution, the uniformity of the square image can be used to reduce errors in the mapping process from the target image to the hemispherical image, thereby improving the accuracy of the conversion.
[0018] In combination with the first aspect, in some possible implementations, determining the longitude value of each pixel point on the unit sphere hemisphere based on the first coordinate and the target radius of the unit sphere includes:
[0019] Create a hemisphere of the unit sphere with the target radius as the radius;
[0020] Based on the horizontal coordinate of the first coordinate and the target radius, calculate and obtain the longitude value of each pixel point on the horizontal axis;
[0021] Based on the longitudinal coordinate of the first coordinate and the target radius, the longitude value of each pixel point on the longitudinal axis is calculated.
[0022] Through the above technical solution, the position of each pixel point on the hemispherical image can be calculated according to the mapping relationship between the first coordinate and the longitude value, thereby further improving the accuracy of hemispherical image acquisition.
[0023] In combination with the first aspect, in some possible implementations, projecting each pixel point onto the bottom plane of the hemisphere based on a preset distortion center to obtain a fisheye image corresponding to the target image includes:
[0024] Calculate the second coordinate of each pixel point vertically mapped onto the bottom plane of the hemisphere based on the longitude value of each pixel point on the hemisphere image;
[0025] Obtaining the coordinates of the preset distortion center on the bottom plane as the distortion center point coordinates;
[0026] Based on the distortion center point coordinates and the second coordinates, a fisheye image corresponding to the target image is obtained.
[0027] Through the above technical solution, fisheye images with different distortion degrees can be generated through the distortion center, thereby improving the flexibility of fisheye image data acquisition.
[0028] In combination with the first aspect, in some possible implementations, obtaining a fisheye image corresponding to the target image based on the distortion center point coordinates and the second coordinates includes:
[0029] Calculate the sum of the ordinate of the coordinate of the distortion center point and the ordinate of the second coordinate to obtain the ordinate of the third coordinate;
[0030] Calculate the sum of the abscissa of the coordinates of the distortion center point and the abscissa of the second coordinate to obtain the abscissa of the third coordinate;
[0031] Based on the third coordinate, a fisheye image corresponding to the target image is obtained.
[0032] Through the above technical solution, the third coordinate of the pixel point on the fisheye image can be calculated through the coordinate of the distortion center, thereby improving the accuracy of projecting from the hemispherical image to the fisheye image.
[0033] In combination with the first aspect, in some possible implementations, the method further includes:
[0034] If the target image has a target annotation box, obtaining first annotation coordinates of each target box pixel point on the target image;
[0035] Based on the first annotated coordinates, obtaining second annotated coordinates of each pixel point of the target frame on the fisheye image;
[0036] Obtain the maximum abscissa, the maximum ordinate, the minimum abscissa and the minimum ordinate of all the second labeled coordinates;
[0037] Determine a first fisheye marked vertex based on the maximum abscissa and the maximum ordinate, and determine a second fisheye marked vertex based on the minimum abscissa and the minimum ordinate;
[0038] A fisheye annotation frame corresponding to the fisheye image is generated based on the first fisheye annotation vertex and the second fisheye annotation vertex.
[0039] Through the above technical solution, the fisheye annotation box can be determined by projecting all the points in the annotation box to obtain the maximum and minimum coordinate values, so that the fisheye annotation box can select the original annotation content, ensuring the accurate conversion of the target annotation box and improving the efficiency of fisheye image analysis and processing.
[0040] In a second aspect, an embodiment of the present application provides a fisheye camera data generation device, the device comprising:
[0041] An icon image acquisition unit, used to acquire a target image captured by a normal camera;
[0042] A hemispherical projection unit, used for projecting each pixel point of the target image onto a hemispherical surface of a unit sphere hemisphere to obtain a hemispherical image;
[0043] The fisheye projection unit is used to project each of the pixel points onto the bottom plane of the hemisphere based on a preset distortion center to obtain a fisheye image corresponding to the target image.
[0044] In a third aspect, an embodiment of the present application provides a computer storage medium, wherein the computer storage medium stores a plurality of instructions, wherein the instructions are suitable for being loaded by a processor and executing the above-mentioned method steps.
[0045] In a fourth aspect, an embodiment of the present application provides an electronic device, which may include: a processor and a memory; wherein the memory stores a computer program, and the computer program is suitable for being loaded by the processor and executing the above-mentioned method steps.
[0046] In one or more embodiments of the present application, a target image captured by a normal camera is acquired, each pixel of the target image is projected onto a hemispherical surface of a unit sphere hemisphere to acquire a hemispherical image, and each pixel is projected onto a bottom plane of the hemisphere based on a preset distortion center to acquire a fisheye image corresponding to the target image. By projecting the image captured by a normal camera onto a hemispherical surface, and then projecting onto a plane based on a preset distortion center to acquire a fisheye image, the fisheye image can be acquired conveniently and quickly, and the degree of distortion of the fisheye image can be controlled, further improving the flexibility of acquiring fisheye image data. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0048] Figure 1This is an example schematic diagram of fisheye camera data generation provided in an embodiment of the present application;
[0049] Figure 2 It is a flowchart of a method for generating fisheye camera data provided by an embodiment of the present application;
[0050] Figure 3 It is a schematic diagram of a process of obtaining a hemispherical image provided by an embodiment of the present application;
[0051] Figure 4 is an example schematic diagram of obtaining a first coordinate based on a rectangular coordinate system provided in an embodiment of the present application;
[0052] Figure 5 is a schematic diagram of a process of obtaining a first coordinate provided in an embodiment of the present application;
[0053] Figure 6 It is a schematic diagram of a process for obtaining a longitude value provided in an embodiment of the present application;
[0054] Figure 7 is an example schematic diagram of a unit sphere hemisphere provided in an embodiment of the present application;
[0055] Figure 8 It is a schematic diagram of a process of obtaining a fisheye image based on a hemispherical image provided by an embodiment of the present application;
[0056] Fig. 9 This is an example schematic diagram of obtaining the coordinates of a second work provided in an embodiment of the present application;
[0057] Fig.10 It is a schematic diagram of a process of obtaining a fisheye image based on a distortion center provided in an embodiment of the present application;
[0058] Fig.11 is an example schematic diagram of a third coordinate provided in an embodiment of the present application;
[0059] Fig.12 It is a flowchart of a label box conversion provided by an embodiment of the present application;
[0060] Fig.13 It is a structural schematic diagram of a fisheye camera data generating device provided in an embodiment of the present application;
[0061] Fig.14 It is a structural schematic diagram of a fisheye camera data generating device provided in an embodiment of the present application;
[0062] Fig.15 It is a structural schematic diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0063] The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present application without creative efforts shall fall within the protection scope of the present application.
[0064] The lens of a fish-eye camera is specially designed, which allows light to enter at a wider angle to achieve an ultra-wide viewing angle, resulting in distortion at the imaging edge and causing the content in the image to appear stretched or distorted. The fish-eye images obtained by the fish-eye camera can be applied to the fields of monitoring and security, such as panoramic reverse imaging of automobiles, outdoor sports cameras, panoramic photography, video surveillance systems, etc. And due to the existence of distortion, fish-eye images have a unique visual effect and can be used to create interesting visual effects in artistic photography and creative photography. If only relying on the fish-eye camera to collect fish-eye images, the quantity of the collected fish-eye image data is difficult to meet the research needs of users or relevant staff, and it will also consume a large amount of manpower and material resources. The embodiments of the present application provide a fish-eye camera data generation device, which can convert the images collected by a normal camera into fish-eye images. The fish-eye camera data generation method provided by the embodiments of the present application can be implemented depending on a computer program and can run on a fish-eye camera data generation device based on the von Neumann architecture. This computer program can be integrated in an application or run as an independent tool-type application. The images collected by the normal camera obtained by the fish-eye camera data generation device can be collected and input into the fish-eye camera data generation device by users or staff using a digital camera, mobile phone camera, etc., or can be obtained by downloading from the Internet, scanning a paper map with a scanner, etc.
[0065] Please refer to Figure 1, an example schematic diagram of fisheye camera data generation is provided for the embodiment of the present application. The user can input the target image to be converted into a fisheye image into the fisheye camera data generation device. The target image is an image captured by a normal camera, wherein the normal camera can also be called a standard camera or an ordinary camera, which is mainly used in daily contract scenes such as portraits and landscapes. Different from the fisheye camera, the lens design of the normal camera follows the traditional optical principle to provide a more natural image perspective and lower distortion. The fisheye camera data generation device can project each pixel point in the target image onto a hemispherical surface to obtain a hemispherical image. The hemispherical image is an image in a spherical state, which can cause the content in the target image to be distorted, and then project each pixel point in the hemispherical image onto a plane to obtain a fisheye image. By converting the existing target image to obtain a fisheye image, the fisheye image data set is enriched, and the cost and difficulty of data collection are reduced. Users or relevant staff do not need to use a fisheye camera for field shooting to obtain fisheye images, thereby simplifying the research process and improving the efficiency of research and analysis.
[0066] The fisheye camera data generation method provided by the present application is described in detail below in conjunction with specific embodiments.
[0067] See also Figure 2 , is a flow chart of a method for generating fisheye camera data according to an embodiment of the present application. Figure 2 As shown, the method in the embodiment of the present application may include the following steps S101-S103.
[0068] S101, obtaining a target image captured by a normal camera.
[0069] Specifically, when a user or staff member needs a fisheye image, the target image can be input into the fisheye camera data generating device, and the fisheye camera data generating device can obtain the target image, which is the target image captured by a normal camera.
[0070] S102, projecting each pixel point of the target image onto the hemispherical surface of the unit sphere hemisphere to obtain a hemispherical image.
[0071] Specifically, the fisheye camera data generating device can create a unit sphere hemisphere, the radius of the unit sphere hemisphere can be related to the side length of the target image, for example, the side length of the target image can be twice the radius of the unit sphere +, and then each pixel point in the target image is projected onto the hemispherical surface of the unit sphere hemisphere to obtain a hemispherical image. The hemispherical image is an image in three-dimensional space. Projecting it onto the hemispherical surface can distort the content of the original target image and produce a visual effect that exceeds the normal camera viewing angle.
[0072] S103, projecting each pixel point onto the bottom plane of the hemisphere based on a preset distortion center to obtain a fisheye image corresponding to the target image.
[0073] Specifically, the distortion center is a key parameter in the fish-eye image, which can represent the symmetry center of the lens optical system of the fish-eye camera, that is, the central point for reference of the distortion effect. In the fish-eye image, the pixel points at the image edge will stretch towards the distortion center to form the distortion effect. Therefore, the position of the distortion center will affect the distortion effect of the image. In the fish-eye image, the part far from the distortion center will have a more serious distortion. Since the hemispherical image is in a three-dimensional space, it is necessary to project the hemispherical image onto the bottom plane of the hemisphere to form a two-dimensional fish-eye image. By projecting according to different distortion centers, fish-eye images with different effects can be obtained. The user or relevant staff can preset the distortion center in the fish-eye camera data generation device, and then the fish-eye camera data generation device can project each pixel point onto the bottom plane of the hemisphere based on the preset distortion center to obtain the fish-eye image corresponding to the target image. For example, the preset distortion center can be the center of the hemisphere, that is, the center of the fish-eye image. Then, the distortion of the obtained fish-eye image will occur symmetrically around the center. The area near the center of the fish-eye image will be relatively clear and the distortion effect will be relatively small. The distortion at the edge of the fish-eye image will become more obvious, and the shape of the object will become more distorted and stretched.
[0074] In the embodiment of the present application, the target image collected by a normal camera is obtained, and each pixel point of the target image is projected onto the hemispherical surface of the hemisphere of the unit sphere to obtain a hemispherical image. Based on the preset distortion center, each pixel point is projected onto the bottom plane of the hemisphere to obtain the fish-eye image corresponding to the target image. By projecting the image collected by the normal camera onto the hemispherical surface and then projecting it onto the plane according to the preset distortion center to obtain the fish-eye image, the fish-eye image can be obtained conveniently and quickly, and the distortion degree of the fish-eye image can be controlled, further improving the flexibility of obtaining fish-eye image data.
[0075] Please refer to Figure 3 , which is a schematic flow chart for obtaining a hemispherical image provided by the embodiment of the present application. Step S102 may include the following steps:
[0076] S201, obtain the first coordinates of each pixel point on the target image.
[0077] Specifically, in order to accurately project each pixel point, the first coordinates of each pixel point on the target image can be obtained. The first coordinates can represent the position of each pixel point on the target image. For example, the abscissa of the first coordinates can be the column number of the pixel point on the target image, and the ordinate of the first coordinates can be the row number of the pixel point on the target image.
[0078] Optionally, the fisheye camera data generating device can use the vertex of the target image as the origin, for example, the upper left vertex of the target image can be used as the origin, and the straight line where the side length of the target image is located can be used as the coordinate axis to establish a plane rectangular coordinate system, and then obtain the first coordinate of each pixel point on the plane rectangular coordinate system. Please refer to Figure 4 , is an example schematic diagram of obtaining the first coordinate based on a rectangular coordinate system provided in an embodiment of the present application, taking the upper left corner vertex of the target image as the origin, the straight line where the upper side length is located as the horizontal axis, and the straight line where the left side length is located as the vertical axis, to establish a plane rectangular coordinate system, wherein P' is the xth coordinate in the target image. i Column y j A pixel point in a row, the first coordinate of P' can be (x i ,y j ).
[0079] S202, determining the longitude value of each pixel point on the hemisphere of the unit sphere based on the first coordinate and the target radius of the unit sphere.
[0080] Specifically, the fisheye camera data generating device can create a unit sphere hemisphere, and the target radius of the unit sphere hemisphere can be related to the side length of the target image, and the target radius is the radius of the unit sphere. For example, the side length of the target image can be twice the target radius, so the longitude value of each pixel point on the unit sphere can be determined based on the first coordinate and the target radius of the unit sphere. The longitude value can include the position of the pixel point in the horizontal axis direction and the position of the pixel point in the vertical axis direction, and the value range of the longitude value is [0,π].
[0081] S203, obtaining a hemispherical image based on the longitude value of each pixel point.
[0082] Specifically, each pixel point is projected onto a hemisphere based on the longitude value of each pixel point. For example, the projection point corresponding to each pixel point can be determined on the hemisphere based on the longitude value, and the pixel value of the corresponding pixel point is assigned to the projection point, thereby obtaining a hemispherical image, wherein the pixel value can be the color value of a single pixel point in the image, and can include the grayscale value or RGB value of this pixel point, etc.
[0083] In the embodiment of the present application, the first coordinate of each pixel point on the target image is obtained, and the longitude value of each pixel point on the unit sphere hemisphere is determined based on the first coordinate and the target radius of the unit sphere, and the hemispherical image is obtained based on the longitude value of each pixel point. The projection of each pixel point is completed through the longitude value of each pixel point, thereby improving the accuracy of the projection process and the accuracy of the hemispherical image.
[0084] Due to the differences in sensor size, resolution or lens focal length of normal cameras, the sizes of the acquired target images may also be different. The target image may be a rectangle with unequal length and width. In order to accurately project the target image onto the unit sphere hemisphere, the target image needs to be converted into four square images with equal sides.
[0085] See also Figure 5 , provides a schematic diagram of a process of obtaining a first coordinate in an embodiment of the present application. Step S201 may include the following steps:
[0086] S301, converting the target image into a square image with a side length twice the target radius.
[0087] Specifically, the fisheye camera data generating device can convert the target image into a square image with a side length of twice the target radius, so as to facilitate the subsequent projection of each pixel point of the target image onto the unit sphere hemisphere.
[0088] Optionally, if the user or relevant staff has requirements for the size of the generated fisheye image, they can first set the target radius of the unit sphere hemisphere, and send a first instruction to the fisheye camera data generating device to generate a fisheye image according to the required size. The first instruction can include the preset target radius. After the fisheye camera data generating device obtains the first instruction, it can create a unit sphere hemisphere based on the target radius and convert the target image into a square image with a side length twice the target radius.
[0089] Optionally, if the user or relevant staff has no requirement for the size of the generated fisheye image, a second instruction to generate a fisheye image according to the target image size can be sent to the fisheye camera data generating device. After the fisheye camera data generating device obtains the second instruction, it can determine the side length value according to the length value and width value of the target image, and then convert the target image into a square image with a side length equal to the side length value, and the side length value is twice the target radius, and then create a unit sphere hemisphere based on the target radius.
[0090] Optionally, the side length value may be a width value. For example, if the size of the target image is 2560x1440, that is, the length value is 2560 pixels and the width value is 1440 pixels, then the side length value may be 1440 pixels, and the target radius may be 720 pixels. The fisheye camera data generating device compresses the length of the target image from the original length value to the side length value, that is, compresses the original length of 2560 pixels to 1440 pixels, thereby obtaining a square image.
[0091] Optionally, in order to further avoid deformation problems when the target image is converted into a square image, the fisheye camera data generating device can fill the target image with a blank background to obtain an initial square image with a side length of the length value, and then compress the initial square image to obtain a square image with a side length value of the width value. For example, the size of the target image is 2560*1440, that is, the length value is 2560 pixels and the width value is 1440 pixels, then the side length value can be 2560 pixels. The fisheye camera data generating device can fill the target image with a blank background to obtain an initial square image with a size of 2560*2560, and then compress the initial square image to obtain a square image with a size of 1440*1440.
[0092] S302, obtaining the first coordinate of each pixel point on the square image.
[0093] Specifically, the fisheye camera data generating device may obtain the first coordinates of each pixel point on the square image, and the first coordinates may represent the position of each pixel point on the square image. The method for obtaining the first coordinates is the same as step S201.
[0094] In an embodiment of the present application, the target image is converted into a square image with a side length of twice the target radius, and the first coordinate of each pixel point on the square image is obtained. Through the uniformity of the square image, the error in the mapping process from the target image to the hemispherical image is reduced, and the accuracy of the conversion is improved.
[0095] See also Figure 6 , provides a schematic diagram of a process for obtaining a longitude value for an embodiment of the present application. Step S202 may include the following steps:
[0096] S401, establishing a hemisphere of the unit sphere with the target radius as the radius.
[0097] Specifically, the fisheye camera data generating device can establish a unit sphere hemisphere with the target radius as the radius, wherein the target radius can be preset by the user or relevant staff, or can be obtained based on the side length of the target image.
[0098] Please also see Figure 7 , an example schematic diagram of a unit sphere hemisphere is provided for an embodiment of the present application, a three-dimensional rectangular coordinate system is established with the center of the unit sphere hemisphere as the origin, point P can be the point where the pixel point P' on the target image is projected onto the unit sphere hemisphere, the value of point P in the y-axis direction can be the longitude value of point P on the horizontal axis, and the value of point P in the x-axis direction can be the longitude value of point P on the vertical axis.
[0099] S402: Based on the horizontal coordinate of the first coordinate and the target radius, the longitude value of each pixel point on the horizontal axis is calculated.
[0100] Specifically, the fisheye camera data generating device can calculate the longitude value of each pixel point on the horizontal axis based on the horizontal coordinate of the first coordinate and the target radius. The mapping relationship between the horizontal coordinate of the first coordinate, the target radius and the longitude value is as follows:
[0101]
[0102] Among them, x i is the horizontal coordinate of the first coordinate of the pixel point, R is the target radius, and α is the longitude value of the corresponding pixel point on the horizontal axis of the unit sphere hemisphere, thus:
[0103]
[0104] S403: Based on the ordinate of the first coordinate and the target radius, calculate and obtain the longitude value of each pixel point on the ordinate.
[0105] Specifically, similar to the method for calculating the longitude value of the pixel point on the horizontal axis, the fisheye camera data generating device can calculate the longitude value of each pixel point on the vertical axis based on the vertical coordinate of the first coordinate and the target radius. The mapping relationship between the vertical coordinate of the first coordinate, the target radius and the longitude value on the vertical axis is as follows:
[0106]
[0107] Among them, y j is the ordinate of the first coordinate of the pixel point, R is the target radius, and β is the longitude value of the corresponding pixel point on the ordinate axis of the unit sphere hemisphere. Thus, we can get:
[0108]
[0109] In the embodiment of the present application, a hemisphere of the unit sphere is established with the target radius as the radius, and the longitude value of each pixel point on the horizontal axis is calculated based on the horizontal coordinate of the first coordinate and the target radius, and the longitude value of each pixel point on the vertical axis is calculated based on the vertical coordinate of the first coordinate and the target radius. According to the mapping relationship between the first coordinate and the longitude values on the horizontal and vertical axes, the position of each pixel point on the hemispherical image is calculated, which further improves the accuracy of the hemispherical image acquisition.
[0110] See also Figure 8 , provides a schematic diagram of a process of acquiring a fisheye image based on a hemispherical image in an embodiment of the present application. Step S103 may include the following steps:
[0111] S501, based on the longitude value of each pixel point on the hemispherical image, calculate the second coordinate of each pixel point vertically mapped to the bottom plane of the hemispherical image.
[0112] Specifically, since the hemispherical image is in a three-dimensional space, it needs to be projected onto the bottom plane of the hemisphere to form a two-dimensional fisheye image. The fisheye camera data generating device can calculate the second coordinate of each pixel point mapped to the bottom plane of the hemisphere based on the longitude value of each pixel point on the hemispherical image.
[0113] Please also see Fig. 9 , is an example schematic diagram of obtaining the coordinates of the second work provided in an embodiment of the present application, the bottom plane of the hemisphere may be the xoy plane of the three-dimensional rectangular coordinate system, the point P may be the point on the unit sphere hemisphere projected by the pixel point P' on the target image, P 1 P is the vertical mapping of pixel point P to the point on the xoz plane, 2 is the point vertically mapped from the pixel point P to the yoz plane, α is the longitude value of the pixel point P on the horizontal axis, and is the straight line OP 2 The angle with the negative half axis of the y-axis, β is the longitude value of the pixel point P on the vertical axis, and the straight line OP 1 The angle with the negative half axis of the x-axis is due to:
[0114] π-θ=α
[0115]
[0116] Thus, the angle θ can be calculated. The first coordinate (x i ,y j ) are as follows:
[0117]
[0118] According to the spherical characteristics and the relationship between angles and coordinates, we can get the angles θ, The corresponding relationship between the pixel point P on the hemispherical image and (x, y, z) in the three-dimensional rectangular coordinate system is as follows:
[0119] x 2 +y 2 +z 2 =R 2
[0120]
[0121] Where R is the target radius of the unit sphere. The second coordinate (x, y) of the pixel point P' can be obtained by projecting the pixel point P (x, y, z) onto the xoy plane. According to the above formula, we can get:
[0122] when hour,
[0123] when When x=0
[0124] when hour,
[0125] when hour,
[0126] when When y=0
[0127] when hour,
[0128] At the same time, you can also get:
[0129]
[0130] S502, obtaining the coordinates of the preset distortion center on the bottom plane as the distortion center point coordinates.
[0131] Specifically, the distortion center is a key parameter in the fisheye image, which can represent the symmetry center of the lens optical system of the fisheye camera, that is, the center point of reference for the distortion effect. In the fisheye image, the pixels at the edge of the image will stretch toward the distortion center to form a distortion effect, so the position of the distortion center will affect the distortion effect of the image. In the fisheye image, the part far away from the distortion center will appear more seriously distorted. Projecting according to different distortion centers can obtain fisheye images with different effects. Users or relevant staff can preset the distortion center in the fisheye camera data generating device, and the fisheye camera data generating device can obtain the coordinates of the preset distortion center on the bottom plane as the coordinates of the distortion center point.
[0132] S503: Obtain a fisheye image corresponding to the target image based on the coordinates of the distortion center point and the second coordinates.
[0133] Specifically, the fisheye camera data generating device can obtain a fisheye image corresponding to the target image based on the coordinates of the distortion center point and the second coordinate. Users or relevant staff can obtain fisheye images with different distortion effects corresponding to the same target image by presetting different distortion centers, thereby further increasing the data volume of the fisheye image.
[0134] In the embodiment of the present application, based on the longitude value of each pixel point on the hemispherical image, the second coordinate of each pixel point vertically mapped to the hemispherical bottom plane is calculated, the coordinate of the preset distortion center on the bottom plane is obtained as the distortion center point coordinate, and based on the distortion center point coordinate and the second coordinate, the fisheye image corresponding to the target image is obtained. Fisheye images with different distortion degrees are generated through the distortion center, which improves the flexibility of fisheye image data acquisition.
[0135] See also Fig.10 , which provides a schematic diagram of a process of acquiring a fisheye image based on a distortion center according to an embodiment of the present application. Step S503 may include the following steps:
[0136] S601, calculating the sum of the ordinate of the distortion center point coordinate and the ordinate of the second coordinate to obtain the ordinate of the third coordinate.
[0137] Specifically, the coordinate of the pixel point on the fisheye image is the third coordinate, and the third coordinate can represent the position of the pixel point on the fisheye image.
[0138] For example, see Fig.11 , which is an example schematic diagram of a third coordinate provided in an embodiment of the present application, the fisheye camera data generating device can be as follows Fig.11 As shown, a rectangular coordinate system is established with two tangent lines of the fisheye image as coordinate axes. The pixel point P"' is the pixel point P" on the hemispherical image, which is projected on the fisheye image based on the preset distortion center, and the coordinates are (u, v).
[0139] The fisheye camera data generating device can calculate the sum of the ordinate of the distortion center point coordinate and the ordinate of the second coordinate, thereby obtaining the ordinate of the third coordinate, and the formula is as follows:
[0140] v=y+y 0
[0141] Among them, the coordinates of the distortion center point are (x 0 ,y 0 ), y is the ordinate of the second coordinate, so we can get:
[0142] when hour,
[0143] when When v = y 0
[0144] when hour,
[0145] S602, calculating the sum of the abscissa of the coordinate of the distortion center point and the abscissa of the second coordinate to obtain the abscissa of the third coordinate.
[0146] Specifically, the fisheye camera data generating device can calculate the abscissa of the distortion center point coordinate and the sum of the abscissa of the second coordinate, thereby obtaining the abscissa of the third coordinate, and the formula is as follows:
[0147] u=x+x 0
[0148] Among them, x 0is the abscissa of the distortion center point coordinates, and x is the abscissa of the second coordinate, so we can get:
[0149] when hour,
[0150] Will Substituting the values of and θ into the equation, we get:
[0151]
[0152] when When u=x 0
[0153] when hour,
[0154] Will Substituting the values of and θ into the equation, we get:
[0155]
[0156] S603: Obtain a fisheye image corresponding to the target image based on the third coordinate.
[0157] Specifically, each pixel point is projected onto the bottom plane of the hemisphere based on the third coordinate. For example, the projection point corresponding to each pixel point can be determined on the bottom plane of the hemisphere according to the third coordinate, and the pixel value of the corresponding pixel point is assigned to the projection point to obtain a fisheye image.
[0158] Optionally, if there are pixel gaps in the converted fisheye image, the fisheye camera data generating device may use a bilinear interpolation method to fill in the pixel gaps.
[0159] In the embodiment of the present application, the ordinate of the coordinate of the distortion center point and the sum of the ordinate of the second coordinate are calculated to obtain the ordinate of the third coordinate, the abscissa of the coordinate of the distortion center point and the sum of the abscissa of the second coordinate are calculated to obtain the abscissa of the third coordinate, and the fisheye image corresponding to the target image is obtained based on the third coordinate. The third coordinate of the pixel point on the fisheye image is calculated by the coordinate of the distortion center, thereby improving the accuracy of the projection from the hemispherical image to the fisheye image.
[0160] The fisheye image converted from the target image can be used for research and analysis by users or relevant staff, so there may be a labeling box in the target image. For example, the labeling box may contain labeling content that the user or relevant staff thinks is important. Therefore, after obtaining the fisheye image, it is also necessary to select the converted labeling content, so it is necessary to determine the corresponding labeling box on the fisheye image. Due to the distortion of the coordinate frame during the conversion process, it is not enough to simply convert the vertex coordinates of the labeling box in the target image, so that the converted box will pass through the middle of the distorted labeling content. The fisheye camera data generating device can project all points on the labeling box to obtain the converted labeling box.
[0161] See also Fig.12 , which is a schematic diagram of a flow chart of a label box conversion according to an embodiment of the present application. The fisheye camera data generation method may further include the following steps:
[0162] S701: If a target annotation box exists in the target image, obtain the first annotation coordinates of each pixel point in the target annotation box on the target image.
[0163] Specifically, if there is a target annotation box in the target image, the fisheye camera data generating device can obtain the first annotation coordinates of each target box pixel point on the target image, wherein the target annotation box is a annotation box in the target image, the target annotation box can be a rectangle, the target box pixel point is the pixel point on the target annotation box, and the first annotation coordinate can represent the position of the target box pixel point on the target image, for example, it can be the first coordinate of the target box pixel point on the target image.
[0164] S702: Based on the first labeled coordinates, obtain second labeled coordinates of each target frame pixel point on the fisheye image.
[0165] Specifically, based on the first labeled coordinates, the second labeled coordinates of each target frame pixel on the fisheye image can be obtained. The second labeled coordinates can represent the position of the target frame pixel on the fisheye image, for example, can be the third coordinate of the target frame pixel on the fisheye image.
[0166] S703, obtaining the maximum horizontal coordinate, the maximum vertical coordinate, the minimum horizontal coordinate and the minimum vertical coordinate of all the second marked coordinates.
[0167] Specifically, all the horizontal coordinates in the second labeled coordinates may be obtained, and then the maximum horizontal coordinate and the minimum horizontal coordinate may be determined from all the horizontal coordinates. All the vertical coordinates in the second labeled coordinates may be obtained, and then the maximum vertical coordinate and the minimum vertical coordinate may be obtained from all the vertical coordinates.
[0168] S704, determining a first fisheye labeled vertex based on the maximum abscissa and the maximum ordinate, and determining a second fisheye labeled vertex based on the minimum abscissa and the minimum ordinate.
[0169] Specifically, if the annotation box is a rectangle, the fisheye annotation box in the fisheye image can be determined by the two vertices of the diagonally opposite corners of the rectangle, and the fisheye annotation box is the annotation box corresponding to the target annotation box in the fisheye image. The maximum horizontal coordinate is used as the horizontal coordinate of the first fisheye annotation vertex, and the maximum vertical coordinate is used as the vertical coordinate of the first fisheye annotation vertex, so as to determine the first fisheye annotation vertex, and then the minimum horizontal coordinate is used as the horizontal coordinate of the second fisheye annotation vertex, and the minimum vertical coordinate is used as the vertical coordinate of the second fisheye annotation vertex, so as to determine the second fisheye annotation vertex.
[0170] S705 , generating a fisheye annotation frame corresponding to the fisheye image based on the first fisheye annotation vertex and the second fisheye annotation vertex.
[0171] Specifically, the first fisheye labeled vertex and the second fisheye labeled vertex are two vertices at diagonally opposite corners of the rectangle, so a fisheye labeled frame corresponding to the fisheye image can be generated based on the first fisheye labeled vertex and the second fisheye labeled vertex. For example, the first fisheye labeled vertex can be used as the lower right vertex, and the second fisheye labeled vertex can be used as the upper left vertex. A rectangle is made based on the first fisheye labeled vertex and the second fisheye labeled vertex, and the resulting rectangle is the fisheye labeled frame.
[0172] In an embodiment of the present application, if a target annotation frame exists in the target image, the first annotation coordinates of each pixel point of the target annotation frame on the target image are obtained, and based on the first annotation coordinates, the second annotation coordinates of each pixel point of the target frame on the fisheye image are obtained, and the maximum horizontal coordinate, the maximum vertical coordinate, the minimum horizontal coordinate and the minimum vertical coordinate of all the second annotation coordinates are obtained, and the first fisheye annotation vertex is determined based on the maximum horizontal coordinate and the maximum vertical coordinate, and the second fisheye annotation vertex is determined based on the minimum horizontal coordinate and the minimum vertical coordinate, and the fisheye annotation frame corresponding to the fisheye image is generated based on the first fisheye annotation vertex and the second fisheye annotation vertex. By projecting all the points of the annotation frame, the maximum and minimum coordinate values are obtained to determine the fisheye annotation frame, so that the fisheye annotation frame can select the original annotation content, ensuring the accurate conversion of the target annotation frame and improving the efficiency of the analysis and processing of the fisheye image.
[0173] The following will be combined with the attached Fig.13 -Attached Fig.14 , the fisheye camera data generation device provided in the embodiment of the present application is introduced in detail. It should be noted that the attached Fig.13 -Attached Fig.14 The fisheye camera data generating device in the present application is used to execute Figure 1-Figure 12For the convenience of explanation, only the part related to the embodiment of the present application is shown. For the specific technical details not disclosed, please refer to the present application. Figure 1-Figure 12 The embodiment shown.
[0174] See also Fig.13 , which shows a schematic diagram of the structure of a fisheye camera data generating device provided by an exemplary embodiment of the present application. The fisheye camera data generating device can be implemented as all or part of the device through software, hardware or a combination of both. The device 1 includes an icon image acquisition unit 11, a hemispherical projection unit 12 and a fisheye projection unit 13.
[0175] The icon image acquisition unit 11 is used to acquire the target image captured by a normal camera;
[0176] A hemispherical projection unit 12 is used to project each pixel point of the target image onto a hemispherical surface of a unit sphere hemisphere to obtain a hemispherical image;
[0177] The fisheye projection unit 13 is used to project each of the pixel points onto the bottom plane of the hemisphere based on a preset distortion center to obtain a fisheye image corresponding to the target image.
[0178] In this embodiment, a target image captured by a normal camera is acquired, each pixel of the target image is projected onto a hemispherical surface of a unit sphere hemisphere to acquire a hemispherical image, and each pixel is projected onto a bottom plane of the hemisphere based on a preset distortion center to acquire a fisheye image corresponding to the target image. By projecting the image captured by a normal camera onto a hemispherical surface, and then projecting onto a plane based on a preset distortion center to acquire a fisheye image, the fisheye image can be acquired conveniently and quickly, and the degree of distortion of the fisheye image can be controlled, further improving the flexibility of acquiring fisheye image data.
[0179] See also Fig.14 , which shows a schematic diagram of the structure of a fisheye camera data generating device provided by an exemplary embodiment of the present application. The fisheye camera data generating device can be implemented as all or part of the device through software, hardware or a combination of both. The device 1 includes an icon image acquisition unit 11, a hemispherical projection unit 12, a fisheye projection unit 13 and a label frame conversion unit 14.
[0180] The icon image acquisition unit 11 is used to acquire the target image captured by a normal camera;
[0181] A hemispherical projection unit 12 is used to project each pixel point of the target image onto a hemispherical surface of a unit sphere hemisphere to obtain a hemispherical image;
[0182] Optionally, the hemispherical projection unit 12 is specifically configured to obtain the first coordinates of each pixel point on the target image;
[0183] Based on the first coordinates and the target radius of the unit sphere, determine the longitude values of each pixel point on the hemisphere of the unit sphere;
[0184] Based on the longitude values of each pixel point, obtain a hemispherical image.
[0185] Optionally, the hemispherical projection unit 12 is specifically configured to convert the target image into a square image with a side length twice the target radius;
[0186] Obtain the first coordinates of each pixel point on the square image.
[0187] Optionally, the hemispherical projection unit 12 is specifically configured to establish a hemisphere of the unit sphere with the target radius as the radius;
[0188] Based on the abscissa of the first coordinates and the target radius, calculate the longitude values of each pixel point on the horizontal axis;
[0189] Based on the ordinate of the first coordinates and the target radius, calculate the longitude values of each pixel point on the vertical axis.
[0190] The fisheye projection unit 13 is configured to project each pixel point onto the bottom plane of the hemisphere based on a preset distortion center to obtain a fisheye image corresponding to the target image.
[0191] Optionally, the fisheye projection unit 13 is specifically configured to calculate the second coordinates of each pixel point vertically mapped onto the bottom plane of the hemisphere based on the longitude values of each pixel point on the hemispherical image;
[0192] Obtain the coordinates of the preset distortion center on the bottom plane as the distortion center point coordinates;
[0193] Based on the distortion center point coordinates and the second coordinates, obtain a fisheye image corresponding to the target image.
[0194] Optionally, the fisheye projection unit 13 is specifically configured to calculate the sum of the ordinate of the distortion center point coordinates and the ordinate of the second coordinates to obtain the ordinate of the third coordinates;
[0195] Calculate the sum of the abscissa of the distortion center point coordinates and the abscissa of the second coordinates to obtain the abscissa of the third coordinates;
[0196] Based on the third coordinates, obtain a fisheye image corresponding to the target image.
[0197] The annotation box conversion unit 14 is used for obtaining the first annotation coordinates of each target box pixel point on the target image if there is a target annotation box on the target image;
[0198] Based on the first annotated coordinates, obtaining second annotated coordinates of each pixel point of the target frame on the fisheye image;
[0199] Obtain the maximum abscissa, the maximum ordinate, the minimum abscissa and the minimum ordinate of all the second labeled coordinates;
[0200] Determine a first fisheye marked vertex based on the maximum abscissa and the maximum ordinate, and determine a second fisheye marked vertex based on the minimum abscissa and the minimum ordinate;
[0201] A fisheye annotation frame corresponding to the fisheye image is generated based on the first fisheye annotation vertex and the second fisheye annotation vertex.
[0202] In this embodiment, a target image captured by a normal camera is obtained, the target image is converted into a square image with a side length of twice the target radius, and the first coordinate of each pixel on the square image is obtained. Through the uniformity of the square image, the error in the mapping process from the target image to the hemispherical image is reduced, and the accuracy of the conversion is improved. Based on the first coordinate and the target radius of the unit sphere, the longitude value of each pixel on the unit sphere hemisphere is determined, and the hemispherical image is obtained based on the longitude value of each pixel. The projection of each pixel is completed by the longitude value of each pixel, thereby improving the accuracy of the projection process and the accuracy of the hemispherical image. A hemisphere of the unit sphere is established with the target radius as the radius, and the longitude value of each pixel on the horizontal axis is calculated based on the horizontal coordinate of the first coordinate and the target radius, and the longitude value of each pixel on the vertical axis is calculated based on the vertical coordinate of the first coordinate and the target radius. According to the mapping relationship between the first coordinate and the longitude values on the horizontal and vertical axes, the position of each pixel on the hemispherical image is calculated, which further improves the accuracy of the hemispherical image acquisition. Based on the longitude value of each pixel point on the hemispherical image, the second coordinate of each pixel point vertically mapped to the bottom plane of the hemispherical image is calculated, and the coordinate of the preset distortion center on the bottom plane is obtained as the coordinate of the distortion center point. The ordinate of the coordinate of the distortion center point and the sum of the ordinate of the second coordinate are calculated to obtain the ordinate of the third coordinate. The abscissa of the coordinate of the distortion center point and the sum of the abscissa of the second coordinate are calculated to obtain the abscissa of the third coordinate. Based on the third coordinate, the fisheye image corresponding to the target image is obtained. The third coordinate of the pixel point on the fisheye image is calculated by the coordinate of the distortion center, thereby improving the accuracy of the projection from the hemispherical image to the fisheye image. Based on the coordinate of the distortion center point and the second coordinate, the fisheye image corresponding to the target image is obtained, and fisheye images with different distortion degrees are generated by the distortion center and different parameter settings, thereby improving the flexibility of fisheye image data acquisition. By projecting the image captured by the normal camera onto the hemispherical surface, and then projecting it onto the plane according to the preset distortion center to obtain the fisheye image, the fisheye image is obtained conveniently and quickly, and the distortion degree of the fisheye image can be controlled, further improving the flexibility of fisheye image data acquisition. The fisheye annotation frame can also be determined by projecting all points of the annotation frame to obtain the maximum and minimum coordinate values, so that the fisheye annotation frame can select the original annotation content, ensuring the accurate conversion of the target annotation frame and improving the efficiency of fisheye image analysis and processing.
[0203] It should be noted that the fisheye camera data generation device provided in the above embodiment only uses the division of the above functional modules as an example when executing the fisheye camera data generation method. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. In addition, the fisheye camera data generation device provided in the above embodiment and the fisheye camera data generation method embodiment belong to the same concept, and the implementation process thereof is detailed in the method embodiment, which will not be repeated here.
[0204] The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.
[0205] The present application also provides a computer storage medium, which can store multiple instructions, and the instructions are suitable for being loaded and executed by a processor as described above. Figure 1-Figure 12 The fisheye camera data generation method of the embodiment shown in the figure can be specifically referred to in the Figure 1-Figure 12 The specific description of the illustrated embodiment will not be repeated here.
[0206] The present application also provides a computer program product, which stores at least one instruction, and the at least one instruction is loaded and executed by the processor as described above. Figure 1-Figure 12 The fisheye camera data generation method of the embodiment shown in the figure can be specifically referred to in the Figure 1-Figure 12 The specific description of the illustrated embodiment will not be repeated here.
[0207] Please refer to Fig.15 , which shows a block diagram of the structure of an electronic device provided by an exemplary embodiment of the present application. The electronic device in the present application may include one or more of the following components: a processor 110, a memory 120, an input device 130, an output device 140, and a bus 150. The processor 110, the memory 120, the input device 130, and the output device 140 may be connected via the bus 150.
[0208] The processor 110 may include one or more processing cores. The processor 110 uses various interfaces and lines to connect various parts of the entire electronic device, and executes various functions and processes data of the terminal 100 by running or executing instructions, programs, code sets or instruction sets stored in the memory 120, and calling data stored in the memory 120. Optionally, the processor 110 can be implemented in at least one hardware form of digital signal processing (DSP), field-programmable gate array (FPGA), and programmable logic array (PLA). The processor 110 can integrate one or a combination of a central processing unit (CPU), a graphics processor (GPU), and a modem. Among them, the CPU mainly processes the operating system, user pages, and applications; the GPU is responsible for rendering and drawing display content; and the modem is used to process wireless communications. It can be understood that the above-mentioned modem may not be integrated into the processor 110, but may be implemented separately through a communication chip.
[0209] The memory 120 may include a random access memory (RAM) or a read-only memory (ROM). Optionally, the memory 120 includes a non-transitory computer-readable medium (Non-Transitory Computer-Readable Storage Medium). The memory 120 may be used to store instructions, programs, codes, code sets or instruction sets. The memory 120 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for implementing at least one function (such as a touch function, a sound playback function, an image playback function, etc.), instructions for implementing the above-mentioned various method embodiments, etc. The operating system may be an Android system, including a system deeply developed based on the Android system, an IOS system developed by Apple, including a system deeply developed based on the IOS system or other systems.
[0210] The memory 120 can be divided into an operating system space and a user space. The operating system runs in the operating system space, and native and third-party applications run in the user space. In order to ensure that different third-party applications can achieve good operating results, the operating system allocates corresponding system resources to different third-party applications. However, the requirements for system resources in different application scenarios in the same third-party application are also different. For example, in the local resource loading scenario, the third-party application has higher requirements for disk reading speed; in the animation rendering scenario, the third-party application has higher requirements for GPU performance. The operating system and third-party applications are independent of each other, and the operating system often cannot perceive the current application scenario of the third-party application in a timely manner, resulting in the operating system being unable to perform targeted system resource adaptation according to the specific application scenario of the third-party application.
[0211] In order for the operating system to distinguish the specific application scenarios of third-party applications, it is necessary to open up data communication between third-party applications and the operating system so that the operating system can obtain the current scenario information of third-party applications at any time, and then perform targeted system resource adaptation based on the current scenario.
[0212] The input device 130 is used to receive input commands or data, and includes but is not limited to a keyboard, a mouse, a camera, a microphone, or a touch device. The output device 140 is used to output commands or data, and includes but is not limited to a display device and a speaker. In one example, the input device 130 and the output device 140 can be combined, and the input device 130 and the output device 140 are touch screen displays.
[0213] The touch display screen can be designed as a full screen, a curved screen or a special-shaped screen. The touch display screen can also be designed as a combination of a full screen and a curved screen, or a combination of a special-shaped screen and a curved screen, which is not limited in the embodiments of the present application.
[0214] In addition, those skilled in the art will appreciate that the structure of the electronic device shown in the above drawings does not constitute a limitation on the electronic device, and the electronic device may include more or fewer components than shown, or combine certain components, or arrange the components differently. For example, the electronic device also includes a radio frequency circuit, an input unit, a sensor, an audio circuit, a wireless fidelity (WiFi) module, a power supply, a Bluetooth module and other components, which will not be described in detail here.
[0215] exist Fig.15 In the electronic device shown, the processor 110 can be used to call the fisheye camera data generation application stored in the memory 120, and specifically perform the following operations:
[0216] Acquire the target image captured by a normal camera;
[0217] Projecting each pixel point of the target image onto a hemispherical surface of a unit sphere hemisphere to obtain a hemispherical image;
[0218] Based on a preset distortion center, each pixel point is projected onto the bottom plane of the hemisphere to obtain a fisheye image corresponding to the target image.
[0219] In one embodiment, when the processor 110 projects each pixel point of the target image onto the hemispherical surface of the unit sphere hemisphere to obtain the hemispherical image, the processor 110 specifically performs the following operations:
[0220] Obtaining the first coordinate of each pixel point on the target image;
[0221] Determine the longitude value of each pixel point on the hemisphere of the unit sphere based on the first coordinate and the target radius of the unit sphere;
[0222] A hemispherical image is obtained based on the longitude value of each pixel point.
[0223] In one embodiment, when the processor 110 acquires the first coordinate of each pixel point on the target image, the processor 110 specifically performs the following operations:
[0224] Converting the target image into a square image with a side length twice the target radius;
[0225] The first coordinate of each pixel point on the square image is obtained.
[0226] In one embodiment, when the processor 110 determines the longitude value of each pixel point on the hemisphere of the unit sphere based on the first coordinate and the target radius of the unit sphere, the processor 110 specifically performs the following operations:
[0227] Create a hemisphere of the unit sphere with the target radius as the radius;
[0228] Based on the horizontal coordinate of the first coordinate and the target radius, calculate and obtain the longitude value of each pixel point on the horizontal axis;
[0229] Based on the longitudinal coordinate of the first coordinate and the target radius, the longitude value of each pixel point on the longitudinal axis is calculated.
[0230] In one embodiment, when the processor 110 projects each pixel point onto the bottom plane of the hemisphere based on a preset distortion center to obtain a fisheye image corresponding to the target image, the processor 110 specifically performs the following operations:
[0231] Calculate the second coordinate of each pixel point vertically mapped onto the bottom plane of the hemisphere based on the longitude value of each pixel point on the hemisphere image;
[0232] Obtaining the coordinates of the preset distortion center on the bottom plane as the distortion center point coordinates;
[0233] Based on the distortion center point coordinates and the second coordinates, a fisheye image corresponding to the target image is obtained.
[0234] In one embodiment, when the processor 110 obtains the fisheye image corresponding to the target image based on the coordinates of the distortion center point and the second coordinates, the processor 110 specifically performs the following operations:
[0235] Calculate the sum of the ordinate of the coordinate of the distortion center point and the ordinate of the second coordinate to obtain the ordinate of the third coordinate;
[0236] Calculate the sum of the abscissa of the coordinates of the distortion center point and the abscissa of the second coordinate to obtain the abscissa of the third coordinate;
[0237] Based on the third coordinate, a fisheye image corresponding to the target image is obtained.
[0238] In one embodiment, when executing the fisheye camera data generating method, the processor 110 further performs the following operations:
[0239] If the target image has a target annotation box, obtaining first annotation coordinates of each target box pixel point on the target image;
[0240] Based on the first annotated coordinates, obtaining second annotated coordinates of each pixel point of the target frame on the fisheye image;
[0241] Obtain the maximum abscissa, the maximum ordinate, the minimum abscissa and the minimum ordinate of all the second labeled coordinates;
[0242] Determine a first fisheye marked vertex based on the maximum abscissa and the maximum ordinate, and determine a second fisheye marked vertex based on the minimum abscissa and the minimum ordinate;
[0243] A fisheye annotation frame corresponding to the fisheye image is generated based on the first fisheye annotation vertex and the second fisheye annotation vertex.
[0244] In this embodiment, a target image captured by a normal camera is obtained, the target image is converted into a square image with a side length of twice the target radius, and the first coordinate of each pixel on the square image is obtained. Through the uniformity of the square image, the error in the mapping process from the target image to the hemispherical image is reduced, and the accuracy of the conversion is improved. Based on the first coordinate and the target radius of the unit sphere, the longitude value of each pixel on the unit sphere hemisphere is determined, and the hemispherical image is obtained based on the longitude value of each pixel. The projection of each pixel is completed by the longitude value of each pixel, thereby improving the accuracy of the projection process and the accuracy of the hemispherical image. A hemisphere of the unit sphere is established with the target radius as the radius, and the longitude value of each pixel on the horizontal axis is calculated based on the horizontal coordinate of the first coordinate and the target radius, and the longitude value of each pixel on the vertical axis is calculated based on the vertical coordinate of the first coordinate and the target radius. According to the mapping relationship between the first coordinate and the longitude values on the horizontal and vertical axes, the position of each pixel on the hemispherical image is calculated, which further improves the accuracy of the hemispherical image acquisition. Based on the longitude value of each pixel point on the hemispherical image, the second coordinate of each pixel point vertically mapped to the bottom plane of the hemispherical image is calculated, and the coordinate of the preset distortion center on the bottom plane is obtained as the coordinate of the distortion center point. The ordinate of the coordinate of the distortion center point and the sum of the ordinate of the second coordinate are calculated to obtain the ordinate of the third coordinate. The abscissa of the coordinate of the distortion center point and the sum of the abscissa of the second coordinate are calculated to obtain the abscissa of the third coordinate. Based on the third coordinate, the fisheye image corresponding to the target image is obtained. The third coordinate of the pixel point on the fisheye image is calculated by the coordinate of the distortion center, thereby improving the accuracy of the projection from the hemispherical image to the fisheye image. Based on the coordinate of the distortion center point and the second coordinate, the fisheye image corresponding to the target image is obtained, and fisheye images with different distortion degrees are generated by the distortion center and different parameter settings, thereby improving the flexibility of fisheye image data acquisition. By projecting the image captured by the normal camera onto the hemispherical surface, and then projecting it onto the plane according to the preset distortion center to obtain the fisheye image, the fisheye image is obtained conveniently and quickly, and the distortion degree of the fisheye image can be controlled, further improving the flexibility of fisheye image data acquisition. The fisheye annotation frame can also be determined by projecting all points of the annotation frame to obtain the maximum and minimum coordinate values, so that the fisheye annotation frame can select the original annotation content, ensuring the accurate conversion of the target annotation frame and improving the efficiency of fisheye image analysis and processing.
[0245] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing related hardware through a computer program, and the program can be stored in a computer-readable storage medium, and when the program is executed, it can include the processes of the embodiments of the above-mentioned methods. The storage medium can be a disk, an optical disk, a read-only storage memory, or a random access memory, etc.
[0246] The above disclosure is only the preferred embodiment of the present application, which certainly cannot be used to limit the scope of rights of the present application. Therefore, equivalent changes made according to the claims of the present application are still within the scope covered by the present application.
[0247] It should be noted that the information (including but not limited to user device information, user personal information, etc.), data (including but not limited to data used for analysis, stored data, displayed data, etc.) and signals involved in the embodiments of this specification are all authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of the relevant countries and regions. For example, the target image and the coordinates of each pixel point involved in this specification are all obtained with full authorization.
Claims
1. A method for generating fisheye camera data, characterized in that: The method comprises: Acquire the target image captured by a normal camera; Projecting each pixel point of the target image onto a hemispherical surface of a unit sphere hemisphere to obtain a hemispherical image; Based on a preset distortion center, each pixel point is projected onto the bottom plane of the hemisphere to obtain a fisheye image corresponding to the target image.
2. The method according to claim 1, characterized in that The step of projecting each pixel point of the target image onto a hemispherical surface of a unit sphere hemisphere to obtain a hemispherical image includes: Obtaining the first coordinate of each pixel point on the target image; Determine the longitude value of each pixel point on the hemisphere of the unit sphere based on the first coordinate and the target radius of the unit sphere; A hemispherical image is obtained based on the longitude value of each pixel point.
3. The method according to claim 2, characterized in that The obtaining of the first coordinates of each pixel point on the target image includes: Converting the target image into a square image with a side length twice the target radius; The first coordinate of each pixel point on the square image is obtained.
4. The method according to claim 2, characterized in that: The determining, based on the first coordinate and the target radius of the unit sphere, the longitude value of each pixel point on the hemisphere of the unit sphere includes: Create a hemisphere of the unit sphere with the target radius as the radius; Based on the horizontal coordinate of the first coordinate and the target radius, calculate and obtain the longitude value of each pixel point on the horizontal axis; Based on the longitudinal coordinate of the first coordinate and the target radius, the longitude value of each pixel point on the longitudinal axis is calculated.
5. The method according to claim 1, characterized in that The step of projecting each pixel point onto the bottom plane of the hemisphere based on a preset distortion center to obtain a fisheye image corresponding to the target image includes: Calculate the second coordinate of each pixel point vertically mapped onto the bottom plane of the hemisphere based on the longitude value of each pixel point on the hemisphere image; Obtaining the coordinates of the preset distortion center on the bottom plane as the distortion center point coordinates; Based on the distortion center point coordinates and the second coordinates, a fisheye image corresponding to the target image is obtained.
6. The method according to claim 5, characterized in that The obtaining, based on the coordinates of the distortion center point and the second coordinates, a fisheye image corresponding to the target image includes: Calculate the sum of the ordinate of the coordinate of the distortion center point and the ordinate of the second coordinate to obtain the ordinate of the third coordinate; Calculate the sum of the abscissa of the coordinates of the distortion center point and the abscissa of the second coordinate to obtain the abscissa of the third coordinate; Based on the third coordinate, a fisheye image corresponding to the target image is obtained.
7. The method according to claim 1, characterized in that The method further comprises: If the target image has a target annotation box, obtaining first annotation coordinates of each target box pixel point on the target image; Based on the first annotated coordinates, obtaining second annotated coordinates of each pixel point of the target frame on the fisheye image; Obtain the maximum abscissa, the maximum ordinate, the minimum abscissa and the minimum ordinate of all the second labeled coordinates; Determine a first fisheye marked vertex based on the maximum abscissa and the maximum ordinate, and determine a second fisheye marked vertex based on the minimum abscissa and the minimum ordinate; A fisheye annotation frame corresponding to the fisheye image is generated based on the first fisheye annotation vertex and the second fisheye annotation vertex.
8. A fisheye camera data generating device, characterized in that: The device comprises: An icon image acquisition unit, used to acquire a target image captured by a normal camera; A hemispherical projection unit, used for projecting each pixel point of the target image onto a hemispherical surface of a unit sphere hemisphere to obtain a hemispherical image; The fisheye projection unit is used to project each of the pixel points onto the bottom plane of the hemisphere based on a preset distortion center to obtain a fisheye image corresponding to the target image.
9. A computer storage medium, characterized in that: The computer storage medium stores a plurality of instructions, and the instructions are suitable for being loaded by a processor and executing the method steps according to any one of claims 1 to 7.
10. An electronic device, characterized in that: include: A processor and a memory; wherein the memory stores a computer program, and the computer program is suitable for being loaded by the processor and executing the method steps as claimed in any one of claims 1 to 7.