Application method of intelligent device with single camera, intelligent device and computer readable storage medium
By creating a virtual camera in a single front-facing camera device and flipping the image data stream, the problem of a single front-facing camera device being unable to run multi-camera applications normally is solved, improving the user experience and the functional scalability of the device.
Patent Information
- Application Number
- CN202510946473.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-09
- Publication Date
- 2025-09-12
AI Technical Summary
Smart devices with a single front camera cannot work properly when running applications that rely on multiple cameras, especially applications that cannot make video calls or use the rear camera, resulting in a poor user experience.
By creating a first virtual camera and a second virtual camera, binding the physical camera, and flipping the image data stream when needed, it is ensured that the application can recognize and use the two virtual cameras and achieve normal interaction with the physical camera.
This enables smart devices with a single front camera to run applications that rely on multiple cameras, improving the user experience and ensuring consistent image preview orientation.
Smart Images

Figure CN120640119A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of smart device processing, and in particular to an application method of a smart device with a single camera, the smart device, and a computer-readable storage medium. Background Art
[0002] In the current Android app development landscape, mainstream applications are developed around phones equipped with dual front and rear cameras. This is because, as mainstream devices on the market, dual front and rear camera hardware configurations have become the norm. When designing and developing apps, app developers often focus on implementing and adapting features to this hardware requirement.
[0003] However, in real-world applications, there are a large number of devices equipped with only a single front-facing camera. These devices generally face compatibility issues when running the aforementioned mainstream applications. Specifically, for applications that rely on multiple cameras, such as WeChat's video calling function, video calls will not function properly because smart devices with only a single front-facing camera cannot meet its multi-camera requirements. Furthermore, for applications that require the use of the rear-facing camera, such as the Google Scan app, the applications cannot be opened and run because devices with only a single front-facing camera do not have a rear camera.
[0004] The core cause of this problem is that app developers, constrained by the prevalence of dual-camera smartphones, have focused on developing for these devices, while neglecting compatibility with devices with only a single front-facing camera. This makes it difficult for these devices to function properly with apps that require multiple cameras or the rear camera, severely impacting the scalability and user experience of these devices.
[0005] An existing method for processing image data on Android devices involves the system's HAL layer acquiring the captured video or photo frames after the device's camera captures them. The GPU processes the frames according to pre-set instructions, producing a processed video or photo frame and outputting it. These pre-set instructions include flipping the frames. However, this Android device's camera method still doesn't handle applications that require dual cameras on single-camera smart devices, resulting in a diminished user experience. Summary of the Invention
[0006] A first object of the present invention is to provide an application method for a smart device with a single camera, which enables the smart device with a single camera to open an application program that uses two cameras.
[0007] A second object of the present invention is to provide an intelligent device that implements the application method of the above-mentioned intelligent device with a single camera.
[0008] A third object of the present invention is to provide a computer-readable storage medium for applying the above-mentioned application method of the smart device with a single camera.
[0009] To achieve the first purpose of the present invention, the present invention provides an application method for an intelligent device with a single camera, which is applied to an intelligent device with only one physical camera. The method includes: a hardware abstraction layer obtains configuration information of the physical camera, registers a first virtual camera and a second virtual camera, the shooting direction of the first virtual camera is the same as the shooting direction of the physical camera, and the shooting direction of the second virtual camera is opposite to the shooting direction of the physical camera; binds the first virtual camera and the second virtual camera to the physical camera; sends the device information of the first virtual camera, the device information of the second virtual camera and the device information of the physical camera to the camera system service process; receives user shooting direction information of the application, determines whether the user shooting direction in the user shooting direction information is consistent with the shooting direction of the physical camera, and if the user shooting direction is inconsistent with the shooting direction of the physical camera, sets the real-time image data stream acquired by the physical camera to perform a flip operation.
[0010] As can be seen from the above solution, by creating a first virtual camera and a second virtual camera, the application can recognize the existence of two virtual cameras, allowing the application to operate normally. The first and second virtual cameras are bound to the physical camera, so that no matter which direction the application wants to open the camera, the physical camera is opened. If the user's shooting direction is inconsistent with the shooting direction of the physical camera, the real-time image data stream captured by the physical camera is set to be flipped to ensure that the preview direction of the image captured by the physical camera is normal in different shooting directions, which is convenient for users.
[0011] In a further solution, after the real-time video data stream acquired by the physical camera is set to be flipped, the following steps are further performed: the physical camera is turned on to acquire the camera data of the physical camera.
[0012] In a further solution, if the user's shooting direction is consistent with the shooting direction of the physical camera, the physical camera is directly turned on to obtain the camera data of the physical camera.
[0013] It can be seen from this that after obtaining the user's shooting direction and pre-processing the entity shooting picture, the entity camera can be opened to obtain the camera data of the entity camera, so that the preview direction of the picture taken by the entity camera seen by the user is normal, thereby improving the user experience.
[0014] In a further solution, before the hardware abstraction layer obtains the configuration information of the physical camera, it also executes: determining whether there is only one physical camera on the smart device; if there is only one physical camera on the smart device, executing the step of obtaining the configuration information of the physical camera; if there is more than one physical camera on the smart device, sending the number of cameras of the smart device to the camera system service process.
[0015] It can be seen from this that only smart devices with only one camera need to create two virtual cameras and bind the two virtual cameras to one physical camera. If the smart device has more than one physical camera, there is no need to create two virtual cameras and bind the two virtual cameras to one physical camera.
[0016] In a further solution, before receiving the user shooting direction information of the application, the following steps are further performed: the application receives the user shooting direction information, and the application obtains the device information of the first virtual camera and the device information of the second virtual camera.
[0017] It can be seen that the application program knows that there are two virtual cameras by obtaining the device information of the first virtual camera and the device information of the second virtual camera, that is, the application program can run smoothly.
[0018] In a further solution, the step of setting the real-time image data stream acquired by the physical camera to perform a flip operation includes: setting the real-time image data stream acquired by the physical camera to perform a vertical flip operation.
[0019] It can be seen that by vertically flipping, the preview direction of the picture in the opposite direction of the user shooting with the physical camera is normal, thereby improving the user experience.
[0020] In order to achieve the second purpose, the present invention provides a smart device, which includes a hardware abstraction layer, and the hardware abstraction layer executes the above-mentioned application method of the smart device with a single camera.
[0021] In order to achieve the third purpose, the smart device provided by the present invention includes a hardware abstraction layer, and the hardware abstraction layer can execute the above-mentioned application method of the smart device with a single camera. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] Figure 1 The present invention is a flowchart of an embodiment of an application method of a smart device with a single camera.
[0023] The present invention will be further described below with reference to the accompanying drawings and embodiments. DETAILED DESCRIPTION
[0024] The application method of the smart device with a single camera provided by the present invention creates a first virtual camera and a second virtual camera, and binds the first virtual camera and the second virtual camera to the physical camera, so that when an application that relies on multiple cameras or an application that needs to use a camera in the opposite direction of the physical camera in the smart device with only one physical camera needs to open the camera, the application can run smoothly.
[0025] An embodiment of the application method of a smart device with a single camera: The embodiment of the application method of the smart device with a single camera is executed on a smart device with only one physical camera. The smart device is provided with a hardware abstraction layer, and the application method of the smart device with a single camera of the embodiment is executed through the hardware abstraction layer, which has strong portability.
[0026] Before executing step S1, the hardware abstraction layer first determines whether the smart device has only one physical camera. If the smart device has more than one physical camera, the hardware abstraction layer sends the number of cameras on the smart device to the camera system service process. The camera system service process interacts with the application based on the device information of the smart device's cameras.
[0027] If the smart device has only one physical camera, step S1 is executed, and the hardware abstraction layer obtains the configuration information of the physical camera and registers the first virtual camera and the second virtual camera. The physical camera configuration information includes the shooting direction of the physical camera. Generally, smart devices, such as mobile phones, include two cameras facing forward and backward, i.e., one camera faces forward and the other faces backward. In this embodiment, the physical camera can be located in front of or behind the smart device. This embodiment takes the physical camera facing forward as an example, i.e., the first virtual camera is the virtual front camera, and the second virtual camera is the virtual rear camera.
[0028] Specifically, the shooting direction of the first virtual camera is the same as the shooting direction of the physical camera, and the shooting direction of the second virtual camera is opposite to the shooting direction of the physical camera.
[0029] After registering the first and second virtual cameras, step S2 is executed to bind the first and second virtual cameras to physical cameras. That is, when the application recognizes the first and second virtual cameras, the application can function normally. Because the first and second virtual cameras are each bound to a physical camera, when the application requests to open a camera, the physical camera is opened.
[0030] After binding the first virtual camera and the second virtual camera to the physical camera, step S3 is executed to send the device information of the first virtual camera, the device information of the second virtual camera, and the device information of the physical camera to the camera system service process. The device information of the first virtual camera includes the shooting direction of the first virtual camera, and the device information of the second virtual camera includes the shooting direction of the second virtual camera.
[0031] The hardware abstraction layer sends the device information of the first virtual camera, the second virtual camera, and the physical camera to the camera system service process (CameraServer) through the cameraDeviceStatusChange function. The camera system service process is the core service for managing camera resources in the Android system. It is responsible for maintaining the status of all camera devices, handling permission verification, and allocating hardware resources. It acts as an intermediary between applications and hardware.
[0032] When an application uses a camera, for example, a scanning application that needs to open the camera on the back of a smart device for scanning, the application receives the user's shooting direction information and then obtains the device information of the first and second virtual cameras. The application obtains the device information of the first and second virtual cameras from the hardware abstraction layer through the camera system service process. The application uses this information to determine whether the application can proceed.
[0033] In the traditional method, when the scanning application needs to open the camera at the rear of the smart device for scanning, since the smart device of this embodiment only has a front camera, the scanning application cannot work properly. In this application, since a first virtual camera and a second virtual camera are created, the application recognizes the camera to be used. For example, when the scanning application needs to open the camera at the rear of the smart device for scanning, a first virtual camera and a second virtual camera are created in this embodiment. In this embodiment, the physical camera is in front of the smart device, the shooting direction of the first virtual camera is in front of the smart device, and the shooting direction of the second virtual camera is in the rear of the smart device. When the scanning application needs to open the camera at the rear of the smart device for scanning, since the second virtual camera is recognized, the smart device works properly.
[0034] Applications cannot directly access the physical camera and need to indirectly obtain the device information of the first virtual camera and the second virtual camera through the interface (CameraManager) provided by the Android framework layer (Framework).
[0035] After receiving the user's shooting direction information, the application sends the user's shooting direction information to the hardware abstraction layer. The hardware abstraction layer then executes step S4 to receive the user's shooting direction information. After receiving the user's shooting direction information, the application executes step S5 to determine whether the user's shooting direction is consistent with the shooting direction of the physical camera.
[0036] If the user's shooting direction is inconsistent with the physical camera's shooting direction, step S6 is executed to perform a flip operation on the real-time image data stream captured by the physical camera. After the real-time image data stream captured by the physical camera is flipped, step S7 is executed to turn on the physical camera and capture the camera data. The real-time image data stream captured by the physical camera is flipped, and the flip operation is a vertical flip operation (V4L2_CID_VFLIP). The flip operation is performed using an ioctl command to vertically flip the real-time image data stream.
[0037] If the user's shooting direction is consistent with the shooting direction of the physical camera, step S7 is directly executed to turn on the physical camera and obtain the camera data of the physical camera. If the user's shooting direction is inconsistent with the shooting direction of the physical camera, the real-time image data stream obtained by the physical camera is set to be flipped to ensure that the preview direction of the image captured by the physical camera is normal for user convenience.
[0038] The application method of this embodiment for a single-camera smart device allows a single physical camera to run smoothly when using applications that require multiple cameras or require a camera that is opposite to the physical camera. Furthermore, when the user's shooting direction differs from that of the physical camera, a real-time image data stream flipping operation is configured to ensure that the preview orientation of the image captured by the physical camera remains normal in each shooting direction, facilitating user experience.
[0039] Smart device example: The smart device of this embodiment includes a camera and an operating system, wherein a hardware abstraction layer is provided on the operating system. The hardware abstraction layer implements the above-mentioned application method of the smart device with a single camera when executing a computer program.
[0040] Computer readable storage medium embodiment: The application method of the smart device with a single camera in the smart device described in the above embodiment can be stored in a computer-readable storage medium in the form of a computer program. When the computer program is executed, the steps of the application method of the smart device with a single camera in the above smart device can be completed. The computer-readable medium can be a computer-readable signal medium or a computer-readable storage medium. The computer-readable storage medium can be, for example, but not limited to: an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media (a non-exhaustive list) include: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.
[0041] The above are only preferred embodiments of the present invention, but the design concept of the invention is not limited to this. Without departing from the concept of the present invention, it can also include more other equivalent embodiments. It is obvious that various changes, readjustments and substitutions can be made by those skilled in the art without departing from the scope of protection of the present invention.
Claims
1. An application method for a smart device with a single camera, wherein the application method is applied to a smart device with only one physical camera, and is characterized in that: The method includes: The hardware abstraction layer obtains configuration information of the physical camera, registers a first virtual camera and a second virtual camera, wherein the shooting direction of the first virtual camera is the same as the shooting direction of the physical camera, and the shooting direction of the second virtual camera is opposite to the shooting direction of the physical camera; Binding the first virtual camera and the second virtual camera to the physical camera; Send the device information of the first virtual camera, the device information of the second virtual camera, and the device information of the physical camera to the camera system service process; Receive user shooting direction information from the application, determine whether the user shooting direction in the user shooting direction information is consistent with the shooting direction of the physical camera, and if the user shooting direction is inconsistent with the shooting direction of the physical camera, set the real-time image data stream obtained by the physical camera to perform a flip operation.
2. The application method of a smart device with a single camera according to claim 1, characterized in that: After setting the real-time image data stream acquired by the physical camera to perform a flip operation, further execute: Turn on the physical camera and obtain the camera data of the physical camera.
3. The application method of a smart device with a single camera according to claim 2, characterized in that: If the shooting direction of the user is consistent with the shooting direction of the physical camera, the physical camera is directly turned on to obtain the camera data of the physical camera.
4. The application method of a smart device with a single camera according to any one of claims 1 to 3, characterized in that: Before the hardware abstraction layer obtains the configuration information of the physical camera, it also executes: Determine whether there is only one physical camera on the smart device; If there is only one physical camera on the smart device, executing the step of obtaining configuration information of the physical camera; If there is more than one physical camera on the smart device, the number of cameras of the smart device is sent to the camera system service process.
5. The application method of a smart device with a single camera according to any one of claims 1 to 3, characterized in that: Before receiving the user's shooting direction information of the application, also execute: The application receives the user's shooting direction information, and the application obtains the device information of the first virtual camera and the device information of the second virtual camera.
6. The application method of a smart device with a single camera according to any one of claims 1 to 3, characterized in that: The step of setting the real-time image data stream acquired by the physical camera to perform a flip operation includes: The real-time image data stream acquired by the physical camera is set to perform a vertical flip operation.
7. A smart device comprising a hardware abstraction layer, wherein the hardware abstraction layer executes the application method of the smart device with a single camera according to any one of claims 1 to 6.
8. A computer-readable storage medium, characterized in that A computer program is stored thereon, and when the computer program is executed, the application method of the smart device with a single camera described in any one of claims 1 to 6 is implemented.
Citation Information
Patent Citations
Compatibility method for supporting external mobile camera and built-in camera of mobile equipment in Android system
CN104394305A
Multi-application camera access method and device with Linux compatible with Android
CN113342422A
Camera control method, terminal device, storage medium and program product
CN114449171A
Method and device for adjusting mapping relation of camera module and storage medium
CN116866545A
Multi-application camera sharing method and system based on multi-instance virtual camera, and intelligent terminal equipment
CN118394451A