Camera control method, system, medium and terminal device of terminal device

By adding attribute parameters to the interface files of the Android system, multiple cameras are enabled at the same time, solving the problem of only one camera in the existing technology, meeting the needs of dual-camera live broadcast scenarios, and improving the convenience and experience of live broadcasts.

CN118102074BActive Publication Date: 2025-04-04ZHUHAI SHIXI TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202410020534.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-01-06
Publication Date
2025-04-04
Estimated Expiration
2044-01-06

AI Technical Summary

Technical Problem

In the existing Android system, third-party applications can only enable one camera of the terminal device, which cannot meet the needs of live broadcast scenarios displayed at multiple angles at the same time, resulting in the live broadcast process requiring manual operation, which lacks convenience.

Method used

By adding attribute parameters to the interface file, using preset attribute parameters to determine one or more cameras that need to be started, the application layer has no perception and multiple cameras to be started simultaneously, and supports dual-camera live broadcast scenarios.

Benefits of technology

It solves the problem that third-party platforms can only enable one camera, and realizes that multiple cameras can be activated simultaneously without perception in the application layer, meeting the needs of dual-camera live broadcast scenarios and improving the convenience and experience of live broadcasts.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118102074B_ABST
    Figure CN118102074B_ABST
Patent Text Reader

Abstract

The present invention provides a camera control method, system, medium and terminal device of a terminal device, the method comprising receiving a startup instruction for any camera in the terminal device based on the application layer of the terminal device camera system, generating a startup signal based on the startup instruction, transmitting the startup signal to the hardware abstraction layer via the service layer; the hardware abstraction layer calls an interface file, determines one or more target cameras according to the startup signal using the attribute parameters preset in the interface file, and starts the target cameras. The solution of the present invention solves the pain point in the prior art that a third-party platform can only enable one camera of a terminal device, and can realize the simultaneous startup of multiple cameras without the perception of the application layer.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of mobile terminal technology, and in particular to a camera control method, system, medium and terminal device of a terminal device. Background Art

[0002] In the current Android system, although various hardware manufacturers are equipped with multiple cameras, for third-party applications, the Android system will only open permissions for one of the rear main camera or the front camera.

[0003] In some live broadcasting scenarios, due to the need to shoot different angles for different people or objects, multiple mobile phones or tablets are set up to achieve multi-angle shooting of the same scene. When different scene video streams are needed, they are usually switched back and forth between multiple mobile phones. When only one mobile phone product is used for video live broadcasting, the anchor can only use the rear camera or front camera of the mobile phone through the live broadcast application to achieve a single-screen live broadcast, which cannot meet the needs of scenes that display multiple angles at the same time, so the live broadcast process requires manual operation at any time, which lacks convenience. Summary of the invention

[0004] In view of the above problems, the present invention proposes a camera control method, system, medium and terminal device of a terminal device that overcome the above problems or at least partially solve the above problems.

[0005] According to one aspect of the present invention, a camera control method of a terminal device is provided, which is applied to a camera control system of the terminal device, wherein the camera control system includes an application layer, a service layer and a hardware abstraction layer, and the method includes:

[0006] An application layer based on the camera system of the terminal device receives a startup instruction for any camera in the terminal device, generates a startup signal based on the startup instruction, and transmits the startup signal to the hardware abstraction layer via the service layer;

[0007] The hardware abstraction layer calls the interface file, uses the attribute parameters preset in the interface file to determine one or more target cameras according to the start signal, and starts the target cameras.

[0008] Optionally, generating a start signal based on the start instruction includes:

[0009] Determine the scene picture mode selected by the target user of the terminal device based on the startup instruction; the scene picture mode includes a single camera mode and a dual camera mode;

[0010] Determine a target camera and a corresponding camera identifier corresponding to the scene picture mode;

[0011] A start signal is generated according to the camera identifier and the scene picture mode.

[0012] Optionally, the determining one or more target cameras according to the start signal using attribute parameters preset in the interface file includes:

[0013] Identifying the scene picture mode in the start signal using the attribute parameters preset in the interface file;

[0014] Determine the number of cameras that the hardware abstraction layer needs to call according to the scene picture mode;

[0015] At least one target camera is determined according to the number of cameras and the camera identifiers.

