Multi-camera picture preview method and apparatus, and electronic device and storage medium

By using a combination of M adapter boards and image signal processors in the Android system to create virtual objects and threads, combined with JNI and HAL, the problem that the Android system cannot preview multiple camera images at the same time is solved, and the preview of multiple camera images is realized. and video recording, expanding the application scope of the system.

WO2024183345A1PCT designated stage expired Publication Date: 2024-09-12XI AN FIBOCOM WIRELESS SOFTWARE INC
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
PCT/CN2023/133695
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2023-03-03
Filing Date
2023-11-23
Publication Date
2024-09-12

AI Technical Summary

Technical Problem

The Android system can currently only preview images from up to two cameras at the same time, which cannot meet the needs for multi-angle monitoring in some specific fields, limiting its scope of use.

Method used

N cameras are connected to M image signal processors through M adapter boards. N virtual objects are created and N threads are started to obtain preview data. The Java local interface JNI and hardware abstraction layer HAL are combined to bypass the system framework layer. Achieve multi-camera screen preview.

Benefits of technology

It realizes multi-camera picture preview, expands the scope of use of the Android system, supports at least 8 channels of simultaneous preview and recording, and is suitable for scenes such as large vehicles and multi-angle monitoring.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2023133695_12092024_PF_FP_ABST
    Figure CN2023133695_12092024_PF_FP_ABST
Patent Text Reader

Abstract

Disclosed are a multi-camera picture preview method and apparatus, and an electronic device and a storage medium. The method comprises: creating N virtual objects corresponding to N cameras, wherein the N cameras are cameras that are adapted to M image signal processors by means of M adapter boards, and the M adapter boards are configured to expand the number of cameras, which are connected to each of the M image signal processors, N being an integer greater than 2, and M being an integer greater than or equal to 1; starting N threads, and acquiring, by means of the N threads, preview data corresponding to the N cameras, wherein the N threads correspond to the N virtual objects on a one-to-one basis; and rendering the preview data corresponding to the N cameras, so as to obtain preview pictures of the N cameras.
Need to check novelty before this filing date? Find Prior Art

Description

Multi-camera image preview method, device, electronic device and storage medium

[0001] Citation of Related Applications

[0002] This disclosure claims all rights and interests in the invention patent application with application number 202310200355.4 filed with the State Intellectual Property Office of the People's Republic of China on March 3, 2023, entitled "Multi-camera screen preview method, device, electronic device and storage medium", and incorporates its entire contents into this disclosure by reference.

[0003] field

[0004] The present disclosure generally relates to the field of software development technology, and more specifically to a multi-camera image preview method, device, electronic device, and storage medium.

[0005] background

[0006] With the widespread adoption and expansion of the Android system, its scope and areas of application are continuously expanding. Android is gradually expanding beyond smartphones to other devices such as in-vehicle devices, smart homes, and surveillance equipment. Currently, the Android system generally only supports previewing one camera feed, or at most two cameras simultaneously, and cannot support previewing a larger number of cameras simultaneously. This limitation on the number of camera feeds cannot meet the needs of certain specific applications, such as multi-angle monitoring of large vehicles and home environments, significantly limiting the scope of Android's use.

[0007] Overview

[0008] In a first aspect, the present disclosure provides a multi-camera image preview method, which includes:

[0009] Creating N virtual objects corresponding to N cameras, where the N cameras are cameras connected to M image signal processors via M adapter boards, the M adapter boards being configured to expand the number of cameras connected to each of the M image signal processors, where N is an integer greater than 2, and M is an integer greater than or equal to 1;

[0010] Starting N threads, and obtaining preview data corresponding to the N cameras through the N threads, wherein the N threads correspond one-to-one to the N virtual objects;

[0011] The preview data corresponding to the N cameras are rendered to obtain preview images of the N cameras.

[0012] In some embodiments, each of the M adapter boards is configured to expand the number of cameras connected to each of the M image signal processors to H times the original number, where H is an integer greater than 1;

[0013] The step of creating N virtual objects corresponding to the N cameras includes:

[0014] Obtain the number of cameras connected to the M adapter boards;

[0015] When the number of the cameras is N, N virtual objects corresponding to the N cameras are created, where N is an integer less than or equal to H*M.

