Camera sharing method and apparatus, device, and medium
By allocating memory and copying image data separately for multiple camera processes in the head-mounted device, the camera data conflict when multiple applications start simultaneously in the head-mounted device is resolved, enabling multiple processes to share camera data and acquire normal data.
Patent Information
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- GEER TECH CO LTD
- Filing Date
- 2024-12-03
- Publication Date
- 2026-05-07
AI Technical Summary
In head-mounted devices, when multiple applications are launched simultaneously, the same camera, once invoked by one process, cannot be invoked by other processes, resulting in the inability to acquire camera data simultaneously or the camera function of subsequently launched processes becoming invalid.
By allocating first memory for the first camera process, allocating second memory for the second camera process according to the image configuration requirements of the second camera process, controlling the target camera to acquire and store image data, and then copying the image data in the second memory to the third memory, the sharing of the camera by multiple camera processes can be realized.
It enables at least two camera processes to successfully call the same camera, resolves the camera data acquisition conflict when multiple applications are launched simultaneously, and ensures that all processes can acquire camera data normally.
Smart Images

Figure CN2024136489_07052026_PF_FP_ABST
Abstract
Description
Camera sharing methods, devices, equipment and media
[0001] This application claims priority to Chinese Patent Application No. 202411516947.8, filed on October 28, 2024, entitled "Camera Sharing Method, Apparatus, Device and Medium", the entire contents of which are incorporated herein by reference. Technical Field
[0002] This invention relates to the field of image processing technology, and more specifically, to a camera sharing method, apparatus, device, and medium. Background Technology
[0003] With the rapid development of economy and technology, wearable devices, especially head-mounted devices (such as AR, VR, MR and XR smart glasses or helmets), are widely used in various fields.
[0004] Multiple applications running simultaneously is a typical application scenario in head-mounted displays (HMDs), where multiple applications run in the foreground on the HMD simultaneously. In this scenario, the HMD may simultaneously run at least two processes that need to access the same camera. For example, it might run both a 6DoF algorithm and a gesture algorithm simultaneously, or it might run both a camera app and a QR code scanning app simultaneously.
[0005] However, when a head-mounted device simultaneously launches at least two processes that need to access the same camera, once that same camera is accessed by one process, it cannot be accessed by other processes. This results in at least two processes that need to access the same camera being unable to simultaneously obtain camera data, or the camera function of the later-launched process becoming invalid. Summary of the Invention
[0006] One object of the present invention is to provide a new technical solution for camera sharing.
[0007] According to a first aspect of the present invention, a camera sharing method is provided, the method comprising:
[0008] When the first camera process is started, first memory is requested for the first camera process according to the first image configuration requirements corresponding to the first camera process, and second memory is requested for the second camera process according to the second image configuration requirements corresponding to the second camera process. The second camera process is a camera process that may call the same target camera at the same time as the first camera process.
[0009] The target camera is controlled to acquire first image data according to the first image configuration requirements, and the first image data is stored in the first memory;
[0010] When the second camera process is started, third memory is requested for the second camera process according to the second image configuration requirements;
[0011] The target camera is controlled to acquire second image data according to the second image configuration requirements, and the second image data is stored in the second memory;
[0012] The second image data in the second memory is copied to the third memory.
[0013] Optionally, before allocating first memory for the first camera process according to the first image configuration requirement corresponding to the first camera process and allocating second memory for the second camera process according to the second image configuration requirement corresponding to the second camera process when the first camera process is started, the process includes:
[0014] When the first camera process is enabled, the target camera is determined;
[0015] Based on the target camera, determine the target preset mapping relationship corresponding to the target camera from the candidate preset mapping relationships;
[0016] Based on the target preset mapping relationship, determine the second camera process corresponding to the first camera process;
[0017] The candidate preset mapping relationship is used to reflect the correspondence between the camera and the camera process that may call the camera at the same time.
[0018] Optionally, the method further includes:
[0019] If the first camera process is closed and the second camera process is not started, the second memory is reclaimed.
[0020] Optionally, copying the second image data from the second memory to the third memory includes:
[0021] Once the second image data has been filled into the second memory, the second image data in the second memory is copied to the third memory.
[0022] Optionally, either the first image configuration requirement or the second image configuration requirement includes at least one of image size and image format.
[0023] According to a second aspect of the present invention, a camera sharing device is provided, the device comprising:
[0024] The first application module is used to apply for first memory for the first camera process according to the first image configuration requirements corresponding to the first camera process when the first camera process is started, and to apply for second memory for the second camera process according to the second image configuration requirements corresponding to the second camera process, wherein the second camera process is a camera process that may call the same target camera at the same time as the first camera process.
[0025] The first control module is used to control the target camera to acquire first image data according to the first image configuration requirements, and to store the first image data in the first memory;
[0026] The second application module is used to apply for third memory for the second camera process according to the second image configuration requirements when the second camera process is started.
[0027] The second control module is used to control the target camera to acquire second image data according to the second image configuration requirements, and to store the second image data in the second memory;
[0028] The copying module is used to copy the second image data in the second memory to the third memory.
[0029] Optionally, the device further includes:
[0030] The determination module is used to determine the target camera when the first camera process is started;
[0031] Based on the target camera, determine the target preset mapping relationship corresponding to the target camera from the candidate preset mapping relationships;
[0032] Based on the target preset mapping relationship, determine the second camera process corresponding to the first camera process;
[0033] The candidate preset mapping relationship is used to reflect the correspondence between the camera and the camera process that may call the camera at the same time.
[0034] Optionally, the copying module is specifically used for:
[0035] Once the second image data has been filled into the second memory, the second image data in the second memory is copied to the third memory.
[0036] According to a third aspect of the invention, an electronic device is provided, the electronic device comprising the means as described in any one of the second aspects; or,
[0037] The electronic device includes a memory and a processor, the memory being used to store computer instructions, and the processor being used to retrieve the computer instructions from the memory to perform the method as described in any one of the first aspects.
[0038] According to a fourth aspect of the present invention, a computer-readable storage medium is provided having a computer program stored thereon, which, when executed by a processor, implements the method according to any one of the first aspects.
[0039] This invention provides a camera sharing method, comprising: when a first camera process is started, allocating first memory for the first camera process according to a first image configuration requirement corresponding to the first camera process, and allocating second memory for a second camera process according to a second image configuration requirement corresponding to the second camera process, wherein the second camera process is a camera process that may simultaneously call the same target camera as the first camera process; controlling the target camera to acquire first image data according to the first image configuration requirement, and storing the first image data in the first memory; when the second camera process is started, allocating third memory for the second camera process according to the second image configuration requirement; controlling the target camera to acquire second image data according to the second image configuration requirement, and storing the second image data in the second memory; and copying the second image data in the second memory to the third memory. This method enables at least two camera processes to successfully call a camera, that is, it realizes camera sharing by at least two camera processes.
[0040] Other features and advantages of this specification will become clear from the following detailed description of exemplary embodiments with reference to the accompanying drawings. Attached Figure Description
[0041] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments of the invention and, together with their description, serve to explain the principles of the invention.
[0042] Figure 1 is a block diagram of the hardware configuration of an electronic device for implementing a camera sharing method according to an embodiment of the present invention;
[0043] Figure 2 is a flowchart illustrating a camera sharing method according to an embodiment of the present invention;
[0044] Figure 3 is a schematic diagram of a camera architecture according to an embodiment of the present invention;
[0045] Figure 4 is a schematic diagram of a camera sharing device according to an embodiment of the present invention;
[0046] Figure 5 is a block diagram of the hardware configuration of an electronic device for implementing a camera sharing method according to an embodiment of the present invention.
[0047] The realization of the objective, functional features and advantages of the present invention will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation
[0048] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of the present invention, and not all of them. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0049] It should be noted that if the embodiments of the present invention involve directional indicators (such as up, down, left, right, front, back, etc.), the directional indicators are only used to explain the relative positional relationship and movement of the components in a certain specific posture (as shown in the figure). If the specific posture changes, the directional indicators will also change accordingly.
[0050] Furthermore, if the embodiments of this invention involve descriptions such as "first" or "second," these descriptions are for descriptive purposes only and should not be construed as indicating or implying their relative importance or implicitly specifying the number of technical features indicated. Therefore, a feature defined with "first" or "second" may explicitly or implicitly include at least one of those features. Additionally, the meaning of "and / or" throughout the text includes three parallel solutions; for example, "A and / or B" includes solution A, solution B, or a solution where both A and B are satisfied simultaneously. Furthermore, the technical solutions of the various embodiments can be combined with each other, but this must be based on the ability of those skilled in the art to implement them. When the combination of technical solutions is contradictory or impossible to implement, it should be considered that such a combination of technical solutions does not exist and is not within the scope of protection claimed by this invention.
[0051] Figure 1 is a block diagram of the hardware configuration of an electronic device for implementing a camera sharing method according to an embodiment of the present invention.
[0052] Electronic device 1000 can be a terminal or a server. Furthermore, the terminal can be a head-mounted device (such as an AR device, MR device, VR device, and XR device), a portable computer, a tablet computer, a PDA, etc. The server can be a cloud server, etc.
[0053] Electronic device 1000 may include a processor 1100, a memory 1200, an interface device 1300, a communication device 1400, a display device 1500, an input device 1600, a speaker 1700, a microphone 1800, etc. The processor 1100 may be a central processing unit (CPU), a microprocessor (MCU), etc. The memory 1200 may include, for example, ROM (Read-Only Memory), RAM (Random Access Memory), or non-volatile memory such as a hard disk. The interface device 1300 may include, for example, a USB interface, a headphone jack, etc. The communication device 1400 may be capable of wired or wireless communication. The display device 1500 may be, for example, an LCD screen, a touch screen, etc. The input device 1600 may include, for example, a touch screen, a keyboard, etc. Users can input / output voice information through the speaker 1700 and the microphone 1800.
[0054] Although multiple devices are shown for electronic device 1000 in FIG1, the present invention may refer to only some of the devices therein. For example, electronic device 1000 may refer to only memory 1200 and processor 1100.
[0055] In an embodiment of the present invention, the memory 1200 of the electronic device 1000 is used to store instructions for controlling the processor 1100 to execute the camera sharing method provided in the embodiment of the present invention.
[0056] In the above description, those skilled in the art can design instructions based on the scheme disclosed in this invention. How the instructions control the processor to operate is well known in the art, and therefore will not be described in detail here.
[0057] This invention provides a camera sharing method, which is applied to the electronic device shown in Figure 1. As shown in Figure 2, the camera sharing method provided by this invention includes the following steps S2100 to S2500.
[0058] Step S2100: When the first camera process is started, first memory is requested for the first camera process according to the first image configuration requirements corresponding to the first camera process, and second memory is requested for the second camera process according to the second image configuration requirements corresponding to the second camera process.
[0059] The second camera process is a camera process that may simultaneously call the same target camera as the first camera process.
[0060] Electronic devices typically have multiple cameras, such as wide-angle lenses, ultra-wide-angle lenses, and telephoto lenses. A single camera can be invoked by at least two camera processes. When at least two camera processes invoke a single camera, there is a possibility that at least two camera processes will invoke the same camera simultaneously. In this embodiment, for any camera on the electronic device, the camera process that starts first among the at least two camera processes that simultaneously invoke the same camera is designated as the first camera process, and the remaining camera processes are designated as the second camera process. Furthermore, the camera invoked simultaneously by the first camera process and the second camera process is designated as the target camera.
[0061] In one example, either the first camera process or the second camera process can be a camera algorithm or a camera application. The camera algorithm could be, for example, a 6DoF algorithm or a gesture algorithm, while the camera application could be, for example, a social application that enables video calls or a search application that allows scanning.
[0062] Either the first image configuration requirement or the second image configuration requirement describes the specifications of the image data required by the corresponding camera process. In one embodiment, either the first image configuration requirement or the second image configuration requirement includes at least one of image size and image format. The image format may be, for example, RGB or YUV format.
[0063] When the first camera process starts, it is determined that the first camera process calls the target camera. At this point, as with traditional camera process startup mechanisms, first memory is allocated for the first camera process based on its first image configuration requirements. However, unlike traditional camera process startup mechanisms, second memory is allocated for the second camera process based on its second image configuration requirements. That is, the second image configuration requirements of the second camera process are used as the image configuration requirements of the first camera process to allocate corresponding second memory. Therefore, the above step S1100 is entirely feasible.
[0064] After allocating first memory for the first camera process to be started based on the above step S2100, the following step S2200 is executed to control the camera to acquire corresponding image data.
[0065] Step S2200: Control the target camera to acquire first image data according to the first image configuration requirements, and store the first image data in the first memory.
[0066] In one example, taking the first image configuration requirement as including the image size, and the first image configuration requirement as 640*480, based on the above step S2200, the image data acquired by the target camera is image data of 640*480 specification.
[0067] In this embodiment, the image data acquired by the target camera according to the first image configuration requirements is recorded as the first image data.
[0068] After allocating first memory for the first camera process in step S2100, the target camera is controlled to acquire first image data according to the first image configuration requirements in step S2200. Furthermore, the first image data is stored in the first memory so that the first camera process can acquire it. Thus, like a traditional camera process startup mechanism, the operations after the first camera process starts are completed.
[0069] In step S2300, when the second camera process is started, third memory is requested for the second camera process according to the second image configuration requirements.
[0070] In this embodiment, the startup of the second target process specifically refers to the simultaneous startup of the first camera process and the second target camera.
[0071] When the second camera process is started, as with the traditional camera process startup mechanism, a third memory is requested for the second camera process based on the second image configuration requirements.
[0072] In step S2400, the target camera is controlled to acquire second image data according to the second image configuration requirements, and the second image data is stored in the second memory.
[0073] In this embodiment, the image data acquired by the target camera according to the second image configuration requirements is recorded as the second image data.
[0074] When the second camera process is started, as with traditional camera process startup mechanisms, after allocating third memory for the second camera process according to the second image configuration requirements, the target camera is controlled to acquire second image data according to the second image configuration requirements. However, unlike traditional camera process startup mechanisms, this approach first stores the second image data in the second memory.
[0075] Step S2500: Copy the second image data from the second memory to the third memory.
[0076] Since the second memory stores the second image data acquired by the target camera according to the second image configuration requirements corresponding to the second camera process, based on the above step S2500, the second image data in the second memory that meets the second image configuration requirements corresponding to the second camera process can be completely copied to the third memory. At this time, the third memory stores the second image data acquired according to the second image configuration requirements corresponding to the second camera process. In this way, the second camera process can successfully call the image data in the third memory.
[0077] Based on the above steps S2100 to S2500, at least two camera processes can successfully invoke a camera, that is, at least two camera processes can share the camera.
[0078] This invention provides a camera sharing method, comprising: when a first camera process is started, allocating first memory for the first camera process according to a first image configuration requirement corresponding to the first camera process, and allocating second memory for a second camera process according to a second image configuration requirement corresponding to the second camera process, wherein the second camera process is a camera process that may simultaneously call the same target camera as the first camera process; controlling the target camera to acquire first image data according to the first image configuration requirement, and storing the first image data in the first memory; when the second camera process is started, allocating third memory for the second camera process according to the second image configuration requirement; controlling the target camera to acquire second image data according to the second image configuration requirement, and storing the second image data in the second memory; and copying the second image data in the second memory to the third memory. This method enables at least two camera processes to successfully call a camera, that is, it realizes camera sharing by at least two camera processes.
[0079] In one embodiment of the present invention, the camera sharing method provided by the present invention further includes a step of determining a second camera process before the above-described step S2100. This step is described in steps S2110 to S2112.
[0080] Step S2110: If the first camera process is started, determine the target camera.
[0081] In this embodiment, when the first camera process is started, the camera called by the first camera process is determined and recorded as the target camera.
[0082] Step S2111: Based on the target camera, determine the target preset mapping relationship corresponding to the target camera from the candidate preset mapping relationships.
[0083] Different cameras have different preset mapping relationships. The preset mapping relationship is used to reflect the correspondence between the camera and the camera process that may call the camera at the same time.
[0084] In this embodiment, for any given camera, it is known in advance that there are camera processes that may simultaneously invoke that camera. Therefore, a preset mapping relationship can be generated in advance and stored in the electronic device.
[0085] In this embodiment, the preset mapping relationship corresponding to any camera is recorded as the candidate preset mapping relationship. And, the preset mapping relationship corresponding to the target camera is recorded as the target preset mapping relationship.
[0086] After identifying the target camera, the candidate preset mapping relationship corresponding to the target camera is determined from the candidate preset mapping relationships and used as the target preset mapping relationship.
[0087] Step S2112: Determine the second camera process corresponding to the first camera process according to the target preset mapping relationship.
[0088] It is understandable that the target preset mapping relationship can reflect the camera processes that may simultaneously call the target camera. Based on this, the camera processes other than the first camera process reflected in the target preset mapping relationship are denoted as the second camera process.
[0089] In one embodiment of the application, the camera sharing method provided by the present invention further includes the following step S2600.
[0090] Step S2600: If the first camera process is closed and the second camera process is not started, the second memory is reclaimed.
[0091] In this embodiment, if the second camera process is not started when the first camera process is closed, it means that the second memory requested by the second camera process is useless. At this time, the second memory is reclaimed, which can avoid unnecessary memory occupation.
[0092] In one embodiment of the present invention, the above step S2500 can be specifically implemented by the following step S2510.
[0093] Step S2510: After the second image data is completely filled in the second memory, the second image data in the second memory is copied to the third memory.
[0094] In this embodiment, after the second memory is filled with data, the image data in the second memory is copied to the third memory. This avoids redundant or erroneous copying of image data from the second memory to the third memory, which could lead to errors in the image data in the third memory.
[0095] Combining the above embodiments and the camera architecture shown in Figure 3, and taking the first camera process as APP1, the second camera process as APP2, the target camera as camera1, and the first image configuration requirement for APP1 being an image size of 640*480, and the second image configuration requirement for APP2 being an image size of 720*1280 and 1280*1920 as an example, the specific implementation of steps S2100 to S2500 is as follows:
[0096] S1, when APP1 is started, APP1 sends the first image configuration requirement of 640*480 to the camera server;
[0097] S2, the camera server determines the status of camera 1, specifically determining that camera 1 is called by APP1. At this time, it determines that the first camera process corresponding to camera 1 is APP1 and the second camera process is APP2. Furthermore, it determines the second image configuration requirements of 720*1280 and 1280*1920, and sends the first image configuration requirements of 640*480 and the second image configuration requirements of 720*1280 and 1280*1920 to the camera driver through the config in the camera provider.
[0098] S3, after receiving the first image configuration requirement of 640*480 and the second image configuration requirements of 720*1280 and 1280*1920, the camera driver instructs the camera provider to request the first memory buffer1 corresponding to 640*480, the second memory s_buffer2 corresponding to 720*1280 and the second memory s_buffer3 corresponding to 1280*1920;
[0099] S4, according to the instructions in S3 above, the camera provider requests the first memory buffer1 corresponding to 640*480, the second memory s_buffer2 corresponding to 720*1280, and the second memory s_buffer3 corresponding to 1280*1920.
[0100] S5, APP1 controls camera 1 to acquire first image data according to the first image configuration requirement of 640*480;
[0101] S6, store the first image data captured by camera 1 into the first buffer 1.
[0102] S7, when APP2 is started, APP1 controls camera 1 to collect second image data according to the second image configuration requirements of 720*1280 and 1280*1920, and instructs camera provider to apply for the third memory buffer 2 corresponding to 720*1280 and the third memory buffer 3 corresponding to 1280*1920.
[0103] S8 stores the 720*1280 second image data captured by camera 1 in the second memory s_buffer2, and copies the data in the second memory s_buffer2 to the third memory buffer2. It also stores the 1280*1920 second image data captured by camera 1 in the second memory s_buffer3, and copies the data in the second memory s_buffer3 to the third memory buffer3.
[0104] As can be understood, as shown in Figure 3, after S8 above, the image data in buffer1, buffer2 and buffer3 are fed back to APP1 and APP2 through the camera server.
[0105] The present invention also provides a camera sharing device 400, as shown in FIG4, the device 400 comprising:
[0106] The first application module 410 is used to apply for first memory for the first camera process according to the first image configuration requirements corresponding to the first camera process when the first camera process is started, and to apply for second memory for the second camera process according to the second image configuration requirements corresponding to the second camera process, wherein the second camera process is a camera process that may call the same target camera at the same time as the first camera process.
[0107] The first control module 420 is used to control the target camera to acquire first image data according to the first image configuration requirements, and to store the first image data in the first memory;
[0108] The second application module 430 is used to apply for third memory for the second camera process according to the second image configuration requirements when the second camera process is started.
[0109] The second control module 440 is used to control the target camera to acquire second image data according to the second image configuration requirements, and to store the second image data in the second memory;
[0110] The copying module 450 is used to copy the second image data in the second memory to the third memory.
[0111] In one embodiment of the present invention, the device 400 further includes:
[0112] The determination module is used to determine the target camera when the first camera process is started;
[0113] Based on the target camera, determine the target preset mapping relationship corresponding to the target camera from the candidate preset mapping relationships;
[0114] Based on the target preset mapping relationship, determine the second camera process corresponding to the first camera process;
[0115] The candidate preset mapping relationship is used to reflect the correspondence between the camera and the camera process that may call the camera at the same time.
[0116] In one embodiment of the present invention, the copying module 450 is specifically used for:
[0117] Once the second image data has been filled into the second memory, the second image data in the second memory is copied to the third memory.
[0118] In one embodiment of the present invention, the device 400 further includes:
[0119] The recycling module is used to reclaim the second memory when the first camera process is closed and the second camera process is not started.
[0120] In one embodiment of the present invention, either the first image configuration requirement or the second image configuration requirement includes at least one of image size and image format.
[0121] The present invention also provides an electronic device comprising the device 400 as described in any of the above-described device embodiments.
[0122] Alternatively, as shown in FIG5, the electronic device 500 includes a memory 510 and a processor 520, the memory 510 being used to store computer instructions, and the processor 520 being used to retrieve the computer instructions from the memory 510 to execute the method as described in any of the above method embodiments.
[0123] The present invention also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method according to any one of the above-described method embodiments.
[0124] This invention can be a system, method, and / or computer program product. A computer program product may include a computer-readable storage medium having computer-readable program instructions loaded thereon for causing a processor to implement various aspects of the invention.
[0125] Computer-readable storage media can be tangible devices capable of holding and storing instructions for use by an instruction execution device. Computer-readable storage media can be, for example—but not limited to—electrical storage devices, magnetic storage devices, optical storage devices, electromagnetic storage devices, semiconductor storage devices, or any suitable combination thereof. More specific examples (a non-exhaustive list) of computer-readable storage media include: portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), static random access memory (SRAM), portable compact disc read-only memory (CD-ROM), digital multifunction disc (DVD), memory sticks, floppy disks, mechanical encoding devices, such as punch cards or recessed protrusions storing instructions thereon, and any suitable combination thereof. The computer-readable storage media used herein are not to be construed as transient signals themselves, such as radio waves or other freely propagating electromagnetic waves, electromagnetic waves propagating through waveguides or other transmission media (e.g., light pulses through fiber optic cables), or electrical signals transmitted through wires.
[0126] The computer-readable program instructions described herein can be downloaded from computer-readable storage media to various computing / processing devices, or downloaded via a network, such as the Internet, local area network, wide area network, and / or wireless network, to an external computer or external storage device. The network may include copper transmission cables, fiber optic transmission, wireless transmission, routers, firewalls, switches, gateway computers, and / or edge servers. A network adapter card or network interface in each computing / processing device receives the computer-readable program instructions from the network and forwards them to the computer-readable storage media in the respective computing / processing device.
[0127] The computer program instructions used to perform the operations of this invention may be assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine-dependent instructions, microcode, firmware instructions, state setting data, or source code or object code written in any combination of one or more programming languages, including object-oriented programming languages such as Smalltalk, C++, etc., and conventional procedural programming languages such as the "C" language or similar programming languages. The computer-readable program instructions may be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or may be connected to an external computer (e.g., via the Internet using an Internet service provider). In some embodiments, electronic circuitry, such as programmable logic circuitry, field-programmable gate arrays (FPGAs), or programmable logic arrays (PLAs), is personalized by utilizing state information from the computer-readable program instructions. This electronic circuitry can execute the computer-readable program instructions to implement various aspects of the invention.
[0128] Various aspects of the present invention are described herein with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It should be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer-readable program instructions.
[0129] These computer-readable program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing apparatus to produce a machine such that, when executed by the processor of the computer or other programmable data processing apparatus, they create means for implementing the functions / actions specified in one or more blocks of the flowchart and / or block diagram. These computer-readable program instructions can also be stored in a computer-readable storage medium that causes a computer, programmable data processing apparatus, and / or other device to operate in a particular manner; thus, the computer-readable medium storing the instructions comprises an article of manufacture that includes instructions for implementing aspects of the functions / actions specified in one or more blocks of the flowchart and / or block diagram.
[0130] Computer-readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other device to cause a series of operational steps to be performed on the computer, other programmable data processing apparatus, or other device to produce a computer-implemented process, thereby causing the instructions executed on the computer, other programmable data processing apparatus, or other device to perform the functions / actions specified in one or more boxes of a flowchart and / or block diagram.
[0131] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of the present invention. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of an instruction containing one or more executable instructions for implementing a specified logical function. In some alternative implementations, the functions marked in the blocks may occur in a different order than those marked in the drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or action, or using a combination of dedicated hardware and computer instructions. It will be known to those skilled in the art that implementation in hardware, implementation in software, and implementation using a combination of software and hardware are equivalent. It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or system that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or system. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or system that includes that element.
[0132] The sequence numbers of the above embodiments of the present invention are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.
[0133] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) as described above, and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, television, or network device, etc.) to execute the methods of the various embodiments of the present invention.
[0134] The above description is merely a preferred embodiment of the present invention and does not limit the patent scope of the present invention. Any equivalent structural transformations made using the contents of the present invention's specification and drawings under the inventive concept of the present invention, or direct / indirect applications in other related technical fields, are included within the patent protection scope of the present invention.
Claims
1. A camera sharing method, characterized in that, The method includes: When the first camera process is started, first memory is requested for the first camera process according to the first image configuration requirements corresponding to the first camera process, and second memory is requested for the second camera process according to the second image configuration requirements corresponding to the second camera process. The second camera process is a camera process that may call the same target camera at the same time as the first camera process. The target camera is controlled to acquire first image data according to the first image configuration requirements, and the first image data is stored in the first memory; When the second camera process is started, third memory is requested for the second camera process according to the second image configuration requirements; The target camera is controlled to acquire second image data according to the second image configuration requirements, and the second image data is stored in the second memory; The second image data in the second memory is copied to the third memory.
2. The method according to claim 1, characterized in that, Before allocating first memory for the first camera process according to the first image configuration requirement corresponding to the first camera process and allocating second memory for the second camera process according to the second image configuration requirement corresponding to the second camera process when the first camera process is started, the process includes: When the first camera process is enabled, the target camera is determined; Based on the target camera, determine the target preset mapping relationship corresponding to the target camera from the candidate preset mapping relationships; Based on the target preset mapping relationship, determine the second camera process corresponding to the first camera process; The candidate preset mapping relationship is used to reflect the correspondence between the camera and the camera process that may call the camera at the same time.
3. The method according to claim 1, characterized in that, The method further includes: If the first camera process is closed and the second camera process is not started, the second memory is reclaimed.
4. The method according to claim 1, characterized in that, The step of copying the second image data from the second memory to the third memory includes: Once the second image data has been filled into the second memory, the second image data in the second memory is copied to the third memory.
5. The method according to claim 1, characterized in that, Either the first image configuration requirement or the second image configuration requirement includes at least one of image size and image format.
6. A camera sharing device, characterized in that, The device includes: The first application module is used to apply for first memory for the first camera process according to the first image configuration requirements corresponding to the first camera process when the first camera process is started, and to apply for second memory for the second camera process according to the second image configuration requirements corresponding to the second camera process, wherein the second camera process is a camera process that may call the same target camera at the same time as the first camera process. The first control module is used to control the target camera to acquire first image data according to the first image configuration requirements, and to store the first image data in the first memory; The second application module is used to apply for third memory for the second camera process according to the second image configuration requirements when the second camera process is started. The second control module is used to control the target camera to acquire second image data according to the second image configuration requirements, and to store the second image data in the second memory; The copying module is used to copy the second image data in the second memory to the third memory.
7. The apparatus according to claim 6, characterized in that, The device further includes: The determination module is used to determine the target camera when the first camera process is started; Based on the target camera, determine the target preset mapping relationship corresponding to the target camera from the candidate preset mapping relationships; Based on the target preset mapping relationship, determine the second camera process corresponding to the first camera process; The candidate preset mapping relationship is used to reflect the correspondence between the camera and the camera process that may call the camera at the same time.
8. The apparatus according to claim 6, characterized in that, The copying module is specifically used for: Once the second image data has been filled into the second memory, the second image data in the second memory is copied to the third memory.
9. An electronic device, characterized in that, The electronic device includes the means as described in any one of claims 6 to 8; or... The electronic device includes a memory and a processor, the memory being used to store computer instructions, and the processor being used to retrieve the computer instructions from the memory to perform the method as described in any one of claims 1-5.
10. A computer-readable storage medium, characterized in that, It stores a computer program that, when executed by a processor, implements the method according to any one of claims 1-5.
Citation Information
Patent Citations
Method and system for achieving camera resource sharing
CN101594510A
Camera resource application method and device
CN104918112A
Method and device for sharing camera by multiple applications and computer readable storage medium
CN112579322A
Method, device and system for sharing camera by multiple applications
CN113347477A
Notifications for control sharing of camera resources
US20180146127A1