[0016] Optionally, determining at least one target camera according to the number of cameras and the camera identifiers includes:

[0017] If the scene picture mode is a single camera mode, it is determined that the number of cameras that the hardware abstraction layer needs to call is one, and the camera corresponding to the camera identifier is used as a target camera, and the target camera is started;

[0018] If the scene picture mode is a dual-camera mode, it is determined that the number of cameras that the hardware abstraction layer needs to call is two, the camera identifier is modified to a predefined dual-camera identifier, both cameras of the terminal device are used as target cameras, and the two target cameras are started simultaneously.

[0019] Optionally, the terminal device includes a front camera and a rear camera.

[0020] Optionally, after simultaneously starting the two target cameras, the method further includes:

[0021] Control the front camera to shoot a front area of ​​the terminal device to generate a first video stream, and control the rear camera to shoot a rear area of ​​the terminal device to generate a second video stream;

[0022] A picture-in-picture video stream is generated based on the first video stream and the second video stream; the first video stream is used as a window screen of the picture-in-picture video stream, and the second video stream is used as a background screen of the picture-in-picture video stream; or, the second video stream is used as a window screen of the picture-in-picture video stream, and the first video stream is used as a background screen of the picture-in-picture video stream; or,

[0023] A split-screen video stream is generated based on the first video stream and the second video stream; the first video stream is used as the first picture of the split-screen video stream, and the second video stream is used as the second picture of the split-screen video stream; or, the second video stream is used as the first picture of the split-screen video stream, and the first video stream is used as the second picture of the split-screen video stream; the first picture and the second picture are spliced ​​left and right or top and bottom.

[0024] Optionally, the terminal device includes a first camera and a second camera; the first camera and the second camera are arranged on the same side and are used to simultaneously capture video streams of the same scene in the front area or the rear area of ​​the terminal device.

[0025] Optionally, the first camera and the second camera are rotatable relative to the terminal device.

[0026] Optionally, the first camera is a main camera, and the second camera is a close-up camera, and the resolution of the close-up camera is greater than that of the first camera.

[0027] Optionally, after simultaneously starting the two target cameras, the method further includes:

[0028] Control the first camera and the second camera to simultaneously capture a panoramic video stream and a close-up video stream of a target area in a front area or a rear area of ​​the terminal device;

[0029] A picture-in-picture video stream is generated based on the panoramic video stream and the close-up video stream; the panoramic video stream is used as a window screen of the picture-in-picture video stream, and the close-up video stream is used as a background screen of the picture-in-picture video stream; or, the close-up video stream is used as a window screen of the picture-in-picture video stream, and the panoramic video stream is used as a background screen of the picture-in-picture video stream; or,

[0030] A split-screen video stream is generated based on the panoramic video stream and the close-up video stream; the panoramic video stream is used as the first picture of the split-screen video stream, and the close-up video stream is used as the second picture of the split-screen video stream; or, the close-up video stream is used as the first picture of the split-screen video stream, and the panoramic video stream is used as the second picture of the split-screen video stream; the first picture and the second picture are spliced ​​left and right or up and down.

[0031] According to another aspect of the present invention, a camera control system of a terminal device is also provided, the system comprising an application layer, a service layer and a hardware abstraction layer:

[0032] The application layer is used to receive a startup instruction for any camera in the terminal device, generate a startup signal based on the startup instruction, and transmit the startup signal to the hardware abstraction layer via the service layer;

[0033] The hardware abstraction layer is used to call the interface file, use the attribute parameters preset in the interface file to determine one or more target cameras according to the start signal, and start the target cameras.

[0034] According to another aspect of the present invention, a computer-readable storage medium is provided, wherein the computer-readable storage medium is used to store program codes, and the program codes are used to execute any of the above methods.

[0035] According to another aspect of the present invention, a terminal device is provided, the terminal device comprising a processor and a memory:

[0036] The memory is used to store program code and transmit the program code to the processor;

[0037] The processor is configured to execute any of the above methods according to instructions in the program code.