[0016] In some embodiments, obtaining preview data corresponding to the N cameras through the N threads includes:

[0017] Obtain a first identifier and a second identifier corresponding to the N cameras, wherein the first identifier is used to identify the number of the adapter board to which the camera is connected, and the second identifier is used to identify the number of the channel on the adapter board to which the camera is connected;

[0018] The adapter board corresponding to the first identifier among the M adapter boards is controlled to be turned on, and the preview data of the N cameras corresponding to the second identifier are obtained through the N threads.

[0019] In some embodiments, controlling the adapter board corresponding to the first identifier among the M adapter boards to turn on, and obtaining preview data of the N cameras corresponding to the second identifier through the N threads, includes:

[0020] By calling the Java native interface JNI and the hardware abstraction layer HAL, the adapter board corresponding to the first identifier among the M adapter boards is controlled to be turned on, and the preview data of the N cameras corresponding to the second identifier are obtained from the cache by calling the Java native interface JNI and the hardware abstraction layer HAL through the N threads, wherein the Java native interface JNI is configured to skip the original framework layer of the system to realize the data transmission between the software development layer and the hardware abstraction, and the software development layer encapsulates the multi-camera screen preview method.

[0021] In some embodiments, before rendering the preview data corresponding to the N cameras to obtain the preview images of the N cameras, the method further includes:

[0022] Draw N preview windows corresponding to the N cameras;

[0023] The rendering of the preview data corresponding to the N cameras to obtain preview images of the N cameras includes:

[0024] The preview data corresponding to the N cameras are rendered in the N preview windows to obtain preview images of the N cameras.

[0025] In some embodiments, after rendering the preview data corresponding to the N cameras to obtain preview images of the N cameras, the method further includes:

[0026] A calling interface is provided for the third-party application, so that the third-party application can display the N preview windows in its own user interface.

[0027] In some embodiments, after rendering the preview data corresponding to the N cameras to obtain preview images of the N cameras, the method further includes:

[0028] Upon receiving a photo-taking instruction sent by the third-party application, obtaining a photo-taking picture based on the N preview windows; or

[0029] When a video recording instruction is received from the third-party application, video recording is acquired based on the N preview windows.

[0030] In a second aspect, the present disclosure provides a multi-camera image preview device, comprising:

[0031] a creation module configured to create N virtual objects corresponding to N cameras, wherein the N cameras are cameras connected to M image signal processors via M adapter boards, the M adapter boards being configured to expand the number of cameras connected to each of the M image signal processors, N being an integer greater than 2, and M being an integer greater than or equal to 1;

[0032] A first acquisition module is configured to start N threads and acquire preview data corresponding to the N cameras through the N threads, wherein the N threads correspond one-to-one to the N virtual objects;

[0033] The rendering module is configured to render the preview data corresponding to the N cameras to obtain preview images of the N cameras.

[0034] In a third aspect, the present disclosure provides an electronic device comprising a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other via the communication bus;

[0035] a memory configured to store a computer program;

[0036] The processor is configured to implement the multi-camera image preview method described in the present disclosure when executing the program stored in the memory.

[0037] In a fourth aspect, the present disclosure provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the multi-camera image preview method described in the present disclosure.

[0038] BRIEF DESCRIPTION OF THE DRAWINGS

[0039] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the present disclosure.

[0040] In order to more clearly illustrate the technical solutions of the embodiments of the present disclosure, the following briefly introduces the drawings required for the embodiments. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.

[0041] FIG1 is a schematic diagram of a flow chart of a multi-camera image preview method provided by an embodiment of the present disclosure;

[0042] FIG2 is a schematic diagram of the overall architecture of a Camera provided by an embodiment of the present disclosure;

[0043] FIG3 is a schematic diagram of a hardware and software implementation framework provided by an embodiment of the present disclosure;

[0044] FIG4 is a flowchart of the interaction process between the SDK and the third-party application according to an embodiment of the present disclosure;

[0045] FIG5 is a schematic structural diagram of a multi-camera image preview device provided by an embodiment of the present disclosure; and

[0046] FIG6 is a schematic structural diagram of an electronic device provided by an embodiment of the present disclosure.

[0047] Details

[0048] To make the objectives, technical solutions, and advantages of the embodiments of the present disclosure more clear, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the accompanying drawings. Obviously, the described embodiments are part of the embodiments of the present disclosure, not all of the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments of the present disclosure without making any creative efforts shall fall within the scope of protection of the present disclosure.

[0049] See Figure 1, which is a flow chart of a multi-camera image preview method provided by an embodiment of the present disclosure. As shown in Figure 1, the multi-camera image preview method may include the following steps:

[0050] Step 101: Create N virtual objects corresponding to N cameras, where the N cameras are cameras connected to M image signal processors via M adapter boards, the M adapter boards being configured to expand the number of cameras connected to each of the M image signal processors, N is an integer greater than 2, and M is an integer greater than or equal to 1;

[0051] Step 102: Start N threads and obtain preview data corresponding to N cameras through the N threads, where the N threads correspond one-to-one to the N virtual objects;

[0052] Step 103: Render the preview data corresponding to the N cameras to obtain preview images of the N cameras.

[0053] It should be noted that the multi-camera screen preview method provided in the embodiment of the present disclosure is applied to a software development kit (Software Development Kit, referred to as SDK). The SDK can provide an application programming interface (Application Programming Interface, referred to as API) for the application layer for third-party application calls. The SDK can realize multi-camera control and data acquisition, photo taking, video recording, watermarking, preview, loop recording, sub-packet recording, storage and other functions. As shown in Figure 2, Figure 2 is a schematic diagram of the overall camera architecture provided by the embodiment of the present disclosure. The SDK is arranged between the application layer and the framework layer. By adding the SDK, the capability limitation of the Android framework layer is bypassed to achieve the function of multi-channel simultaneous preview and simultaneous recording.

[0054] In certain embodiments, the N cameras refer to cameras connected to M image signal processors via M adapter plates, where N is any integer greater than 2, such as 3, 4, 5, etc., and M is any integer greater than or equal to 1, such as 1, 2, 3, etc., and the present disclosure does not specifically limit this. Since traditional Android devices are limited by the number of image signal processors (ISPs), it is impossible to preview a large number of camera images simultaneously. In certain embodiments, taking the Qualcomm QCM6125 platform as an example, the platform has two ISPs. If the capabilities of the Android native system are used, it can only support previewing of two camera images at most at the same time. However, if two adapter plates are used to correspond to the two ISPs of the platform respectively, assuming that one adapter plate can connect to four cameras, then the two adapter plates can output preview data of a total of eight cameras accordingly. The above-mentioned adapter plate can be an N4 adapter plate (i.e., supporting four cameras at the same time), or it can be another type of adapter plate, and the present disclosure does not specifically limit this.

[0055] In certain implementations, after the SDK determines the number of cameras connected to M adapter boards, it can create a number of virtual objects corresponding to the number of cameras. For example, if the SDK determines the number of cameras connected to M adapter boards is N, then N virtual objects need to be created. Virtual objects in this context refer to the virtual objects of the cameras on the software side. Through the object interface, parameters can be set, and operations such as previewing, taking photos, and recording videos can be performed.

[0056] In some embodiments, the N threads correspond one-to-one to the N virtual objects. For example, if eight cameras are connected to the ISP in an Android device, the SDK will create eight virtual objects, each containing a thread that can retrieve preview data from the corresponding camera. This preview data includes, but is not limited to, video and audio data.

[0057] In some implementations, after obtaining preview data corresponding to N cameras, the SDK renders the obtained preview data to obtain preview images corresponding to the N cameras. In this way, when the application layer needs to display all or part of the preview images, it can be transmitted to the application layer for display.

[0058] In this embodiment, N cameras can be connected to M image signal processors through M adapter boards, and the preview data corresponding to the N cameras can be obtained through N threads, and the preview data corresponding to the N cameras can be rendered to obtain preview pictures of the N cameras, thereby realizing the preview function of multiple camera pictures, reducing the limit on the number of preview camera pictures, meeting the needs of some specific fields, and greatly expanding the scope of use of the Android system.

[0059] In some embodiments, each of the M adapter boards is configured to expand the number of cameras connected to each of the M image signal processors to H times the original number, where H is an integer greater than 1;

