Camera virtualization method and device, first equipment, second equipment and storage medium
By receiving the broadcast data of the first device, a virtual camera is created, and the problem that the second device needs to use other devices to first shoot and upload images when taking pictures or recording, achieving a better user experience.
Patent Information
- Application Number
- CN202311394699.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-10-25
- Publication Date
- 2025-04-25
AI Technical Summary
When the second device needs to take pictures or record videos, it is necessary to first use a mobile phone and other devices to take pictures or record videos, and then upload the image, reducing the user experience.
By receiving the broadcast data sent by the first device, acquiring camera device parameters, creating a virtual camera, and feeding back the camera information of the virtual camera to the application, so that it displays the virtual camera in the display interface.
The second device can use the camera function of the first device, and improves the user experience of the second device's functions such as taking pictures, recording and scanning.
Smart Images

Figure CN119892888A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of control technology, and in particular to a camera virtualization method and apparatus, a first device, a second device, and a storage medium. Background Art
[0002] Electronic devices are usually equipped with different accessories. For example, mobile phones are usually equipped with high-resolution cameras, through which photos or videos can be taken. Second devices are usually equipped with large screens but not cameras. When the second device needs to take photos or videos, it is necessary to first take photos or videos with a mobile phone or other device, and then upload the images to the second device, which reduces the user experience. Summary of the invention
[0003] The present disclosure provides a camera virtualization method and apparatus, a first device, a second device, and a storage medium to solve the above technical problems.
[0004] According to a first aspect of the present disclosure, a camera virtualization method is provided, the method comprising:
[0005] In response to receiving the broadcast data sent by the first device, acquiring device parameters of the camera;
[0006] Creating a virtual camera according to the device parameters;
[0007] In response to detecting an operation of calling a virtual camera by an application, camera information of the virtual camera is fed back to the application so that the virtual camera is displayed in a display interface of the application.
[0008] Optionally, creating a virtual camera according to the device parameters includes:
[0009] In response to the second device receiving the broadcast data, calling a virtual camera creation function of an operating system kernel layer in the second device;
[0010] The device parameters in the broadcast data are input into the virtual camera creation function to obtain a virtual camera.
[0011] Optionally, the method further comprises:
[0012] In response to the virtual camera being created successfully, the virtual camera is added to a virtual camera list; the virtual camera list includes at least one virtual camera corresponding to a camera of the first device.
[0013] Optionally, the method further comprises:
[0014] In response to detecting an operation of starting a virtual camera in the application, establishing a communication link with a first device corresponding to the virtual camera; the communication link is used to transmit command information between the second device and the first device;
[0015] In response to the communication link being successfully established, sending a preview request to the first device via the communication link;
[0016] In response to receiving the data link establishment request, a data link is established with a first device corresponding to the virtual camera, where the data link is used to transmit a video stream returned by the camera of the first device.
[0017] Optionally, establishing a communication link with a first device corresponding to the virtual camera includes:
[0018] Sending a communication link establishment request to a first device corresponding to the virtual camera according to the communication mode of the broadcast data; the communication link establishment request is used to request to establish a communication link with the first device;
[0019] Acquire communication link response information returned by the first device; the communication link response information is used to indicate result information of whether the first device establishes the communication link;
[0020] In response to the communication link response information being result information of establishing the communication link, determining to establish the communication link with a first device corresponding to the virtual camera.
[0021] Optionally, establishing a data link with a first device corresponding to the virtual camera includes:
[0022] Acquire the designated network data sent by the first device; the designated network data includes a network name and a network password of the designated network;
[0023] The designated network is logged in according to the network name and the network password, and the designated network serves as a data link for transmitting a video stream to the first device.
[0024] Optionally, the method further comprises:
[0025] In response to receiving a video stream via the data link, the video stream is sent to the virtual camera so that the virtual camera forwards it to the application for display.
[0026] Optionally, the method further comprises:
[0027] In response to detecting a photographing operation on the virtual camera, obtaining a photographing request generated by the virtual camera;
[0028] Sending the photographing request to the first device, so that the first device takes a photograph to obtain a target image and the first device sends the target image through a file transfer link;
[0029] In response to receiving the target image through the file transfer link, the target image is sent to the virtual camera so that the virtual camera forwards it to the application.
[0030] Optionally, the method further comprises:
[0031] In response to detecting a video recording start operation on the virtual camera, marking a video frame corresponding to the video recording start operation to obtain a start video frame;
[0032] In response to detecting a video recording end operation on the virtual camera, marking a video frame corresponding to the video recording end operation to obtain an end video frame;
[0033] The starting video frame, the ending video frame and the video frames therebetween are saved to a target location as a recorded video.
[0034] Optionally, the method further comprises:
[0035] In response to detecting a closing operation on the virtual camera, a camera closing request is generated and sent to the first device, so that the first device closes the camera.
[0036] According to a second aspect of the present disclosure, a camera virtualization method is provided, the method comprising:
[0037] Broadcast data including camera device parameters is sent according to a preset period, so that the second device creates a virtual camera based on the device parameters.
[0038] Optionally, the method further comprises:
[0039] In response to receiving the communication link establishment request, establishing a communication link with the second device;
[0040] In response to receiving the preview request via the communication link, establishing a data link with the second device;
[0041] The camera is called to capture the video stream and sent to the second device through the data link.
[0042] Optionally, establishing a communication link with the second device includes:
[0043] Acquire designated network data of the generated designated network; the designated network data includes a network name and a network password of the designated network;
[0044] The designated network data is sent to the second device so that the second device logs into the designated network according to the network name and the network password, and the designated network serves as a data link for transmitting the video stream to the first device.
[0045] Optionally, the method further comprises:
[0046] Obtaining a photo-taking request sent by the second device;
[0047] In response to receiving the photo-taking request, a target image is photographed and the target image is sent to the second device via a file transfer link.
[0048] Optionally, the method further comprises:
[0049] In response to receiving the camera closing request sent by the second device, the camera is closed and the communication link and the data link are disconnected.
[0050] According to a third aspect of the present disclosure, a camera virtualization device is provided, the device comprising:
[0051] A device parameter acquisition module, configured to acquire device parameters of the camera in response to receiving broadcast data sent by the first device;
[0052] A virtual camera creation module, used for creating a virtual camera according to the device parameters;
[0053] The camera information feedback module is used to feed back the camera information of the virtual camera to the application in response to detecting the operation of calling the virtual camera by the application, so that the virtual camera is displayed in the display interface of the application.
[0054] Optionally, the virtual camera creation module includes:
[0055] A creation function calling submodule is used to call a virtual camera creation function of an operating system kernel layer in the second device in response to the second device receiving the broadcast data;
[0056] The virtual camera configuration submodule is used to input the device parameters in the broadcast data into the virtual camera creation function to obtain a virtual camera.
[0057] Optionally, the device further comprises:
[0058] The camera list updating module is used for adding the virtual camera to the virtual camera list in response to the virtual camera being successfully created; the virtual camera list includes at least one virtual camera corresponding to the camera of the first device.
[0059] Optionally, the device further comprises:
[0060] a communication link establishing module, configured to establish a communication link with a first device corresponding to the virtual camera in response to detecting an operation of starting the virtual camera in the application; the communication link is used to transmit command information between the second device and the first device;
[0061] a preview request sending module, configured to send a preview request to the first device via the communication link in response to the communication link being successfully established;
[0062] The data link establishment module is used to establish a data link with a first device corresponding to the virtual camera in response to receiving a data link establishment request, wherein the data link is used to transmit a video stream returned by the camera of the first device.
[0063] Optionally, the data link establishment module includes:
[0064] A communication request sending submodule, configured to send a communication link establishment request to a first device corresponding to the virtual camera according to the communication mode of the broadcast data; the communication link establishment request is used to request to establish a communication link with the first device;
[0065] a response information acquisition submodule, used to acquire the communication link response information returned by the first device; the communication link response information is used to indicate the result information of whether the first device establishes the communication link;
[0066] The communication link determination submodule is used to determine, in response to the communication link response information being result information of establishing the communication link, to establish the communication link with the first device corresponding to the virtual camera.
[0067] Optionally, the data link establishment module includes:
[0068] A network data acquisition submodule, used to acquire the specified network data sent by the first device; the specified network data includes a network name and a network password of the specified network;
[0069] The designated network login submodule is used to log in to the designated network according to the network name and the network password, and the designated network serves as a data link for transmitting video to the first device.
[0070] Optionally, the device further comprises:
[0071] The video stream conversion module is used for sending the video stream to the virtual camera in response to receiving the video stream through the data link, so that the virtual camera forwards it to the application for display.
[0072] Optionally, the device further comprises:
[0073] A photo request acquisition module, configured to acquire a photo request generated by the virtual camera in response to detecting a photo operation on the virtual camera;
[0074] A photographing request sending module, used for sending the photographing request to the first device, so that the first device takes a photograph to obtain a target image and the first device sends the target image through a file transfer link;
[0075] The target image acquisition module is used for sending the target image to the virtual camera in response to receiving the target image through the file transfer link, so that the virtual camera forwards it to the application.
[0076] Optionally, the device further comprises:
[0077] A starting video frame acquisition module is used for, in response to detecting a video start operation on the virtual camera, marking a video frame corresponding to the video start operation to obtain a starting video frame;
[0078] An end video frame acquisition module is used for, in response to detecting a video end operation of the virtual camera, marking a video frame corresponding to the video end operation to obtain an end video frame;
[0079] The recorded video acquisition module is used to save the starting video frame, the ending video frame and the video frames between the two to a target location as the recorded video.
[0080] Optionally, the device further comprises:
[0081] The camera closing module is used to generate a camera closing request in response to detecting a closing operation on the virtual camera and send the request to the first device so that the first device closes the camera.
[0082] According to a fourth aspect of the present disclosure, a camera virtualization device is provided, the device comprising:
[0083] The device parameter broadcast module is used to send broadcast data containing camera device parameters according to a preset period, so that the second device creates a virtual camera based on the device parameters.
[0084] Optionally, the device further comprises:
[0085] a communication link establishing module, configured to establish a communication link with the second device in response to receiving a communication link establishment request;
[0086] a data link establishing module, configured to establish a data link with the second device in response to receiving a preview request through the communication link;
[0087] The data stream sending module is used to call the camera to collect the video stream and send it to the second device through the data link.
[0088] Optionally, the communication link establishing module includes:
[0089] A network data acquisition module, used to acquire the specified network data of the generated specified network; the specified network data includes the network name and network password of the specified network;
[0090] The network data sending module is used to send the designated network data to the second device, so that the second device logs into the designated network according to the network name and the network password, and the designated network serves as a data link for transmitting video data to the first device.
[0091] Optionally, the device further comprises:
[0092] A photo request acquisition module, used to acquire a photo request sent by the second device;
[0093] The target image shooting module is used to shoot the target image in response to receiving the photo request and send the target image to the second device through a file transfer link.
[0094] Optionally, the device further comprises:
[0095] The camera closing module is used to close the camera and disconnect the communication link and the data link in response to receiving the camera closing request sent by the second device.
[0096] According to a fifth aspect of the present disclosure, a second device is provided, including:
[0097] Processor and memory;
[0098] The memory is used to store a computer program executable by the processor;
[0099] The processor is configured to execute the computer program in the memory to implement the method as described in any one of the first aspects.
[0100] According to a sixth aspect of the present disclosure, there is provided an electronic device, including:
[0101] Processor and memory;
[0102] The memory is used to store a computer program executable by the processor;
[0103] The processor is configured to execute the computer program in the memory to implement the method as described in any one of the second aspects.
[0104] According to a seventh aspect of the present disclosure, a non-transitory computer-readable storage medium is provided, and when an executable computer program in the storage medium is executed by a processor, the method described in any one of the first aspect or the second aspect can be implemented.
[0105] The technical solution provided by the embodiments of the present disclosure may have the following beneficial effects:
[0106] The solution of this embodiment can obtain the device parameters of the camera in response to receiving the broadcast data sent by the first device; then, create a virtual camera according to the device parameters; then, in response to detecting the operation of calling the virtual camera by the application, feed back the camera information of the virtual camera to the application, so that the virtual camera is displayed in the display interface of the application. In this way, the second device in this embodiment can use the camera function of at least one first device to expand the functions of taking pictures, recording and / or scanning for the second device, thereby improving the user experience of the second device.
[0107] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0108] Figure 1 The present invention is a flowchart of a camera virtualization method according to an embodiment of the present invention.
[0109] Figure 2 The present invention is a flowchart of creating a virtual camera according to an embodiment of the present invention.
[0110] Figure 3 The present invention is a flowchart of a camera virtualization method according to an embodiment of the present invention.
[0111] Figure 4 The present invention is a block diagram of a focusing device according to an embodiment of the present invention.
[0112] Figure 5 The present invention is a block diagram of an electronic device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0113] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices consistent with some aspects of the present disclosure as detailed in the appended claims.
[0114] The embodiments of the present disclosure provide a camera virtualization method and apparatus, a first device, a second device, and a storage medium. The first device may include but is not limited to devices equipped with a camera, such as a smart phone, a tablet computer, and a camera, and the second device may include but is not limited to devices that are not equipped with a camera or are equipped with a low-resolution camera, such as a personal computer and a smart display. For the convenience of description, the following embodiments describe the solutions of each embodiment with the first device and the second device, but this does not constitute a limitation on the solutions of the present disclosure.
[0115] Figure 1 FIG. 1 is a flow chart of a camera virtualization method according to an embodiment of the present disclosure. Figure 1 , a camera virtualization method can be applied to a second device, including steps 11 to 13.
[0116] In step 11, in response to receiving the broadcast data sent by the first device, the device parameters of the camera are obtained.
[0117] In this embodiment, the first device may have a communication module such as a Bluetooth module and / or a WIFI module, which may send broadcast data containing camera device parameters according to a preset period. In one example, the first device may store configuration data of the communication module, which includes a preset period (such as 0.1 to 100 seconds) and the content carried by the broadcast data, which may include but is not limited to the name of the communication module, the communication protocol, the number of cameras, and the device parameters of each camera, wherein the device parameters include but are not limited to the video frame resolution, the photo image resolution, the zoom factor, etc. of the camera, which can be set according to the specific scenario and are not limited here.
[0118] In this embodiment, the second device may have a communication module such as a Bluetooth module and / or a WIFI module, which can detect broadcast data according to a preset period. In one example, the second device may store configuration data of the communication module, which includes a preset period (such as 0.1 to 100 seconds), which can be set according to the specific scenario and is not limited here.
[0119] In this embodiment, after receiving the broadcast data sent by the first device, the second device can parse the broadcast data to obtain the device parameters of the camera. It is understandable that in some scenarios, the broadcast data may also include the identification code of the first device or the identification code of the communication module, so as to facilitate the subsequent establishment of a communication link and / or a data link.
[0120] In step 12, a virtual camera is created according to the device parameters.
[0121] In this embodiment, the second device can create a virtual camera according to the device parameters. Figure 2 , including step 21 and step 22.
[0122] In step 21, in response to the second device receiving the broadcast data, a virtual camera creation function of the operating system kernel layer in the second device is called.
[0123] In step 22, the device parameters in the broadcast data are input into the virtual camera creation function to obtain a virtual camera.
[0124] In one example, the second device includes a communication layer, an application layer and a kernel layer. The communication layer is used to communicate with an external device (such as the first device) to exchange data. The application layer is a platform for the operation of various applications, supporting applications to call different functions, etc.
[0125] In this step, after the communication layer of the second device receives the broadcast data, the virtual camera creation function of the kernel layer of the operating system of the second device can be called. Taking the second device using the Windows operating system as an example, the virtual camera creation function can be KsCreateFilterFactory. Those skilled in the art can select the corresponding virtual camera creation function according to the operating system of the second device, or set the virtual camera creation function separately. If the virtual camera can be created, the corresponding solution falls within the protection scope of the present disclosure.
[0126] It should be noted that in this step, the virtual camera creation function is set at the kernel layer and can be encapsulated as a function interface for different applications to call, thereby improving the effect of creating a virtual camera.
[0127] In this step, after the virtual camera creation function successfully creates the virtual camera, a response message indicating that the virtual camera is successfully created is returned; or, after the virtual camera creation function fails to create the virtual camera, a response message indicating that the virtual camera is failed to be created is returned.
[0128] In this step, the second device can input the device parameters in the broadcast data as input data to the virtual camera creation function to obtain a virtual camera, that is, virtualize the camera in the first device into a virtual camera in the second device. This can be regarded as connecting the camera in the first device to the second device, thereby increasing the number of cameras in the second device.
[0129] In one embodiment, when the virtual camera is successfully created, the second device may add the virtual camera to a preset virtual camera list, where the virtual camera list includes at least one virtual camera corresponding to a camera of the first device.
[0130] It should be noted that when the second device is offline (logged out of the account, disconnected from the network, away from the first device, etc.), the heartbeat of the second device and the first device is disconnected. At this time, the second device can call a virtual function deletion function, such as the KsDeleteFilterFactory function, to delete the virtual camera corresponding to the camera parameters, thereby keeping the virtual camera list dynamically updated, achieving the effect that a second device can use multiple cameras of the first device.
[0131] In step 13, in response to detecting an operation of calling a virtual camera by an application, camera information of the virtual camera is fed back to the application so that the virtual camera is displayed in a display interface of the application.
[0132] In this embodiment, at least one application with a camera usage requirement is installed in the second device. When the second device is turned on, the application can be displayed in the display interface of the second device. The second device can start the application in response to the user's operation of starting the application. In the process of starting the application, when it is detected that the application has a camera usage requirement, the application layer of the operating system of the second device can load the camera information of at least one virtual camera into the application, for example, calling an API interface, traversing each virtual camera in the virtual camera list and returning it to the application.
[0133] When the application is started, the application layer of the second device can send the display interface of the application to the display of the electronic device for display. At this time, at least one virtual camera will be configured in the directory of the application's camera function, shooting function, etc. In this way, the second device can support any number of virtual cameras, thereby dynamically creating or deleting virtual cameras as the broadcast data is broadcast, thereby improving the user experience of the second device.
[0134] In this embodiment, during the use of the application, the user may need to use the camera function. At this time, the user can click the shooting function and select the desired virtual camera from at least one candidate virtual camera. When the second device detects the operation of starting the virtual camera in the application, it can establish a communication link with the first device corresponding to the virtual camera. The communication link is used to transmit command information between the second device and the first device, such as preview request, photo request, camera shutdown request, preview request response information, photo request response information, etc.
[0135] In one example, a second device establishes a communication link with a first device corresponding to a virtual camera, including: the second device can obtain a communication method for broadcasting data, such as BLE, local area network, etc., and continue to use the communication method to send a communication link establishment request to the first device corresponding to the virtual camera. After receiving the communication link establishment request, the first device can consult the local communication module; when the communication module meets the communication conditions, it can pair with the communication module of the second device to establish a communication link, obtain a communication link establishment result, and feedback the communication link establishment result to the second device. The second device receives the communication link establishment result,
[0136] When the communication link establishment result indicates that the communication link is successfully established, the second device can determine that the communication link is successfully established; when the communication link establishment result indicates that the communication link is unsuccessful, the second device can determine that the communication link is unsuccessful, and can resend the communication link establishment request until the communication link is successfully established; or if the communication link still fails to be established after sending several times (for example, 2-5 times), stop sending the communication link establishment request.
[0137] In this embodiment, when the communication link establishment result indicates that the communication link is successfully established, the second device can send a preview request to the first device through the communication link. After receiving the preview request, the first device can establish a data link with the second device.
[0138] In one example, the first device may generate a designated network, such as a WIFI hotspot network, and obtain the network name and network password of the WIFI hotspot network. Then, the first device may generate a data link establishment request, which includes the network name and network password of the WIFI hotspot network, and send the data link establishment request to the second device via a communication link.
[0139] After receiving the data link establishment request, the second device can establish a data link with the first device corresponding to the virtual camera, and the data link is used to transmit the video stream returned by the camera of the first device. After the data link is established, the second device can return the data link establishment result to the first device.
[0140] When the first device receives the data link establishment result indicating that the data link establishment fails, it may repeatedly send the data link establishment request until the data link is successfully established; or, if the data link establishment request still fails after repeatedly sending the data link establishment request, it may give up establishing the data link.
[0141] After receiving the data link establishment result indicating that the data link is successfully established, the first device can start the camera and feed back the video stream captured by the camera to the second device through the data link. In this embodiment, by establishing a separate data link to transmit the video stream, it can ensure that the preview process of the second device is not stuck, thereby improving the shooting experience.
[0142] In one embodiment, after receiving the video stream, the application layer of the second device can send the video stream to the virtual camera of the kernel layer through the data link, and then the virtual camera sends it to the application of the application layer, and finally the application can display the above video stream. In this way, in this embodiment, through point-to-point (P2P) transmission of the video stream, the video stream can exclusively use the data link, so that the second device can play the video without lag.
[0143] In one embodiment, during the display of the preview image, the user may have a need to take a photo and take a photo. When a photo operation on the virtual camera is detected, the second device may obtain a photo request generated by the virtual camera, where the photo request includes a photo image resolution that is greater than a video frame resolution. The photo request may be sent from the application to the virtual camera of the kernel layer, and then sent by the virtual camera to the application layer, and finally sent by the communication layer and the communication link to the first device.
[0144] After receiving the photo request, the first device can take a photo to obtain a target image. It is understandable that the resolution of the target image is higher than the resolution of the preview image. Then, the first device can send the target image via a data link, or can transmit the target image via a file transfer link using a file transfer method.
[0145] In one example, the first device and the second device transmit the target image by file transfer, and for this purpose, the first device and the second device can establish an image transmission link. The establishment method of the image transmission link is the same as the establishment method of the communication link. For details, please refer to the establishment content of the communication link, which will not be repeated here. In this example, by transmitting the target image by file transfer, a high-resolution target image can be transmitted. Compared with directly selecting a low-resolution video frame from the video stream, a high-resolution image can be obtained, which is conducive to improving the photo-taking experience.
[0146] exist Figure 1 Based on the camera virtualization method shown, the embodiment of the present disclosure further provides a camera virtualization method, which can be applied to a first device provided with a camera, including:
[0147] The first device sends broadcast data including camera device parameters according to a preset period, so that the second device creates a virtual camera based on the device parameters.
[0148] In one embodiment, after sending the broadcast data, the second device may create a virtual camera. When the user triggers the virtual camera, the second device may send a preview request to the first device. At this time, the first device may first receive the communication link establishment request sent by the second device and establish a communication link with the second device. Then the preview request is transmitted through the communication link. When the preview request is received, the first device may establish a data link with the second device. The first device starts the camera, captures the video stream and sends the video stream to the second device via the data link, so that the second device displays the preview images of each frame in the video stream in the display interface of the application.
[0149] In one embodiment, the first device may obtain a photo-taking request sent by the second device; then, capture a target image and send it to the second device via a file transfer link, so that the second device sends the target image to the application via a virtual camera.
[0150] In one embodiment, the first device may receive a camera shutdown request sent by the second device, shut down the camera and disconnect the communication link, data link, and image transmission link, etc. Accordingly, the second device deletes the virtual camera to update the virtual camera list.
[0151] It should be noted that the method embodiment shown in this embodiment is different from Figure 1 The contents of the exemplary embodiments match those of the Figure 1 The contents of the illustrated embodiments will not be repeated here.
[0152] The following describes a camera virtualization method provided by an embodiment of the present disclosure in conjunction with the accompanying drawings. Figure 3 ,include:
[0153] The second device includes a kernel layer, an application layer and a communication layer. The kernel layer includes a virtual camera driver and creates virtual cameras 1, 2, ..., n. The application layer includes a camera service, an application program and a display interface (UI). The communication layer includes a camera publishing module, a message transmission module, a file transmission module and a video transmission module.
[0154] After the application is started, the available virtual cameras 1, 2, ..., n can be displayed. When the user clicks on any virtual camera in the application, the application can send a preview request to the virtual camera of the kernel layer, which is forwarded by the virtual camera driver to the camera service of the application layer, and then sent to the first device by the camera publishing module and the communication layer.
[0155] The second device establishes a communication link with the first device, sends a preview request to the first device, and establishes a data link. Then the first device captures the video stream and sends it to the second device through the data link. After the video transmission module of the second device decodes the video stream, it sends the decoded video stream to the virtual camera through the camera service, and then to the application. Finally, the application displays the preview image of each frame in the above video stream.
[0156] When the second device receives a photo request, it can send it to the first device through the virtual camera, camera service, and message transmission module. After the first device captures the target image, it can send it to the second device through the image transmission link, and pass through the communication layer, file transfer module, camera service, and virtual camera of the kernel layer in the second device in turn, and finally reach the application for display.
[0157] In the present disclosure, a camera virtualization method is provided. The present disclosure also provides a camera virtualization device. Figure 4 , the device comprises:
[0158] The device parameter acquisition module 41 is used to acquire the device parameters of the camera in response to receiving the broadcast data sent by the first device;
[0159] A virtual camera creation module 42, used to create a virtual camera according to the device parameters;
[0160] The camera information feedback module 43 is used to feed back the camera information of the virtual camera to the application in response to detecting the operation of calling the virtual camera by the application, so that the virtual camera is displayed in the display interface of the application.
[0161] In one embodiment, the virtual camera creation module includes:
[0162] A creation function calling submodule is used to call a virtual camera creation function of an operating system kernel layer in the second device in response to the second device receiving the broadcast data;
[0163] The virtual camera configuration submodule is used to input the device parameters in the broadcast data into the virtual camera creation function to obtain a virtual camera.
[0164] In one embodiment, the device further comprises:
[0165] The camera list updating module is used for adding the virtual camera to the virtual camera list in response to the virtual camera being successfully created; the virtual camera list includes at least one virtual camera corresponding to the camera of the first device.
[0166] In one embodiment, the device further comprises:
[0167] a communication link establishing module, configured to establish a communication link with a first device corresponding to the virtual camera in response to detecting an operation of starting the virtual camera in the application; the communication link is used to transmit command information between the second device and the first device;
[0168] a preview request sending module, configured to send a preview request to the first device via the communication link in response to the communication link being successfully established;
[0169] The data link establishment module is used to establish a data link with a first device corresponding to the virtual camera in response to receiving a data link establishment request, wherein the data link is used to transmit a video stream returned by the camera of the first device.
[0170] In one embodiment, the data link establishment module includes:
[0171] A communication request sending submodule, configured to send a communication link establishment request to a first device corresponding to the virtual camera according to the communication mode of the broadcast data; the communication link establishment request is used to request to establish a communication link with the first device;
[0172] a response information acquisition submodule, used to acquire the communication link response information returned by the first device; the communication link response information is used to indicate the result information of whether the first device establishes the communication link;
[0173] The communication link determination submodule is used to determine, in response to the communication link response information being result information of establishing the communication link, to establish the communication link with the first device corresponding to the virtual camera.
[0174] In one embodiment, the data link establishment module includes:
[0175] A network data acquisition submodule, used to acquire the specified network data sent by the first device; the specified network data includes a network name and a network password of the specified network;
[0176] The designated network login submodule is used to log in to the designated network according to the network name and the network password, and the designated network serves as a data link for transmitting video to the first device.
[0177] In one embodiment, the device further comprises:
[0178] The video stream conversion module is used for sending the video stream to the virtual camera in response to receiving the video stream through the data link, so that the virtual camera forwards it to the application for display.
[0179] In one embodiment, the device further comprises:
[0180] A photo request acquisition module, configured to acquire a photo request generated by the virtual camera in response to detecting a photo operation on the virtual camera;
[0181] A photographing request sending module, used for sending the photographing request to the first device, so that the first device takes a photograph to obtain a target image and the first device sends the target image through a file transfer link;
[0182] The target image acquisition module is used for sending the target image to the virtual camera in response to receiving the target image through the file transfer link, so that the virtual camera forwards it to the application.
[0183] In one embodiment, the device further comprises:
[0184] A starting video frame acquisition module is used for, in response to detecting a video start operation on the virtual camera, marking a video frame corresponding to the video start operation to obtain a starting video frame;
[0185] An end video frame acquisition module is used for, in response to detecting a video end operation of the virtual camera, marking a video frame corresponding to the video end operation to obtain an end video frame;
[0186] The recorded video acquisition module is used to save the starting video frame, the ending video frame and the video frames between the two to a target location as the recorded video.
[0187] In one embodiment, the device further comprises:
[0188] The camera closing module is used to generate a camera closing request in response to detecting a closing operation on the virtual camera and send the request to the first device so that the first device closes the camera.
[0189] The present disclosure provides a camera virtualization method, and an embodiment of the present disclosure also provides a camera virtualization device, the device comprising:
[0190] The device parameter broadcast module is used to send broadcast data containing camera device parameters according to a preset period, so that the second device creates a virtual camera based on the device parameters.
[0191] In one embodiment, the device further comprises:
[0192] a communication link establishing module, configured to establish a communication link with the second device in response to receiving a communication link establishment request;
[0193] a data link establishing module, configured to establish a data link with the second device in response to receiving a preview request through the communication link;
[0194] The data stream sending module is used to call the camera to collect the video stream and send it to the second device through the data link.
[0195] In one embodiment, the communication link establishment module includes:
[0196] A network data acquisition module, used to acquire the specified network data of the generated specified network; the specified network data includes the network name and network password of the specified network;
[0197] The network data sending module is used to send the designated network data to the second device, so that the second device logs into the designated network according to the network name and the network password, and the designated network serves as a data link for transmitting video data to the first device.
[0198] In one embodiment, the device further comprises:
[0199] A photo request acquisition module, used to acquire a photo request sent by the second device;
[0200] The target image shooting module is used to shoot the target image in response to receiving the photo request and send the target image to the second device through a file transfer link.
[0201] In one embodiment, the device further comprises:
[0202] The camera closing module is used to close the camera and disconnect the communication link and the data link in response to receiving the camera closing request sent by the second device.
[0203] It should be noted that the device embodiment shown in this embodiment matches the content of the above method embodiment, and the content of the above method embodiment can be referred to, which will not be repeated here.
[0204] Figure 5 5 is a block diagram of an electronic device according to an exemplary embodiment. For example, the electronic device 500 may be a smart phone, a computer, a digital broadcast terminal, a tablet device, a medical device, a fitness device, a personal digital assistant, etc. The electronic device may be used as the first device or the second device.
[0205] Reference Figure 5 The electronic device 500 may include one or more of the following components: a processing component 502 , a memory 504 , a power component 506 , a multimedia component 508 , an audio component 510 , an input / output (I / O) interface 512 , a sensor component 514 , a communication component 516 , and an image acquisition component 518 .
[0206] The processing component 502 generally controls the overall operation of the electronic device 500, such as operations associated with display, phone calls, data communications, camera operations, and recording operations. The processing component 502 may include one or more processors 520 to execute computer programs. In addition, the processing component 502 may include one or more modules to facilitate interaction between the processing component 502 and other components. For example, the processing component 502 may include a multimedia module to facilitate interaction between the multimedia component 508 and the processing component 502. In an example, the processor 520 may implement the scheme of the above method.
[0207] The memory 504 is configured to store various types of data to support operations on the electronic device 500. Examples of such data include computer programs for any application or method operating on the electronic device 500, contact data, phone book data, messages, pictures, videos, etc. The memory 504 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk.
[0208] The power supply component 506 provides power to various components of the electronic device 500. The power supply component 506 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power for the electronic device 500. The power supply component 506 may include a power supply chip, and the controller may communicate with the power supply chip to control the power supply chip to turn on or off the first switch device, so that the battery supplies power to the mainboard circuit or does not supply power.
[0209] The multimedia component 508 includes a screen that provides an output interface between the electronic device 500 and the target object. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input information from the target object. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundaries of a touch or slide action, but also detect the duration and pressure associated with the touch or slide operation.
[0210] The audio component 510 is configured to output and / or input audio file information. For example, the audio component 510 includes a microphone (MIC), and when the electronic device 500 is in an operation mode, such as a call mode, a recording mode, and a speech recognition mode, the microphone is configured to receive external audio file information. The received audio file information can be further stored in the memory 504 or sent via the communication component 516. In some embodiments, the audio component 510 also includes a speaker for outputting audio file information.
[0211] The I / O interface 512 provides an interface between the processing component 502 and a peripheral interface module, such as a keyboard, a click wheel, a button, etc.
[0212] The sensor component 514 includes one or more sensors for providing various aspects of status assessment for the electronic device 500. For example, the sensor component 514 can detect the open / closed state of the electronic device 500, the relative positioning of components, such as the display screen and keypad of the electronic device 500, and the sensor component 514 can also detect the position change of the electronic device 500 or a component, the presence or absence of contact between the target object and the electronic device 500, the orientation or acceleration / deceleration of the electronic device 500, and the temperature change of the electronic device 500. In this example, the sensor component 514 can include a magnetic sensor, a gyroscope, and a magnetic field sensor, and can also include an inertial sensor, an image sensor, etc., wherein the magnetic field sensor includes at least one of the following: a Hall sensor, a thin film magnetoresistive sensor, and a magnetic liquid acceleration sensor.
[0213] The communication component 516 is configured to facilitate wired or wireless communication between the electronic device 500 and other devices. The electronic device 500 can access a wireless network based on a communication standard, such as WiFi, 2G, 3G, 4G, 5G, or a combination thereof. In an exemplary embodiment, the communication component 516 receives broadcast information or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 516 also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.
[0214] In an exemplary embodiment, the electronic device 500 may be implemented by one or more application specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components.
[0215] In an exemplary embodiment, the present disclosure also provides a non-transitory computer-readable storage medium, and when an executable computer program in the storage medium is executed by a processor, the above-mentioned method can be implemented.
[0216] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the disclosure disclosed herein. The present disclosure is intended to cover any variations, uses, or adaptations that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The description and examples are to be considered exemplary only, and the true scope and spirit of the present disclosure are indicated by the following claims.
[0217] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.
Claims
1. A camera virtualization method, characterized in that: The method comprises: In response to receiving the broadcast data sent by the first device, acquiring device parameters of the camera; Creating a virtual camera according to the device parameters; In response to detecting an operation of calling a virtual camera by an application, camera information of the virtual camera is fed back to the application so that the virtual camera is displayed in a display interface of the application.
2. The method according to claim 1, characterized in that Creating a virtual camera according to the device parameters, including: In response to the second device receiving the broadcast data, calling a virtual camera creation function of an operating system kernel layer in the second device; The device parameters in the broadcast data are input into the virtual camera creation function to obtain a virtual camera.
3. The method according to claim 2, characterized in that The method further comprises: In response to the virtual camera being created successfully, the virtual camera is added to a virtual camera list; the virtual camera list includes at least one virtual camera corresponding to a camera of the first device.
4. The method according to claim 1, characterized in that The method further comprises: In response to detecting an operation of starting a virtual camera in the application, establishing a communication link with a first device corresponding to the virtual camera; the communication link is used to transmit command information between a second device and the first device; In response to the communication link being successfully established, sending a preview request to the first device via the communication link; In response to receiving the data link establishment request, a data link is established with a first device corresponding to the virtual camera, where the data link is used to transmit a video stream returned by the camera of the first device.
5. The method according to claim 4, characterized in that Establishing a communication link with a first device corresponding to the virtual camera includes: Sending a communication link establishment request to a first device corresponding to the virtual camera according to the communication mode of the broadcast data; the communication link establishment request is used to request to establish a communication link with the first device; Acquire communication link response information returned by the first device; the communication link response information is used to indicate result information of whether the first device establishes the communication link; In response to the communication link response information being result information of establishing the communication link, determining to establish the communication link with a first device corresponding to the virtual camera.
6. The method according to claim 4, characterized in that Establishing a data link with a first device corresponding to the virtual camera includes: Acquire the designated network data sent by the first device; the designated network data includes a network name and a network password of the designated network; The designated network is logged in according to the network name and the network password, and the designated network serves as a data link for transmitting a video stream to the first device.
7. The method according to claim 4, characterized in that The method further comprises: In response to receiving a video stream via the data link, the video stream is sent to the virtual camera so that the virtual camera forwards it to the application for display.
8. The method according to claim 1, characterized in that The method further comprises: In response to detecting a photographing operation on the virtual camera, obtaining a photographing request generated by the virtual camera; Sending the photographing request to the first device, so that the first device takes a photograph to obtain a target image and the first device sends the target image through a file transfer link; In response to receiving the target image through the file transfer link, the target image is sent to the virtual camera so that the virtual camera forwards it to the application.
9. The method according to claim 1, characterized in that: The method further comprises: In response to detecting a video recording start operation on the virtual camera, marking a video frame corresponding to the video recording start operation to obtain a start video frame; In response to detecting a video recording end operation on the virtual camera, marking a video frame corresponding to the video recording end operation to obtain an end video frame; The starting video frame, the ending video frame and the video frames therebetween are saved to a target location as a recorded video.
10. The method according to claim 1, characterized in that The method further comprises: In response to detecting a closing operation on the virtual camera, a camera closing request is generated and sent to the first device, so that the first device closes the camera.
11. A camera virtualization method, characterized in that: The method comprises: Broadcast data including camera device parameters is sent according to a preset period, so that the second device creates a virtual camera based on the device parameters.
12. The method according to claim 11, characterized in that The method further comprises: In response to receiving the communication link establishment request, establishing a communication link with the second device; In response to receiving the preview request via the communication link, establishing a data link with the second device; The camera is called to capture the video stream and sent to the second device through the data link.
13. The method according to claim 11, characterized in that Establishing a communication link with the second device, comprising: Acquire designated network data of the generated designated network; the designated network data includes a network name and a network password of the designated network; The designated network data is sent to the second device so that the second device logs into the designated network according to the network name and the network password, and the designated network serves as a data link for transmitting the video stream to the first device.
14. The method according to claim 11, characterized in that The method further comprises: Obtaining a photo-taking request sent by the second device; In response to receiving the photo-taking request, a target image is photographed and the target image is sent to the second device via a file transfer link.
15. The method according to claim 11, characterized in that The method further comprises: In response to receiving the camera closing request sent by the second device, the camera is closed and the communication link and the data link are disconnected.
16. A camera virtualization device, characterized in that: The device comprises: A device parameter acquisition module, configured to acquire device parameters of the camera in response to receiving broadcast data sent by the first device; A virtual camera creation module, used for creating a virtual camera according to the device parameters; The camera information feedback module is used to feed back the camera information of the virtual camera to the application in response to detecting the operation of calling the virtual camera by the application, so that the virtual camera is displayed in the display interface of the application.
17. A second device, characterized in that: include: Processor and memory; The memory is used to store a computer program executable by the processor; The processor is configured to execute the computer program in the memory to implement the method according to any one of claims 1 to 10.
18. A first device, characterized in that: include: Processor and memory; The memory is used to store a computer program executable by the processor; The processor is configured to execute the computer program in the memory to implement the method according to any one of claims 11 to 15.
19. A non-transitory computer-readable storage medium, characterized in that: When the executable computer program in the storage medium is executed by a processor, the method according to any one of claims 1 to 10 or 11 to 15 can be implemented.