[0038] The present invention provides a camera control method, system, medium and terminal device of a terminal device. In the scheme of the present invention, by adding attribute parameters in an interface file and first determining one or more cameras to be started through the preset attribute parameters, the pain point that a third-party platform in the prior art can only enable one camera of a terminal device can be solved, and multiple cameras can be started simultaneously without the perception of the application layer, thereby meeting the user's scene requirements such as dual-camera live broadcast scenes.

[0039] The above description is only an overview of the technical solution of the present invention. In order to more clearly understand the technical means of the present invention, it can be implemented according to the contents of the specification. In order to make the above and other purposes, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are listed below.

[0040] Based on the following detailed description of specific embodiments of the present invention in conjunction with the accompanying drawings, those skilled in the art will become more aware of the above and other objects, advantages and features of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS

[0041] Various other advantages and benefits will become apparent to those of ordinary skill in the art by reading the detailed description of the preferred embodiments below. The accompanying drawings are only for the purpose of illustrating the preferred embodiments and are not to be considered as limiting the present invention. Moreover, the same reference symbols are used throughout the accompanying drawings to represent the same components. In the accompanying drawings:

[0042] Figure 1 A schematic diagram of a camera control method of a terminal device according to an embodiment of the present invention is shown;

[0043] Figure 2A schematic diagram of start signal transmission according to an embodiment of the present invention is shown;

[0044] Figure 3 A schematic diagram of a preset attribute parameter recognition camera according to an embodiment of the present invention is shown;

[0045] Figure 4 A schematic diagram of a terminal device according to an embodiment of the present invention is shown. DETAILED DESCRIPTION

[0046] The exemplary embodiments of the present invention will be described in more detail below with reference to the accompanying drawings. Although the exemplary embodiments of the present invention are shown in the accompanying drawings, it should be understood that the present invention can be implemented in various forms and should not be limited by the embodiments set forth herein. On the contrary, these embodiments are provided in order to enable a more thorough understanding of the present invention and to enable the scope of the present invention to be fully communicated to those skilled in the art.

[0047] The embodiment of the present invention provides a camera control method for a terminal device. The terminal device of the embodiment adopts an Android system and is provided with a camera control system, the control system being an Android Camera. The control system can adopt the camxhal3. system architecture of a Qualcomm platform, or other types of system architectures. In practical applications, the underlying code can be adjusted according to the system architectures of different platforms to implement the camera control method for the terminal device of the embodiment. The camera control system of the embodiment includes an application layer, a service layer, and a hardware abstraction layer HAL.

[0048] like Figure 1 As shown, the camera control method of the terminal device in the embodiment of the present invention may at least include the following steps S101 to S102.

[0049] S101, receiving a startup instruction for any camera in the terminal device based on the application layer of the terminal device camera system, generating a startup signal based on the startup instruction, and transmitting the startup signal to the hardware abstraction layer via the service layer;

[0050] S102, the hardware abstraction layer calls the interface file, uses the attribute parameters preset in the interface file to determine one or more target cameras according to the start signal, and starts the target cameras.

[0051] The overall framework of Android Camera mainly includes three aspects: application layer camera app, service layer cameraserver and hardware abstraction layer HAL. The communication between the above layers is implemented through binder. The camera app and cameraserver communicate using AIDL (Android Interface Definition Language), and the camera server and hal (provider process) communicate using HIDL (HAL interface definition language).

[0052] The Android Camera Hardware Abstraction Layer (HAL) is mainly used to connect the underlying camera driver with the hardware and framework APIs located in android.hardware. The Camera subsystem mainly includes various implementations of camera pipeline components, and the camera HAL provides the interface for using these components.

[0053] In the embodiment of the present invention, by adding attribute parameters to the interface file and first determining one or more cameras to be started by the preset attribute parameters, the pain point that the third-party platform can only enable one camera of the terminal device in the prior art can be solved, and multiple cameras can be started simultaneously without the perception of the application layer, thereby meeting the user's scene requirements such as dual-camera live broadcast scenes. The embodiment of the present invention mainly adopts Qualcomm CameraHAL3 as the camera system architecture.

[0054] Figure 2 A schematic diagram of the transmission of a startup signal according to an embodiment of the present invention is shown. The startup signal of the camera generated by the application layer can be transmitted to the hardware abstraction layer through the service layer.

[0055] In some embodiments, generating a start signal based on the start instruction in the above step S101 may include:

[0056] S101-1, determining a scene picture mode selected by a target user of the terminal device based on the startup instruction. The scene picture mode includes a single camera mode and a dual camera mode.

[0057] S101 - 2, determining the target camera corresponding to the scene picture mode and the corresponding camera identifier.

[0058] (camera id).

[0059] S101 - 3, generating a start signal according to the camera identifier and the scene image mode.

[0060] The terminal device may have an interactive interface of the camera app at the application layer, and the target user may interact with the terminal device through the interactive interface to realize the control of the camera opening, switching, picture mode, etc. through the interactive interface. For example, the user interactive interface of the application layer may have a camera selection button or a switching button, and the target camera selected by the target user and the corresponding scene picture mode can be identified through the relevant buttons.

[0061] In some cases, taking the live broadcast scene as an example, the target user can freely select different scene picture modes before or during the live broadcast. Therefore, the selection of the scene picture mode can trigger the start instruction for the camera. Therefore, the scene picture mode can be obtained through the start instruction, and the target camera and the corresponding camera identifier required in the scene picture mode can be determined at the same time. After generating the start signal related to the camera, the application layer camera app generates the corresponding start signal. The scene picture mode of this embodiment includes a single camera mode and a dual camera mode.

[0062] The terminal of this embodiment has two cameras, a first camera and a second camera. Taking a traditional terminal device such as a mobile phone or a tablet computer as an example, the first camera may be a front camera and the second camera may be a rear camera. Figure 2 For the live broadcast machine shown, the first camera and the second camera of this type of terminal device can be arranged side by side on the same side and can be rotated relative to the terminal device, so as to realize the shooting of the front area or the rear area of ​​the terminal device. The first camera can be a main camera, and the second camera can be a close-up camera. The resolution of the close-up camera is greater than that of the first camera. The two cameras can also shoot the front area or the rear area at the same time. The first camera can be the main camera, and the second camera can be a close-up camera. The resolution of the close-up camera is greater than that of the first camera. In this way, when the two cameras are called, the panoramic and close-up images of the same scene can be displayed at the same time.

[0063] The single camera mode referred to in this embodiment can be a scene mode in which the front camera or the rear camera (the first camera or the second camera) can meet the shooting requirements. For example, when the terminal device is a mobile phone, a tablet, etc., and the first camera and the second camera are on different sides, the video stream can be shot with the first camera alone or the second camera alone.

[0064] Dual-camera mode is a scene mode that requires displaying video streams from two cameras, such as picture-in-picture scene mode and split-screen scene mode. In the picture-in-picture scene mode, the video stream captured by one of the two cameras of the terminal device is displayed as the background of the picture-in-picture, and the video stream captured by the other camera is displayed as the window of the picture-in-picture. In the split-screen scene mode, the video streams captured by the two cameras of the terminal device can be displayed side by side, either vertically or horizontally. The cameras used for different scene modes can be pre-defined. When the scene mode specified by the target user is identified, the camera to be called can be directly determined.

[0065] 1. Front and rear cameras

[0066] Taking the camera as a front camera or a rear camera as an example, after starting the two target cameras at the same time, the front camera can be controlled to shoot the front area of ​​the terminal device to generate a first video stream, and the rear camera can be controlled to shoot the rear area of ​​the terminal device to generate a second video stream;

[0067] A picture-in-picture video stream is generated based on the first video stream and the second video stream; the first video stream is used as the window screen of the picture-in-picture video stream, and the second video stream is used as the background screen of the picture-in-picture video stream; or, the second video stream is used as the window screen of the picture-in-picture video stream, and the first video stream is used as the background screen of the picture-in-picture video stream; or, a split-screen video stream is generated based on the first video stream and the second video stream; the first video stream is used as the first screen of the split-screen video stream, and the second video stream is used as the second screen of the split-screen video stream; or, the second video stream is used as the first screen of the split-screen video stream, and the first video stream is used as the second screen of the split-screen video stream; the first screen and the second screen are spliced ​​left and right or top and bottom.