[0060] In some embodiments, step 101, creating N virtual objects corresponding to N cameras, includes:

[0061] Get the number of cameras connected to M adapter boards;

[0062] When the number of cameras is N, N virtual objects corresponding to the N cameras are created, where N is an integer less than or equal to H*M.

[0063] In some embodiments, when creating N virtual objects corresponding to N cameras, the SDK needs to first determine the number of cameras on the Android device, and then create virtual objects based on the obtained number of cameras. In some embodiments, the SDK can obtain the interface status of the adapter board by calling the Java Native Interface (JNI) and the Hardware Abstract Layer (HAL), thereby determining the number of cameras based on the interface status of the adapter board. If the Android device currently has N cameras connected to the adapter board, then N virtual objects corresponding to the N cameras are created; if the Android device currently has no cameras connected to the adapter board, then a prompt message is generated to remind the user that there are no available cameras.

[0064] It should be noted that adapter boards can expand the number of connected cameras. If each adapter board supports expanding the number of connected cameras to H times the original number, then M adapter boards can support the connection of H*M cameras. However, due to different actual business needs, the actual number of connected cameras will also vary. Therefore, the actual number of connected cameras N is an integer less than or equal to H*M.

[0065] In the above manner, a corresponding number of virtual objects can be created according to the number of cameras obtained, so as to facilitate the subsequent acquisition of preview data of each camera based on the virtual objects.

[0066] In some embodiments, the above step 102, obtaining preview data corresponding to N cameras through N threads, includes:

[0067] Obtain a first identifier and a second identifier corresponding to N cameras, wherein the first identifier is used to identify the number of the adapter board to which the camera is connected, and the second identifier is used to identify the number of the channel on the adapter board to which the camera is connected;

[0068] The adapter board corresponding to the first identifier among the M adapter boards is controlled to be turned on, and preview data of the N cameras corresponding to the second identifier are obtained through N threads.

[0069] In certain embodiments, the first identifier is used to identify the number of the adapter board to which the camera is connected, and the second identifier is used to identify the channel number on the adapter board to which the camera is connected. Taking the N4 adapter board as an example, each N4 adapter board corresponds to a first identifier, which can be represented by "Camera ID." If two N4 adapter boards are used, the value range of "Camera ID" is {0, 1}. Each N4 adapter board has four channels, supporting the connection of four cameras. Each channel corresponds to a second identifier, which is represented by "Channel ID." The value range of "Channel ID" is {0, 1, 2, 3}.

[0070] In some implementations, the SDK can obtain the first and second identifiers corresponding to N cameras, control the M adapter boards corresponding to the first identifier to open, and obtain preview data from the N cameras corresponding to the second identifiers through N threads. In this way, multiple camera images can be previewed simultaneously.

[0071] In some embodiments, the above steps of controlling the adapter board corresponding to the first identifier among the M adapter boards to be turned on, and obtaining preview data of the N cameras corresponding to the second identifier through N threads, include:

[0072] By calling the Java local interface JNI and the hardware abstraction layer HAL, the adapter board corresponding to the first identifier among the M adapter boards is controlled to be turned on, and the Java local interface JNI and the hardware abstraction layer HAL are called through N threads to obtain the preview data of the N cameras corresponding to the second identifier from the cache, wherein the Java local interface JNI is configured to skip the original framework layer of the system to realize the data transmission between the software development layer and the hardware abstraction, and the software development layer encapsulates the multi-camera screen preview method.

[0073] In certain embodiments, the SDK can obtain preview data of N cameras by calling the Java native interface JNI and the hardware abstraction layer HAL. Specifically, the SDK can design a virtual object to implement a thread, and the do while loop in the thread can read the preview data of the interface in the hardware abstraction layer HAL through the so library in the Java native interface JNI. When a third-party application is actually used, one virtual object corresponds to one camera entity, and N virtual objects are newly created. The thread in each virtual object continuously obtains the preview data of the camera composed of the Camera id + Channel id through the Java native interface JNI. Among them, the SDK mainly undertakes the function of providing an external API. When the camera is turned on, the adapter board corresponding to the Camera id is opened by calling the cameraInit interface in the Java native interface JNI, and a separate thread is started to read the preview data of the interface in the hardware abstraction layer HAL through the getCameraFrame method, thereby realizing the acquisition of preview data corresponding to N cameras.

[0074] In some embodiments, before the above step 103 of rendering the preview data corresponding to the N cameras to obtain the preview images of the N cameras, the method further includes:

[0075] Draw N preview windows corresponding to N cameras;

[0076] Render the preview data corresponding to N cameras to obtain the preview images of N cameras, including:

[0077] The preview data corresponding to the N cameras are rendered in the N preview windows to obtain the preview images of the N cameras.

[0078] In certain embodiments, before rendering the preview data corresponding to N cameras to obtain the preview images of N cameras, N preview windows corresponding to the N cameras can be drawn based on the number of cameras N obtained. In this way, when obtaining the preview images of N cameras, the preview data corresponding to the N cameras can be rendered in the N preview windows to obtain the preview images of N cameras. Specifically, after obtaining the preview data, the SDK can also send the preview data to the preview window GLSurfaceView via a callback, and implement data preview and interface rendering display through the GLSurfaceView+GLSurfaceView.Renderer method.

[0079] In some embodiments, after the above step of rendering the preview data corresponding to the N cameras to obtain the preview images of the N cameras, the method further includes:

[0080] Provides a calling interface for third-party applications to display N preview windows in their own user interface.

[0081] In some implementation schemes, after the SDK renders the preview data corresponding to N cameras and obtains the preview images of N cameras, it can also provide a calling interface for third-party applications so that the third-party applications can display N preview windows in their own user interfaces. In this way, users can view N preview windows through third-party applications and realize real-time monitoring of multiple camera images.

[0082] In some embodiments, after rendering the preview data corresponding to the N cameras to obtain preview images of the N cameras in step 103, the method further includes:

[0083] When receiving a photo-taking instruction from a third-party application, obtaining a photo-taking picture based on N preview windows; or

[0084] When a video recording instruction is received from a third-party application, video recording is obtained based on N preview windows.

[0085] In certain implementation schemes, after the SDK renders the preview data corresponding to N cameras and obtains the preview images of N cameras, it can also obtain photographic images based on N preview windows when it receives a photographing instruction sent by a third-party application, or obtain recordings based on N preview windows when it receives a recording instruction sent by a third-party application, thereby realizing the function of taking photos or recording videos of N or part of the camera images.

[0086] In certain implementation schemes, taking the N4 adapter board as an example, it is possible to achieve simultaneous preview of 8-way camera images, and the hardware and software implementation framework is shown in Figure 3. At the hardware level, the camera data output capability is expanded by 1*4 through 1 ISP corresponding to 1 N4 adapter board. The driver layer needs to expand support for the N4 adapter board so that the hardware abstraction layer HAL can control the opening and closing of the N4 adapter board and obtain the preview data of the camera connected to each N4 adapter board. The hardware abstraction layer HAL can control the working status of two N4 adapter boards (i.e., N4 adapter board 0 and N4 adapter board 1) through the driver layer. Each N4 adapter board is connected to 4 cameras respectively, and the two N4 adapter boards are connected to a total of 8 cameras (i.e., camera 0 to camera 7). Each camera can correspond to a cache queue, which is configured to temporarily store the preview data of its own camera. At the software level, the Qualcomm platform's native mm-camera is replaced with the Hardware Abstraction Layer (HAL). This provides a Camera ID and Channel ID for each N4 adapter board. Each N4 adapter board corresponds to one Camera ID, while two N4 adapter boards correspond to {0, 1}. Each N4 adapter board outputs preview data for four cameras, corresponding to {0, 1, 2, 3}. Preview data for each of the eight cameras is obtained through the SDK, Java Native Interface (JNI) so library, and Hardware Abstraction Layer (HAL) so library. A Camera object is designed in the SDK to implement threading. A do-while loop in the thread reads the Camera preview data from the Hardware Abstraction Layer (HAL) interface through the Java Native Interface (JNI) so library. When used in the client app, one virtual object corresponds to each camera entity. Eight objects are created, and the thread in each object continuously obtains camera preview data from the Camera ID + Channel ID combination object through the Java Native Interface (JNI) so library. The SDK primarily provides an external API. When the camera is turned on, it calls the Java Native Interface (JNI) cameraInit interface to open an N4 adapter board. A separate thread is started to read preview data using the getCameraFrame method. After obtaining the preview data, the data is sent to GLSurfaceView via a callback. The client app can use the preview data obtained from the SDK to preview and render the interface using GLSurfaceView+GLSurfaceView.Renderer. Furthermore, the client app can use the callback data to synchronize audio and video using AudioRecord+MediaCodec, and save the recorded file in MP4 format.

[0087] In some embodiments, the interaction process between the SDK and the third-party application is shown in Figure 4 and includes the following steps:

[0088] Step 401: Get the number of cameras. If the number of cameras is greater than 0, execute step 402; if the number of cameras is equal to 0, execute step 421.

[0089] Step 402: Initialize according to the number of cameras.

[0090] Step 403: Initialize layout and user interface operations.

[0091] Step 404: Draw N preview windows, where N is an integer greater than 2.

[0092] Step 405: Add a photo button and set monitoring.

[0093] Step 406: Add a recording button and set up monitoring.

[0094] Step 407: Determine whether the photo button is clicked.

[0095] Step 408: Determine whether the record button is clicked.

[0096] Step 409: Initialize the number of virtual objects.

[0097] Step 410: Create N virtual objects.

[0098] Step 411: Initialize the system status.

[0099] Step 412: Monitor the preview window creation status.

[0100] Step 413: Determine whether to start the camera preview. If yes, go to step 414; if not, go to step 422.

[0101] Step 414: Create and start N threads.

[0102] Step 415: When a photo taking instruction is detected, obtain a photo.

[0103] Step 416: Save the image.

[0104] Step 417: Start recording when a recording instruction is detected.

[0105] Step 418: Save the video.

[0106] Step 419: Determine whether to close the third-party application. If yes, proceed to step 420; if no, return to step 415.

[0107] Step 420: Close and release resources.

[0108] Step 421: Generate a prompt message, indicating that there is no available camera.

[0109] Step 422: Do not start the camera preview.

[0110] It should be noted that the above steps 403, 409, and 411 can be executed simultaneously or sequentially; the above steps 415 to 416 and the above steps 417 to 418 can also be executed simultaneously or sequentially, and the above serial numbers do not limit the actual execution order.

[0111] In this embodiment, the Android system can achieve at least eight simultaneous previews and recordings. By pairing one ISP with one N4 adapter board, the number of cameras can be quadrupled. Software-wise, through the SDK + Java Native Interface (JNI) .so library + Hardware Abstraction Layer (HAL) .so library approach, the capabilities of at least eight simultaneous previews and recordings can be bypassed. This system can be used for onboard equipment on large trucks, enabling preview and video monitoring of at least eight positions on the vehicle body to prevent traffic accidents. It can also be used in specific scenarios such as stores, where a single Android client can support eight cameras scanning, improving scanning efficiency and thus expanding the use of the Android system.

[0112] 5 , which is a schematic diagram of the structure of a multi-camera image preview device provided by an embodiment of the present disclosure. As shown in FIG5 , the device 500 includes:

[0113] a creation module 501 configured to create N virtual objects corresponding to N cameras, where the N cameras are cameras connected to M image signal processors via M adapter boards, the M adapter boards being configured to expand the number of cameras connected to each of the M image signal processors, N being an integer greater than 2, and M being an integer greater than or equal to 1;

[0114] A first acquisition module 502 is configured to start N threads and acquire preview data corresponding to N cameras through the N threads, wherein the N threads correspond one-to-one to the N virtual objects;

[0115] The rendering module 503 is configured to render the preview data corresponding to the N cameras to obtain preview images of the N cameras.

[0116] In some embodiments, each of the M adapter boards is configured to expand the number of cameras connected to each of the M image signal processors to H times the original number, where H is an integer greater than 1;

[0117] The creation module 501 includes:

[0118] A first acquisition submodule is configured to acquire the number of cameras connected to the M adapter boards;

[0119] The creation submodule is configured to create N virtual objects corresponding to the N cameras when the number of cameras is N, where N is an integer less than or equal to H*M.

[0120] In some embodiments, the first acquisition module 502 includes:

[0121] A second acquisition submodule is configured to obtain a first identifier and a second identifier corresponding to the N cameras, wherein the first identifier is used to identify the number of the adapter board to which the camera is connected, and the second identifier is used to identify the number of the channel on the adapter board to which the camera is connected;

[0122] The third acquisition submodule is configured to control the adapter board corresponding to the first identifier among the M adapter boards to be turned on, and obtain preview data of the N cameras corresponding to the second identifier through N threads.

[0123] In some embodiments, the third acquisition submodule is further configured to:

[0124] By calling the Java local interface JNI and the hardware abstraction layer HAL, the adapter board corresponding to the first identifier among the M adapter boards is controlled to be turned on, and the Java local interface JNI and the hardware abstraction layer HAL are called through N threads to obtain the preview data of the N cameras corresponding to the second identifier from the cache, wherein the Java local interface JNI is configured to skip the original framework layer of the system to realize the data transmission between the software development layer and the hardware abstraction, and the software development layer encapsulates the multi-camera screen preview method.

[0125] In certain embodiments, the apparatus 500 further comprises:

[0126] A drawing module configured to draw N preview windows corresponding to N cameras;

[0127] The rendering module 503 is further configured to render the preview data corresponding to the N cameras in the N preview windows to obtain preview images of the N cameras.

[0128] In certain embodiments, the apparatus 500 further comprises:

[0129] A module is provided, configured to provide a calling interface for a third-party application, so that the third-party application can display N preview windows in its own user interface.

[0130] In certain embodiments, the apparatus 500 further comprises:

[0131] The second acquisition module is configured to acquire the photographed image based on N preview windows when receiving a photographing instruction sent by a third-party application; or

[0132] The third acquisition module is configured to acquire the video based on the N preview windows when receiving a video recording instruction sent by a third-party application.

[0133] It should be noted that the device 500 can implement the steps of the multi-camera image preview method provided by any of the aforementioned method embodiments and can achieve the same technical effects, which will not be described in detail here.

[0134] As shown in FIG6 , the embodiment of the present disclosure further provides an electronic device, including a processor 611, a communication interface 612, a memory 613, and a communication bus 614, wherein the processor 611, the communication interface 612, and the memory 613 communicate with each other via the communication bus 614.

[0135] Memory 613, configured to store computer programs;

[0136] The processor 611 is configured to execute the program stored in the memory 613 to implement the multi-camera image preview method provided by the present disclosure, including:

[0137] Create N virtual objects corresponding to N cameras, where the N cameras are cameras connected to M image signal processors via M adapter boards, the M adapter boards being configured to expand the number of cameras connected to each of the M image signal processors, where N is an integer greater than 2, and M is an integer greater than or equal to 1;

[0138] Start N threads and obtain preview data corresponding to N cameras through N threads, where N threads correspond one to one to N virtual objects;

[0139] The preview data corresponding to the N cameras are rendered to obtain preview images of the N cameras.

[0140] The electronic device provided in the embodiments of the present disclosure may be a module capable of realizing a communication function or a terminal device including the module, etc., and the terminal device may be a mobile terminal or a smart terminal. In certain embodiments, the mobile terminal may be at least one of a mobile phone, a tablet computer, a laptop computer, etc. In certain embodiments, the smart terminal may be a terminal including a wireless communication module such as a smart car, a smart watch, a shared bicycle, or a smart cabinet. In certain embodiments, the module may be a wireless communication module, such as any one of a 2G communication module, a 3G communication module, a 4G communication module, a 5G communication module, and an NB-IOT communication module.

[0141] An embodiment of the present disclosure further provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the present disclosure provides a multi-camera image preview method.

[0142] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the terms "comprises," "comprising," or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article, or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or device. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of other identical elements in the process, method, article, or device comprising the element.

[0143] The foregoing description is intended only to provide specific embodiments of the present disclosure, which will enable those skilled in the art to understand and implement the present disclosure. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present disclosure. Therefore, the present disclosure is not intended to be limited to the embodiments shown herein, but rather to be construed in the broadest manner consistent with the principles and novel features disclosed herein.

Claims

