USB camera management device, method, target system, equipment and storage medium
By introducing a USB camera management device between the operating system layer and the application layer, providing a unified API interface, the problem of low USB camera development efficiency in the prior art is solved, and cross-platform efficient and low-cost development is achieved.
Patent Information
- Application Number
- CN202210823901.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-07-13
- Publication Date
- 2025-08-15
- Estimated Expiration
- 2042-07-13
AI Technical Summary
In the prior art, the development and management of USB cameras lack a unified API interface, developers need to have an in-depth understanding of the LINUX system, resulting in low development efficiency, high cost and low code reuse rate.
It provides a USB camera management device, located between the operating system layer and the application layer, receives processing requests through the receiving unit, and executes related processing actions through commands of the operating system layer, returns processing results, provides API interface supply layer usage, supports JAVA programming and can be run in a docker container.
It simplifies the development process of USB cameras, saves development costs, improves development efficiency, supports cross-platform transplantation, and avoids repeated labor.
Smart Images

Figure CN115348386B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a USB camera management device, method, target system, equipment and storage medium. Background Art
[0002] USB cameras are widely used in all aspects of life and work due to their ease of use, low price, and high performance. With technological advancements, USB cameras now generally support multi-channel intelligent analysis and monitoring. Users can perform real-time video compression, digital recording, and network transmission. However, the current development and management of USB cameras using V4L2 and Libudev is relatively loose. As Linux modules, V4L2 and Libudev do not provide external APIs, only external programming methods. This requires developers to master Linux-related knowledge and programming, and then call Linux standard libraries such as ioctl to operate on device nodes. Often, a simple function requires a large amount of code to implement, resulting in low development efficiency, high development costs, and low code reuse. Summary of the Invention
[0003] In order to solve the above technical problems or at least partially solve the above technical problems, the embodiments of the present application provide a USB camera management device, method, target system, computer equipment and computer-readable storage medium.
[0004] In a first aspect of an embodiment of the present application, a USB camera management device is provided, wherein the USB camera management device is applied to a preset target system, the target system includes an operating system layer and an application layer, and the USB camera management device is located between the operating system layer and the application layer;
[0005] The USB camera management device includes: a receiving unit for receiving a processing request from the application layer, wherein the processing request is used to instruct the execution of a processing action related to the USB camera mounted on the target system; a processing unit for executing the processing action corresponding to the processing request through the operation command of the operating system layer, obtaining a processing result, and returning the obtained processing result to the application layer.
[0006] In a second aspect of an embodiment of the present application, a USB camera management method is provided, the method comprising: receiving a processing request from an application layer, the processing request being used to instruct execution of a processing action related to a USB camera mounted on a target system; executing a processing action corresponding to the processing request through an operation command of an operating system layer, obtaining a processing result, and returning the obtained processing result to the application layer.
[0007] Optionally, the processing request includes an information acquisition instruction, and the information acquisition instruction is used to instruct to acquire information of a USB camera mounted on the target system;
[0008] Executing a processing action corresponding to the processing request through an operation command of the operating system layer, obtaining a processing result, and returning the obtained processing result to the application layer includes:
[0009] Generate a query command according to the information acquisition instruction, and send the query command to the operating system layer, so that the operating system layer queries the information of the USB camera according to the query command;
[0010] Receive information of the USB camera queried by the operating system layer;
[0011] The received information of the USB camera is sent to the application layer.
[0012] Optionally, the information acquisition instruction includes a device information acquisition instruction;
[0013] Executing a processing action corresponding to the processing request through an operation command of the operating system layer, obtaining a processing result, and returning the obtained processing result to the application layer includes:
[0014] Generate a first query command according to the device information acquisition instruction, and send the first query command to the operating system layer, so that the operating system layer queries the device information of the USB camera according to the first query command;
[0015] Receive the device information of the USB camera queried by the operating system layer;
[0016] The received device information of the USB camera is sent to the application layer.
[0017] Optionally, the information acquisition instruction includes a video stream information acquisition instruction;
[0018] Executing a processing action corresponding to the processing request through an operation command of the operating system layer, obtaining a processing result, and returning the obtained processing result to the application layer includes:
[0019] Generate a second query command according to the video stream information acquisition instruction, and send the second query command to the operating system layer, so that the operating system layer queries the video stream information supported by the USB camera according to the second query command;
[0020] Receive video stream information supported by the USB camera queried by the operating system layer;
[0021] The received video stream information supported by the USB camera is sent to the application layer.
[0022] Optionally, the processing request also includes an information collection configuration instruction, and the information collection configuration instruction is used to configure the information collection method of the USB camera mounted on the target system; executing the processing action corresponding to the processing request through the operation command of the operating system layer, and obtaining the processing result includes: generating an information setting command according to the information collection configuration instruction, and sending the information setting command to the system operation layer, so that the system operation layer sets the information collection method of the USB camera mounted on the target system.
[0023] Optionally, the processing request also includes a verification instruction, and the verification instruction is used to instruct verification whether the USB camera mounted on the target system performs information collection in accordance with the information collection configuration instruction; executing the processing action corresponding to the processing request through the operation command of the operating system layer, and obtaining the processing result includes: generating a verification command according to the verification instruction, and sending the verification command to the system operation layer, so that the system operation layer verifies whether the USB camera mounted on the target system performs information collection in accordance with the information collection configuration instruction.
[0024] Optionally, receiving the processing request from the application layer includes: receiving a processing request from the application layer written based on JAVA programming language.
[0025] In a third aspect of an embodiment of the present application, a target system is provided, the target system comprising an operating system layer, an application layer, and a USB camera management device, wherein the USB camera management device is located between the operating system layer and the application layer;
[0026] The USB camera management device includes: a receiving unit for receiving a processing request from the application layer, wherein the processing request is used to instruct the execution of a processing action related to the USB camera mounted on the target system; a processing unit for executing the processing action corresponding to the processing request through the operation command of the operating system layer, obtaining a processing result, and returning the obtained processing result to the application layer.
[0027] In a fourth aspect of an embodiment of the present application, a computer device is provided, comprising a processor and a memory, wherein the memory stores at least one instruction, at least one program, a code set, or an instruction set, and the at least one instruction, the at least one program, the code set, or the instruction set is loaded and executed by the processor to implement the USB camera management method of an embodiment of the present application.
[0028] In a fifth aspect of an embodiment of the present application, a computer-readable storage medium is provided, wherein the storage medium stores at least one instruction, at least one program, a code set, or an instruction set, and the at least one instruction, the at least one program, the code set, or the instruction set is loaded and executed by a processor to implement the USB camera management method of an embodiment of the present application.
[0029] One embodiment of the above invention has the following advantages or beneficial effects:
[0030] The USB camera management device provided in the embodiment of the present application receives a processing request from the application layer through a receiving unit, wherein the processing request is used to instruct the execution of a processing action related to the USB camera mounted on the target system. The processing unit executes the processing action corresponding to the processing request, obtains a processing result, and returns the obtained processing result to the application layer. That is, the USB camera management device provides the application layer with an access interface for accessing the USB camera mounted on the preset target system. The application layer accesses, manages, and operates the USB camera by calling the access interface provided by the USB camera management device. Developers of the application layer do not need to understand the underlying system to develop USB camera applications. They only need to understand the calls of the USB camera management device to more conveniently and quickly operate and manage the USB camera, saving development costs and improving development efficiency. The USB camera management device also provides a JNI interface unit that can receive instructions written in the JAVA programming language from the application layer to facilitate JAVA program calls. Furthermore, the USB camera management device can also run in a Docker container. The application layer can freely and dynamically operate the inserted USB camera in the Docker container, making the USB camera management device quickly portable to different platforms, improving reuse rate and avoiding a lot of repetitive work. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] The accompanying drawings are provided for a better understanding of the present invention and are not intended to limit the present invention.
[0032] Figure 1 An architectural diagram illustrating an exemplary system in which the USB camera management device according to an embodiment of the present application can be applied;
[0033] Figure 2 The following schematically shows a structural diagram of a USB camera management device according to an embodiment of the present invention;
[0034] Figure 3 A schematic diagram of the structure of a USB camera management device according to another embodiment of the present invention is shown;
[0035] Figure 4The following schematically shows a structural diagram of a USB camera management device according to another embodiment of the present invention;
[0036] Figure 5 A schematic diagram of the structure of a USB camera management device according to another embodiment of the present invention is shown;
[0037] Figure 6 The following schematically illustrates an exemplary system architecture diagram in which the USB camera management device according to an embodiment of the present invention can be applied;
[0038] Figure 7 The following schematically shows a structural diagram of a USB camera management method according to an embodiment of the present invention;
[0039] Figure 8 The schematic diagram schematically shows the structure of a computer device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0040] The following description of exemplary embodiments of the present invention is made in conjunction with the accompanying drawings, and various details of the embodiments of the present application are included to facilitate understanding. These details should be considered as merely exemplary. Therefore, it should be appreciated by those skilled in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present invention. Similarly, for the sake of clarity and conciseness, descriptions of well-known functions and structures are omitted in the following description.
[0041] To facilitate understanding of the USB camera management device, method, and target system of the embodiments of the present application, the following technical terms involved in the embodiments of the present application are explained:
[0042] A USB camera is a camera with a USB interface, which is also a USB device.
[0043] USB (Universal Serial Bus) is an external bus standard used to regulate the connection and communication between computers and external devices. It is an interface technology used in the computer field.
[0044] Middleware is a type of software that sits between application systems and system software. It uses the basic services (functions) provided by system software to connect various parts of application systems or different applications on the network, thereby achieving the purpose of resource sharing and function sharing.
[0045] Linux, full name GNU / Linux, is a UNIX-like operating system that is free to use and free to disseminate.
[0046] JAVA is an object-oriented programming language.
[0047] C++ is a statically typed, compiled, cross-platform, irregular high-level computer programming language.
[0048] An API (Application Programming Interface) is a set of predefined interfaces (such as functions and HTTP interfaces), or a convention for connecting different components of a software system. It is used to provide a set of routines that applications and developers can access based on certain software or hardware without having to access the source code or understand the details of the internal working mechanism.
[0049] V4L2 (Video for Linux two) is an improved version of V4L. It is an API for capturing image, video, and audio data under the default operating system. When used with appropriate video capture devices and corresponding drivers, it enables image, video, and audio capture. It is widely used in teleconferencing, videophones, video surveillance systems, and embedded multimedia terminals.
[0050] Libudev: Libudev is the device manager for the Linux kernel 2.6 series. Its primary function is to manage device nodes in the / dev directory. The Libudev library can be used to retrieve device information.
[0051] Docker: Docker is an open-source application container engine that allows developers to package their applications and dependencies into portable containers and then deploy them to any popular pre-built machine. It also allows for virtualization. Containers are completely sandboxed, with no interfaces between them. In short, it's a container that can be used as a pre-built image.
[0052] JNI: JNI is the abbreviation of Java Native Interface, which provides several APIs to implement communication between Java and other languages (mainly C and C++ languages).
[0053] Figure 1 The following schematically shows the architecture of the target system in which the USB camera management device according to the embodiment of the present application can be applied. Figure 2 The structure diagram of the USB camera management device according to one embodiment of the present application is schematically shown.
[0054] like Figure 1As shown, the preset target system 100 used by the USB camera management device of the present embodiment includes an operating system layer 101, an application layer 103, and the USB camera management device 102. The operating system layer 101 refers to a computer program that manages computer hardware and software resources, managing hardware at the bottom and providing a support environment for software operation at the top. The application layer 103 refers to the application program layer, which includes various application programs. The USB camera management device 102 is located between the operating system layer 101 and the application layer 103.
[0055] like Figure 2 As shown, the USB camera management device 102 includes a receiving unit 1021 and a processing unit 1022. The receiving unit 1021 is used to receive a processing request from the application layer 103, and the processing request is used to instruct the execution of a processing action related to the USB camera mounted on the target system. In an optional embodiment, the receiving unit 1021 can receive a processing request written in C++ or JAVA. The processing unit 1022 is used to execute the processing action corresponding to the processing request through the operation command of the operating system layer 101, obtain the processing result, and return the obtained processing result to the application layer. Exemplarily, the processing request from the application layer may include an instruction for instructing to obtain information about the USB camera, an instruction for instructing to set the information collection method of the USB camera, and an instruction for verifying whether the information collection function of the USB camera is normal.
[0056] The USB camera management device 102 serves as a middleware that connects the operating system layer 101 and the application layer 103, and provides the application layer 103 with an API interface for accessing the USB camera mounted on the target system 100. The application program of the application layer 103 accesses, manages and operates the USB camera by calling the USB camera management device 102. The developer of the application layer only needs to understand the call of the USB camera management device and does not need to understand the underlying system to develop the application program of the USB camera, thereby realizing more convenient and quick operation and management of the USB camera, saving development costs and improving development efficiency.
[0057] Exemplarily, the preset target system may be a Linux system, comprising a Linux host and a USB camera, with the USB camera plugged into the Linux host. The Linux system may also include other devices, such as input / output devices, etc., which are not limited herein. A USB camera management device provided by an embodiment of the present application is installed on the Linux host. The USB camera management device provided by an embodiment of the present application can be used to quickly develop USB camera-based applications. For a Linux system, the USB camera management device of an embodiment of the present application can be implemented by encapsulating the V42L video framework and the libudev library. The processing unit of the USB camera management device can access nodes in the / dev directory through functions in the libudev library, for example, by calling udev_enumerate_add_match_subsystem(enumerate, "block") to enumerate the video devices mounted on the current Linux host (enumerate the block devices marked with the string "video4linux," where "video4linux" is used to indicate that the block device is a video device). These nodes are then traversed to determine whether the video device is truly available. A truly available video device is the mounted USB camera, and then the relevant information of the video device is queried.
[0058] Figure 3 A schematic diagram of the structure of a USB camera management device 102 according to another embodiment of the present invention is shown. Figure 3 As shown, the USB camera management device 102 includes a receiving unit 1021 and a processing unit 1022 , and the processing unit 1022 includes an obtaining module 10221 .
[0059] In this embodiment, the receiving unit 1021 is used to receive a processing request from the application layer, the processing request including an information acquisition instruction, the information acquisition instruction being used to instruct the acquisition of information about the USB camera mounted on the target system. The acquisition module 10221 is used to generate a query command based on the information acquisition instruction and send the query command to the operating system layer. The operating system layer queries the information about the USB camera based on the query command and sends the retrieved information about the USB camera to the acquisition module 10221. The acquisition module 10221 receives the information about the USB camera and sends the received information about the USB camera to the application layer. Exemplarily, the information acquisition instruction can be used to instruct the acquisition of one or more of the following information about the USB camera mounted on the target system: manufacturer information, product number, video encoding format, resolution, and frame rate.
[0060] The USB camera management device of an embodiment of the present invention provides an acquisition module for obtaining relevant information about the USB camera, that is, it provides a service for obtaining relevant information about the USB camera. The application layer can access the USB camera by calling the USB camera management device to obtain the required information. Taking the Linux system as an example, when a USB camera is inserted into the Linux system, a node corresponding to the USB camera is randomly generated in the / dev directory of the Linux system. The acquisition unit of the USB camera management device can access the nodes in the / dev directory through functions in the libudev function library, enumerate the USB cameras mounted on the current Linux host (enumerate the block devices marked with the string video4linux, which is used to indicate that the block device is a video device), and then query the relevant information of the USB camera.
[0061] In an optional embodiment, the information acquisition instruction may include a device information acquisition instruction, which is used to instruct the acquisition of basic information about the USB camera, such as manufacturer information, supplier information, and product number. After the USB camera management device 102 receives the device information acquisition instruction, the acquisition module 10221 generates a first query command based on the device information acquisition instruction and sends the first query command to the operating system layer. The operating system layer queries the USB camera's device information based on the first query command and sends the retrieved device information to the acquisition module 10221. The acquisition module 10221 receives the USB camera's device information retrieved by the operating system layer and sends the received device information to the application layer. For example, if the target system is Linux, the acquisition module 10221 can obtain the USB camera's device information, such as a node string, manufacturer information (vendorID), product number (productId), and supplier information, by calling the udev_device_get_sysattr_value function of libudev. Exemplarily, the USB camera management device may feed the acquired device information back to the application layer in the form of a list. The node string refers to the name of the node corresponding to the USB camera. After the USB camera is inserted into the target system, a node of the USB camera will be randomly generated in the / dev directory of the target system. The node string is the name of the node.
[0062] In an optional embodiment, the information acquisition instruction may further include a video stream information acquisition instruction, which is used to obtain information about video streams supported by the USB camera, such as encoding formats (codes) and the resolution and frame rate supported by each encoding format. The video stream information acquisition instruction includes a node string of the USB camera to be acquired, and the USB camera management device determines the USB camera to be acquired based on the node string.
[0063] After the USB camera management device 102 receives the video stream information acquisition instruction, the acquisition module 10221 generates a second query command based on the video stream information acquisition instruction and sends the second query command to the operating system layer. The operating system layer queries the video stream information supported by the USB camera based on the second query command and sends the queried video stream information supported by the USB camera to the acquisition module 10221. The acquisition module 10221 receives the video stream information supported by the USB camera queried by the operating system layer and sends the received video stream information to the application layer. Taking the target system as a Linux system as an example, the acquisition module 1022 obtains the video stream information supported by the USB camera using the ioctl function. Using the USB Camera node string obtained above, the USB camera's supported codecs are first obtained, the resolutions supported by each codec are traversed, and finally the frame rates supported by each resolution are traversed. For example, to facilitate the transmission of the obtained video stream information to the application layer, the video stream information can be encapsulated in a List container and returned to the application layer. The List container is a sequential container that allows for efficient insertion and deletion of elements.
[0064] The USB camera management device of the embodiment of the present invention can obtain the device information of the USB camera, such as manufacturer information, product number, supplier information, etc., and can also obtain the video stream information supported by the USB camera, such as video encoding format, resolution, frame rate, etc. The application layer can quickly and easily obtain the information of the USB camera by calling the USB camera management device, which facilitates the development of applications based on the USB camera, improves development efficiency, and saves development costs.
[0065] Figure 4 A schematic diagram of the structure of a USB camera management device 102 according to another embodiment of the present invention is shown. Figure 4 As shown, the USB camera management device 102 includes a receiving unit 1021 and a processing unit 102 , and the processing unit 102 includes an acquisition module 10221 , a setting module 10222 and a verification module 10223 .
[0066] Among them, the receiving unit 1021 is used to receive information acquisition instructions, information collection configuration instructions and verification instructions from the application layer. The information acquisition instruction is used to instruct the acquisition of information of the USB camera mounted on the preset system, the information collection configuration instruction is used to instruct the configuration of the information collection method of the USB camera, and the verification instruction is used to instruct the verification of whether the USB camera performs information collection in accordance with the information collection configuration instruction. Exemplarily, the information acquisition instruction can be used to instruct the acquisition of one or more of the following information of the USB camera mounted on the preset system: manufacturer information, product number, video encoding format, resolution and frame rate. The information collection configuration instruction is used to instruct the configuration of the encoding format, resolution and frame rate of the video stream captured by the USB camera, etc. The information collection configuration instruction and the verification instruction both include the node string of the USB camera to be obtained, and the USB camera management device determines the USB camera to be configured and to be verified based on the node string.
[0067] The acquisition module 10221 is used to generate a query command according to the information acquisition instruction, and send the query command to the operating system layer so that the operating system layer queries the information of the USB camera according to the query command; receives the information of the USB camera queried by the operating system layer; and sends the received information of the USB camera to the application layer.
[0068] The setting module 10222 is used to generate an information setting command according to the information collection configuration instruction, and send the information setting command to the system operation layer, so that the system operation layer sets the information collection method of the USB camera mounted on the preset system.
[0069] The verification module 10223 is used to generate a verification command according to the verification instruction, and send the verification command to the system operation layer, so that the system operation layer verifies whether the USB camera mounted on the preset system collects information according to the information collection configuration instruction.
[0070] The USB camera management device of this embodiment provides a settings module that allows the application layer to customize the USB camera's information collection method based on application requirements. This settings module generates information setting commands, such as ioctl functions, based on information collection configuration instructions. Passing different parameters to the ioctl function can change the USB camera's information collection method, specifically, the USB camera's encoding format, resolution, and frame rate.
[0071] This embodiment takes into account the situation that the USB camera cannot determine whether the video stream or the set information collection method is correct when pushing and pulling streams (pushing video streams and pulling video streams), so a verification module is provided. Through this verification module, the application layer can easily confirm whether the USB camera collects information according to the set information collection method, and whether the current video stream is normal.
[0072] For example, using a Linux target system as an example, verification module 10223 captures the video stream captured by a USB camera through V4L2, determines whether the acquired video stream is correct by intercepting a frame, determines the current encoding format, resolution, and frame rate based on the captured image, and then determines whether the USB camera is collecting information according to the configured information collection method. Because the process of intercepting an image is the process of obtaining a stream, if an image can be intercepted, it can be determined that the USB camera is functioning normally. A verification module is also provided to facilitate the application layer's verification of whether the USB camera is collecting information according to the configured information collection method.
[0073] Figure 5 The following schematically illustrates the structure of a USB camera management device 102 according to another embodiment of the present application. As shown in Figure 5, the USB camera management device 102 includes a receiving unit 1021 and a processing unit 1022. The receiving unit 1021 includes a JNI interface unit 10211. The processing unit 102 includes an acquisition module 10221, a setting module 10222, and a verification module 10223. The JNI interface unit 10211 is configured to receive processing requests written in the Java programming language from the application layer.
[0074] In order to facilitate JAVA program calls, the USB camera management device of the embodiment of the present application provides a JNI interface unit, through which JAVA developers can easily call the USB camera management device.
[0075] In an optional embodiment, if Figure 6 As shown, Figure 1-Figure 5 The USB camera management device provided in the illustrated embodiment can run in a Docker container. This container runs on the operating system layer, facilitating porting of the USB camera management device to different platforms, increasing reuse and avoiding repetitive work. Application developers can dynamically access and operate USB cameras mounted on the host machine through the USB camera management device in the Docker container.
[0076] In this embodiment, the acquisition module 10221 can generate a query command based on the information acquisition instruction, and send the query command to the operating system layer, so that the operating system layer queries the / dev directory of the docker container according to the query command to obtain the information of the USB camera. Exemplarily, after the USB camera management device of the embodiment of the present application is set in the docker container, the / dev directory of the host machine can be mapped to the / dev directory of docker by configuring the startup parameters of docker. The / dev directory contains the nodes of all external devices used in the Linux system, and the information of the external device can be obtained by accessing the mount nodes under this directory. When the USB camera is inserted into the host machine, a node is randomly generated in the / dev directory of the Linux system, such as / dev / video3, and then the node is synchronized to the / dev directory of docker. By accessing the / dev / directory of docker, the node corresponding to the USB camera is obtained, and the USB camera is accessed based on this node.
[0077] The USB camera management device of this embodiment encapsulates the V4L2 video framework and Libudev, encapsulating all functions such as device information acquisition, stream information acquisition, and settings into the USB camera management device, expanding and abstracting it to form a new middleware API interface, and then re-encapsulating the interface through JNI. In this way, upper-layer applications do not need to know the node descriptors of the device or care about the specific implementation of the underlying layer. They can obtain the basic information of the USB camera and the supported video stream formats by calling the USB camera management device, and freely set the encoding format, resolution, frame rate, etc. of the USB camera. It can also verify whether the video stream of the current USB camera is normal. When this USB camera management device is deployed in docker, the host machine's / dev directory is set to be mapped to the corresponding directory of docker, and the host machine's USB camera can be directly accessed in docker.
[0078] Figure 7 The flowchart of a USB camera management method according to an embodiment of the present application is schematically shown. The USB camera management method is applied to the USB camera management device described in the above embodiment.
[0079] like Figure 7 As shown, the method includes:
[0080] Step 701: receiving a processing request from an application layer, wherein the processing request is used to instruct execution of a processing action related to a USB camera mounted on a target system;
[0081] Step 702: Execute the processing action corresponding to the processing request through the operation command of the operating system layer, obtain the processing result, and return the obtained processing result to the application layer.
[0082] Optionally, the processing request includes an information acquisition instruction, and the information acquisition instruction is used to instruct the acquisition of information of the USB camera mounted on the target system; executing the processing action corresponding to the processing request through the operation command of the operating system layer, obtaining the processing result, and returning the obtained processing result to the application layer includes: generating a query command according to the information acquisition instruction, sending the query command to the operating system layer, so that the operating system layer queries the information of the USB camera according to the query command; receiving the information of the USB camera queried by the operating system layer; and sending the received information of the USB camera to the application layer.
[0083] Optionally, the information acquisition instruction includes a device information acquisition instruction; executing the processing action corresponding to the processing request through the operation command of the operating system layer, obtaining the processing result, and returning the obtained processing result to the application layer includes: generating a first query command according to the device information acquisition instruction, sending the first query command to the operating system layer, so that the operating system layer queries the device information of the USB camera according to the first query command; receiving the device information of the USB camera queried by the operating system layer; and sending the received device information of the USB camera to the application layer.
[0084] Optionally, the information acquisition instruction includes a video stream information acquisition instruction; executing the processing action corresponding to the processing request through the operation command of the operating system layer, obtaining the processing result, and returning the obtained processing result to the application layer includes: generating a second query command according to the video stream information acquisition instruction, sending the second query command to the operating system layer, so that the operating system layer queries the video stream information supported by the USB camera according to the second query command; receiving the video stream information supported by the USB camera queried by the operating system layer; and sending the received video stream information supported by the USB camera to the application layer.
[0085] Optionally, the processing request also includes an information collection configuration instruction, and the information collection configuration instruction is used to configure the information collection method of the USB camera mounted on the target system; executing the processing action corresponding to the processing request through the operation command of the operating system layer, and obtaining the processing result includes: generating an information setting command according to the information collection configuration instruction, and sending the information setting command to the system operation layer, so that the system operation layer sets the information collection method of the USB camera mounted on the target system.
[0086] Optionally, the processing request also includes a verification instruction, and the verification instruction is used to instruct verification whether the USB camera mounted on the target system performs information collection in accordance with the information collection configuration instruction; executing the processing action corresponding to the processing request through the operation command of the operating system layer, and obtaining the processing result includes: generating a verification command according to the verification instruction, and sending the verification command to the system operation layer, so that the system operation layer verifies whether the USB camera mounted on the target system performs information collection in accordance with the information collection configuration instruction.
[0087] In the embodiment of the present invention, the program code for implementing the above-mentioned USB camera management method can be generated into a bin file, which can be directly called in a Linux environment.
[0088] In an optional embodiment, to facilitate Java program calls, the USB camera management method of the present invention includes a JNI interface unit, which receives Java-based instructions from the application layer. Furthermore, the program code implementing the USB camera management method and the JNI interface unit can be packaged into an .so library to facilitate Java calls.
[0089] Optionally, the program code implementing the USB camera management method described above can be run in a Docker container to facilitate porting the program code to different platforms, improving reuse and avoiding repetitive work. Application layer developers can dynamically access and operate USB cameras mounted on the host machine through the USB camera management program code in the Docker container.
[0090] Figure 8 The following schematically illustrates a block diagram of a computer device provided in one embodiment of the present application. The computer device can be used to implement the USB camera management method provided in the above embodiment. The computer device can be a PC or a server, or other device with data processing and storage capabilities. Specifically:
[0091] The computer device 800 includes a central processing unit (CPU) 801, a system memory 804 including a random access memory (RAM) 802 and a read-only memory (ROM) 803, and a system bus 805 connecting the system memory 804 and the central processing unit 801. The computer device 800 also includes a basic input / output system (I / O system) 806 that facilitates information transfer between various components within the computer, and a mass storage device 807 for storing an operating system 813, application programs 814, and other program modules 815.
[0092] The basic input / output system 806 includes a display 808 for displaying information and an input device 809, such as a mouse and keyboard, for user input. Both the display 808 and the input device 809 are connected to the central processing unit 801 via an input / output controller 88 connected to the system bus 805. The basic input / output system 806 may also include an input / output controller 88 for receiving and processing input from a variety of other devices, such as a keyboard, mouse, or electronic stylus. Similarly, the input / output controller 88 also provides output to a display screen, printer, or other types of output devices.
[0093] The mass storage device 807 is connected to the central processing unit 801 via a mass storage controller (not shown) connected to the system bus 805. The mass storage device 807 and its associated computer-readable media provide non-volatile storage for the computer device 800. In other words, the mass storage device 807 may include a computer-readable medium (not shown) such as a hard disk or a CD-ROM drive.
[0094] Without loss of generality, the computer-readable medium may include computer storage media and communication media. Computer storage media include volatile and non-volatile, removable and non-removable media implemented by any method or technology for storing information such as computer-readable instructions, data structures, program modules or other data. Computer storage media include RAM, ROM, EPROM, EEPROM, flash memory or other solid-state storage technologies, CD-ROM, DVD or other optical storage, tape cassettes, magnetic tape, disk storage or other magnetic storage devices. Of course, those skilled in the art will appreciate that the computer storage media is not limited to the above-mentioned ones. The above-mentioned system memory 804 and mass storage device 807 can be collectively referred to as memory.
[0095] According to various embodiments of the present application, the computer device 800 may also be connected to a remote computer on a network such as the Internet for operation. That is, the computer device 800 may be connected to a network 812 via a network interface unit 811 connected to the system bus 805. Alternatively, the network interface unit 811 may be used to connect to other types of networks or remote computer systems (not shown).
[0096] The memory further includes one or more programs, which are stored in the memory and configured to be executed by one or more processors. The one or more programs include instructions for executing the training method of the facial key point positioning model.
[0097] In an exemplary embodiment, a computer-readable storage medium is also provided, storing at least one instruction, at least one program, code set, or instruction set. When executed by a processor of a computer device, the at least one instruction, program, code set, or instruction set implements the aforementioned USB camera management method. Alternatively, the computer-readable storage medium may be ROM, RAM, CD-ROM, magnetic tape, floppy disk, or optical data storage device.
[0098] In an exemplary embodiment, a computer program product is further provided. When the computer program product is executed, it is used to implement the above-mentioned USB camera management method.
[0099] The flowcharts and block diagrams in the accompanying drawings illustrate the possible implementation architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present invention. In this regard, each box in the flowchart or block diagram can represent a module, program segment, or a part of code, and the above-mentioned module, program segment, or a part of code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in an order different from that marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flowchart, and the combination of boxes in the block diagram or flowchart, can be implemented with a dedicated hardware-based system that performs the specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0100] The modules involved in the embodiments described in this application can be implemented by software or by hardware. The modules described can also be set in a processor. For example, they can be described as: a processor includes a sending module, an acquisition module, a determination module and a first processing module. Among them, the names of these modules do not constitute a limitation of the unit itself under certain circumstances. For example, the sending module can also be described as a "module that sends a picture acquisition request to the connected server."
[0101] The above specific embodiments do not limit the scope of protection of the present invention. Those skilled in the art will appreciate that various modifications, combinations, sub-combinations, and substitutions may occur depending on design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the present invention are intended to be included within the scope of protection of the present invention.
Claims
1. A USB camera management device, characterized in that: The USB camera management device is applied to a preset target system, the target system includes an operating system layer and an application layer, and the USB camera management device is located between the operating system layer and the application layer; The USB camera management device includes: a receiving unit, configured to receive a processing request from the application layer, wherein the processing request is used to instruct execution of a processing action related to the USB camera mounted on the target system; a processing unit, configured to execute a processing action corresponding to the processing request through an operation command of the operating system layer, obtain a processing result, and return the obtained processing result to the application layer; The processing request includes an information acquisition instruction; the USB camera management device runs in a docker container, the docker container runs on the operating system layer, the / dev directory of the target system is mapped to the / dev directory of the docker container, and the / dev directory of the target system has a node corresponding to the USB camera mounted on the target system; The processing unit includes an acquisition module, which is used to generate a query command according to the information acquisition instruction and send the query command to the operating system layer, so that the operating system layer accesses the node under the / dev directory of the docker container through the function in the libudev function library according to the query command to obtain the information of the USB camera.
2. The USB camera management device according to claim 1, wherein: The acquisition module is further configured to receive information of the USB camera queried by the operating system layer; The received information of the USB camera is sent to the application layer.
3. The USB camera management device according to claim 2, wherein: The information acquisition instruction includes a device information acquisition instruction; The acquisition module is further configured to generate a first query command according to the device information acquisition instruction, and send the first query command to the operating system layer, so that the operating system layer queries the device information of the USB camera according to the first query command; Receive the device information of the USB camera queried by the operating system layer; The received device information of the USB camera is sent to the application layer.
4. The USB camera management device according to claim 2, wherein: The information acquisition instruction includes a video stream information acquisition instruction; The acquisition module is further configured to generate a second query command according to the video stream information acquisition instruction, and send the second query command to the operating system layer, so that the operating system layer queries the video stream information supported by the USB camera according to the second query command; Receive video stream information supported by the USB camera queried by the operating system layer; The received video stream information supported by the USB camera is sent to the application layer.
5. The USB camera management device according to claim 1, wherein: The processing request further includes an information collection configuration instruction, wherein the information collection configuration instruction is used to configure an information collection method of the USB camera mounted on the target system; The processing unit also includes a setting module, which is used to generate an information setting command according to the information collection configuration instruction, and send the information setting command to the operating system layer so that the operating system layer sets the information collection method of the USB camera mounted on the target system.
6. The USB camera management device according to claim 5, characterized in that: The processing request further includes a verification instruction, wherein the verification instruction is used to instruct verification whether the USB camera mounted on the target system collects information according to the information collection configuration instruction; The processing unit also includes a verification module, which is used to generate a verification command based on the verification instruction and send the verification command to the operating system layer so that the operating system layer verifies whether the USB camera mounted on the target system collects information according to the information collection configuration instruction.
7. The USB camera management device according to any one of claims 1 to 6, characterized in that: The receiving unit further includes a JNI interface unit for receiving a processing request written in JAVA programming language from the application layer.
8. A USB camera management method, characterized in that: The method comprises: receiving a processing request from the application layer, wherein the processing request is used to instruct execution of a processing action related to a USB camera mounted on a target system; Executing a processing action corresponding to the processing request through an operation command of the operating system layer, obtaining a processing result, and returning the obtained processing result to the application layer; The processing request includes an information acquisition instruction, and the method further includes: According to the information acquisition instruction, a query command is generated, and the query command is sent to the operating system layer, so that the operating system layer accesses the nodes under the / dev directory of the docker container through the functions in the libudev function library according to the query command to obtain the information of the USB camera; the USB camera management device runs in the docker container, the docker container runs on the operating system layer, the / dev directory of the target system is mapped under the / dev directory of the docker container, and the / dev directory of the target system has a node corresponding to the USB camera mounted on the target system.
9. A target system, characterized in that: The target system includes an operating system layer, an application layer and a USB camera management device, wherein the USB camera management device is located between the operating system layer and the application layer; The USB camera management device includes: a receiving unit, configured to receive a processing request from the application layer, wherein the processing request is used to instruct execution of a processing action related to the USB camera mounted on the target system; a processing unit, configured to execute a processing action corresponding to the processing request through an operation command of the operating system layer, obtain a processing result, and return the obtained processing result to the application layer; The processing request includes an information acquisition instruction; the USB camera management device runs in a docker container, the docker container runs on the operating system layer, the / dev directory of the target system is mapped to the / dev directory of the docker container, and the / dev directory of the target system has a node corresponding to the USB camera mounted on the target system; The processing unit includes an acquisition module, which is used to generate a query command according to the information acquisition instruction and send the query command to the operating system layer, so that the operating system layer accesses the node under the / dev directory of the docker container through the function in the libudev function library according to the query command to obtain the information of the USB camera.
10. A computer device, characterized in that: The computer device includes a processor and a memory, wherein the memory stores at least one instruction, at least one program, a code set, or an instruction set, and the at least one instruction, the at least one program, the code set, or the instruction set is loaded and executed by the processor to implement the method according to claim 8.
11. A computer-readable storage medium, characterized in that The storage medium stores at least one instruction, at least one program, a code set, or an instruction set, and the at least one instruction, the at least one program, the code set, or the instruction set is loaded and executed by the processor to implement the method according to claim 8.
Citation Information
Patent Citations
Method for enabling Android to support hot plug of camera when Linux is compatible with Android system
CN114047964A