Disclosure of Invention
The application aims to provide an image output method, a terminal, an electronic device and a storage medium with preset parameters, wherein at least one path of image output effect is obtained by processing an original image of a wide-angle lens and combining the preset parameters.
In order to achieve the above object, a first aspect of the embodiments of the present application discloses an image output method with preset parameters, including:
acquiring an original image of a wide-angle lens;
carrying out distortion correction on the original image to obtain a corrected image;
acquiring preset parameters;
and processing the corrected image by combining the preset parameters to obtain at least one path of preset output image, wherein the output image corresponds to the preset parameters.
Optionally, the step of performing distortion correction on the original image to obtain a corrected image specifically includes;
acquiring parameters of radial distortion and tangential distortion of the wide-angle lens;
and carrying out distortion correction on the original image according to the parameters to obtain a corrected image.
Optionally, the step of obtaining the preset parameter specifically includes: and acquiring preset parameters according to real-time setting of a user or preset setting in the equipment.
Optionally, before the step of obtaining the preset parameter, the method further includes: receiving preset parameters set by a user through network connection or receiving preset parameters directly set in equipment.
Optionally, the preset parameter includes one or a combination of a plurality of preset directions, numbers and output modes of the output images.
Optionally, the step of processing the corrected image with reference to the preset parameter to obtain at least one preset output image specifically includes:
analyzing preset parameters to obtain an analysis result;
according to the analysis result, operating the corrected image data, wherein the operating comprises positioning in the corrected image, and then performing at least one of interception and translation;
and outputting at least one preset output image.
Optionally, the processing the corrected image with the preset parameters to obtain at least one path of preset output image specifically includes:
analyzing preset parameters to obtain an analysis result, wherein the analysis result comprises information of an output sound source;
according to the analysis result, operating the corrected image data, wherein the operating comprises positioning the position of a sound source in the corrected image, and then performing at least one of interception and translation;
and outputting one path of image, wherein the path of output image contains the information of the sound source.
Optionally, the information of the output sound source is information of an avatar of the speaker.
Optionally, the positioning the head portrait of the speaker in the rectified image includes positioning the speaker according to a sound source. Alternatively, the single wide-angle lens includes a single general wide-angle lens, an ultra wide-angle lens, or a fisheye lens.
The second aspect of the embodiment of the present application discloses an image output terminal with preset parameters, which includes:
a first acquisition module for acquiring an original image of a single wide-angle lens;
the correction module is used for carrying out distortion correction on the original image to obtain a corrected image;
the second acquisition module is used for acquiring preset parameters;
and the output module is used for processing the corrected image by combining the preset parameters to obtain at least one path of preset output image, wherein the output image corresponds to the preset parameters.
Optionally, the orthotic module, comprises:
a correction parameter acquisition module: the system comprises a wide-angle lens, a lens controller and a controller, wherein the wide-angle lens is used for acquiring parameters of radial distortion and tangential distortion of the wide-angle lens;
a corrected image acquisition module: and the image distortion correction module is used for carrying out distortion correction on the original image according to the parameters to obtain a corrected image.
Optionally, the second obtaining module is configured to obtain the preset parameter according to a real-time setting of a user or according to a preset setting in the device.
Optionally, the second obtaining module further includes, before obtaining the preset parameter:
a receiving module: which is used for receiving preset parameters set by a user through network connection or receiving preset parameters directly set in equipment.
Optionally, in the second obtaining module, the preset parameter includes one or a combination of a direction, a number, and an output mode of the preset output image.
Optionally, the output module includes:
the analysis module is used for analyzing the preset parameters to obtain an analysis result;
the processing module is used for operating the corrected image data according to the analysis result, and the operation comprises positioning in the corrected image, and then at least one of intercepting and translating;
and the display module is used for outputting at least one path of preset output image.
Optionally, the first obtaining module is configured to obtain a single wide-angle lens by using a single general wide-angle lens, an ultra wide-angle lens, or a fisheye lens.
A third aspect of the embodiments of the present application discloses an electronic device, which includes a processor and a memory, where the memory stores at least one instruction, at least one program, a code set, or a set of instructions, and the at least one instruction, the at least one program, the code set, or the set of instructions is loaded and executed by the processor to implement the image output method with preset parameters as described above.
A fourth aspect of the embodiments of the present application discloses a computer-readable storage medium, wherein at least one instruction, at least one program, a code set, or a set of instructions is stored in the computer-readable storage medium, and the at least one instruction, the at least one program, the code set, or the set of instructions is loaded and executed by a processor to implement the image output method with one preset parameter as described above.
After adopting above-mentioned technical scheme, this application compares with the background art, has following advantage: the distortion correction is carried out on the original image of the single wide-angle lens, and the corrected image is processed by combining preset parameters, so that at least one path of preset output image of the single wide-angle lens is obtained. The effect of multi-path output of a plurality of lenses or the lens with the cloud platform is realized by using a single wide-angle lens, so that the accuracy and flexibility of output are ensured, and the use cost is reduced.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application.
The embodiment is used for realizing the multi-path output effect of multiple lenses or the lens with the cloud platform by using one wide-angle lens in a video conference or a reversing camera of a doorbell or an automobile, thereby not only ensuring the accuracy and flexibility of output, but also reducing the use cost.
Fig. 1 is a flowchart of a method for outputting an image with preset parameters according to a first embodiment of the present application, please refer to fig. 1, wherein the method for outputting an image with preset parameters includes the following steps:
s110, acquiring an original image of a single wide-angle lens;
in the present embodiment, the single wide-angle lens may be a single general wide-angle lens, an ultra wide-angle lens, or a fisheye lens. The single wide-angle lens can be installed in various application places, such as video conferences in offices, doorbells in homes or in company places, reversing automobiles and the like. The original image is taken through a single wide-angle lens set at these application sites. Because the wide-angle lens has shorter focal distance and wider visual angle in the design specification, the visual angle of the general wide-angle lens can reach 60-84 degrees, the visual angle of the ultra-wide-angle lens can reach 94-118 degrees, and the visual angle of the fisheye lens can even reach 220-230 degrees, and because the visual angle is larger, the original image collected by shooting can generate more serious distortion. The distortion of the wide-angle lens is mainly of two types: radial distortion and tangential distortion. Radial distortion is characterized by minimal distortion at the very center, with increased distortion with increasing radius. Radial distortion can be divided into pincushion distortion and barrel distortion. Tangential distortion occurs when the lens is not parallel to the imaging plane. FIG. 2A is a comparison of a normal image and corresponding radial-pincushion distortion and radial-barrel distortion; fig. 2B is a comparison of a normal image and the corresponding tangential distortion.
S120, carrying out distortion correction on the original image to obtain a corrected image;
specifically, step S120 includes:
(1) acquiring parameters of radial distortion and tangential distortion of the wide-angle lens;
the radial distortion correction formula is as follows (taylor series expansion front 3 terms):
where (x, y) are ideal coordinates, xdrAnd ydrIs the distorted pixel point coordinates, and:
r2=x2+y2
the formula for correcting the tangential distortion is as follows:
both distortions are finally attributed to five parameters: k is a radical of1,k2,k3,p1,p2(ii) a These five parameters can be released according to the above formula.
(2) And carrying out distortion correction on the original image according to the parameters to obtain a corrected image. And after the five parameters are known, the correction from the distorted pixel point coordinates to the ideal coordinates can be completed.
The image is sequentially mapped from the pixel coordinate system to the world coordinate system by the following calculation formula, wherein u and v are coordinates in the pixel coordinate system, XYZ is coordinates in the world coordinate system, and the remaining two matrices are respectively:
RT01 matrix: the camera external parameter is a rotation and translation transformation relation of the camera relative to a world coordinate system.
4 × 3 matrix: the camera internal parameter is the inherent property of the camera and contains parameters such as focal length and pixel size.
Fig. 3A is an original image provided by a wide-angle lens. Fig. 3B is a diagram illustrating the effect of the wide-angle lens after the distortion of the original image is corrected.
S130, acquiring preset parameters;
in this embodiment, the preset parameters may be obtained according to real-time settings of a user, or may be obtained according to preset settings in the device. For example, in a video conference, a user may set the direction of the wide-angle lens output image in real time, or may set the direction in advance in the device. The image output effect currently desired by the user can be met through real-time setting; a default output mode may also be used, without requiring the user to set the image output effect each time.
Before the step of obtaining the preset parameters, the method further comprises the following steps: receiving preset parameters set by a user through network connection or receiving preset parameters directly set in equipment. For example, the user may set the wide-angle lens on an application of the intelligent terminal through network connection, or may directly set the wide-angle lens in the device.
The preset parameters comprise one or more of preset direction, quantity and output mode of the output images. For example, in an office video conference, a user may set which direction images are to be output, or may set polling output. In the video conference, the user can also set that the output of the speaker is locked, only the speaker is output, and the effect of tracking the speaker is realized. Under the monitoring scene, a user can set an image of a monitoring sound source, position the sound source through the sound source and output the image of the sound source.
For example, several buttons representing different directions may be set in a wide-angle lens of a doorbell at home or in an office, and a user may set the direction, the number, and the output mode of an output image by pressing the corresponding buttons.
For example, images of different angles can be set and output in a reversing wide-angle lens of an automobile, so that the reversing real-time requirement is met.
The user can also set one-time output of multiple paths of images or only one path of preset image.
The output mode of the multi-path images can also be set, and the multi-path images can be placed in a certain sequence or output in a combined mode of a main picture and a secondary picture.
And S140, processing the corrected image by combining the preset parameters to obtain at least one path of preset output image, wherein the output image corresponds to the preset parameters.
Specifically, step S140 includes:
analyzing preset parameters to obtain an analysis result;
according to the analysis result, operating the corrected image data, wherein the operating comprises positioning in the corrected image, and then at least one of intercepting and translating;
and outputting at least one preset output image.
In this embodiment, the preset parameters are analyzed to obtain an analysis result, and then the corrected image is subjected to the following operations according to the analyzed parameters:
a. positioning and locking an image meeting the requirements;
b. intercepting an image meeting the requirements;
c. one or more images are acquired in a translation manner according to the output manner in the analysis parameters.
And finally, outputting at least one preset output image corresponding to the preset parameters.
Fig. 4A-4B are schematic diagrams illustrating image multiplexing of preset parameters according to the present embodiment. Fig. 4A is a corrected image, and fig. 4B is a multiplexed output image obtained by processing the corrected image with preset parameters. The user presets the position and the number of the images to be output, and sets three output images to be output in a combined mode of upper, lower left and lower right.
For another example, in a video conference, a situation that the output of a speaker is locked, and the tracking of the speaker is realized, preset parameters are analyzed, and the information that the analysis result is the head portrait of the speaker is output is obtained; according to the analysis result, operating the corrected data image, including positioning the information of the head portrait of the speaker in the corrected image according to sound source positioning, and then intercepting and translating the image of the head portrait information of the speaker; and outputting the image containing the head portrait information of the speaker, wherein the output mode is according to a mode preset by a user.
In another embodiment of the application, in a monitoring scene, the output of a sound source is locked, and an image of sound source information is output. I.e., any way of indicating that it is preset as output content, is within the scope of the present embodiment.
In the embodiment, the position, the number and the output mode of the output image are preset, so that the effect of obtaining at least one path of preset output by using one wide-angle lens is realized, the use cost is saved, and the accuracy and the flexibility of output are also ensured.
Fig. 5 is a block diagram of an image output terminal with preset parameters according to a second embodiment of the present application, and please refer to the first embodiment for parts not described in this embodiment. Referring to fig. 5, an image output terminal with preset parameters includes:
a first acquisition module for acquiring an original image of a single wide-angle lens;
the correction module is used for carrying out distortion correction on the original image to obtain a corrected image;
the second acquisition module is used for acquiring preset parameters;
and the output module is used for processing the corrected image by combining the preset parameters to obtain at least one path of preset output image, wherein the output image corresponds to the preset parameters.
In this embodiment, the single wide-angle lens in the first acquisition module may be a single general wide-angle lens, an ultra wide-angle lens, or a fisheye lens.
In this embodiment, the orthotic module comprises:
a correction parameter acquisition module: the system comprises a wide-angle lens, a lens controller and a controller, wherein the wide-angle lens is used for acquiring parameters of radial distortion and tangential distortion of the wide-angle lens;
a corrected image acquisition module: and the image distortion correction module is used for carrying out distortion correction on the original image according to the parameters to obtain a corrected image.
In this embodiment, the second obtaining module is configured to obtain the preset. The preset parameters can be obtained according to the real-time setting of the user, or the preset parameters can be obtained according to the preset setting in the equipment.
Before the preset parameters are obtained, the method further comprises the following steps:
and the receiving module is used for receiving preset parameters set by a user through network connection or receiving preset parameters directly set in the equipment.
The preset parameters comprise one or more of preset direction, quantity and output mode of the output images.
In this embodiment, the output module includes:
the analysis module is used for analyzing the preset parameters to obtain an analysis result;
the processing module is used for operating the corrected image data according to the analysis result, and the operation comprises positioning in the corrected image, and then at least one of intercepting and translating;
and the display module is used for outputting at least one path of preset output image.
For another example, in a video conference, under a scene that the output of a speaker is locked and the tracking of the speaker is realized, the analysis module is used for analyzing the preset parameters and obtaining the information that the analysis result is the head portrait of the speaker; the processing module is used for operating the corrected data image according to the analysis result, and comprises positioning the information of the head portrait of the speaker in the corrected image according to sound source positioning, and then intercepting and translating the image of the head portrait information of the speaker; and the display module is used for outputting the image containing the head portrait information of the speaker, and the output mode is according to a mode preset by a user.
The third embodiment of the present application further provides an electronic device, please refer to fig. 6, the electronic device includes aprocessor 611 and amemory 612, thememory 612 stores at least one instruction, at least one program, a code set, or a set of instructions, and the at least one instruction, the at least one program, the code set, or the set of instructions is loaded and executed by theprocessor 611 to implement the image output method with preset parameters as described above.
The fourth embodiment of the present application further provides a computer-readable storage medium, in which at least one instruction, at least one program, a code set, or a set of instructions is stored, and the at least one instruction, the at least one program, the code set, or the set of instructions is loaded and executed by a processor to implement the image output method with preset parameters as described above.
The above description is only for the preferred embodiment of the present application, but the scope of the present application is not limited thereto, and any changes or substitutions that can be easily conceived by those skilled in the art within the technical scope of the present application should be covered within the scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.