1. Multi-camera screen preview method, include: Creating N virtual objects corresponding to N cameras, wherein the N cameras are cameras connected to M image signal processors through M adapter boards, and the M adapter boards are configured to expand the number of cameras connected to each of the M image signal processors, N is an integer greater than 2, and M is an integer greater than or equal to 1; Starting N threads, and obtaining preview data corresponding to the N cameras through the N threads, wherein the N threads correspond one-to-one to the N virtual objects; The preview data corresponding to the N cameras are rendered to obtain preview images of the N cameras.

2. The method according to claim 1, wherein each of the M adapter boards is configured to expand the number of cameras connected to each of the M image signal processors to H times the original number, where H is an integer greater than 1; The step of creating N virtual objects corresponding to the N cameras includes: Obtain the number of cameras connected to the M adapter boards; When the number of the cameras is N, N virtual objects corresponding to the N cameras are created, where N is an integer less than or equal to H*M.

3. The method according to claim 1 or 2, wherein the preview data corresponding to the N cameras is obtained through the N threads, include: Obtain a first identifier and a second identifier corresponding to the N cameras, wherein the first identifier is used to identify the number of the adapter board to which the camera is connected, and the second identifier is used to identify the number of the channel on the adapter board to which the camera is connected; The adapter board corresponding to the first identifier among the M adapter boards is controlled to be turned on, and the preview data of the N cameras corresponding to the second identifier are obtained through the N threads.

4. The method according to claim 3, wherein the control starts the adapter board corresponding to the first identifier among the M adapter boards, and obtains the preview data of the N cameras corresponding to the second identifier through the N threads, include: The adapter board corresponding to the first identifier among the M adapter boards is controlled to be turned on by calling the Java local interface JNI and the hardware abstraction layer HAL, and the preview data of the N cameras corresponding to the second identifier are obtained from the cache by calling the Java local interface JNI and the hardware abstraction layer HAL through the N threads, wherein the Java local interface JNI is configured to skip the original framework layer of the system to realize the data transmission between the software development layer and the hardware abstraction, and the software development layer encapsulates the multi-camera screen preview method.

5. The method according to any one of claims 1 to 4, wherein before rendering the preview data corresponding to the N cameras to obtain the preview images of the N cameras, the method further comprises: include: Draw N preview windows corresponding to the N cameras; The rendering of the preview data corresponding to the N cameras to obtain the preview images of the N cameras includes: The preview data corresponding to the N cameras are rendered in the N preview windows to obtain preview images of the N cameras.

6. The method according to claim 5, wherein after rendering the preview data corresponding to the N cameras to obtain the preview images of the N cameras, the method further include: A calling interface is provided for the third-party application so that the third-party application can display the N preview windows in its own user interface.

7. The method according to claim 6, wherein after rendering the preview data corresponding to the N cameras to obtain the preview images of the N cameras, the method further include: When receiving a photo-taking instruction sent by the third-party application, obtaining a photo-taking picture based on the N preview windows; or, When a video recording instruction sent by the third-party application is received, video recording is acquired based on the N preview windows.

8. Multi-camera image preview device, include: A creation module is configured to create N virtual objects corresponding to N cameras, wherein the The N cameras are cameras connected to the M image signal processors through M adapter boards, and the M adapter boards are configured to expand the number of cameras connected to each of the M image signal processors, N is an integer greater than 2, and M is an integer greater than or equal to 1; A first acquisition module is configured to start N threads and acquire preview data corresponding to the N cameras through the N threads, wherein the N threads correspond to the N virtual objects one by one; The rendering module is configured to render the preview data corresponding to the N cameras to obtain the preview images of the N cameras.

9. An electronic device comprising a processor, a communication interface, a memory and a communication bus, in, The processor, the communication interface, and the memory communicate with each other via the communication bus; The memory is configured to store a computer program; The processor is configured to implement the multi-camera image preview method described in any one of claims 1 to 7 when executing the computer program stored in the memory.

10. A computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the multi-camera image preview method described in any one of claims 1 to 7.

Citation Information

Patent Citations

  • Method and device for simultaneously opening multiple cameras

    CN107222677A

  • System supporting simultaneous use of multiple cameras

    CN110611747A

  • Video recording method and equipment

    CN113347378A

  • Multi-camera picture preview method and device, electronic equipment and storage medium

    CN116366965A

  • Image photographing apparatus and method using image stored in camera

    EP2490436A1