[0068] That is, when the first camera and the second camera are set on different sides, that is, when the terminal device has a front camera and a rear camera, the video streams of the front and rear scene areas of the terminal device can be allocated to generate a picture-in-picture video stream or a split-screen video stream using a picture-in-picture algorithm or a split-screen algorithm. The selection of the window picture and the background picture in the picture-in-picture video stream, and the selection of the two pictures in the split-screen can be freely set by the user, or switched arbitrarily during use, and this embodiment does not limit this.

[0069] 2. Same side camera

[0070] Taking the camera on the same side of the main camera and the close-up camera as an example, after starting the two target cameras at the same time, the first camera and the second camera can also be controlled to simultaneously shoot the panoramic video stream and close-up video stream of the target area in the front area or the rear area of ​​the terminal device. For example, since the first camera and the second camera are set on the same side, the first camera can be controlled to shoot the panoramic video stream of the target area in the front area of ​​the terminal device, and the second camera can be controlled to shoot the close-up video stream of the target area, so as to simultaneously display the panoramic video stream and close-up video stream of the target area on the live broadcast interface. Since the first camera and the second camera can be rotated relative to the terminal device, before or during the live broadcast, the first camera and the second camera can also be rotated at the same time to shoot the panoramic video stream and close-up video stream of the rear area of ​​the terminal device, or to shoot the panoramic video stream and close-up video stream of any other angle of the field of view of the first camera and the second camera during the process of turning from the front to the rear of the terminal device.

[0071] Furthermore, a picture-in-picture video stream can be generated based on the panoramic video stream and the close-up video stream; wherein the panoramic video stream serves as the window screen of the picture-in-picture video stream, and the close-up video stream serves as the background screen of the picture-in-picture video stream; or, the close-up video stream serves as the window screen of the picture-in-picture video stream, and the panoramic video stream serves as the background screen of the picture-in-picture video stream. Alternatively, a split-screen video stream can be generated based on the panoramic video stream and the close-up video stream; wherein the panoramic video stream serves as the first screen of the split-screen video stream, and the close-up video stream serves as the second screen of the split-screen video stream; or, the close-up video stream serves as the first screen of the split-screen video stream, and the panoramic video stream serves as the second screen of the split-screen video stream; the first screen and the second screen are spliced ​​left and right or top and bottom.

[0072] In this embodiment, since the first camera and the second camera are respectively a main camera and a close-up camera, the main camera can be a panoramic camera. Therefore, when shooting in dual-camera mode, the main camera and the close-up camera can be used to shoot video streams of the same scene area, thereby generating a picture-in-picture video stream or a split-screen video stream. As above, the background image and the window image in the picture-in-picture video stream can be switched freely, and the first image and the second image in the split-screen video stream can also be switched freely.

[0073] As described above, the camera system of this embodiment can use the CameraHAL3 architecture of the Qualcomm platform system, wherein the camxhal3 of the CameraHAL3 architecture of the Qualcomm platform has a cpp interface file, and the hardware abstraction layer calls the camera through the interface file. The embodiment of the present invention determines the target camera called by the hardware abstraction layer by adding a system-level attribute persist.A in the cpp interface file in advance, that is, determines whether to call the dual cameras at the same time.

[0074] In addition, the solution provided in this embodiment can also be added, for example, a first attribute item for characterizing the screen ratio of the window screen and the background screen in the picture-in-picture video stream and a second attribute item for characterizing the position of the window screen in the picture-in-picture video stream, by monitoring the user's single operation or combined operation such as touching and dragging the window screen in the picture-in-picture video stream in the live broadcast interface, converting the user operation into specific position coordinates or screen ratio and writing it into the corresponding attribute item, thereby realizing the adjustment of the size and position of the window screen in the picture-in-picture video stream. Among them, the window screen position can be defined as the horizontal and vertical coordinates of any corner or center point of the window screen in the live broadcast interface.

[0075] Taking the system architecture of the Qualcomm platform as an example, the relevant use cases of the camera mode (dual-camera use case, dual-camera Usecase) can be set separately on the Qualcomm platform. In the pipeline of the dual-camera use case, a custom node is added after the data pipeline output node (YUV0 or YUV1) and before the camera preview cache node targetdisplaybuffer as a control node.

[0076] In addition, a third attribute item for characterizing the screen ratio of the first screen and the second screen in the split-screen video stream, and a fourth attribute item (or fifth attribute item) for characterizing the position coordinates of the first screen (or the second screen) in the split-screen video stream may be added to the control node. By monitoring the user's single operations or combined operations such as touching and dragging on the first screen or the second screen in the split-screen video stream in the live broadcast interface, the user operations are converted into specific position coordinates or split-screen ratios and written into the corresponding attribute items, thereby realizing the adjustment of the size and position of the two screens in the split-screen video stream.

[0077] The solution of this embodiment meets the user's demand for diverse screens in live broadcast scenarios. At the same time, the size and position of part of the screen can be adjusted through simple touch or drag operations during the live broadcast process, which greatly improves the convenience and enhances the live broadcast experience.

[0078] In some embodiments, Figure 3As shown, the step of determining one or more target cameras according to the start signal using the attribute parameters preset in the interface file in the above step S102 may include:

[0079] S102-1, identifying the scene picture mode in the start signal using the attribute parameters preset in the interface file;

[0080] S102-2, determining the number of cameras that the hardware abstraction layer needs to call according to the scene picture mode;

[0081] S102-3, determining at least one target camera according to the number of cameras and the camera identifiers.

[0082] If the scene picture mode is a single camera mode, it is determined that the number of cameras that the hardware abstraction layer needs to call is one, and the camera corresponding to the camera identifier is used as a target camera, and the target camera is started.

[0083] If the scene image mode is a single camera mode that uses only one camera, the hardware abstraction layer only needs to call one camera. In this case, the corresponding target camera can be determined according to the camera ID. For example, if the camera ID is camera id0, the target camera is determined to be the rear camera (or main camera) of the terminal device. If the camera ID is camera id1, the target camera is determined to be the front camera (or close-up camera) of the terminal device, that is, the corresponding sensor sensor is called.

[0084] In an optional embodiment of the present invention, the main camera and close-up camera of the terminal device can be set on the same side and can be rotated relative to the terminal device to shoot multi-angle video streams. In actual use, the main camera can be used alone to shoot a panoramic video stream of a specified area, or the close-up camera can be used alone to zoom in on a part of the above-mentioned specified area.

[0085] In some optional embodiments, a screen switching function can also be provided. That is, if the live broadcast is performed in a single camera mode, a screen switching function can be added to the live broadcast interface to achieve screen switching. That is, assuming that the first camera of the terminal device is currently used to shoot the video stream, the hardware abstraction layer calls the camera identifier as camera id0. When the user needs to switch between the front and back screens, at this time, the target camera needs to be switched, that is, the second camera is enabled to shoot the video stream. At this time, the camera identifier is not modified to camera id1, but to the dual-camera camera identifier cameraid2. That is to say, in this embodiment, when the screen switching function in the live broadcast interface is detected to be triggered, the number of cameras that need to be called by the custom hardware abstraction layer is two, the camera identifier is modified to a pre-defined dual-camera identifier, and the two target cameras are started at the same time, but only the video stream shot by a single camera is output. When determining the output video stream, the target camera in the video stream shooting state before the screen switching function is triggered can be first confirmed, and another camera other than the target camera in the terminal device is controlled as a new target camera to shoot the video stream. The method provided in this embodiment directly modifies the camera ID to a predefined dual-camera ID after detecting the screen switching function. At this time, the hardware abstraction layer enables two cameras at the same time. Although only one video stream shot by the camera is output at a time, it is convenient for users to flexibly switch between the two video streams. In particular, for terminal devices with a main camera and a close-up camera set on the same side, it is possible to achieve arbitrary switching of the panoramic video stream and the close-up video stream for the same scene or object, and the video stream switching is smooth and not stuck, thereby improving the quality of live broadcasting.

[0086] If the scene picture mode is a dual-camera mode, it is determined that the number of cameras that the hardware abstraction layer needs to call is two, the camera identifier is modified to a predefined dual-camera identifier, both cameras of the terminal device are used as target cameras, and the two target cameras are started simultaneously.

[0087] If the scene image mode is a dual camera mode that requires the use of two cameras, then it is determined that the hardware abstraction layer actually needs to call two cameras. Regardless of which camera ID is carried in the startup signal, it is modified to the pre-defined dual camera ID camera id2.

[0088] In this embodiment, the picture-in-picture mode and the split-screen mode are defined as the dual-camera mode as predefined system-level attribute parameters, which are used to indicate that the hardware abstraction layer needs to enable two cameras at the same time.

[0089] When the scene picture mode is determined to be dual-camera mode, the camera id used by the hardware abstract layer Camera HAL layer can be forcibly modified to dual-camera id2 in the open and close of the camxhal3 file. This operation is imperceptible to the app. The app thinks that the camera currently used is still a single rear camera (or main camera), but the dual-camera identifier is actually used in the Camera HAL layer. The solution of this embodiment can be applied to live broadcast scenarios, that is, when live broadcasting based on terminal devices, dual cameras can be enabled at the same time.

[0090] The embodiment of the present invention further provides a camera control system of a terminal device, which is used to execute the camera control method of the terminal device described in the above embodiment. The system includes an application layer, a service layer and a hardware abstraction layer:

[0091] The application layer is used to receive a startup instruction for any camera in the terminal device, generate a startup signal based on the startup instruction, and transmit the startup signal to the hardware abstraction layer via the service layer;

[0092] The hardware abstraction layer is used to call the interface file, use the attribute parameters preset in the interface file to determine one or more target cameras according to the start signal, and start the target cameras.

[0093] An embodiment of the present invention further provides a computer-readable storage medium, wherein the computer-readable storage medium is used to store program codes, and the program codes are used to execute the camera control method of the terminal device described in the above embodiment.

[0094] An embodiment of the present invention also provides a terminal device, which includes a processor and a memory: the memory is used to store program code and transmit the program code to the processor; the processor is used to execute the camera control method of the terminal device described in the above embodiment according to the instructions in the program code.

[0095] Those skilled in the art can clearly understand that the specific working processes of the systems, devices, modules and units described above can refer to the corresponding processes in the aforementioned method embodiments, and for the sake of brevity, they are not further described here.

[0096] In addition, the functional units in various embodiments of the present invention may be physically independent of each other, or two or more functional units may be integrated together, or all functional units may be integrated into one processing unit. The above integrated functional units may be implemented in the form of hardware, or in the form of software or firmware.

[0097] Those skilled in the art can understand that if the integrated functional unit is implemented in the form of software and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention can essentially or all or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium, which includes a number of instructions to enable a terminal device (such as a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present invention when running the instructions. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), magnetic disk or optical disk and other media that can store program codes.

[0098] Alternatively, all or part of the steps of implementing the aforementioned method embodiments may be accomplished by hardware associated with program instructions (such as a terminal device such as a personal computer, a server, or a network device), and the program instructions may be stored in a computer-readable storage medium. When the program instructions are executed by a processor of the terminal device, the terminal device executes all or part of the steps of the method described in the embodiments of the present invention.

[0099] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that within the spirit and principles of the present invention, the technical solutions described in the aforementioned embodiments can still be modified, or some or all of the technical features therein can be replaced by equivalents. However, these modifications or replacements do not deviate from the protection scope of the present invention.

Claims

1. A camera control method for a terminal device, characterized in that: A camera control system applied to a terminal device, the camera control system comprising an application layer, a service layer and a hardware abstraction layer, the method comprising: An application layer based on the camera system of the terminal device receives a startup instruction for any camera in the terminal device, generates a startup signal based on the startup instruction, and transmits the startup signal to the hardware abstraction layer via the service layer; The hardware abstraction layer calls the interface file, uses the attribute parameters preset in the interface file to determine one or more target cameras according to the start signal, and starts the target cameras; The step of determining one or more target cameras according to the start signal by using the attribute parameters preset in the interface file includes: Identifying the scene picture mode in the start signal using the attribute parameters preset in the interface file; Determine the number of cameras that the hardware abstraction layer needs to call according to the scene picture mode; At least one target camera is determined according to the number of cameras and the camera identifiers.

2. The method according to claim 1, characterized in that Generating a start signal based on the start instruction comprises: Determining a scene picture mode selected by a target user of the terminal device based on the startup instruction; the scene picture mode includes a single camera mode and / or a dual camera mode; Determine a target camera and a corresponding camera identifier corresponding to the scene picture mode; A start signal is generated according to the camera identifier and the scene picture mode.

