CN111314646B - Image acquisition method, image acquisition device, terminal device and readable storage medium - Google Patents

Image acquisition method, image acquisition device, terminal device and readable storage medium Download PDF

Info

Publication number
CN111314646B
CN111314646B CN202010124625.4A CN202010124625A CN111314646B CN 111314646 B CN111314646 B CN 111314646B CN 202010124625 A CN202010124625 A CN 202010124625A CN 111314646 B CN111314646 B CN 111314646B
Authority
CN
China
Prior art keywords
camera
image
remote
identification
local
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202010124625.4A
Other languages
Chinese (zh)
Other versions
CN111314646A (en
Inventor
彭冬炜
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Oppo Chongqing Intelligent Technology Co Ltd
Original Assignee
Oppo Chongqing Intelligent Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Oppo Chongqing Intelligent Technology Co Ltd filed Critical Oppo Chongqing Intelligent Technology Co Ltd
Priority to CN202010124625.4A priority Critical patent/CN111314646B/en
Publication of CN111314646A publication Critical patent/CN111314646A/en
Application granted granted Critical
Publication of CN111314646B publication Critical patent/CN111314646B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N7/00Television systems
    • H04N7/14Systems for two-way working
    • H04N7/141Systems for two-way working between two video terminals, e.g. videophone
    • H04N7/142Constructional details of the terminal equipment, e.g. arrangements of the camera and the display
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/47End-user applications
    • H04N21/478Supplemental services, e.g. displaying phone caller identification, shopping application
    • H04N21/4788Supplemental services, e.g. displaying phone caller identification, shopping application communicating with other users, e.g. chatting
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/60Network structure or processes for video distribution between server and client or between remote clients; Control signalling between clients, server and network components; Transmission of management data between server and client, e.g. sending from server to client commands for recording incoming content stream; Communication details between server and client 
    • H04N21/63Control signaling related to video distribution between client, server and network components; Network processes for video distribution between server and clients or between remote clients, e.g. transmitting basic layer and enhancement layers over different transmission paths, setting up a peer-to-peer communication via Internet between remote STB's; Communication protocols; Addressing
    • H04N21/643Communication protocols
    • H04N21/6437Real-time Transport Protocol [RTP]

Abstract

The application provides an image acquisition method, an image acquisition device, a terminal device and a readable storage medium. The method comprises the following steps: if an instruction for instructing the terminal equipment to acquire the image acquired by the Camera is received, calling an Application Program Interface (API) function for accessing the Camera in a Camera Camera framework; receiving an image returned by the API function; the terminal device executes the following operations by calling the API function: and receiving data sent by a remote camera, and processing the data to obtain an image contained in the data. According to the method and the device, the condition that research and development personnel learn in advance how to process the data sent by the remote camera can be avoided, and therefore the research and development efficiency of the target application program for obtaining the picture of the remote camera is improved to a certain extent.

Description

Image acquisition method, image acquisition device, terminal device and readable storage medium
Technical Field
The present application belongs to the field of camera access technologies, and in particular, to an image acquisition method, an image acquisition apparatus, a terminal device, and a computer-readable storage medium.
Background
In the prior art, in order to enable a terminal device (for example, a mobile phone or a desktop computer) to obtain a picture acquired by a remote camera, an application program (for convenience of the following description, the application program is referred to as a target application program) capable of obtaining the picture acquired by the remote camera needs to be installed on the terminal device, and by running the target application program, the terminal device executes the following operations: establishing connection with a remote camera; receiving data sent by a remote camera; processing the received data (for example, performing processes such as packaging and decoding on the received data) to obtain an image included in the data; finally, the obtained image can be displayed on the interface of the target application program as a preview picture.
Therefore, in the prior art, in order to enable the terminal device to acquire an image acquired by the remote camera, research and development personnel need to write the target application program, so that the terminal device can process data sent by the remote camera to acquire the image, and therefore the research and development personnel need to be familiar with how to process the data sent by the remote camera in advance, which reduces the research and development efficiency of the target application program.
Disclosure of Invention
In view of this, embodiments of the present application provide an image acquisition method, an image acquisition apparatus, a terminal device, and a computer-readable storage medium. The method can avoid the condition that research and development personnel learn in advance how to process the data sent by the remote camera, thereby improving the research and development efficiency of the target application program to a certain extent.
A first aspect of an embodiment of the present application provides an image acquisition method, which is applied to a terminal device, and includes:
if an instruction for instructing the terminal equipment to acquire the image acquired by the Camera is received, calling an Application Program Interface (API) function for accessing the Camera in a Camera Camera framework;
receiving an image returned by the API function;
the terminal device executes the following operations by calling the API function:
and receiving data sent by a remote camera, and processing the data to obtain an image contained in the data.
A second aspect of the embodiments of the present application provides a preview image display apparatus, which is applied to a terminal device, and includes:
the API calling module is used for calling an API function used for accessing the Camera in the Camera Camera framework if an instruction used for indicating the terminal equipment to acquire the image acquired by the Camera is received;
the returned image receiving module is used for receiving the image returned by the API function;
the terminal device executes the following operations by calling the API function:
and receiving data sent by a remote camera, and processing the data to obtain an image contained in the data.
A third aspect of embodiments of the present application provides a terminal device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, and the processor implements the steps of the image acquisition method according to the first aspect when executing the computer program.
A fourth aspect of embodiments of the present application provides a computer-readable storage medium, which stores a computer program, and the computer program, when executed by a processor, implements the steps of the image acquisition method according to the first aspect.
A fifth aspect of embodiments of the present application provides a computer program product comprising a computer program that, when executed by one or more processors, performs the steps of the image acquisition method according to the first aspect.
From the above, the present application provides a method for acquiring a picture collected by a remote camera, that is: if the terminal device receives an instruction for instructing the terminal device to acquire an image acquired by the Camera, an Application Programming Interface (API) function in a Camera framework is called (the number of the API functions is not limited in the present Application, and may be one API function or multiple API functions).
When calling the API function, the terminal equipment can execute the following operations: and receiving data sent by the remote camera, and processing the data to obtain an image contained in the data.
In the technical solution provided by the present application, an API function in a Camera framework of a terminal device is different from that in the prior art, the API function in the Camera framework only enables an application program to access a local Camera installed on the terminal device by calling the API function, and cannot enable the application program to access a remote Camera by calling the API function. In the technical scheme provided by the application, a traditional Camera framework is improved, and a processing process of data sent by a remote Camera is packaged into an API function of the Camera framework, so that when the target application program is researched and developed, the target application program can access the remote Camera only by calling the API function, and a research and development worker of the target application program does not need to know how to process the data sent by the remote Camera.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed in the description of the embodiments or the prior art will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present application.
Fig. 1 is a schematic flow chart illustrating an implementation of an image obtaining method according to an embodiment of the present application;
fig. 2 is a schematic flow chart illustrating an implementation of another image acquisition method provided in the second embodiment of the present application;
FIG. 3 is a schematic diagram for describing how a wechat application implements access to a remote camera in the second embodiment of the present application;
fig. 4 is a schematic flow chart illustrating an implementation of another image acquisition method provided in the third embodiment of the present application;
fig. 5 is a flowchart illustrating an operation performed by a user on an operation interface according to a third embodiment of the present application;
fig. 6 is a data processing flowchart of the terminal device after the Camera application program calls the API function in the Camera framework according to the third embodiment of the present application;
fig. 7 is a schematic structural diagram of an image capturing apparatus according to a fourth embodiment of the present application;
fig. 8 is a schematic structural diagram of a terminal device provided in the fifth embodiment of the present application;
Detailed Description
In the following description, for purposes of explanation and not limitation, specific technical details are set forth, such as particular examples, in order to provide a thorough understanding of the embodiments of the present application. It will be apparent, however, to one skilled in the art that the present application may be practiced in other embodiments that depart from these specific details. In other instances, detailed descriptions of well-known systems, devices, circuits, and methods are omitted so as not to obscure the description of the present application with unnecessary detail.
The image acquisition method provided by the embodiment of the application is applicable to terminal equipment, and the terminal equipment includes but is not limited to: smart phones, tablet computers, notebooks, desktop computers, cloud servers, and the like.
It will be understood that the terms "comprises" and/or "comprising," when used in this specification and the appended claims, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof.
It should be further understood that the term "and/or" as used in this specification and the appended claims refers to and includes any and all possible combinations of one or more of the associated listed items.
In addition, in the description of the present application, the terms "first", "second", and the like are used only for distinguishing the description, and are not intended to indicate or imply relative importance.
In order to explain the technical solution described in the present application, the following description will be given by way of specific examples.
Example one
The following describes an image obtaining method provided in an embodiment of the present application, where the method is applied to a terminal device (for example, a smart phone), with reference to fig. 1, and the method includes the following steps:
in step S101, if an instruction for instructing the terminal device to acquire an image captured by a Camera is received, an application program interface API function in a Camera framework is called, where the terminal device executes the following operations by calling the API function: receiving data sent by a remote camera, and processing the data to obtain an image contained in the data;
as known to those skilled in the art, in the prior art, when a user starts a camera, a terminal device needs to acquire an image acquired by the camera to display a preview picture; or when the user starts the video call function, the terminal equipment also acquires the image acquired by the camera so as to transmit the image to the opposite contact person of the video call; or when the user starts the live function of the application program (such as a fish fighting program), the image collected by the camera is also acquired. Therefore, in the embodiment of the present application, when a user starts a camera, the terminal device may be considered to receive an instruction "for instructing the terminal device to acquire an image acquired by the camera"; or, when the user starts the video call function, the user can think that an instruction for instructing the terminal device to acquire the image acquired by the camera is received; still alternatively, when the user starts the live function of the application program, it may be considered that the instruction for instructing the terminal device to acquire the camera to capture the image is received. That is, the present application does not specifically limit the scene in which the terminal device receives the "instruction for instructing the terminal device to acquire the image acquired by the camera".
In the technical solution provided in the present application, if an instruction for instructing the terminal device to acquire an image captured by a Camera is received, an API function in a Camera framework is called (the number of API functions is not limited, and may be one or multiple), and the API function encapsulates a "method for processing data sent by a remote Camera", so that when the API function is called, the terminal device executes the following operations: and receiving data sent by the remote camera, and processing the data to obtain an image contained in the data.
In the prior art, a number of API functions are provided in a Camera framework of a terminal device, for example, for an Android operating system, an OpenCamera function and the like are provided in the Camera framework, and these API functions in the prior art only provide a function of accessing a local Camera installed in the terminal device. The method improves the existing Camera framework (so that the improved Camera framework comprises an API function supporting access to the remote Camera, the API function can be a rewritten API function or a function obtained by modifying the original API function), and the API function in the Camera framework is packaged with a method for processing data sent by the remote Camera. A specific process executed by the terminal device when the API function described in step S101 is called is described below, that is, "receiving data sent by the remote camera and processing the data to obtain an image included in the data" may include the following specific steps:
step A, sending a request to a remote camera to acquire image resolution, a data transmission protocol and an image coding format supported by the remote camera;
the data transmission Protocol may be RTP (Real-Time Transport Protocol), RTSP (Real-Time Streaming Protocol), or RTMP (Real-Time Messaging Protocol), and the specific form of the data transmission Protocol is not limited in the present application.
The image encoding format may be MPEG4, H264, H265, or the like, and the present application also does not specifically limit the image encoding format.
B, receiving data sent by the remote camera;
if it is known that the remote camera supports multiple image encoding formats in the above step a, before performing step B, "request data of a specific image encoding format from the remote camera" may be performed, and then step B may be performed.
And step C, processing the received data sent by the remote camera based on the acquired image resolution, data transmission protocol and image coding format supported by the remote camera, and acquiring an image from the data.
For example, in step C, the data transmitted by the remote camera is subjected to processing such as packet packing and frame searching based on the data transmission protocol, and the data after the frame packing and frame searching is decoded based on the image resolution and the image encoding format, so as to obtain the included image.
In the embodiment of the present application, the operation of "establishing connection with a remote camera" may be encapsulated in the "API function" described in step S101, or may be performed before the API function is called instead of encapsulating the operation into the API function.
In step S102, receiving an image returned by the API function;
after calling the API function in step S101, the terminal device may obtain an image returned by the API function, and the terminal device may directly display the image stream as a preview image, or store the image in a memory, or perform a packaging process on the image, and send the image to other devices.
Based on the analysis, the API function in the Camera framework in the application is packaged with a process of processing data sent by the remote Camera, and when the terminal device is to acquire a picture acquired by the remote Camera, the API function can be directly called to realize the processing, so that development of the target application program is simple and convenient, and a developer can directly call the corresponding API function when developing the program, and how to process the data returned by the remote Camera (because a specific processing process is packaged into the API function) is not required to be considered, so that the development efficiency of the target application program is improved.
Example two
An embodiment of the present application provides another image obtaining method, which is applied to a terminal device, and please refer to fig. 2, where the image obtaining method includes:
in step S201, if an instruction for instructing the terminal device to acquire an image captured by a Camera is received, an application program interface API function in a Camera framework is called, where the terminal device executes the following operations by calling the API function: judging whether a camera for collecting an image to be acquired is a remote camera or not; if the image is a remote camera, receiving data sent by the remote camera, and processing the data to obtain an image contained in the data; if the terminal equipment is a local camera installed on the terminal equipment, acquiring an image acquired by the local camera;
when the "API function" in step S201 is called, the terminal device may be supported to acquire an image acquired by the remote camera or the local camera. Like the first embodiment, the second embodiment does not limit the number of API functions.
In the second embodiment of the present application, a user may set "a camera that collects an image to be acquired" in advance, for example, the user may set the "camera in a setting application" in the terminal device. Then, when the API function is called, the image acquired by the corresponding camera may be acquired based on the setting of the user, and subsequent operations such as display, storage, or image transmission may be performed.
In the second embodiment of the present application, the terminal device executes the following operations by calling the API function:
judging whether a camera for collecting an image to be acquired is a remote camera or not;
if the image is a remote camera, receiving data sent by the remote camera, and processing the data to obtain an image contained in the data;
and if the local camera is installed on the terminal equipment, acquiring an image acquired by the local camera.
Because the remote camera and the local camera have different access modes, it is necessary to first determine whether the camera for collecting the image to be acquired is the remote camera or the local camera, if the camera is the remote camera, the camera communicates with the remote camera to acquire the image collected by the remote camera, and if the camera is the local camera, the camera communicates with the local camera to acquire the image collected by the local camera.
In step S202, an image returned by the API function is received;
the specific implementation manner of step S202 is the same as that of step S102 in the first embodiment, and specific reference is made to the description of the first embodiment, which is not repeated herein.
In the prior art, an API function for accessing the local Camera is provided in the Camera framework, and based on this, many applications in the prior art, such as WeChat, fighting fish, QQ, and Camera applications, etc., all implement access to the local Camera by calling the API function. Therefore, if the API function described in step S201 is an improvement on the existing API function (i.e., a piece of code is added to the existing API function for accessing the local camera, so that the existing API function adds a function for accessing the remote camera), many existing applications, such as WeChat, Dougu, QQ, or camera applications, can be made to access the remote camera without any improvement.
Based on the technical scheme of the second embodiment of the present application, the following is explained based on fig. 3, so that the current wechat application can transmit the picture collected by the remote camera to the opposite side in real time when performing a video call.
As shown in fig. 3, an application "WeChat" is installed on a terminal device 301, a local camera 302 is installed on the terminal device 301, and the terminal device can communicate with a remote camera 303.
Suppose that the existing wechat application program realizes access to the local Camera 302 by calling an API-X function in a Camera framework in the prior art, so that the wechat can support functions such as video call, for example, when a user makes a video call with a wechat friend, the user can transmit a picture acquired by the local Camera 302 to the other party in real time. In the second embodiment of the present application, if the API-X is modified, when the API-X is called, the terminal device can perform the following operations: judging whether a camera for collecting an image to be acquired is a remote camera or not; if the image is a remote camera, receiving data sent by the remote camera, and processing the data to obtain an image contained in the data; and if the local camera is installed on the terminal equipment, acquiring an image acquired by the local camera. Then, those skilled in the art can easily understand that, in this case, there is no need to change the existing wechat application, that is, when the "camera for acquiring the image is set as the remote camera" (the user may set in advance, that is, set in advance before executing the step S201), the image acquired by the remote camera is acquired and transmitted to the opposite contact in real time, so as to solve the technical problem that the wechat cannot transmit the image acquired by the remote camera to the opposite contact in real time in the prior art. Similarly, based on the technical scheme described in the second embodiment of the present application, the technical problem that in the prior art, live broadcast application programs such as a fish dipper can only live broadcast pictures collected by a local camera can be solved, and specific reasons are not repeated here.
Therefore, in the technical scheme provided by the second embodiment of the application, the terminal device can access the local camera and the remote camera through the API function, so that for a research and development worker of the target application program, the remote camera and the local camera can be monitored only by calling the API function, and great convenience is brought to programming operation. In addition, in the technical solution provided in the second embodiment of the present application, if the API function described in step S201 is "obtained by modifying an API function that is originally used in a Camera framework and accesses a local Camera", an existing application program that supports access to the local Camera may be enabled to access a remote Camera without any modification, that is, the remote Camera may be virtualized as a local Camera, so that some existing application programs (for example, a WeChat, a fighting fish, a QQ, or a Camera application program and the like) may access the remote Camera as accessing the local Camera, thereby solving the technical problem that in the prior art, the WeChat, the fighting fish, the QQ, the Camera application program and the like only can access the local Camera and cannot access the remote Camera, and no modification is required to the application program.
EXAMPLE III
An embodiment of the present application provides another image obtaining method, which is applied to a terminal device, and please refer to fig. 4, where the image obtaining method includes:
in step S401, if an instruction for instructing the terminal device to acquire an image captured by a Camera is received, an application program interface API function in a Camera framework is called, where the terminal device executes the following operations by calling the API function: judging whether the identity mark of a camera for acquiring an image to be acquired is a first mark or a second mark; if the first identification is the first identification, judging whether the camera corresponding to the first identification is a remote camera or not; if the image is a remote camera, receiving data sent by the remote camera, and processing the data to obtain an image contained in the data; if the terminal equipment is a first local camera installed on the terminal equipment, acquiring an image acquired by the first local camera; if the identification is the second identification, judging whether the camera corresponding to the second identification is a remote camera; if the image is a remote camera, receiving data sent by the remote camera, and processing the data to obtain an image contained in the data; if the terminal equipment is a second local camera installed on the terminal equipment, acquiring an image acquired by the second local camera;
in the technical solution provided in the third embodiment of the present application, when the API function in the Camera framework is called, the terminal device can access the Camera corresponding to the first identifier or the Camera corresponding to the second identifier, and both the Camera corresponding to the first identifier and the Camera corresponding to the second identifier may be a remote Camera or a local Camera. As in the first embodiment, the third embodiment also does not specifically limit the number of API functions described in step S401. The API function provided in the third embodiment enables a developer of the target application program to access the two local cameras and the remote camera only by calling the API function, so that the developer can develop the application program conveniently.
At present, most of terminal devices in the prior art are provided with two local cameras, which are a front camera and a rear camera, respectively, and therefore in this embodiment of the application, one of the first local camera and the second local camera in step S401 may be the front camera, and the other may be the rear camera.
In addition, in the third embodiment of the present application, before the step S401 is executed, an operation interface (which may be added to a "setting application") may be provided to the user, and the user may perform setting on the operation interface, so as to determine the cameras corresponding to the first identifier and the second identifier respectively.
In this embodiment of the application, the camera corresponding to the first identifier may be preset to be a first local camera, the camera corresponding to the second identifier may be preset to be a second local camera, and then, based on the initial setting and the setting of the user on the operation interface, it is determined whether the cameras corresponding to the first identifier and the second identifier are remote cameras or corresponding local cameras. For example, the operation interface may display the searched remote camera for the user to select; secondly, establishing connection with a remote camera selected by a user; then, if the connection is successful, setting operation of the user on the identity of the remote camera which is successfully connected is detected, if the user is detected to set the identity of the remote camera which is successfully connected as the first identity, the camera corresponding to the first identity is set as the remote camera, and if the user is detected to set the identity of the remote camera which is successfully connected as the second identity, the camera corresponding to the second identity is set as the remote camera.
In addition, the user can change the camera corresponding to the first identifier to the first local camera and change the camera corresponding to the second identifier to the second local camera on the operation interface.
As shown in fig. 5, the terminal device provides an operation interface for a user, after entering the operation interface, the user can turn on a search switch on the operation interface, and after detecting that the search switch is turned on, the terminal device searches for a remote camera and displays the searched remote cameras on the operation interface in a list form; secondly, a user can click any remote camera on the operation interface, and when the terminal equipment detects the click operation of the user, the connection is established with the remote camera clicked by the user; and then if the connection is successful, reminding the user to set the remote camera as a front camera or a rear camera.
The skilled person can easily understand that "reminding the user to set the remote camera as a front-facing camera or a rear-facing camera" as described herein is equivalent to "reminding the user to set the identity of the remote camera as a first identity or a second identity", and since the first identity and the second identity are relatively difficult to abstract and may be difficult to understand by a general consumer, on the operation interface, the identity of the remote camera can be determined by reminding the user to set the remote camera as a front-facing camera or a rear-facing camera, and the skilled person can easily understand that, if the remote camera is set as a front-facing camera, it is equivalent to virtualizing the remote camera as a local front-facing camera, that is, if the identity of the front-facing camera is initially preset as the second identity, the identity of the rear-facing camera is the first identity, then, if the user sets the remote camera as the front camera through the operation interface, it can be determined that the camera corresponding to the second identifier is changed from the local front camera to the remote camera, and the camera corresponding to the first identifier is still the rear camera.
At present, most of terminal devices in the prior art are provided with a front Camera and a rear Camera, and in order to enable an application program in the terminal device to access the front Camera and the rear Camera, an API function for acquiring an image acquired by the front Camera or the rear Camera is provided in an existing Camera framework. In the third embodiment of the present application, the existing API function may be modified, so that when the modified API function is called, the terminal device can implement "determining whether the identity identifier of the camera acquiring the image to be acquired is the first identifier or the second identifier … … to acquire the image acquired by the second local camera" in step S401. In this case, it is possible to make the remote camera accessible to the existing application programs capable of accessing the front and rear cameras without any modification. This is explained in more detail below with reference to fig. 6.
In the prior art, in order to distinguish the front camera from the rear camera, different identifiers need to be respectively allocated to the front camera and the rear camera, for example, if the identifier of the front camera is a first identifier (for example, 00) and the identifier of the rear camera is a second identifier (for example, 01), when an existing API function is called, the terminal device may first determine the identifier of the camera acquiring the image to be acquired, and if the identifier is the first identifier, acquire the image acquired by the front camera, and then return the image to the application program. How a camera application displays an image captured by a front camera as a preview screen in the prior art is described with reference to fig. 6 (a). As shown in fig. 6(a), the terminal device calls an API function in an existing Camera framework to obtain an image captured by the front Camera, and returns the image to the Camera application, wherein in step S604a, if the terminal device detects that the identifier of the started Camera is the first identifier, the terminal device may call a V4L2 video driver framework to obtain the image captured by the Camera (i.e., the front Camera) corresponding to the first identifier, so as to return to the Camera application, so that the Camera application obtains the image captured by the front Camera, and performs a preview screen display.
In the third embodiment of the present application, an existing API function may be modified, so that when the modified API function is called, the "determining whether the identity identifier of the camera acquiring the image to be acquired is the first identifier or the second identifier … … and then acquiring the image acquired by the second local camera" in step S401 may be implemented, where the specific modified method may be: when the API function is called, step S604a executed by the terminal device is changed to step S604 b. That is, when the modified API function is called, if it is detected that the identifier of the enabled camera is the first identifier, the following operations are performed in the HAL layer:
judging whether the camera corresponding to the first identifier is a remote camera or not;
if so, receiving data returned by the remote camera, processing the data, and acquiring an image contained in the data;
if not, the V4L2 video frame may be called to obtain the image captured by the first identified camera (i.e., the front camera).
Similarly, if the camera identifier detected to be started is the second identifier, the following operations are executed on the HAL layer:
judging whether the camera corresponding to the second identifier is a remote camera or not;
if so, receiving data returned by the remote camera, processing the data, and acquiring an image contained in the data;
if not, the V4L2 video frame may be called to obtain an image captured by the second identified camera (i.e., the rear camera).
As can be seen from this, in the example shown in fig. 6, for the Camera application, when the user sets the Camera for acquiring the image to be acquired in the Camera application as the "front Camera", that is, it is equivalent to inform the API function in the Camera framework that the identity of the Camera for acquiring the image to be acquired is the first identifier, and if the Camera corresponding to the first identifier is set as the remote Camera in advance (for example, the user sets the remote Camera as the front Camera in the operation interface in advance), the picture acquired by the remote Camera may be displayed in the Camera application. Obviously, the access to the remote camera can be realized without modifying the camera application program, and the access to the remote camera can also be realized without modifying other application programs such as WeChat, fighting fish or QQ and the like.
In the third embodiment of the present application, the terminal device can access the two local cameras and the remote camera through the API function, so that for the research and development personnel of the target application program, the monitoring on the remote camera and the two local cameras can be realized only by calling the API function, which is greatly convenient for programming operation.
In addition, in the technical solution provided in the third embodiment of the present application, if the terminal device provides an operation interface so that the user can set the cameras corresponding to the first identifier or the second identifier, and the API function in step S401 is obtained by modifying the API function that is originally used in the Camera framework and accesses the front-facing Camera and the rear-facing Camera, the application program that can be accessed by the front-facing Camera or the rear-facing Camera at present can be made to access the remote Camera without any modification. For example, for a WeChat application program, if a user sets a remote camera as a front-facing camera on an operation interface, then when the user uses WeChat to perform video call, if the front-facing camera is turned on, pictures acquired by the remote camera can be sent to a contact of the opposite party, and therefore the technical problem that some existing application programs can only access a local camera and cannot access the remote camera is solved.
Example four
The fourth embodiment of the application provides an image acquisition device. For convenience of explanation, only a part related to the present application is shown, and as shown in fig. 7, the image capturing apparatus 700 includes:
the API calling module 701 is configured to call an API function, which is used for accessing the Camera and is in the Camera framework, if an instruction for instructing the terminal device to acquire an image acquired by the Camera is received;
a returned image receiving module 702, configured to receive an image returned by the API function;
wherein the API function includes a remote data processing module: the system comprises a remote camera, a data processing module and a data processing module, wherein the data processing module is used for receiving data sent by the remote camera and processing the data to obtain images contained in the data.
Optionally, the API function further includes:
the remote judgment module is used for judging whether a camera for acquiring an image to be acquired is a remote camera;
correspondingly, the remote data processing module is specifically configured to:
if the remote judgment module judges that the result is a remote camera, receiving data sent by the remote camera, and processing the data to obtain an image contained in the data;
accordingly, the API function further includes:
and the local image acquisition module is used for acquiring the image acquired by the local camera if the local camera is installed on the terminal equipment.
Optionally, the terminal device is configured to obtain a picture acquired by a camera with a first identifier or a second identifier when calling the API function;
accordingly, the API function further includes:
the identification judgment module is used for judging whether the identity identification of the camera for acquiring the image to be acquired is the first identification or the second identification;
correspondingly, the remote judging module, the remote data processing module and the local image acquiring module are specifically configured to:
if the first identification is the first identification, judging whether the camera corresponding to the first identification is a remote camera or not; if the image is a remote camera, receiving data sent by the remote camera, and processing the data to obtain an image contained in the data; if the terminal equipment is a first local camera installed on the terminal equipment, acquiring an image acquired by the first local camera;
if the second identification is the second identification, judging whether the camera corresponding to the second identification is a remote camera or not; if the image is a remote camera, receiving data sent by the remote camera, and processing the data to obtain an image contained in the data; and if the image is a second local camera installed on the terminal equipment, acquiring the image acquired by the second local camera.
Optionally, the image capturing apparatus 700 further includes:
and the operation interface module is used for providing an operation interface for a user, determining whether the camera corresponding to the first identifier is a remote camera or the first local camera according to the setting of the user on the operation interface, and determining whether the camera corresponding to the second identifier is a remote camera or the second local camera.
Optionally, one of the first local camera and the second local camera is a front-facing camera on the terminal device, and the other is a rear-facing camera on the terminal device;
the API function is: and modifying the API function used for acquiring the images acquired by the front Camera and the rear Camera in the Camera framework to obtain a function.
Optionally, the camera corresponding to the first identifier is preset as the first local camera, and the camera corresponding to the second identifier is preset as the second local camera;
correspondingly, the operation interface module comprises:
the remote searching unit is used for searching the remote camera and displaying the searched remote camera to the operation interface for the user to select;
the connection establishing unit is used for establishing connection with the remote camera selected by the user;
the detection unit is used for detecting the setting operation of the user on the identity of the remote camera which is successfully connected if the connection is successful;
the setting unit is used for setting the camera corresponding to the first identifier as the remote camera if the fact that the user sets the identity identifier of the remote camera which is successfully connected as the first identifier is detected; and if the fact that the user sets the identity identification of the remote camera which is successfully connected as the second identification is detected, setting the camera corresponding to the second identification as the remote camera.
Optionally, the remote data processing module includes:
the request unit is used for sending a request to the remote camera to acquire the image resolution, the data transmission protocol and the image coding format supported by the remote camera;
the receiving unit is used for receiving the data sent by the remote camera;
and the processing unit is used for processing the received data sent by the remote camera based on the acquired image resolution, data transmission protocol and image coding format supported by the remote camera, and acquiring an image from the data.
It should be noted that, for the information interaction, execution process, and other contents between the above-mentioned devices/units, since the first method embodiment and the second method embodiment are based on the same concept, specific functions and technical effects thereof may be specifically referred to a corresponding method embodiment part, and details are not described herein again.
EXAMPLE five
Fig. 8 is a schematic diagram of a terminal device provided in the fifth embodiment of the present application. As shown in fig. 8, the terminal apparatus 800 of this embodiment includes: a processor 801, a memory 802, and a computer program 803 stored in the memory 802 and operable on the processor 801. The steps in the various method embodiments described above are implemented when the processor 801 described above executes the computer program 803 described above. Alternatively, the processor 801 implements the functions of the modules/units in the device embodiments when executing the computer program 803.
Illustratively, the computer program 803 may be divided into one or more modules/units, which are stored in the memory 802 and executed by the processor 801 to complete the present application. The one or more modules/units may be a series of computer program instruction segments capable of performing specific functions, which are used to describe the execution process of the computer program 803 in the terminal device 800. For example, the computer program 803 may be divided into an API call module and a return image receiving module, and the specific functions of the modules are as follows:
if an instruction for instructing the terminal equipment to acquire the image acquired by the Camera is received, calling an Application Program Interface (API) function for accessing the Camera in a Camera Camera framework;
receiving an image returned by the API function;
the terminal device executes the following operations by calling the API function:
and receiving data sent by a remote camera, and processing the data to obtain an image contained in the data.
The terminal device may include, but is not limited to, a processor 801 and a memory 802. Those skilled in the art will appreciate that fig. 8 is merely an example of a terminal device 800 and does not constitute a limitation of terminal device 800 and may include more or fewer components than shown, or some components may be combined, or different components, e.g., the terminal device may also include input-output devices, network access devices, buses, etc.
The Processor 801 may be a Central Processing Unit (CPU), other general purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic, discrete hardware components, etc. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The storage 802 may be an internal storage unit of the terminal device 800, such as a hard disk or a memory of the terminal device 800. The memory 802 may also be an external storage device of the terminal device 800, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), and the like, which are provided on the terminal device 800. Further, the memory 802 may include both an internal storage unit and an external storage device of the terminal device 800. The memory 802 is used for storing the computer program and other programs and data required by the terminal device. The memory 802 may also be used to temporarily store data that has been output or is to be output.
It will be apparent to those skilled in the art that, for convenience and brevity of description, only the above-mentioned division of the functional units and modules is illustrated, and in practical applications, the above-mentioned functions may be distributed as different functional units and modules according to needs, that is, the internal structure of the apparatus may be divided into different functional units or modules to implement all or part of the above-mentioned functions.
In the above embodiments, the descriptions of the respective embodiments have respective emphasis, and reference may be made to the related descriptions of other embodiments for parts that are not described or illustrated in a certain embodiment.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus/terminal device and method may be implemented in other ways. For example, the above-described embodiments of the apparatus/terminal device are merely illustrative, and for example, the division of the above modules or units is only one logical function division, and there may be other division manners in actual implementation, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed.
In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated modules/units described above, if implemented in the form of software functional units and sold or used as separate products, may be stored in a computer readable storage medium. Based on such understanding, all or part of the processes in the above method embodiments may be implemented by a computer program, which may be stored in a computer readable storage medium and executed by a processor, so as to implement the steps of the above method embodiments. The computer program includes computer program code, and the computer program code may be in a source code form, an object code form, an executable file or some intermediate form. The computer readable medium may include: any entity or device capable of carrying the above-mentioned computer program code, recording medium, usb disk, removable hard disk, magnetic disk, optical disk, computer Memory, Read-Only Memory (ROM), Random Access Memory (RAM), electrical carrier wave signal, telecommunication signal, software distribution medium, etc. It should be noted that the computer readable medium described above may include content that is subject to appropriate increase or decrease as required by legislation and patent practice in jurisdictions, for example, in some jurisdictions, computer readable media that does not include electrical carrier signals and telecommunications signals in accordance with legislation and patent practice.
The above embodiments are only used for illustrating the technical solutions of the present application, and not for limiting the same; although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; such modifications and substitutions do not substantially depart from the spirit and scope of the embodiments of the present application and are intended to be included within the scope of the present application.

