Detailed Description
Reference will now be made in detail to embodiments of the present application, examples of which are illustrated in the accompanying drawings, wherein like or similar reference numerals refer to the same or similar elements or elements having the same or similar function throughout. The embodiments described below with reference to the drawings are exemplary only for the purpose of explaining the present application and are not to be construed as limiting the present application. On the contrary, the embodiments of the application include all changes, modifications and equivalents coming within the spirit and terms of the claims appended hereto.
Fig. 1 is a schematic flowchart of a photographing method based on Camera2 according to an embodiment of the present application.
In this embodiment, a mobile device may communicate with one or more Core networks (Core networks) through a Radio Access Network (RAN), and the mobile device may be referred to as an Access terminal, a User Equipment (UE), a subscriber unit, a subscriber station, a mobile station, a remote terminal, a mobile device, a User terminal, a wireless communication device, a User agent, or a User Equipment.
The mobile device may also be a cellular phone, a cordless phone, a Session Initiation Protocol (SIP) phone, a Wireless Local Loop (WLL) station, a Personal Digital Assistant (PDA), a handheld device with Wireless communication capability, a computing device or other processing device connected to a Wireless modem, an in-vehicle device, a wearable device, a mobile device in a future 5G network, and so forth.
The mobile device in the embodiment of the present application supports the Camera2 function, and the related description of the Camera2 function may be referred to in the prior art, and is not described herein again.
The embodiment of the present application provides a photographing method based on Camera2, for solving the technical problem in the related art that the photographing processing path will go through the same algorithm as the preview processing path, thereby causing the photographing time to be long and unnecessarily occupying the operating power consumption of the mobile device, and refer to the following specifically.
Referring to fig. 2, fig. 2 is a schematic diagram of an architecture of a mobile device in an embodiment of the present application, including: the camera application layer provides icons of the applications, user interaction interfaces of the applications and the like, and particularly comprises a plurality of portals providing camera services. The conventional design of a camera application layer is that a photo mode, a camera equipment control mode, a preview mode, a photographing mode and a view layer mode are designed according to modules, and then a data control module, such as a database, a written file and the like, is used; the application framework layer is a Software Development Kit (SDK) layer opened by Android, and is a bridge layer for communication between the application layer and the HAL; HAL framework layer: is a bridge for communicating the application framework layer and the HAL layer; the HAL layer is the control layer for various sensors, or other components, that encapsulates the control logic for the various components.
The embodiment of the present application is specifically applied to the Camera application layer of the above architecture, and improves the architecture of the existing mobile device, so as to assist the photographing method based on Camera 2.
Referring to fig. 1, the method includes:
s101: and acquiring preview image data output by the target flow pipeline.
The target stream pipe is a stream pipe for outputting preview image data and assisting image preview.
Compared with the prior art in which a preview processing path and a photographing processing path are configured, each path corresponds to a flow pipeline, the embodiment of the application improves the existing architecture, deletes one photographing processing path in the architecture of the mobile device, uses the preview image data output by the existing preview processing path to assist the preview of the subsequent image, uses the photographing image data output by the photographing processing path to assist the subsequent photographing, and adjusts the preview image data output by the target flow pipeline to assist the subsequent photographing.
Referring to fig. 2, fig. 2 indicates that, except for the target stream pipe 21, in the embodiment of the present application, only one stream pipe is reserved, and the other stream pipe (the path in the dashed box 22 in fig. 2) is subjected to deletion processing.
The method for obtaining the preview image data output by the target flow pipeline specifically comprises the steps of receiving preview configuration parameters input by a user in a preview interface of the mobile equipment, obtaining initial image data output by the target flow pipeline, and configuring the initial image data by adopting the preview configuration parameters, so that the preview image data is obtained, the preview of subsequent images can be effectively assisted, and the timeliness and the preview effect of image preview are guaranteed.
It is understood that when a user starts a user interaction interface of a photographing application at a camera application layer, the user interaction interface generally displays a preview picture, and the user generally has a requirement for adjusting the preview picture, for example, adjusting a brightness value and an exposure value, parameters described by the requirement for adjusting, that is, may be referred to as preview configuration parameters, and data related to the preview picture initially displayed by the user interaction interface may be referred to as initial image data, which may be configured in a target flow pipe of a HAL framework layer, may be directly read from the target flow pipe, and configure the initial image data using the preview configuration parameters, for example, setting a brightness parameter and an exposure parameter related to the initial image data according to the brightness value and the exposure value, so as to obtain the preview image data, which is not limited.
S102: the preview image data is transmitted to the imaging component.
After the preview image data output by the target flow pipeline is acquired, the preview image data is directly transmitted to the imaging component, so that the imaging is assisted.
In the embodiment of the application, the preview image data can be output to the preview component; the preview component is adopted to carry out imaging processing on the preview image data so as to obtain the preview image, therefore, the completeness of the application function of the mobile equipment camera is effectively guaranteed, the preview efficiency and the photographing efficiency are integrally improved, and the operation power consumption of the mobile equipment is reduced.
Optionally, the acquired preview image data may be directly transmitted to the imaging component, or the preview image data may be compressed and then transmitted to the imaging component, and appropriate transformation and adjustment may be performed according to actual application requirements, which is not limited to this.
In the embodiment of the application, the preview image data can be copied to obtain copy image data; the copy image data is transmitted to the imaging component, and the copy of the preview image data is formed, so that image preview and image photographing can be simultaneously supported, and the method is simple and convenient to realize.
In the embodiment of the application, the preview image data can be copied to obtain the copy image data after the image photographing instruction is received and the preview image data output by the target flow pipeline is obtained, so that the copy image data is generated as required without occupying excessive memory resources, and the image photographing is directly assisted after the copy image data is generated, so that the photographing efficiency is ensured from multiple angles.
The image data copied from the preview image data may be referred to as copy image data.
S103: and imaging the preview image data by adopting the imaging component to obtain a target image.
It can be understood that, the preview processing path performs a certain image processing on the preview image data, for example, a brightness parameter and an exposure parameter related to the initial image data are set according to the brightness value and the exposure value, so as to obtain the preview image data, and the user may dynamically adjust the photographing requirement during the actual photographing process, and take a photograph with a photographing parameter different from the preview configuration parameter.
Therefore, in the embodiment of the application, after the preview image data is transmitted to the imaging component, the imaging component is further adopted to perform imaging processing on the preview image data to obtain the target image.
For example, a photographing instruction input by a user may be monitored, and the photographing instruction is parsed to identify a photographing parameter, so that the imaging component performs imaging processing on the preview image data by using the photographing parameter to obtain a target image.
Optionally, in some embodiments, referring to fig. 3, the imaging processing on the preview image data to obtain the target image includes:
s301: and updating the size information of the preview image data to obtain new preview image data.
S302: and coding the new preview image data to obtain a coded image.
S303: and receiving photographing configuration parameters input by a user in a photographing interface of the mobile equipment.
S304: and configuring the coded image by adopting the photographing configuration parameters so as to obtain a target image.
Referring also to fig. 2 above, the imaging assembly of fig. 2 may further include: the mobile device comprises an image processing module, an encoding module and an image information writing module, wherein the image processing module updates the size information of the preview image data to obtain new preview image data, the encoding module encodes the new preview image data to obtain an encoded image, the image information writing module receives photographing configuration parameters input by a user in a photographing interface of the mobile device, the encoded image is configured by adopting the photographing configuration parameters to obtain a target image, and the target image is written into a database without limitation.
The method comprises the steps of updating size information of preview image data to obtain new preview image data, coding the new preview image data to obtain a coded image, receiving photographing configuration parameters input by a user in a photographing interface of the mobile equipment, and configuring the coded image by adopting the photographing configuration parameters to obtain a target image, so that the output target image meets photographing requirements of the user, the preview image data can be fused into a photographing processing path continuously, and photographing effects are improved.
In this embodiment, through obtaining the preview image data output by the target flow pipeline, transmitting the preview image data to the imaging component, and adopting the imaging component to perform imaging processing on the preview image data to obtain a target image, the preview image data output by the target flow pipeline is directly adopted to assist subsequent photographing, and since the preview processing path has performed certain image processing on the preview image data, therefore, the photographing is assisted by directly adopting the existing preview image data, instead of secondary processing, the photographing efficiency is effectively improved, and the operation and storage power consumption of the mobile device are reduced.
The technical effect of the present application is illustrated below in the form of experimental data:
assuming that the photographed image data is 10MB data, generally in YUV format, the technical solution in the embodiment of the present application can save memory space of 10/2 × 3 — 15MB size.
Assuming that 3 special effect processes are required and each special effect process takes 100ms, the technical scheme in the embodiment of the application can reduce the photographing time of the mobile device by 300ms, so that the photographing is faster and the expressive force of the photographed product is improved.
Since the preview processing path does not need to be configured, the memory with the size 1.5 times that of the memory occupied by the preview processing path can be applied, so that the required memory space is less, and if the picture size of 10MB is taken, the size of 10/2 × 3 to 15MB can be saved, and the usage amount of the system memory during photographing is reduced.
By adopting the embodiment of the application, the photographing performance is faster, favorable conditions are provided for superposing more photographing algorithms again, the size of the application APK can be reduced, and the method is more suitable for application scenes of continuous photographing.
Fig. 4 is a schematic structural diagram of a photographing device based on Camera2 according to an embodiment of the present application.
Referring to fig. 4, the apparatus 400 includes:
an obtaining module 401, configured to obtain preview image data output by a target flow pipeline;
a transmission module 402 for transmitting the preview image data to the imaging component;
a first processing module 403, configured to perform imaging processing on the preview image data by using an imaging component to obtain a target image.
Optionally, in some embodiments, referring to fig. 5, the apparatus 400 further comprises:
an output module 404, configured to output the preview image data to a preview component;
and a second processing module 405, configured to perform imaging processing on the preview image data by using the preview component to obtain a preview image.
Optionally, in some embodiments, referring to fig. 5, the obtaining module 401 includes:
the first receiving submodule 4011 is configured to receive a preview configuration parameter input by a user in a preview interface of the mobile device;
the obtaining sub-module 4012 is configured to obtain initial image data output by the target flow pipeline;
the first configuring sub-module 4013 is configured to configure the initial image data by using the preview configuration parameter, so as to obtain preview image data.
Optionally, in some embodiments, referring to fig. 5, the apparatus 400 further comprises:
a copying module 406, configured to copy the preview image data to obtain copy image data;
a transmission module 402, further configured to:
the duplicate image data is transmitted to an imaging component.
Optionally, in some embodiments, referring to fig. 5, the first processing module 403 includes:
an update sub-module 4031, configured to update the size information of the preview image data to obtain new preview image data;
the encoding submodule 4032 is used for encoding the new preview image data to obtain an encoded image;
the second receiving submodule 4033 is used for receiving the photographing configuration parameters input by the user in the photographing interface of the mobile device;
and the second configuration submodule 4034 is configured to configure the encoded image by using the photographing configuration parameters, so as to obtain a target image.
It should be noted that the explanation of the aforementioned embodiment of the photographing method based on Camera2 in fig. 1-3 also applies to the photographing apparatus 400 based on Camera2 in this embodiment, and the implementation principle is similar, and is not described herein again.
In this embodiment, through obtaining the preview image data output by the target flow pipeline, transmitting the preview image data to the imaging component, and adopting the imaging component to perform imaging processing on the preview image data to obtain a target image, the preview image data output by the target flow pipeline is directly adopted to assist subsequent photographing, and since the preview processing path has performed certain image processing on the preview image data, therefore, the photographing is assisted by directly adopting the existing preview image data, instead of secondary processing, the photographing efficiency is effectively improved, and the operation and storage power consumption of the mobile device are reduced.
Fig. 6 is a schematic structural diagram of a mobile device according to an embodiment of the present application.
Referring to fig. 6, a mobile device 600 of the present embodiment includes a housing 601, a processor 602, a memory 603, a circuit board 604, and a power circuit 605, where the circuit board 604 is disposed inside a space surrounded by the housing 601, and the processor 602 and the memory 603 are disposed on the circuit board 604; a power circuit 605 for powering various circuits or devices of the mobile device 600; the memory 603 is used for storing executable program code; the processor 602 executes a program corresponding to the executable program code by reading the executable program code stored in the memory 603, for performing:
acquiring preview image data output by a target flow pipeline;
transmitting the preview image data to an imaging component;
and imaging the preview image data by adopting the imaging component to obtain a target image.
It should be noted that the foregoing explanation of the embodiment of the photographing method based on Camera2 in the embodiments of fig. 1 to fig. 3 also applies to the mobile device 600 of this embodiment, and the implementation principle is similar and will not be described herein again.
In this embodiment, through obtaining the preview image data output by the target flow pipeline, transmitting the preview image data to the imaging component, and adopting the imaging component to perform imaging processing on the preview image data to obtain a target image, the preview image data output by the target flow pipeline is directly adopted to assist subsequent photographing, and since the preview processing path has performed certain image processing on the preview image data, therefore, the photographing is assisted by directly adopting the existing preview image data, instead of secondary processing, the photographing efficiency is effectively improved, and the operation and storage power consumption of the mobile device are reduced.
In order to implement the above embodiments, the present application provides a non-transitory computer-readable storage medium, on which a computer program is stored, and the program, when executed by a processor, implements the Camera 2-based photographing method of the foregoing method embodiments.
It should be noted that, in the description of the present application, the terms "first", "second", etc. are used for descriptive purposes only and are not to be construed as indicating or implying relative importance. In addition, in the description of the present application, "a plurality" means two or more unless otherwise specified.
Any process or method descriptions in flow charts or otherwise described herein may be understood as representing modules, segments, or portions of code which include one or more executable instructions for implementing specific logical functions or steps of the process, and the scope of the preferred embodiments of the present application includes other implementations in which functions may be executed out of order from that shown or discussed, including substantially concurrently or in reverse order, depending on the functionality involved, as would be understood by those reasonably skilled in the art of the present application.
It should be understood that portions of the present application may be implemented in hardware, software, firmware, or a combination thereof. In the above embodiments, the various steps or methods may be implemented in software or firmware stored in memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, any one or combination of the following techniques, which are known in the art, may be used: a discrete logic circuit having a logic gate circuit for implementing a logic function on a data signal, an application specific integrated circuit having an appropriate combinational logic gate circuit, a Programmable Gate Array (PGA), a Field Programmable Gate Array (FPGA), or the like.
It will be understood by those skilled in the art that all or part of the steps carried by the method for implementing the above embodiments may be implemented by hardware related to instructions of a program, which may be stored in a computer readable storage medium, and when the program is executed, the program includes one or a combination of the steps of the method embodiments.
In addition, functional units in the embodiments of the present application may be integrated into one processing module, or each unit may exist alone physically, or two or more units are integrated into one module. The integrated module can be realized in a hardware mode, and can also be realized in a software functional module mode. The integrated module, if implemented in the form of a software functional module and sold or used as a stand-alone product, may also be stored in a computer readable storage medium.
The storage medium mentioned above may be a read-only memory, a magnetic or optical disk, etc.
In the description herein, reference to the description of the term "one embodiment," "some embodiments," "an example," "a specific example," or "some examples," etc., means that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the application. In this specification, the schematic representations of the terms used above do not necessarily refer to the same embodiment or example. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples.
Although embodiments of the present application have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting the present application, and that variations, modifications, substitutions and alterations may be made to the above embodiments by those of ordinary skill in the art within the scope of the present application.