3. The method according to claim 1, characterized in that The determining at least one target camera according to the number of cameras and the camera identifiers comprises: If the scene picture mode is a single camera mode, it is determined that the number of cameras that the hardware abstraction layer needs to call is one, and the camera corresponding to the camera identifier is used as a target camera, and the target camera is started; If the scene picture mode is a dual-camera mode, it is determined that the number of cameras that the hardware abstraction layer needs to call is two, the camera identifier is modified to a predefined dual-camera identifier, both cameras of the terminal device are used as target cameras, and the two target cameras are started simultaneously.

4. The method according to claim 3, characterized in that The terminal device includes a front camera and a rear camera.

5. The method according to claim 4, characterized in that After simultaneously starting the two target cameras, the method further includes: Control the front camera to shoot a front area of ​​the terminal device to generate a first video stream, and control the rear camera to shoot a rear area of ​​the terminal device to generate a second video stream; A picture-in-picture video stream is generated based on the first video stream and the second video stream; the first video stream is used as a window screen of the picture-in-picture video stream, and the second video stream is used as a background screen of the picture-in-picture video stream; or, the second video stream is used as a window screen of the picture-in-picture video stream, and the first video stream is used as a background screen of the picture-in-picture video stream; or, A split-screen video stream is generated based on the first video stream and the second video stream; the first video stream is used as the first picture of the split-screen video stream, and the second video stream is used as the second picture of the split-screen video stream; or, the second video stream is used as the first picture of the split-screen video stream, and the first video stream is used as the second picture of the split-screen video stream; the first picture and the second picture are spliced ​​left and right or top and bottom.

6. The method according to claim 3, characterized in that The terminal device includes a first camera and a second camera; the first camera and the second camera are arranged on the same side and are used to simultaneously capture the video stream of the same scene in the front area or the rear area of ​​the terminal device.

7. The method according to claim 6, characterized in that The first camera and the second camera are rotatable relative to the terminal device.

8. The method according to claim 6, characterized in that The first camera is a main camera, and the second camera is a close-up camera. The resolution of the close-up camera is greater than that of the first camera.

9. The method according to claim 8, characterized in that After simultaneously starting the two target cameras, the method further includes: Control the first camera and the second camera to simultaneously capture a panoramic video stream and a close-up video stream of a target area in a front area or a rear area of ​​the terminal device; A picture-in-picture video stream is generated based on the panoramic video stream and the close-up video stream; the panoramic video stream is used as a window screen of the picture-in-picture video stream, and the close-up video stream is used as a background screen of the picture-in-picture video stream; or, the close-up video stream is used as a window screen of the picture-in-picture video stream, and the panoramic video stream is used as a background screen of the picture-in-picture video stream; or, A split-screen video stream is generated based on the panoramic video stream and the close-up video stream; the panoramic video stream is used as the first picture of the split-screen video stream, and the close-up video stream is used as the second picture of the split-screen video stream; or, the close-up video stream is used as the first picture of the split-screen video stream, and the panoramic video stream is used as the second picture of the split-screen video stream; the first picture and the second picture are spliced ​​left and right or up and down.

10. A camera control system for a terminal device, characterized in that: The system is used to execute the camera control method of the terminal device according to any one of claims 1 to 9, and comprises an application layer, a service layer and a hardware abstraction layer: The application layer is used to receive a startup instruction for any camera in the terminal device, generate a startup signal based on the startup instruction, and transmit the startup signal to the hardware abstraction layer via the service layer; The hardware abstraction layer is used to call the interface file, use the attribute parameters preset in the interface file to determine one or more target cameras according to the start signal, and start the target cameras.

11. A computer-readable storage medium, characterized in that: The computer-readable storage medium is used to store program code, and the program code is used to execute the camera control method of the terminal device according to any one of claims 1-9.

12. A terminal device, characterized in that: The terminal device includes a processor and a memory: The memory is used to store program codes and transmit the program codes to the processor; The processor is used to execute the camera control method of the terminal device according to any one of claims 1-9 according to the instructions in the program code.

Citation Information

Patent Citations

  • Video recording method and equipment

    CN113347378A

  • Method and device for adjusting mapping relation of camera module and storage medium

    CN116866545A