Claims (8)

1. An image acquisition method is applied to terminal equipment and is characterized by comprising the following steps:
if an instruction for instructing the terminal equipment to acquire the image acquired by the Camera is received, calling an Application Program Interface (API) function for accessing the Camera in a Camera Camera framework;
receiving an image returned by the API function;
when the terminal device calls the API function, the terminal device is configured to obtain a picture acquired by a camera with a first identity or a second identity, and the terminal device executes the following operations by calling the API function:
judging whether the identity mark of a camera for collecting the image to be acquired is the first mark or the second mark;
if the first identification is the first identification, judging whether the camera corresponding to the first identification is a remote camera or not; if the image is a remote camera, receiving data sent by the remote camera, and processing the data to obtain an image contained in the data; if the terminal equipment is a first local camera installed on the terminal equipment, acquiring an image acquired by the first local camera;
if the second identification is the second identification, judging whether the camera corresponding to the second identification is a remote camera or not; if the image is a remote camera, receiving data sent by the remote camera, and processing the data to obtain an image contained in the data; and if the image is a second local camera installed on the terminal equipment, acquiring the image acquired by the second local camera.
2. The image capturing method according to claim 1, wherein before the step of calling an API function in a Camera framework for accessing a Camera if an instruction for instructing the terminal device to capture an image captured by the Camera is received, the image capturing method further comprises:
and providing an operation interface for a user, determining whether the camera corresponding to the first identifier is a remote camera or the first local camera according to the setting of the user on the operation interface, and determining whether the camera corresponding to the second identifier is a remote camera or the second local camera.
3. The image acquisition method according to claim 2, wherein one of the first local camera and the second local camera is a front camera on the terminal device, and the other is a rear camera on the terminal device;
the API function is: and modifying the API function used for acquiring the images acquired by the front Camera and the rear Camera in the Camera framework to obtain a function.
4. The image acquisition method according to claim 2, wherein a camera corresponding to the first identifier is preset as the first local camera, and a camera corresponding to the second identifier is preset as the second local camera;
correspondingly, the providing an operation interface for the user, determining whether the camera corresponding to the first identifier is a remote camera or the first local camera and determining whether the camera corresponding to the second identifier is a remote camera or the second local camera according to the setting of the user on the operation interface, includes:
searching a remote camera, and displaying the searched remote camera to the operation interface for the user to select;
establishing connection with a remote camera selected by a user;
if the connection is successful, detecting the setting operation of the user on the identity of the successfully connected remote camera;
if the fact that the user sets the identity identification of the remote camera which is successfully connected as the first identification is detected, setting the camera corresponding to the first identification as the remote camera; and if the fact that the user sets the identity identification of the remote camera which is successfully connected as the second identification is detected, setting the camera corresponding to the second identification as the remote camera.
5. The image acquisition method according to any one of claims 1 to 4, wherein the receiving data sent by the remote camera, and processing the data to obtain the image included in the data, comprises:
sending a request to the remote camera to acquire the image resolution, the data transmission protocol and the image coding format supported by the remote camera;
receiving data sent by the remote camera;
and processing the received data sent by the remote camera based on the acquired image resolution, data transmission protocol and image coding format supported by the remote camera, and acquiring an image from the data.
6. An image acquisition device applied to a terminal device, comprising:
the API calling module is used for calling an API function used for accessing the Camera in the Camera Camera framework if an instruction used for indicating the terminal equipment to acquire the image acquired by the Camera is received;
the returned image receiving module is used for receiving the image returned by the API function;
the terminal equipment is used for acquiring a picture acquired by a camera with a first identity or a second identity when calling the API function; the API function includes:
the identification judgment module is used for judging whether the identity identification of the camera for acquiring the image to be acquired is the first identification or the second identification;
the remote judgment module, the remote data processing module and the local image acquisition module are specifically used for:
if the first identification is the first identification, judging whether the camera corresponding to the first identification is a remote camera or not; if the image is a remote camera, receiving data sent by the remote camera, and processing the data to obtain an image contained in the data; if the terminal equipment is a first local camera installed on the terminal equipment, acquiring an image acquired by the first local camera;
if the second identification is the second identification, judging whether the camera corresponding to the second identification is a remote camera or not; if the image is a remote camera, receiving data sent by the remote camera, and processing the data to obtain an image contained in the data; and if the image is a second local camera installed on the terminal equipment, acquiring the image acquired by the second local camera.
7. A terminal device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that the processor implements the steps of the image acquisition method according to any one of claims 1 to 5 when executing the computer program.
8. A computer-readable storage medium, in which a computer program is stored which, when being executed by a processor, carries out the steps of the image acquisition method according to any one of claims 1 to 5.
CN202010124625.4A 2020-02-27 2020-02-27 Image acquisition method, image acquisition device, terminal device and readable storage medium Active CN111314646B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010124625.4A CN111314646B (en) 2020-02-27 2020-02-27 Image acquisition method, image acquisition device, terminal device and readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010124625.4A CN111314646B (en) 2020-02-27 2020-02-27 Image acquisition method, image acquisition device, terminal device and readable storage medium

Publications (2)

Publication Number Publication Date
CN111314646A CN111314646A (en) 2020-06-19
CN111314646B true CN111314646B (en) 2021-04-23

Family

ID=71151571

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010124625.4A Active CN111314646B (en) 2020-02-27 2020-02-27 Image acquisition method, image acquisition device, terminal device and readable storage medium

Country Status (1)

Country Link
CN (1) CN111314646B (en)

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111901661B (en) * 2020-07-30 2022-05-24 海信视像科技股份有限公司 Video recording method, video playing method and display equipment
CN112199127A (en) * 2020-10-10 2021-01-08 Oppo(重庆)智能科技有限公司 Image data processing method and device, mobile terminal and storage medium
CN115878252A (en) * 2021-09-28 2023-03-31 华为技术有限公司 Virtual equipment operation method
CN114501136B (en) * 2022-01-12 2023-11-10 惠州Tcl移动通信有限公司 Image acquisition method, device, mobile terminal and storage medium
CN114584738A (en) * 2022-05-06 2022-06-03 深圳市飞图视讯有限公司 Camera sharing method and device, terminal equipment and storage medium
CN115242972A (en) * 2022-06-23 2022-10-25 深圳康佳电子科技有限公司 Method and device for calling camera by application, electronic equipment and storage medium

Citations (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20060242677A1 (en) * 2005-04-20 2006-10-26 Anthony V. Pugliese Iii Extendible and open camera connector system
CN103036912A (en) * 2013-01-14 2013-04-10 深圳市瑞彩电子技术有限公司 HTTP (Hyper Text Transport Protocol)-based IP (Internet Protocol) camera access method, service and system
CN103366780A (en) * 2012-03-31 2013-10-23 盛乐信息技术(上海)有限公司 Multimedia player engine system and use method thereof, and multimedia player
CN103442071A (en) * 2013-08-30 2013-12-11 华南理工大学 Mobile phone screen content real-time sharing method
US20150007199A1 (en) * 2013-06-28 2015-01-01 Vmware, Inc. Method and system for extending application programming interfaces
US9852294B1 (en) * 2014-06-24 2017-12-26 Symantec Corporation Systems and methods for detecting suspicious applications based on how entry-point functions are triggered
CN108304247A (en) * 2017-12-19 2018-07-20 华为技术有限公司 The method and apparatus of access camera, server, readable storage medium storing program for executing
CN108769540A (en) * 2018-08-30 2018-11-06 宇龙计算机通信科技(深圳)有限公司 A kind of image pickup method and equipment using remote terminal
CN109068059A (en) * 2018-08-27 2018-12-21 Oppo广东移动通信有限公司 A kind of method, mobile terminal and storage medium calling camera
EP3442217A1 (en) * 2012-08-22 2019-02-13 2236008 Ontario Inc. Composition manager camera
CN110287040A (en) * 2019-06-26 2019-09-27 苏宁消费金融有限公司 A kind of realization system of remote call service frame
CN110650307A (en) * 2019-10-30 2020-01-03 广州河东科技有限公司 QT-based audio and video plug flow method, device, equipment and storage medium
CN110769179A (en) * 2018-07-25 2020-02-07 视联动力信息技术股份有限公司 Audio and video data stream processing method and system

Patent Citations (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20060242677A1 (en) * 2005-04-20 2006-10-26 Anthony V. Pugliese Iii Extendible and open camera connector system
CN103366780A (en) * 2012-03-31 2013-10-23 盛乐信息技术(上海)有限公司 Multimedia player engine system and use method thereof, and multimedia player
EP3442217A1 (en) * 2012-08-22 2019-02-13 2236008 Ontario Inc. Composition manager camera
CN103036912A (en) * 2013-01-14 2013-04-10 深圳市瑞彩电子技术有限公司 HTTP (Hyper Text Transport Protocol)-based IP (Internet Protocol) camera access method, service and system
US20150007199A1 (en) * 2013-06-28 2015-01-01 Vmware, Inc. Method and system for extending application programming interfaces
CN103442071A (en) * 2013-08-30 2013-12-11 华南理工大学 Mobile phone screen content real-time sharing method
US9852294B1 (en) * 2014-06-24 2017-12-26 Symantec Corporation Systems and methods for detecting suspicious applications based on how entry-point functions are triggered
CN108304247A (en) * 2017-12-19 2018-07-20 华为技术有限公司 The method and apparatus of access camera, server, readable storage medium storing program for executing
CN110769179A (en) * 2018-07-25 2020-02-07 视联动力信息技术股份有限公司 Audio and video data stream processing method and system
CN109068059A (en) * 2018-08-27 2018-12-21 Oppo广东移动通信有限公司 A kind of method, mobile terminal and storage medium calling camera
CN108769540A (en) * 2018-08-30 2018-11-06 宇龙计算机通信科技(深圳)有限公司 A kind of image pickup method and equipment using remote terminal
CN110287040A (en) * 2019-06-26 2019-09-27 苏宁消费金融有限公司 A kind of realization system of remote call service frame
CN110650307A (en) * 2019-10-30 2020-01-03 广州河东科技有限公司 QT-based audio and video plug flow method, device, equipment and storage medium

Also Published As

Publication number Publication date
CN111314646A (en) 2020-06-19

Similar Documents

Publication Publication Date Title
CN111314646B (en) Image acquisition method, image acquisition device, terminal device and readable storage medium
CN107295352B (en) Video compression method, device, equipment and storage medium
WO2015100990A1 (en) Inter-terminal image sharing method, terminal device and communication system
CN113542757A (en) Image transmission method and device for cloud application, server and storage medium
CN111212264A (en) Image processing method and device based on edge calculation and storage medium
CN112486620A (en) Cross-process off-screen rendering method and device, electronic equipment and storage medium
CN109302639B (en) Bullet screen message distribution method, bullet screen message distribution device, terminal and storage medium
US20160267624A1 (en) Information terminal and image display system
US20240073488A1 (en) Live video processing method and apparatus, device and medium
CN112738620A (en) Media resource screen projection method, equipment and system
CN112351221B (en) Image special effect processing method, device, electronic equipment and computer readable storage medium
CN108959393B (en) Dynamic picture processing method, device and storage medium
CN113190196B (en) Multi-device linkage realization method and device, medium and electronic device
EP4180942A1 (en) Screen projection method and apparatus, electronic device, and computer readable storage medium
CN115237481A (en) Method, device and equipment for driving external equipment and storage medium
CN111885417B (en) VR video playing method, device, equipment and storage medium
CN113055350B (en) Data transmission method, device, equipment and readable storage medium
CN113852763A (en) Audio and video processing method and device, electronic equipment and storage medium
CN110673919A (en) Screen capturing method and device
CN103974087A (en) Video image file compressing system, client and method
CN116546262A (en) Data processing method, device, equipment and storage medium
CN112804574A (en) Multimedia content transmission and playing method and device
CN113918849A (en) Page display method, device and system, electronic equipment and storage medium
CN106851134B (en) Method, device and system for transmitting image data
US20240089560A1 (en) Video generation method, apparatus, electronic device and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant