CN117425071B - Image acquisition method, electronic equipment and storage medium - Google Patents

Image acquisition method, electronic equipment and storage medium Download PDF

Info

Publication number
CN117425071B
CN117425071B CN202311726713.1A CN202311726713A CN117425071B CN 117425071 B CN117425071 B CN 117425071B CN 202311726713 A CN202311726713 A CN 202311726713A CN 117425071 B CN117425071 B CN 117425071B
Authority
CN
China
Prior art keywords
camera
image
imaging target
acquisition
electronic device
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
CN202311726713.1A
Other languages
Chinese (zh)
Other versions
CN117425071A (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.)
Honor Device Co Ltd
Original Assignee
Honor Device 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 Honor Device Co Ltd filed Critical Honor Device Co Ltd
Priority to CN202311726713.1A priority Critical patent/CN117425071B/en
Publication of CN117425071A publication Critical patent/CN117425071A/en
Application granted granted Critical
Publication of CN117425071B publication Critical patent/CN117425071B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N23/00Cameras or camera modules comprising electronic image sensors; Control thereof
    • H04N23/60Control of cameras or camera modules
    • H04N23/67Focus control based on electronic image sensor signals
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N23/00Cameras or camera modules comprising electronic image sensors; Control thereof
    • H04N23/60Control of cameras or camera modules
    • H04N23/67Focus control based on electronic image sensor signals
    • H04N23/671Focus control based on electronic image sensor signals in combination with active ranging signals, e.g. using light or sound signals emitted toward objects

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Studio Devices (AREA)

Abstract

本申请涉及电子技术领域,尤其涉及一种图像采集方法、电子设备及计算机可读存储介质。其中,方法应用于包括第一摄像头和第二摄像头(例如主摄像头和其他摄像头)的电子设备。方法包括:检测到采集指令,例如用户打开扫码程序后生成的指令,则控制第一摄像头和第二摄像头进行采集,并显示第一摄像头的采集画面;对应于在第一摄像头采集的图像中未检测到成像目标,如未检测到二维码,并且检测到第二摄像头以第一采集参数采集的第一图像中存在成像目标,如检测到二维码,则根据第一采集参数控制第一摄像头进行采集,得到包括成像目标的第二图像。本申请的方案可以充分利用多个摄像头的采集能力,提高第一摄像头的采集效率,以及识别成像目标的效率。

The present application relates to the field of electronic technology, and in particular to an image acquisition method, an electronic device, and a computer-readable storage medium. The method is applied to an electronic device including a first camera and a second camera (such as a main camera and another camera). The method includes: when an acquisition instruction is detected, such as an instruction generated after a user opens a code scanning program, the first camera and the second camera are controlled to acquire data, and the acquisition screen of the first camera is displayed; corresponding to the imaging target not being detected in the image acquired by the first camera, such as the QR code not being detected, and the imaging target being detected in the first image acquired by the second camera with the first acquisition parameter, if the QR code is detected, the first camera is controlled to acquire data according to the first acquisition parameter to obtain a second image including the imaging target. The scheme of the present application can make full use of the acquisition capabilities of multiple cameras, improve the acquisition efficiency of the first camera, and the efficiency of identifying the imaging target.

Description

一种图像采集方法、电子设备及存储介质Image acquisition method, electronic device and storage medium

技术领域Technical Field

本申请涉及电子技术领域,尤其涉及一种图像采集方法、电子设备及存储介质。The present application relates to the field of electronic technology, and in particular to an image acquisition method, electronic equipment and storage medium.

背景技术Background Art

目前人们越来越多地使用电子设备(例如,手机、平板电脑等终端设备、门禁设备)来对现实环境进行采集,来获取环境中成像目标(例如,图形码、人物、动物、文件等)的图像,并基于采集到的成像目标的图像来实现相关的功能。例如,电子设备可以通过采集图形码的图像,来识别图形码中所携带的信息,并基于识别出的信息来执行对应的功能,例如访问网页、下载应用程序(application,APP)、关注账号、扫码付款等。又例如,门禁系统可以通过采集环境中的用户头像,以识别出该用户是否具有通过门禁系统的权限。At present, more and more people use electronic devices (for example, mobile phones, tablet computers and other terminal devices, access control devices) to collect real-world environments, to obtain images of imaging targets (for example, graphic codes, people, animals, files, etc.) in the environment, and to implement related functions based on the images of the imaging targets collected. For example, electronic devices can identify the information carried in the graphic code by collecting images of the graphic code, and perform corresponding functions based on the identified information, such as accessing web pages, downloading applications (applications, APPs), following accounts, scanning codes to pay, etc. For another example, the access control system can collect user portraits in the environment to identify whether the user has the authority to pass through the access control system.

但在实际应用场景中,电子设备的摄像头启动时的初始对焦区域通常并不在成像目标所处的区域,使得摄像头所采集到的图像中成像目标的图像并不清晰。电子设备需要不断地调整采集参数(例如由近到远或由远到近调整对焦区域),来获取成像目标的清晰图像,导致电子设备采集成像目标的清晰图像耗时较长,影响电子设备基于采集到的图像实现相关功能的效率。However, in actual application scenarios, the initial focus area of the electronic device's camera when it is turned on is usually not in the area where the imaging target is located, so that the image of the imaging target in the image captured by the camera is not clear. The electronic device needs to constantly adjust the acquisition parameters (for example, adjust the focus area from near to far or from far to near) to obtain a clear image of the imaging target, which results in a long time for the electronic device to acquire a clear image of the imaging target, affecting the efficiency of the electronic device in implementing related functions based on the captured image.

发明内容Summary of the invention

本申请的目的在于提供一种图像采集方法、电子设备及计算机可读存储介质。The purpose of this application is to provide an image acquisition method, an electronic device and a computer-readable storage medium.

第一方面,本申请提供一种图像采集方法,应用于电子设备,电子设备包括第一摄像头和第二摄像头;并且方法包括:检测到采集指令,控制第一摄像头和第二摄像头进行采集,并显示第一摄像头的采集画面;对应于在第一摄像头采集的图像中未检测到成像目标,并且检测到第二摄像头以第一采集参数采集的第一图像中存在成像目标;根据第一采集参数控制第一摄像头进行采集,得到包括成像目标的第二图像,并显示第二图像。In a first aspect, the present application provides an image acquisition method, which is applied to an electronic device, the electronic device comprising a first camera and a second camera; and the method comprises: detecting an acquisition instruction, controlling the first camera and the second camera to perform acquisition, and displaying the acquisition screen of the first camera; corresponding to the imaging target not being detected in the image captured by the first camera, and detecting the presence of the imaging target in the first image captured by the second camera with a first acquisition parameter; controlling the first camera to perform acquisition according to the first acquisition parameter to obtain a second image including the imaging target, and displaying the second image.

即在本申请实施例中,在第一摄像头采集的图像中未检测到成像目标,而第二摄像头采集的图像中检测到了图像目标的情况下,可以控制第一摄像头重新调整采集参数进行采集,以采集得到包括成像目标的图像。可以理解,在第一摄像头重新采集之前,电子设备上显示的采集画面中,成像目标的图像不够清晰;而在第一摄像头根据第二摄像头的第一采集参数重新采集之后,电子设备上显示的采集画面中可以显示较为清晰的成像目标,即可以从第一摄像头新采集的图像中检测到成像目标。That is, in the embodiment of the present application, when the imaging target is not detected in the image captured by the first camera, but the imaging target is detected in the image captured by the second camera, the first camera can be controlled to readjust the acquisition parameters for acquisition to acquire an image including the imaging target. It can be understood that before the first camera re-acquires, the image of the imaging target in the acquisition screen displayed on the electronic device is not clear enough; and after the first camera re-acquires according to the first acquisition parameters of the second camera, the acquisition screen displayed on the electronic device can display a clearer imaging target, that is, the imaging target can be detected from the image newly captured by the first camera.

通过本申请实施例,可以使用除第一摄像头之外的第二摄像头进行采集及目标识别,在第一摄像头没有识别到、第二摄像头识别到成像目标的情况下,根据第二摄像头的采集参数来控制第一摄像头采集到成像目标足够清晰的第一目标图像,从而能够加快第一摄像头识别到成像目标的速度,提高第一摄像头的目标识别效率。Through the embodiments of the present application, a second camera other than the first camera can be used for acquisition and target recognition. When the first camera fails to recognize the imaging target but the second camera recognizes the imaging target, the first camera can be controlled according to the acquisition parameters of the second camera to acquire a sufficiently clear first target image of the imaging target, thereby speeding up the speed at which the first camera recognizes the imaging target and improving the target recognition efficiency of the first camera.

在上述第一方面的一种可能的实现中,第一摄像头基于第一对焦策略进行采集,第二摄像头基于第二对焦策略进行采集,第一对焦策略和第二对焦策略不同。In a possible implementation of the first aspect above, the first camera collects images based on a first focus strategy, and the second camera collects images based on a second focus strategy, and the first focus strategy and the second focus strategy are different.

在上述第一方面的一种可能的实现中,第一对焦策略为对焦点由近至远采集多张图像,第二对焦策略为对焦点由远至近采集多张图像。成像目标到电子设备的距离大于预设距离。In a possible implementation of the first aspect, the first focusing strategy is to capture multiple images from near to far focus points, and the second focusing strategy is to capture multiple images from far to near focus points. The distance from the imaging target to the electronic device is greater than a preset distance.

即在本申请实施例中,第一对焦策略为将第一摄像头的对焦点或者对焦区域由近及远遍历,其间第一摄像头可以基于预设频率不断采集图像,并且,成像目标到电子设备的距离大于预设距离,表示成像目标处于远景处。同理,第二对焦策略为将第二摄像头的对焦点或者对焦区域由远及近遍历,其间第二摄像头可以基于预设频率不断采集图像。That is, in the embodiment of the present application, the first focus strategy is to traverse the focus point or focus area of the first camera from near to far, during which the first camera can continuously collect images based on a preset frequency, and the distance between the imaging target and the electronic device is greater than the preset distance, indicating that the imaging target is in the distance. Similarly, the second focus strategy is to traverse the focus point or focus area of the second camera from far to near, during which the second camera can continuously collect images based on a preset frequency.

通过本申请实施例,第二摄像头可以快速识别到远景的成像目标,并使第一摄像头能够根据第二摄像头的采集参数来调整,从而使得第一摄像头也能够快速识别到远景的成像目标,提升第一摄像头在该场景(成像目标位于较远处)下的目标检测效率。Through the embodiments of the present application, the second camera can quickly identify imaging targets in the distance, and enable the first camera to adjust according to the acquisition parameters of the second camera, so that the first camera can also quickly identify imaging targets in the distance, thereby improving the target detection efficiency of the first camera in this scenario (the imaging target is located at a relatively far distance).

在上述第一方面的一种可能的实现中,检测到第二摄像头以第一采集参数采集的第一图像中存在成像目标,包括:对第二摄像头采集的、采集范围与第一摄像头的采集范围相对应的多张图像进行检测,检测出存在成像目标的第一图像。In a possible implementation of the first aspect above, detecting the presence of an imaging target in a first image captured by a second camera with a first acquisition parameter includes: detecting a plurality of images captured by the second camera, whose acquisition range corresponds to the acquisition range of the first camera, and detecting the first image in which the imaging target exists.

即在本申请实施例中,对第二摄像头采集图像的检测范围,以及对第一摄像头采集图像的检测范围,其对应的现实环境的范围是一致的。例如,第一摄像头采集图像的视场角为第一角度,则可以对第二摄像头采集的图像进行裁切,对该裁切得到的图像进行检测;其中,裁切得到的图像所对应的视场角即为上述的第一角度。That is, in the embodiment of the present application, the detection range of the image captured by the second camera and the detection range of the image captured by the first camera correspond to the same range of the real environment. For example, if the field of view of the image captured by the first camera is a first angle, the image captured by the second camera can be cropped and the cropped image can be detected; wherein the field of view corresponding to the cropped image is the first angle mentioned above.

在上述第一方面的一种可能的实现中,根据第一采集参数控制第一摄像头进行采集,得到包括成像目标的第二图像,并显示第二图像,包括:根据第一采集参数,确定成像目标至电子设备的距离;基于成像目标至电子设备的距离,确定第一摄像头采集第二图像所需的第二采集参数;控制第一摄像头以第二采集参数进行采集,得到包括成像目标的第二图像。In a possible implementation of the first aspect above, the first camera is controlled to perform acquisition according to the first acquisition parameter to obtain a second image including the imaging target, and the second image is displayed, including: determining the distance from the imaging target to the electronic device according to the first acquisition parameter; determining the second acquisition parameter required for the first camera to acquire the second image based on the distance from the imaging target to the electronic device; and controlling the first camera to perform acquisition with the second acquisition parameter to obtain the second image including the imaging target.

即在本申请实施例中,成像目标至电子设备的距离,即成像目标对应的物距。可以理解,在成像目标包括多个的情况下,物距所对应的成像目标即位于对焦点的成像目标。That is, in the embodiment of the present application, the distance from the imaging target to the electronic device is the object distance corresponding to the imaging target. It can be understood that when there are multiple imaging targets, the imaging target corresponding to the object distance is the imaging target located at the focus point.

在上述第一方面的一种可能的实现中,第一采集参数、第二采集参数分别为对焦参数。In a possible implementation of the first aspect above, the first acquisition parameter and the second acquisition parameter are focus parameters respectively.

即在本申请实施例中,对焦参数可以是摄像头的马达位置。That is, in the embodiment of the present application, the focus parameter may be the motor position of the camera.

在上述第一方面的一种可能的实现中,对应于在第一摄像头采集的图像中检测到成像目标,控制第二摄像头停止采集图像。In a possible implementation of the first aspect, in response to detecting an imaging target in an image captured by the first camera, the second camera is controlled to stop capturing images.

在上述第一方面的一种可能的实现中,第二图像中显示有多个成像目标,并且方法还包括:对用户从多个成像目标中选择的第一成像目标进行识别。In a possible implementation of the first aspect above, a plurality of imaging targets are displayed in the second image, and the method further includes: identifying a first imaging target selected by a user from the plurality of imaging targets.

在上述第一方面的一种可能的实现中,第一摄像头的数量为一个,第二摄像头的数量为多个;检测到第二摄像头以第一采集参数采集的第一图像中存在成像目标,包括:检测到多个第二摄像头中的一个第二摄像头以第一采集参数采集的第一图像中存在成像目标。In a possible implementation of the first aspect above, the number of first cameras is one, and the number of second cameras is multiple; detecting that an imaging target exists in a first image captured by the second camera with first acquisition parameters includes: detecting that an imaging target exists in a first image captured by one of the multiple second cameras with the first acquisition parameters.

在上述第一方面的一种可能的实现中,第一摄像头为广角摄像头,第二摄像头为超广角摄像头。In a possible implementation of the first aspect above, the first camera is a wide-angle camera, and the second camera is an ultra-wide-angle camera.

在上述第一方面的一种可能的实现中,成像目标包括图形码、人物、景物、物品、文字、文档中的至少一种。In a possible implementation of the first aspect, the imaging target includes at least one of a graphic code, a person, a scene, an object, text, and a document.

第二方面,本申请提供一种图像采集方法,应用于电子设备,电子设备包括第一摄像头和第二摄像头;并且方法包括:检测到采集指令,控制第一摄像头和第二摄像头进行采集,并显示第一摄像头的采集画面;对应于在第一摄像头采集的图像中未检测到成像目标,并且检测到第二摄像头采集的第三图像中存在成像目标;将显示的第一摄像头的采集画面切换为第二摄像头的采集画面,其中,第二摄像头的采集画面中显示有成像目标。In a second aspect, the present application provides an image acquisition method, which is applied to an electronic device, the electronic device comprising a first camera and a second camera; and the method comprises: detecting an acquisition instruction, controlling the first camera and the second camera to perform acquisition, and displaying the acquisition screen of the first camera; corresponding to the imaging target not being detected in the image acquired by the first camera, and detecting the presence of the imaging target in the third image acquired by the second camera; switching the displayed acquisition screen of the first camera to the acquisition screen of the second camera, wherein the imaging target is displayed in the acquisition screen of the second camera.

即在本申请实施例中,在第一摄像头采集的图像中未检测到成像目标,而第二摄像头采集的图像中检测到了图像目标的情况下,可以将显示的第一摄像头的采集画面,切换为第二摄像头的采集画面。可以理解,切换之前,电子设备上显示的采集画面中,成像目标的图像不够清晰;切换之后,电子设备上显示的采集画面中可以显示较为清晰的成像目标,即可以从第二摄像头新采集的图像中检测到成像目标。That is, in the embodiment of the present application, when the imaging target is not detected in the image captured by the first camera, but the imaging target is detected in the image captured by the second camera, the captured screen of the first camera can be switched to the captured screen of the second camera. It can be understood that before the switching, the image of the imaging target in the captured screen displayed on the electronic device is not clear enough; after the switching, the captured screen displayed on the electronic device can display a clearer imaging target, that is, the imaging target can be detected from the image newly captured by the second camera.

通过本申请实施例的一种图像采集方法,可以充分利用不同摄像头的特性,将当前场景下检测效率更高的摄像头的采集画面送显,例如,上述的第二摄像头,从而能够提高检测成像目标的效率。Through an image acquisition method of an embodiment of the present application, the characteristics of different cameras can be fully utilized to display the acquisition image of a camera with higher detection efficiency in the current scene, for example, the second camera mentioned above, thereby improving the efficiency of detecting imaging targets.

在上述第二方面的一种可能的实现中,第二摄像头的采集画面为:根据第二摄像头采集的图像调整得到的、与第一摄像头的采集范围相对应的画面。In a possible implementation of the second aspect above, the captured image of the second camera is: a image corresponding to a capture range of the first camera and obtained by adjusting the image captured by the second camera.

即在本申请实施例中,显示的第二摄像头的采集画面,以及切换之前、显示的第一摄像头的采集画面,其对应的现实环境的范围是一致的。例如,第一摄像头采集图像的视场角为第一角度,则可以对第二摄像头采集的图像进行裁切,对该裁切得到的图像进行送显;其中,裁切得到的图像所对应的视场角即为上述的第一角度。That is, in the embodiment of the present application, the captured image of the second camera displayed and the captured image of the first camera displayed before the switch have the same range of corresponding real environment. For example, if the field of view of the image captured by the first camera is the first angle, the image captured by the second camera can be cropped and the cropped image can be displayed; wherein the field of view corresponding to the cropped image is the first angle mentioned above.

在上述第二方面的一种可能的实现中,第一摄像头基于第一对焦策略进行采集,第二摄像头基于第二对焦策略进行采集,第一对焦策略和第二对焦策略不同。In a possible implementation of the second aspect, the first camera collects images based on a first focus strategy, and the second camera collects images based on a second focus strategy, and the first focus strategy and the second focus strategy are different.

在上述第二方面的一种可能的实现中,第一对焦策略为对焦点由近至远采集多张图像,第二对焦策略为对焦点由远至近采集多张图像。In a possible implementation of the second aspect above, the first focusing strategy is to capture multiple images from a near focus point to a far focus point, and the second focusing strategy is to capture multiple images from a far focus point to a near focus point.

即在本申请实施例中,第一对焦策略为将第一摄像头的对焦点或者对焦区域由近及远遍历,其间第一摄像头可以基于预设频率不断采集图像。同理,第二对焦策略为将第二摄像头的对焦点或者对焦区域由远及近遍历,其间第二摄像头可以基于预设频率不断采集图像。That is, in the embodiment of the present application, the first focus strategy is to traverse the focus point or focus area of the first camera from near to far, during which the first camera can continuously collect images based on a preset frequency. Similarly, the second focus strategy is to traverse the focus point or focus area of the second camera from far to near, during which the second camera can continuously collect images based on a preset frequency.

在上述第二方面的一种可能的实现中,检测到第二摄像头以第一采集参数采集的第一图像中存在成像目标,包括:对第二摄像头采集的、采集范围与第一摄像头的采集范围相对应的多张图像进行检测,检测出存在成像目标的第一图像。In a possible implementation of the second aspect above, detecting the presence of an imaging target in a first image captured by a second camera with a first acquisition parameter includes: detecting a plurality of images captured by the second camera, whose acquisition range corresponds to the acquisition range of the first camera, and detecting the first image in which the imaging target exists.

即在本申请实施例中,对第二摄像头采集图像的检测范围,以及对第一摄像头采集图像的检测范围,其对应的现实环境的范围是一致的。例如,第一摄像头采集图像的视场角为第一角度,则可以对第二摄像头采集的图像进行裁切,对该裁切得到的图像进行检测;其中,裁切得到的图像所对应的视场角即为上述的第一角度。That is, in the embodiment of the present application, the detection range of the image captured by the second camera and the detection range of the image captured by the first camera correspond to the same range of the real environment. For example, if the field of view of the image captured by the first camera is a first angle, the image captured by the second camera can be cropped and the cropped image can be detected; wherein the field of view corresponding to the cropped image is the first angle mentioned above.

在上述第二方面的一种可能的实现中,成像目标的数量为多个,第二摄像头的采集画面中显示有成像目标,包括: 在第二摄像头的采集画面中显示多个成像目标;对用户从多个成像目标中选择的第一成像目标进行识别。In a possible implementation of the second aspect above, there are multiple imaging targets, and the imaging targets are displayed in the capture screen of the second camera, including: displaying multiple imaging targets in the capture screen of the second camera; and identifying the first imaging target selected by the user from the multiple imaging targets.

在上述第二方面的一种可能的实现中,第一摄像头的数量为一个,第二摄像头的数量为多个;检测到第二摄像头采集的第三图像中存在成像目标,包括:检测到多个第二摄像头中的目标摄像头采集的第三图像中存在成像目标;切换为第二摄像头的采集画面,包括:切换为目标摄像头的采集画面。In a possible implementation of the second aspect above, the number of first cameras is one, and the number of second cameras is multiple; detecting the presence of an imaging target in a third image captured by the second camera includes: detecting the presence of an imaging target in a third image captured by a target camera among the multiple second cameras; switching to the capture screen of the second camera includes: switching to the capture screen of the target camera.

在上述第二方面的一种可能的实现中,第一摄像头为广角摄像头,第二摄像头为超广角摄像头。In a possible implementation of the second aspect above, the first camera is a wide-angle camera, and the second camera is an ultra-wide-angle camera.

在上述第二方面的一种可能的实现中,成像目标包括图形码、人物、景物、物品、文字、文档中的至少一种。In a possible implementation of the second aspect, the imaging target includes at least one of a graphic code, a person, a scene, an object, text, and a document.

第三方面,本申请实施例提供一种电子设备,包括:存储器,用于存储由电子设备的一个或多个处理器执行的指令,以及处理器,当处理器执行存储器中的指令时,可使得电子设备执行上述第一方面或第二方面的方法。In a third aspect, an embodiment of the present application provides an electronic device, comprising: a memory for storing instructions executed by one or more processors of the electronic device, and a processor, which, when the processor executes the instructions in the memory, enables the electronic device to execute the method of the first or second aspect mentioned above.

第四方面,本申请实施例提供一种存储介质,存储介质上存储有指令,指令在电子设备上执行时使电子设备执行上述第一方面或第二方面的方法。In a fourth aspect, an embodiment of the present application provides a storage medium having instructions stored thereon, and when the instructions are executed on an electronic device, the electronic device executes the method of the first aspect or the second aspect mentioned above.

第五方面,本申请实施例提供一种芯片,芯片包括可编程逻辑电路和/或程序指令,当芯片运行时,实现上述第一方面或第二方面的方法。In a fifth aspect, an embodiment of the present application provides a chip, which includes a programmable logic circuit and/or program instructions. When the chip is running, it implements the method of the first aspect or the second aspect mentioned above.

附图说明BRIEF DESCRIPTION OF THE DRAWINGS

图1A根据本申请示出了第一种成像画面的示意图;FIG1A is a schematic diagram showing a first imaging screen according to the present application;

图1B根据本申请示出了第二种成像画面的示意图;FIG1B is a schematic diagram showing a second imaging screen according to the present application;

图2A根据本申请实施例示出了一种电子设备100的第一界面示意图;FIG2A shows a schematic diagram of a first interface of an electronic device 100 according to an embodiment of the present application;

图2B根据本申请实施例示出了一种电子设备100的第二界面示意图;FIG. 2B shows a schematic diagram of a second interface of an electronic device 100 according to an embodiment of the present application;

图3根据本申请实施例示出了一种图像采集方法的第一流程示意图;FIG3 shows a first flow chart of an image acquisition method according to an embodiment of the present application;

图4根据本申请实施例示出了一种图像采集方法的第二流程示意图;FIG4 shows a second flow chart of an image acquisition method according to an embodiment of the present application;

图5A根据本申请实施例示出了第一种成像画面的示意图;FIG5A is a schematic diagram showing a first imaging screen according to an embodiment of the present application;

图5B根据本申请实施例示出了第二种成像画面的示意图;FIG5B is a schematic diagram showing a second imaging screen according to an embodiment of the present application;

图6A根据本申请实施例示出了第三种成像画面的示意图;FIG6A is a schematic diagram showing a third imaging screen according to an embodiment of the present application;

图6B根据本申请实施例示出了第四种成像画面的示意图;FIG6B is a schematic diagram showing a fourth imaging screen according to an embodiment of the present application;

图7根据本申请实施例示出了一种图像采集方法的第三流程示意图;FIG7 shows a third flow chart of an image acquisition method according to an embodiment of the present application;

图8根据本申请实施例示出了一种电子设备100的硬件框架示意图;FIG8 shows a schematic diagram of a hardware framework of an electronic device 100 according to an embodiment of the present application;

图9根据本申请实施例示出了一种电子设备100的软件结构框图。FIG. 9 shows a software structure block diagram of an electronic device 100 according to an embodiment of the present application.

具体实施方式DETAILED DESCRIPTION

本申请的说明性实施例包括但不限于一种图像采集方法、电子设备及存储介质。The illustrative embodiments of the present application include, but are not limited to, an image acquisition method, an electronic device, and a storage medium.

应理解,本申请实施例中的成像目标可以是图形码、人物、景物、动物、文件、文字、人脸等。为便于描述,以下各实施例中,以成像目标为图形码为例,介绍本申请的技术方案。It should be understood that the imaging target in the embodiments of the present application may be a graphic code, a person, a scene, an animal, a file, text, a face, etc. For ease of description, in the following embodiments, the imaging target is a graphic code as an example to introduce the technical solution of the present application.

一般来说,电子设备是通过单个摄像头来采集成像目标根据摄像头获取的图像来识别图形码。然而,摄像头的初始对焦区域不在图形码处,然后摄像头需要不断地调整对焦区域,直至对焦到图形码处,或者图形码位于摄像头的景深范围(即清晰区域)内,图形码的成像才足以清楚。也就是说,单个摄像头需要耗费大量时间才能够得到图形码的清晰成像,在此之前终端设备都无法进行图形码识别,导致识别图形码的效率低。Generally speaking, electronic devices use a single camera to capture the image target and recognize the graphic code based on the image obtained by the camera. However, the initial focus area of the camera is not at the graphic code, and then the camera needs to continuously adjust the focus area until it focuses on the graphic code, or the graphic code is within the depth of field range of the camera (i.e., the clear area), so that the image of the graphic code is clear enough. In other words, a single camera needs to spend a lot of time to obtain a clear image of the graphic code. Before this, the terminal device cannot recognize the graphic code, resulting in low efficiency in recognizing the graphic code.

可以理解,电子设备的采集界面上显示有摄像头获取的成像画面,电子设备可以控制该摄像头进行自动对焦,即通过控制马达或者电机来控制摄像头中对焦镜片组的运动,改变成像画面中的对焦点或者改变成像的放大倍数,使对焦点附近画面变清晰。例如,改变对焦点,使对焦点位于图形码处,或者基于光学变焦来放大图像,从而使图形码的成像变清晰。It can be understood that the electronic device's acquisition interface displays the image captured by the camera, and the electronic device can control the camera to perform automatic focusing, that is, by controlling the motor or motor to control the movement of the focus lens group in the camera, change the focus point in the image or change the magnification of the image, so that the image near the focus point becomes clear. For example, the focus point is changed so that the focus point is located at the graphic code, or the image is enlarged based on optical zoom, so that the image of the graphic code becomes clear.

例如,在一些实施例中,电子设备可以基于特定的对焦策略进行对焦,该对焦策略在一些场景下无法很快地识别出图形码。例如,对焦策略采用由近及远的策略(即先对焦于近处对象,再逐渐拉远对焦区域或对焦点,对焦于更远处对象)的情况下,若在图形码处在采集画面(即用户执行扫码操作时,电子设备上显示的采集成像画面)中的远景处,则需要经过长时间的对焦过程,摄像头才能够对焦到图形码处或者图形码处附近,使图形码位于景深范围(清晰范围)之内,以获取到图形码的清晰画面。For example, in some embodiments, the electronic device may focus based on a specific focus strategy, which may not be able to quickly identify the graphic code in some scenarios. For example, when the focus strategy adopts a near-to-far strategy (i.e., focusing on a near object first, then gradually moving the focus area or focus point away, and focusing on a farther object), if the graphic code is in the far view of the acquisition screen (i.e., the acquisition imaging screen displayed on the electronic device when the user performs a code scanning operation), a long focusing process is required before the camera can focus on the graphic code or near the graphic code, so that the graphic code is within the depth of field range (clear range) to obtain a clear picture of the graphic code.

作为一种示例,电子设备可以是移动终端10,移动终端10的摄像头前方的现实环境是:停车场道闸附近的环境。以图1A、图1B为例,图1A、图1B中分别图示了扫码界面的成像画面,其中包括车辆内的方向盘01、挡风玻璃之外的立牌上的二维码02、立牌后方墙面上的二维码03。As an example, the electronic device may be a mobile terminal 10, and the real environment in front of the camera of the mobile terminal 10 is: the environment near the parking lot gate. Taking FIG. 1A and FIG. 1B as examples, FIG. 1A and FIG. 1B respectively illustrate the imaging screen of the code scanning interface, including the steering wheel 01 in the vehicle, the QR code 02 on the sign outside the windshield, and the QR code 03 on the wall behind the sign.

例如,移动终端10基于由近及远的策略进行对焦。首先,如图1A,摄像头的对焦点位于近处,例如车内的方向盘01处,此时方向盘01的成像清晰,二维码02以及二维码03的成像模糊。然后,对焦点由近向远移动;即镜头的像距缩短,物距变长。经过一段时间之后,对焦点才移动至立牌上的二维码02处,此时二维码02的成像由模糊变为清晰,使移动终端10能够识别到二维码02,并且于二维码02周围显示图形码选定框。此时由于二维码03位于景深范围之外,图像较为模糊。上述流程中,移动终端10检测到二维码02的耗时较长,检测二维码的效率较低。For example, the mobile terminal 10 focuses based on a near-to-far strategy. First, as shown in FIG1A , the focus point of the camera is located near, such as the steering wheel 01 in the car. At this time, the image of the steering wheel 01 is clear, and the images of the two-dimensional code 02 and the two-dimensional code 03 are blurred. Then, the focus point moves from near to far; that is, the image distance of the lens is shortened and the object distance is lengthened. After a period of time, the focus point moves to the two-dimensional code 02 on the signboard. At this time, the image of the two-dimensional code 02 changes from blurred to clear, allowing the mobile terminal 10 to recognize the two-dimensional code 02 and display a graphic code selection box around the two-dimensional code 02. At this time, since the two-dimensional code 03 is outside the depth of field, the image is relatively blurred. In the above process, it takes a long time for the mobile terminal 10 to detect the two-dimensional code 02, and the efficiency of detecting the two-dimensional code is low.

同理,若电子设备采用的对焦策略是由远及近的策略,在图形码所在的位置与电子设备距离较近的情况下,由于摄像头首先对焦于远处,然后才逐渐向近处、靠近图形码的位置对焦,电子设备也需要花费很长时间才能采集到近处的图形码的清晰图像。Similarly, if the electronic device adopts a focus strategy from far to near, when the graphic code is located close to the electronic device, the electronic device will need a long time to capture a clear image of the nearby graphic code because the camera first focuses on the distant area and then gradually focuses on the nearby area close to the graphic code.

也就是说,无论采取是采用由近到远还是由近到远的对焦策略,在一些场景中,只采集一个摄像头来采集图形码的图像都可能需要花费较长时间才能采集到清晰的图形码。That is to say, no matter whether the focus strategy is from near to far or from near to far, in some scenes, it may take a long time to capture a clear graphic code using only one camera to capture the image of the graphic code.

可以理解,一般电子设备上设置有多个摄像头,例如手机上设置有主摄像头(广角摄像头)、超广角摄像头、微距摄像头、定焦摄像头等。因此,为了充分利用多个摄像头的采集能力,本申请实施例提供的一种图像采集方法中,电子设备可以并行采用多个摄像头来采集图像,并分别检测各个摄像头采集的图像中是否存在成像目标。如果在目标摄像头采集的目标图像中检测到成像目标,则可以显示基于该目标摄像头的检测结果。例如,主摄像头采集的图像中未检测到成像目标,但在微距摄像头采集的图像中已检测到,则电子设备显示的成像画面可以切换为微距摄像头的采集画面,并在其中显示检测到的成像目标。如此,可以充分利用不同摄像头的特性,将当前场景下检测效率更高的摄像头的采集画面送显,例如,上述的目标摄像头,从而能够提高检测成像目标的效率。It can be understood that generally, multiple cameras are provided on electronic devices, for example, a main camera (wide-angle camera), an ultra-wide-angle camera, a macro camera, a fixed-focus camera, etc. are provided on a mobile phone. Therefore, in order to make full use of the acquisition capabilities of multiple cameras, in an image acquisition method provided in an embodiment of the present application, the electronic device can use multiple cameras in parallel to acquire images, and respectively detect whether there is an imaging target in the image acquired by each camera. If the imaging target is detected in the target image acquired by the target camera, the detection result based on the target camera can be displayed. For example, if the imaging target is not detected in the image acquired by the main camera, but has been detected in the image acquired by the macro camera, the imaging screen displayed by the electronic device can be switched to the acquisition screen of the macro camera, and the detected imaging target is displayed therein. In this way, the characteristics of different cameras can be fully utilized, and the acquisition screen of the camera with higher detection efficiency in the current scene can be displayed, for example, the above-mentioned target camera, so as to improve the efficiency of detecting the imaging target.

在一些可选的实施例中,电子设备可以并行采用第一摄像头和至少一个第二摄像头分别采用不同的对焦策略采集图像,并分别检测各个摄像头所采集到的图像中是否存在成像目标。电子设备如果先在第一摄像头所采集的图像中检测到成像目标,则控制第一摄像头采集成像目标的图像;电子设备如果先在至少一个第二摄像头中的第三摄像头所采集的图像中检测到成像目标,电子设备可以基于第三摄像头当前的采集参数(例如,对焦参数等)确定成像目标所对应的对焦信息(例如,成像目标到电子设备的距离),并基于确定的对焦信息控制第一摄像头采集成像目标的图像。In some optional embodiments, the electronic device may use the first camera and at least one second camera in parallel to respectively use different focus strategies to capture images, and respectively detect whether there is an imaging target in the images captured by each camera. If the electronic device first detects the imaging target in the image captured by the first camera, it controls the first camera to capture the image of the imaging target; if the electronic device first detects the imaging target in the image captured by the third camera in at least one second camera, the electronic device may determine the focus information corresponding to the imaging target (for example, the distance from the imaging target to the electronic device) based on the current capture parameters (for example, focus parameters, etc.) of the third camera, and control the first camera to capture the image of the imaging target based on the determined focus information.

电子设备在采集到成像目标的图像后,即可实现相关功能。例如,在成像目标为二维码(或者条形码)时,电子设备可以对采集到的包含有二维码的图像进行识别,从而实现支付、访问网页等功能,例如1A所示的停车场场景中,电子设备可以对道闸旁的二维码图片进行扫码,实现停车的支付功能。在成像目标为文件时,电子设备可以对采集到的文件的图像进行识别,从而实现文本识别、文件扫描等功能。又例如,在成像目标为文档时,电子设备在采集到文档的图像后,可以对文档的图像进行校正;再例如,在成像目标为文字是,电子设备在采集到文字的图像后,可以对文字进行翻译;还例如,在成像目标为人脸时,电子设备在采集到人脸图像后可以识别人脸的特征以确定该人脸对应的用户是否具有某一系统(例如门禁系统)的访问权限。After the electronic device captures the image of the imaging target, it can realize the relevant functions. For example, when the imaging target is a QR code (or barcode), the electronic device can recognize the captured image containing the QR code, so as to realize functions such as payment and access to web pages. For example, in the parking scene shown in 1A, the electronic device can scan the QR code image next to the gate to realize the parking payment function. When the imaging target is a file, the electronic device can recognize the captured image of the file, so as to realize functions such as text recognition and file scanning. For another example, when the imaging target is a document, the electronic device can correct the image of the document after capturing the image of the document; for another example, when the imaging target is text, the electronic device can translate the text after capturing the image of the text; for another example, when the imaging target is a face, the electronic device can recognize the features of the face after capturing the face image to determine whether the user corresponding to the face has access rights to a certain system (such as a door access control system).

在一些实施例中,电子设备可以将第一摄像头所采集的图像实时显示在电子设备的屏幕上,即用户点击相机控件触发的采集界面上,而不显示第二摄像头所采集的图像。基于电子设备的至少两个摄像头(包含第一摄像头、至少一个第二摄像头)获取的图像进行目标检测,并在采集界面上实时显示第一摄像头的成像画面。若第一摄像头识别到成像目标,电子设备可以控制第一摄像头采集成像目标的图像并将图像显示在采集界面上。若至少一个第二摄像头中的第三摄像头先于第一摄像头检测到成像目标,则电子设备可以确定出第三摄像头所采用成像目标的对焦信息,并基于该对焦信息确定成像目标和电子设备的距离,然后控制第一摄像头基于该距离重新对焦,以识别到目标成像目标、采集成像目标的图像并将采到的图像显示在采集界面上。举例而言,假设成像目标位于电子设备的远处,如果第一摄像头基于由近及远的对焦策略没有识别到远处的成像目标时,第二摄像头基于由远及近的对焦策略立刻识别到了该远处的成像目标,则可以基于第二摄像头的对焦参数确定成像目标的目标位置,根据目标位置控制第一摄像头向远处对焦,从而识别到该远处的成像目标。通过上述方法,可以利用至少两个摄像头识别成像目标,避免单个摄像头在对焦策略上的局限性,提高识别效率。In some embodiments, the electronic device may display the image captured by the first camera in real time on the screen of the electronic device, that is, on the capture interface triggered by the user clicking the camera control, without displaying the image captured by the second camera. Target detection is performed based on the images acquired by at least two cameras (including the first camera and at least one second camera) of the electronic device, and the imaging screen of the first camera is displayed in real time on the capture interface. If the first camera recognizes the imaging target, the electronic device can control the first camera to capture the image of the imaging target and display the image on the capture interface. If the third camera of at least one second camera detects the imaging target before the first camera, the electronic device can determine the focus information of the imaging target adopted by the third camera, and determine the distance between the imaging target and the electronic device based on the focus information, and then control the first camera to refocus based on the distance to identify the target imaging target, capture the image of the imaging target and display the captured image on the capture interface. For example, assuming that the imaging target is located far away from the electronic device, if the first camera does not recognize the imaging target in the distance based on the near-to-far focus strategy, and the second camera immediately recognizes the imaging target in the distance based on the far-to-near focus strategy, then the target position of the imaging target can be determined based on the focus parameters of the second camera, and the first camera can be controlled to focus far away according to the target position, so as to recognize the imaging target in the distance. Through the above method, at least two cameras can be used to recognize the imaging target, avoiding the limitations of a single camera in the focus strategy and improving the recognition efficiency.

根据一些实施例,电子设备基于第二摄像头获取的第一采集图像检测到成像目标之后,可以基于第二采集图像的对焦参数,即第二摄像头采集第一采集图像时的马达位置,确定成像目标到电子设备的距离。然后电子设备可以,基于该距离确定第一摄像头的马达位置,从而使第一摄像头能够移动自身的马达至确定的马达位置,以对焦于第二摄像头检测的成像目标,得到清晰的目标成像,并在采集界面上显示。According to some embodiments, after the electronic device detects the imaging target based on the first acquisition image acquired by the second camera, it can determine the distance from the imaging target to the electronic device based on the focus parameter of the second acquisition image, that is, the motor position when the second camera acquires the first acquisition image. Then the electronic device can determine the motor position of the first camera based on the distance, so that the first camera can move its own motor to the determined motor position to focus on the imaging target detected by the second camera, obtain clear target imaging, and display it on the acquisition interface.

根据一些实施例,第一摄像头可以采用自动对焦的方式,且对焦策略为由近及远;第二摄像头可以采用自动对焦的方式,且对焦策略为由远及近。可以理解,第一摄像头的对焦点可以由微距到无穷远遍历,每隔N(N为大于0的整数)帧将图像数据输出至目标检测模型进行检测;第二摄像头的对焦点可以由无穷远到微距遍历,每隔N帧将图像数据输出至目标检测模型进行检测。According to some embodiments, the first camera may adopt an auto-focus method, and the focus strategy is from near to far; the second camera may adopt an auto-focus method, and the focus strategy is from far to near. It can be understood that the focus point of the first camera can traverse from macro to infinity, and output image data to the target detection model for detection every N (N is an integer greater than 0) frames; the focus point of the second camera can traverse from infinity to macro, and output image data to the target detection model for detection every N frames.

根据一些实施例,第一摄像头的对焦策略为由近及远,第二摄像头包括多个,其中,多个第二摄像头中每个第二摄像头的对焦策略可以不同,例如,第一个第二摄像头的对焦策略为由远到近,第二个第二摄像头的对焦策略为由近到远,其他第二摄像头的对焦策略为由图像中心到近、由图像中心到远,等等。本申请实施例不对每个第二摄像头的对焦策略作限定。According to some embodiments, the focus strategy of the first camera is from near to far, and the second camera includes multiple cameras, wherein the focus strategy of each of the multiple second cameras may be different, for example, the focus strategy of the first second camera is from far to near, the focus strategy of the second second camera is from near to far, and the focus strategies of other second cameras are from the center of the image to near, from the center of the image to far, etc. The embodiment of the present application does not limit the focus strategy of each second camera.

根据一些实施例,第一摄像头可以是主用摄像头,第二摄像头可以是广角摄像头。若在第二摄像头采集的图像中识别到成像目标之前,已经在第一摄像头采集的图像中识别到该成像目标或者其他成像目标,则第二摄像头无需执行任何操作,也就是说,基于第一摄像头采集的图像完成检测流程即可。此实施例中,先在第一摄像头采集的图像中检测到成像目标,说明在该场景下基于第一摄像头的检测效率更高,则可以优先保证第一摄像头完成目标检测。According to some embodiments, the first camera may be a main camera, and the second camera may be a wide-angle camera. If the imaging target or other imaging targets have been identified in the image captured by the first camera before the imaging target is identified in the image captured by the second camera, the second camera does not need to perform any operation, that is, the detection process is completed based on the image captured by the first camera. In this embodiment, the imaging target is first detected in the image captured by the first camera, indicating that the detection efficiency based on the first camera is higher in this scenario, and the first camera can be prioritized to complete the target detection.

下面结合图2A-图2B介绍本申请实施例中电子设备100的界面。The interface of the electronic device 100 in the embodiment of the present application is introduced below in conjunction with FIG. 2A-FIG 2B.

如图2A所示,用户执行检测操作后,电子设备100可以显示如图2A所示的扫码应用程序的界面。其中,检测操作可以是点击扫码按钮或者扫码控件,检测操作用于触发电子设备100的扫码应用程序,如图2A,电子设备100的界面上显示有目标检测程序的界面,界面中包括成像画面20,以及检测框30,即电子设备100可以基于成像画面20中显示的图像进行成像目标检测。As shown in FIG2A , after the user performs the detection operation, the electronic device 100 may display the interface of the code scanning application as shown in FIG2A . The detection operation may be clicking a code scanning button or a code scanning control, and the detection operation is used to trigger the code scanning application of the electronic device 100 . As shown in FIG2A , the interface of the target detection program is displayed on the interface of the electronic device 100 , and the interface includes an imaging screen 20 and a detection frame 30 , that is, the electronic device 100 may perform imaging target detection based on the image displayed in the imaging screen 20 .

可以理解,成像画面20显示第一摄像头对电子设备100的周围环境采集得到的图像,成像画面20的显示画面对应于第一摄像头的采集范围。也就是说,若用户移动电子设备100,或者改变电子设备100的角度,成像画面20随之改变。It can be understood that the imaging screen 20 displays the image acquired by the first camera of the surrounding environment of the electronic device 100, and the display screen of the imaging screen 20 corresponds to the acquisition range of the first camera. That is, if the user moves the electronic device 100 or changes the angle of the electronic device 100, the imaging screen 20 changes accordingly.

本申请实施例中,用户执行检测操作后,第二摄像头也可以对电子设备100的周围环境进行采集,得到图像,然而,第二摄像头采集的图像仅用于成像目标检测,而不显示于电子设备100的界面上。In an embodiment of the present application, after the user performs a detection operation, the second camera can also capture the surrounding environment of the electronic device 100 to obtain an image. However, the image captured by the second camera is only used for imaging target detection and is not displayed on the interface of the electronic device 100.

可以理解,电子设备100基于成像画面20中显示的图像检测到成像目标之后,可以自动控制成像画面20中显示的图像进行放大、移动,使检测得的成像目标的图像位于检测框30内。It can be understood that after the electronic device 100 detects the imaging target based on the image displayed in the imaging screen 20 , it can automatically control the image displayed in the imaging screen 20 to be enlarged and moved so that the detected image of the imaging target is located within the detection frame 30 .

需注意的是,上述实施例仅为第一摄像头采集的图像中仅包含一个成像目标的实施例,在其他可选的实施例中,第一摄像头采集的图像中可以包括多个成像目标,相应地,电子设备100的界面上可以显示有多个检测框30,分别对应于多个成像目标。It should be noted that the above embodiment is only an embodiment in which the image captured by the first camera contains only one imaging target. In other optional embodiments, the image captured by the first camera may include multiple imaging targets. Accordingly, multiple detection boxes 30 can be displayed on the interface of the electronic device 100, corresponding to the multiple imaging targets respectively.

如图2B所示,用户执行检测操作后,电子设备100可以显示如图2B所示的目标检测应用程序的界面。其中,检测操作可以是点击目标检测按钮或者目标检测控件,检测操作用于触发电子设备100的目标检测应用程序。As shown in Figure 2B, after the user performs a detection operation, the electronic device 100 may display the interface of the target detection application as shown in Figure 2B. The detection operation may be clicking a target detection button or a target detection control, and the detection operation is used to trigger the target detection application of the electronic device 100.

如图2B,电子设备100的界面上显示有检测类别按钮40,其对应的检测类别包括识物、文档扫描、识人、翻译、扫码、购物;图2B所示的成像画面20中包括人物50、物体60、文字70。举例而言,对应于用户点击检测类别按钮40中的识人按钮,图2B所示的人物50即为成像目标;对应于用户点击检测类别按钮40中的识物按钮,图2B所示的物体60即为成像目标,对应于用户点击检测类别按钮40中的翻译按钮,则图2B所示的文字70即为成像目标。As shown in FIG2B , a detection category button 40 is displayed on the interface of the electronic device 100, and its corresponding detection categories include object recognition, document scanning, person recognition, translation, code scanning, and shopping; the imaging screen 20 shown in FIG2B includes a person 50, an object 60, and text 70. For example, corresponding to the user clicking the person recognition button in the detection category button 40, the person 50 shown in FIG2B is the imaging target; corresponding to the user clicking the object recognition button in the detection category button 40, the object 60 shown in FIG2B is the imaging target, and corresponding to the user clicking the translation button in the detection category button 40, the text 70 shown in FIG2B is the imaging target.

需注意的是,上述实施例中的检测类别仅为一种示例,在其他可选的实施例中,检测类别按钮40还可以包括其他检测类别的按钮。It should be noted that the detection category in the above embodiment is only an example, and in other optional embodiments, the detection category button 40 may also include buttons of other detection categories.

下面以包括第一摄像头和第二摄像头的电子设备100为例,对本申请实施例提及的图像采集方法进行介绍。可以理解,电子设备100可以包括智能手机、台式计算机、平板电脑、笔记本电脑、智能音箱、数字助理、增强现实(augmented reality,AR)/虚拟现实(virtual reality,VR)设备、智能可穿戴设备等类型的电子设备100。可选的,电子设备100上运行的操作系统可以包括但不限于安卓系统、IOS系统、linux、windows等。The following is an example of an electronic device 100 including a first camera and a second camera to introduce the image acquisition method mentioned in the embodiment of the present application. It can be understood that the electronic device 100 may include a smart phone, a desktop computer, a tablet computer, a laptop computer, a smart speaker, a digital assistant, an augmented reality (AR)/virtual reality (VR) device, a smart wearable device, and other types of electronic devices 100. Optionally, the operating system running on the electronic device 100 may include but is not limited to Android system, IOS system, Linux, Windows, etc.

示例性地,图3根据本申请的一些实施例,示出了一种图像采集方法的第一流程示意图。该流程的执行主体为电子设备100。参考图3,本申请实施例的一种图像采集方法的示例性流程包括:Exemplarily, FIG3 shows a first flow diagram of an image acquisition method according to some embodiments of the present application. The execution subject of the flow is the electronic device 100. Referring to FIG3, an exemplary flow of an image acquisition method of an embodiment of the present application includes:

S301:检测到采集指令,控制第一摄像头和第二摄像头进行采集,并显示第一摄像头的采集画面。S301: Detecting a collection instruction, controlling the first camera and the second camera to collect data, and displaying the collection screen of the first camera.

可以理解,采集指令表示用户意图为:利用电子设备100的摄像功能,采集、检测电子设备100的周围环境中的成像目标。It can be understood that the acquisition instruction indicates the user's intention to use the camera function of the electronic device 100 to acquire and detect imaging targets in the surrounding environment of the electronic device 100 .

在一种可选的实施例中,电子设备100在检测到用户启动扫码程序,可以检测到采集成像目标(即图形码)的指令。此时,电子设备100的界面如图2A所示。In an optional embodiment, the electronic device 100 may detect an instruction to capture an imaging target (ie, a graphic code) when detecting that the user starts a code scanning program. At this time, the interface of the electronic device 100 is shown in FIG. 2A .

在一种可选的实施例中,电子设备100在检测到用户启动目标检测应用程序(例如扫码程序)并点击检测按钮(例如识人、识物、扫码、翻译等按钮)时,可以检测到采集指令。In an optional embodiment, the electronic device 100 can detect a collection instruction when it detects that the user starts a target detection application (such as a code scanning program) and clicks a detection button (such as a person recognition, object recognition, code scanning, translation, etc. button).

示例性地,如图2B,电子设备100的界面上显示有检测类别按钮40,其对应的检测类别包括识物、文档扫描、识人、翻译、扫码、购物;图2B所示的成像画面20中包括人物50、物体60、文字70。举例而言,对应于用户点击检测类别按钮40中的识人按钮,图2B所示的人物50即为成像目标;对应于用户点击检测类别按钮40中的识物按钮,图2B所示的物体60即为成像目标,对应于用户点击检测类别按钮40中的翻译按钮,则图2B所示的文字70即为成像目标。Exemplarily, as shown in FIG2B , a detection category button 40 is displayed on the interface of the electronic device 100, and the corresponding detection categories include object recognition, document scanning, person recognition, translation, code scanning, and shopping; the imaging screen 20 shown in FIG2B includes a person 50, an object 60, and text 70. For example, corresponding to the user clicking the person recognition button in the detection category button 40, the person 50 shown in FIG2B is the imaging target; corresponding to the user clicking the object recognition button in the detection category button 40, the object 60 shown in FIG2B is the imaging target, and corresponding to the user clicking the translation button in the detection category button 40, the text 70 shown in FIG2B is the imaging target.

在其他可选的实施例中,用户还可以通过其他应用程序,例如聊天应用程序、购物应用程序、视频应用程序等,执行检测操作。In other optional embodiments, the user may also perform the detection operation through other applications, such as a chat application, a shopping application, a video application, etc.

根据一些实施例,第一摄像头采用自动对焦的方式,且对焦策略为由近及远;第二摄像头采用自动对焦的方式,且对焦策略为由远及近。可以理解,第一摄像头的对焦点可以由微距到无穷远遍历;第二摄像头的对焦点可以由无穷远到微距遍历。According to some embodiments, the first camera adopts an auto-focus method, and the focus strategy is from near to far; the second camera adopts an auto-focus method, and the focus strategy is from far to near. It can be understood that the focus point of the first camera can traverse from macro to infinity; the focus point of the second camera can traverse from infinity to macro.

可选的,第二摄像头可以包括多个,其中,多个第二摄像头中每个第二摄像头的对焦策略可以不同,例如,第一个第二摄像头的对焦策略为由远到近,第二个第二摄像头的对焦策略为由近到远,其他第二摄像头的对焦策略为由图像中心到近、由图像中心到远,等等。本申请实施例不对每个第二摄像头的对焦策略作限定。Optionally, the second camera may include multiple cameras, wherein the focus strategy of each of the multiple second cameras may be different, for example, the focus strategy of the first second camera is from far to near, the focus strategy of the second second camera is from near to far, and the focus strategies of other second cameras are from the center of the image to near, from the center of the image to far, etc. The embodiment of the present application does not limit the focus strategy of each second camera.

在一种可选的实施例中,第一摄像头为电子设备100的主摄像头,即主摄,第二摄像头为电子设备100的非主摄像头,即非主摄。In an optional embodiment, the first camera is a main camera of the electronic device 100, that is, a main camera, and the second camera is a non-main camera of the electronic device 100, that is, a non-main camera.

在一些实施例中,主摄可以是广角摄像头,在电子设备100的所有摄像头中具有最高的像素。In some embodiments, the main camera may be a wide-angle camera having the highest pixel among all cameras of the electronic device 100 .

可选的,非主摄可以是超广角摄像头,相比于主摄,可以具有更大的景深范围,即成像中清晰图像的范围较大。Optionally, the non-main camera may be an ultra-wide-angle camera, which may have a larger depth of field than the main camera, that is, the range of clear images in the imaging is larger.

在另一些实施例中,第二摄像头还可以是微距摄像头等,本申请实施例不对第一摄像头、第二摄像头的类型作限定。In other embodiments, the second camera may also be a macro camera, etc. The embodiments of the present application do not limit the types of the first camera and the second camera.

可以理解,第一摄像头可以按照固定频率采集第一采集图像并送显。其中,送显指显示在电子设备100的显示界面上,例如显示在如图2A所示的成像画面20上。It is understandable that the first camera can capture the first captured image at a fixed frequency and display it. Displaying means displaying it on the display interface of the electronic device 100, for example, displaying it on the imaging screen 20 shown in FIG. 2A.

在一种可选的实施例中,电子设备在检测到采集指令时,可以控制第一摄像头采集第一采集图像,控制第二摄像头采集第二采集图像。其中,第一摄像头和第二摄像头的采集范围可以是相同范围,也可以是不同范围。可以分别对第一采集图像,以及第二采集图像中第一摄像头的采集范围对应的部分,即第二采集图像与第一采集图像重合的部分,进行检测,分别检测其中是否存在成像目标。In an optional embodiment, when the electronic device detects the acquisition instruction, it can control the first camera to acquire the first acquisition image and control the second camera to acquire the second acquisition image. The acquisition ranges of the first camera and the second camera can be the same range or different ranges. The first acquisition image and the part of the second acquisition image corresponding to the acquisition range of the first camera, that is, the part where the second acquisition image overlaps with the first acquisition image, can be detected to detect whether there is an imaging target therein.

作为一种示例,可以每隔N帧,对N帧的第一采集图像或者第二采集图像进行检测。As an example, the first acquired image or the second acquired image of N frames may be detected every N frames.

S302:对应于在第一摄像头采集的图像中未检测到成像目标,并且检测到第二摄像头以第一采集参数采集的第一图像中存在成像目标,确定第一采集参数。S302: Corresponding to the situation where no imaging target is detected in the image captured by the first camera and the imaging target is detected in the first image captured by the second camera with the first capturing parameters, the first capturing parameters are determined.

可以理解,第一图像为检测到成像目标的第二采集图像。It can be understood that the first image is the second acquired image in which the imaging target is detected.

可以理解,作为一种示例,当成像目标在成像画面中位于远景处,且第一摄像头的对焦点由近及远遍历,第二摄像头的对焦点由远及近遍历,则此时第二摄像头会先于第一摄像头对焦到成像目标,即满足条件:在第一摄像头所采集的图像中未检测到成像目标,并且在第二摄像头当前所采集的第一图像中检测到成像目标。又例如,当成像目标在成像画面中位于近景处,且第一摄像头的对焦点由远及近遍历,第二摄像头的对焦点由近及远遍历,则此时第二摄像头同样地会先于第一摄像头对焦到成像目标,即满足上述条件。It can be understood that, as an example, when the imaging target is located in the far view in the imaging screen, and the focus of the first camera traverses from near to far, and the focus of the second camera traverses from far to near, then the second camera will focus on the imaging target before the first camera, that is, the condition is met: the imaging target is not detected in the image captured by the first camera, and the imaging target is detected in the first image currently captured by the second camera. For another example, when the imaging target is located in the near view in the imaging screen, and the focus of the first camera traverses from far to near, and the focus of the second camera traverses from near to far, then the second camera will also focus on the imaging target before the first camera, that is, the above condition is met.

在一种可选的实施例中,第一摄像头可以按照固定频率采集多帧的第一采集图像,每隔N帧第一采集图像,可以将N帧第一采集图像输入检测模型进行检测,以检测N帧第一采集图像中是否存在成像目标。其中,N为大于等于1的整数。In an optional embodiment, the first camera may capture multiple frames of first captured images at a fixed frequency, and every N frames of first captured images may be input into the detection model for detection to detect whether there is an imaging target in the N frames of first captured images, where N is an integer greater than or equal to 1.

可以理解,在检测的过程中,第一摄像头可以实时调整对焦区域,基于不断调整的对焦区域来采集第一采集图像,基于第一采集图像进行检测。It can be understood that during the detection process, the first camera can adjust the focus area in real time, capture the first captured image based on the continuously adjusted focus area, and perform detection based on the first captured image.

可选的,还可以对采集的第一采集图像进行缩放,得到缩放后的第一采集图像,基于缩放后的第一采集图像进行检测。可以理解,可以对第一采集图像进行成比例放大,基于放大后的第一采集图像进行成像目标的检测,直至检测到成像目标,或者达到最大的放大倍率阈值为止,否则增加放大倍数,循环“对第一采集图像进行成比例放大,基于放大后的第一采集图像进行成像目标的检测”的步骤。例如,依次进行2倍、3倍、10倍放大,本申请实施例不对放大倍率作限定。Optionally, the first acquired image may be scaled to obtain the scaled first acquired image, and detection may be performed based on the scaled first acquired image. It is understandable that the first acquired image may be proportionally enlarged, and the imaging target may be detected based on the enlarged first acquired image until the imaging target is detected or the maximum magnification threshold is reached, otherwise the magnification is increased, and the steps of "proportionally enlarging the first acquired image and detecting the imaging target based on the enlarged first acquired image" are repeated. For example, 2x, 3x, and 10x magnification are performed in sequence, and the magnification is not limited in the embodiment of the present application.

在一种可选的实施例中,可以在第二摄像头采集的第二采集图像的重合图像中检测成像目标。可以理解,重合图像是第二采集图像的一部分,且重合图像的采集范围属于第一采集图像的采集范围,也就是说,只需要对第二采集图像中与第一采集图像相重合的部分进行检测。可选的,在第二摄像头的采集范围包括第一摄像头的采集范围的情况下,重合图像的采集范围可以和第一采集图像的采集范围一致;在第二摄像头的采集范围不完全包括第一摄像头的采集范围的情况下,重合图像也可以是第一采集图像的采集范围的一部分。In an optional embodiment, the imaging target can be detected in the overlapping image of the second acquired image acquired by the second camera. It can be understood that the overlapping image is a part of the second acquired image, and the acquisition range of the overlapping image belongs to the acquisition range of the first acquired image, that is, only the part of the second acquired image that overlaps with the first acquired image needs to be detected. Optionally, when the acquisition range of the second camera includes the acquisition range of the first camera, the acquisition range of the overlapping image can be consistent with the acquisition range of the first acquired image; when the acquisition range of the second camera does not completely include the acquisition range of the first camera, the overlapping image can also be a part of the acquisition range of the first acquired image.

以图2A为例,成像画面20的画面范围即第一摄像头的采集范围,在第二摄像头的采集范围包括第一摄像头的采集范围的情况下,重合图像的范围即成像画面20的范围。Taking FIG. 2A as an example, the image range of the imaging image 20 is the acquisition range of the first camera. When the acquisition range of the second camera includes the acquisition range of the first camera, the range of the overlapping images is the range of the imaging image 20 .

作为一种示例,第一摄像头采集图像的视场角为第一角度,则可以对第二摄像头采集的第二采集图像进行裁切,对该裁切得到的图像进行检测;其中,裁切得到的图像即上述的重合图像,其所对应的视场角即为上述的第一角度。As an example, if the field of view angle of the image captured by the first camera is a first angle, the second captured image captured by the second camera can be cropped, and the cropped image can be detected; wherein the cropped image is the above-mentioned overlapping image, and the corresponding field of view angle is the above-mentioned first angle.

可选的,第二摄像头可以按照固定频率采集多帧的第二采集图像,每隔N帧第二采集图像,可以将N帧重合图像输入检测模型进行检测,以检测N帧重合图像中是否存在成像目标。其中,N为大于等于1的整数。Optionally, the second camera may capture multiple frames of second captured images at a fixed frequency, and every N frames of second captured images, N frames of overlapping images may be input into the detection model for detection to detect whether there is an imaging target in the N frames of overlapping images, where N is an integer greater than or equal to 1.

可以理解,第一采集图像即检测出成像目标的第二采集图像。It can be understood that the first acquired image is the second acquired image in which the imaging target is detected.

S303:根据第一采集参数控制第一摄像头进行采集,得到包括成像目标的第二图像,并显示第二图像。S303: Control the first camera to perform acquisition according to the first acquisition parameter to obtain a second image including the imaging target, and display the second image.

可以理解,第一摄像头基于第二采集参数进行采集,可以得到第一目标图像,其中,成像目标位于第一目标图像的对焦区域范围内。也就是说,第一摄像头基于第二采集参数采集,可以对焦于成像目标上,得到成像目标的图像足够清晰的第一目标图像。It can be understood that the first camera can acquire the first target image based on the second acquisition parameter, wherein the imaging target is located within the focus area of the first target image. In other words, the first camera can focus on the imaging target based on the second acquisition parameter to obtain the first target image in which the image of the imaging target is sufficiently clear.

在一种可选的实施例中,第一采集参数、第二采集参数可以分别为对焦参数。作为一种示例,可以根据第一采集参数,确定成像目标至电子设备的距离;基于成像目标至电子设备的距离,确定第一摄像头采集第二图像所需的第二采集参数;控制第一摄像头以第二采集参数进行采集,得到包括成像目标的第二图像。In an optional embodiment, the first acquisition parameter and the second acquisition parameter may be focus parameters respectively. As an example, the distance from the imaging target to the electronic device may be determined according to the first acquisition parameter; based on the distance from the imaging target to the electronic device, the second acquisition parameter required for the first camera to acquire the second image may be determined; and the first camera may be controlled to acquire the second image with the second acquisition parameter to obtain the second image including the imaging target.

可选的,第一采集参数具体可以是第二摄像头采集第一采集图像时的马达位置,第二采集参数可以是第一摄像头采集成像目标所需的马达位置。可以理解,马达位置决定了摄像头的像距、物距,即确定了摄像头的对焦区域或者对焦点的位置。Optionally, the first acquisition parameter may be the motor position when the second camera acquires the first acquisition image, and the second acquisition parameter may be the motor position required for the first camera to acquire the imaging target. It can be understood that the motor position determines the image distance and object distance of the camera, that is, determines the focus area or focus point position of the camera.

可选的,基于第二摄像头采集第一采集图像时的马达位置,可以计算得到成像目标在现实环境中与电子设备100的距离,即成像目标对应的物距。然后,基于成像目标对应的物距,可以计算第一摄像头采集成像目标所需的马达位置Optionally, based on the motor position when the second camera captures the first captured image, the distance between the imaging target and the electronic device 100 in the real environment, that is, the object distance corresponding to the imaging target, can be calculated. Then, based on the object distance corresponding to the imaging target, the motor position required for the first camera to capture the imaging target can be calculated.

在一种可选的实施例中,根据第二摄像头的马达位置、第二摄像头的参数可以得到成像目标和电子设备的距离,进一步地,基于该距离和第一摄像头的参数可以得到第二采集参数。可选的,第二采集参数可以是第一摄像头的马达位置,第一摄像头的马达处于该马达位置时,成像目标能够位于第一摄像头的对焦区域范围内,以通过第一摄像头获取到成像目标的清晰成像。In an optional embodiment, the distance between the imaging target and the electronic device can be obtained according to the motor position of the second camera and the parameters of the second camera, and further, the second acquisition parameter can be obtained based on the distance and the parameters of the first camera. Optionally, the second acquisition parameter can be the motor position of the first camera. When the motor of the first camera is at this motor position, the imaging target can be located within the focus area of the first camera, so that a clear image of the imaging target can be obtained through the first camera.

可选的,电子设备100的屏幕上可以显示第一目标图像以及第一目标图像中成像目标的标识,例如在成像目标的图像中心显示圆点标识。Optionally, the first target image and the identification of the imaging target in the first target image may be displayed on the screen of the electronic device 100, for example, a dot identification may be displayed at the center of the image of the imaging target.

在一种可选的实施方式中,可以基于第二摄像头采集的第一采集图像检测到多个成像目标。在此实施方式中,可以在电子设备100的界面中,如图2A的成像画面20中,在每个成像目标的图像处显示检测标识,例如圆点标识、检测框等。In an optional embodiment, multiple imaging targets can be detected based on the first captured image captured by the second camera. In this embodiment, a detection mark, such as a dot mark, a detection frame, etc., can be displayed at the image of each imaging target in the interface of the electronic device 100, such as the imaging screen 20 of FIG. 2A.

可以理解,响应于用户点击成像目标的标识,电子设备100可以对成像目标进行解析处理。例如,成像目标为二维码时,电子设备100可以解析二维码,实现二维码的相应功能,例如访问网页、支付等。It is understood that in response to the user clicking the logo of the imaging target, the electronic device 100 can parse the imaging target. For example, when the imaging target is a QR code, the electronic device 100 can parse the QR code to implement the corresponding functions of the QR code, such as accessing a web page, making a payment, etc.

在上述的实施例中,可以理解,若先在第二摄像头采集的图像中检测到成像目标,表明在当前场景下,基于第二摄像头的目标检测效率更高,在此情况下,可以优先呈现基于第二摄像头的检测结果。In the above embodiment, it can be understood that if the imaging target is first detected in the image captured by the second camera, it indicates that in the current scene, the target detection efficiency based on the second camera is higher. In this case, the detection result based on the second camera can be presented preferentially.

在一种可选的实施例中,对应于在第一摄像头所采集的第二采集图像中检测到成像目标,且在第二摄像头采集的图像中未检测到成像目标,电子设备可以控制第二摄像头停止采集图像。可以理解,若先在第一摄像头采集的图像中检测到成像目标,表明在当前场景下,基于第一摄像头的目标检测效率更高,在此情况下,可以优先呈现基于第一摄像头的检测结果,即控制第一摄像头按照自身的对焦策略进行对焦点遍历,并实时显示第一摄像头采集的图像,第二摄像头对此不进行干预。In an optional embodiment, corresponding to the imaging target being detected in the second captured image captured by the first camera, and the imaging target not being detected in the image captured by the second camera, the electronic device may control the second camera to stop capturing images. It can be understood that if the imaging target is first detected in the image captured by the first camera, it indicates that in the current scene, the target detection efficiency based on the first camera is higher. In this case, the detection result based on the first camera may be presented first, that is, the first camera is controlled to perform focus traversal according to its own focus strategy, and the image captured by the first camera is displayed in real time, and the second camera does not intervene in this.

在一种可选的实例中,对应于在第一摄像头所采集的第二采集图像中检测到第一成像目标的数量为第一数量、在第二摄像头所采集的第一采集图像中检测到成像目标的数量为第二数量、并且第二数量大于第一数量,电子设备可以显示第二数量的成像目标的检测框。然后,电子设备在检测到用户从第二数量的成像目标的检测框中选择所要采集的成像目标后,如果用户选择的成像目标为在第二采集图像中检测到的成像目标,则电子设备可以控制第一摄像头采集该成像目标的目标图像;如果用户选择的成像目标为在第一采集图像中检测到的成像目标且该成像目标未能在第二采集图像中检测到,则电子设备可以基于第二摄像头采集第二采集图像时所用的采集参数得到第一摄像头采集该成像目标所需的采集参数,并基于确定出的采集参数采集该成像目标的目标图像。In an optional example, corresponding to the first number of first imaging targets detected in the second acquisition image acquired by the first camera, the second number of imaging targets detected in the first acquisition image acquired by the second camera, and the second number being greater than the first number, the electronic device may display a detection frame of the second number of imaging targets. Then, after the electronic device detects that the user selects the imaging target to be acquired from the detection frame of the second number of imaging targets, if the imaging target selected by the user is the imaging target detected in the second acquisition image, the electronic device may control the first camera to acquire the target image of the imaging target; if the imaging target selected by the user is the imaging target detected in the first acquisition image and the imaging target is not detected in the second acquisition image, the electronic device may obtain the acquisition parameters required for the first camera to acquire the imaging target based on the acquisition parameters used by the second camera when acquiring the second acquisition image, and acquire the target image of the imaging target based on the determined acquisition parameters.

通过本申请实施例的一种图像采集方法,可以使用除第一摄像头之外的第二摄像头进行目标识别,由于第一摄像头和第二摄像头的所采用的对焦策略不同在第一摄像头没有识别到、第二摄像头识别到成像目标的情况下,根据第二摄像头的采集参数来控制第一摄像头采集到成像目标足够清晰的第一目标图像,从而能够加快第一摄像头识别到成像目标的速度,提高第一摄像头的目标识别效率。Through an image acquisition method of an embodiment of the present application, a second camera other than the first camera can be used for target recognition. Since the first camera and the second camera adopt different focusing strategies, when the first camera does not recognize the imaging target but the second camera recognizes the imaging target, the first camera is controlled according to the acquisition parameters of the second camera to acquire a sufficiently clear first target image of the imaging target, thereby speeding up the speed at which the first camera recognizes the imaging target and improving the target recognition efficiency of the first camera.

在一些实施例中,电子设备100的第一摄像头和第二摄像头的采集范围不同,例如第二摄像头的采集范围与第一摄像头的采集范围部分重合(以下将第二摄像头的采集范围与第一摄像头的采集范围部分重合的采集范围称为重合采集范围)。在该情形下,电子设备100在基于第二摄像头所采集的图像检测成像目标时,可以只在第二摄像头所采集的图像中与重合范围相对应的图像(以下称为重合图像)中检测,而无需对第二摄像头所采集的图像中其他部分的图像进行检测,有利于进一步提高采集成像目标的清晰图像的效率。In some embodiments, the acquisition ranges of the first camera and the second camera of the electronic device 100 are different, for example, the acquisition range of the second camera partially overlaps with the acquisition range of the first camera (hereinafter, the acquisition range in which the acquisition range of the second camera partially overlaps with the acquisition range of the first camera is referred to as the overlapping acquisition range). In this case, when the electronic device 100 detects the imaging target based on the image captured by the second camera, it can only detect in the image corresponding to the overlapping range in the image captured by the second camera (hereinafter referred to as the overlapping image), without detecting the image of other parts in the image captured by the second camera, which is conducive to further improving the efficiency of capturing clear images of the imaging target.

下面基于图4介绍本申请实施例提供的一种图像采集方法的另一示例性流程。Another exemplary process of an image acquisition method provided by an embodiment of the present application is introduced below based on FIG. 4 .

示例性地,图4根据本申请的一些实施例,示出了一种图像采集方法的第二流程示意图。该流程的执行主体为电子设备100。参考图4,本申请实施例的一种图像采集方法的示例性流程包括:For example, FIG4 shows a second flow diagram of an image acquisition method according to some embodiments of the present application. The execution subject of the flow is the electronic device 100. Referring to FIG4, an exemplary flow of an image acquisition method of an embodiment of the present application includes:

S401:检测到采集指令,控制第一摄像头和第二摄像头进行采集,并显示第一摄像头的采集画面。S401: Detecting a collection instruction, controlling the first camera and the second camera to collect data, and displaying the collection screen of the first camera.

步骤S401的内容可以参考上文中针对图3的步骤S301的阐述,此处不再赘述。The content of step S401 can refer to the above description of step S301 in FIG. 3 , which will not be repeated here.

S402:对应于在第一摄像头采集的图像中未检测到成像目标,并且检测到第二摄像头以第一采集参数采集的第一图像中存在成像目标,确定第一采集参数。S402: Corresponding to the situation where no imaging target is detected in the image captured by the first camera and the imaging target is detected in the first image captured by the second camera with the first capturing parameters, the first capturing parameters are determined.

步骤S402的内容可以参考上文中针对图3的步骤S302的阐述,此处不再赘述。The content of step S402 can refer to the above description of step S302 in FIG. 3 , which will not be repeated here.

S403:将显示的第一摄像头的采集画面切换为第二摄像头的采集画面。S403: Switching the displayed acquisition picture of the first camera to the acquisition picture of the second camera.

在其他一些可选的实施例中,可以将显示的第一摄像头的采集画面切换为第二摄像头的采集画面,其中,第二摄像头的采集画面中显示有成像目标。In some other optional embodiments, the collection picture of the first camera can be switched to the collection picture of the second camera, wherein the collection picture of the second camera displays the imaging target.

可选的,第二摄像头的采集画面为:根据第二摄像头采集的图像调整得到的、与第一摄像头的采集范围相对应的画面。也就是说,显示的第二摄像头的采集图像的范围与第一摄像头的采集范围一致。Optionally, the captured image of the second camera is a picture obtained by adjusting the image captured by the second camera and corresponding to the captured range of the first camera. In other words, the range of the captured image of the second camera displayed is consistent with the captured range of the first camera.

作为一种示例,显示的第二摄像头的采集画面,以及切换之前、显示的第一摄像头的采集画面,其对应的现实环境的范围是一致的。例如,第一摄像头采集图像的视场角为第一角度,则可以对第二摄像头采集的图像进行裁切,对该裁切得到的图像进行送显;其中,裁切得到的图像所对应的视场角即为上述的第一角度。As an example, the captured image of the second camera displayed and the captured image of the first camera displayed before the switch have the same range of corresponding real environment. For example, if the field of view of the image captured by the first camera is a first angle, the image captured by the second camera can be cropped and the cropped image can be displayed; wherein the field of view corresponding to the cropped image is the first angle mentioned above.

在一种可选的实施例中,第二摄像头采集的第一图像中检测到的成像目标的数量为多个。在此实施例中,可以在第二摄像头的采集画面中显示多个成像目标。例如,在图5B所示的界面中显示二维码002、二维码003。然后,可以对用户从多个成像目标中选择的第一成像目标进行识别。例如,对用户从图5B中的二维码002、二维码003中选择二维码进行识别,以实现访问网页、支付等功能。In an optional embodiment, the number of imaging targets detected in the first image captured by the second camera is multiple. In this embodiment, multiple imaging targets can be displayed in the capture screen of the second camera. For example, QR code 002 and QR code 003 are displayed in the interface shown in FIG5B. Then, the first imaging target selected by the user from the multiple imaging targets can be identified. For example, the QR code selected by the user from QR code 002 and QR code 003 in FIG5B is identified to implement functions such as accessing a web page and making a payment.

可选的,第一摄像头的数量为一个,第二摄像头的数量为多个。在此实施例中,若检测到多个第二摄像头中的目标摄像头采集的第三图像中存在成像目标,切换为目标摄像头的采集画面。Optionally, the number of the first camera is one, and the number of the second camera is multiple. In this embodiment, if it is detected that there is an imaging target in the third image captured by the target camera among the multiple second cameras, the capture screen of the target camera is switched.

通过本申请实施例,可以充分利用不同摄像头的特性,将当前场景下检测效率更高的摄像头的采集画面送显,例如,上述的第二摄像头,从而能够提高检测成像目标的效率。Through the embodiments of the present application, the characteristics of different cameras can be fully utilized to display the captured images of the camera with higher detection efficiency in the current scene, for example, the second camera mentioned above, thereby improving the efficiency of detecting imaging targets.

请参考图5A-图5B,下面以电子设备100的第一摄像头、第二摄像头前方的现实环境是停车场道闸附近的环境,且成像目标为二维码为例,对本申请实施例的方法进行介绍。Please refer to Figures 5A-5B. The method of the embodiment of the present application is introduced below by taking the actual environment in front of the first camera and the second camera of the electronic device 100 as the environment near the parking lot gate, and the imaging target is a QR code as an example.

以图5A、图5B分别图示了电子设备100的成像画面,其中包括车辆内的方向盘001、挡风玻璃之外的立牌上的二维码002、立牌后方墙面上的二维码003。5A and 5B illustrate the imaging screen of the electronic device 100 , which includes a steering wheel 001 in the vehicle, a QR code 002 on a sign outside the windshield, and a QR code 003 on the wall behind the sign.

可以理解,第一摄像头基于由近及远的策略进行对焦,第二摄像头基于由远及近的策略进行对焦。It can be understood that the first camera focuses based on a strategy from near to far, and the second camera focuses based on a strategy from far to near.

首先,如图5A,第一摄像头的对焦点位于近处,例如车内的方向盘001处,此时方向盘001的成像清晰,二维码002以及二维码003的成像模糊。First, as shown in FIG5A , the focus of the first camera is located close up, such as the steering wheel 001 in the car. At this time, the image of the steering wheel 001 is clear, and the images of the QR code 002 and the QR code 003 are blurred.

此时,第二摄像头的对焦点位于远处,即第二摄像头获取的第一采集图像中可以检测到二维码003。并且,由于第二摄像头是超广角摄像头,具有较大的景深范围,因此第一采集图像中二维码002的图像也是清晰的。故第二摄像头能够检测到二维码002、二维码003。At this time, the focus of the second camera is located far away, that is, the QR code 003 can be detected in the first captured image acquired by the second camera. In addition, since the second camera is an ultra-wide-angle camera with a large depth of field, the image of the QR code 002 in the first captured image is also clear. Therefore, the second camera can detect QR codes 002 and 003.

然后,可以基于第二摄像头采集第一采集图像时的采集参数,计算第一摄像头采集二维码002、二维码003的采集参数,并控制第一摄像头基于计算得的采集参数进行采集,得到如图5B所示的第一目标图像。Then, based on the acquisition parameters of the second camera when acquiring the first acquisition image, the acquisition parameters of the first camera for acquiring the QR code 002 and the QR code 003 can be calculated, and the first camera can be controlled to acquire based on the calculated acquisition parameters to obtain the first target image as shown in Figure 5B.

如图5B所示,二维码002、二维码003的图像均清晰,同时二维码002、二维码003图像周围还显示有检测框,用户可以通过点击检测框内的区域,以从二维码002、二维码003中选择目标二维码进行识别。可选的,检测框还可以由其他识别标识替代,如圆点标识、箭头标识等。As shown in FIG5B , the images of the two-dimensional code 002 and the two-dimensional code 003 are both clear, and a detection frame is displayed around the images of the two-dimensional code 002 and the two-dimensional code 003. The user can click on the area in the detection frame to select a target two-dimensional code for recognition from the two-dimensional code 002 and the two-dimensional code 003. Optionally, the detection frame can also be replaced by other recognition marks, such as a dot mark, an arrow mark, etc.

可以理解,第二摄像头的对焦点位于较远处,如靠近二维码003处时,即可从采集的第一采集图像中识别到二维码002、二维码003,然后第一摄像头即可根据其摄像参数进行对焦调整、二维码识别,可以大大提高二维码的识别效率。并且,第一摄像头采集第一目标图像时,对焦点也位于较远处,即位于二维码003处或者二维码003附近,此时由于对焦区域在远处,第一摄像头的景深范围也较大,因此二维码002的成像也清晰,即可以同时识别到多个远景处的二维码。It can be understood that when the focus point of the second camera is located at a relatively far distance, such as near QR code 003, QR code 002 and QR code 003 can be identified from the first captured image, and then the first camera can adjust the focus and recognize the QR code according to its camera parameters, which can greatly improve the recognition efficiency of the QR code. In addition, when the first camera captures the first target image, the focus point is also located at a relatively far distance, that is, at or near QR code 003. At this time, since the focus area is far away, the depth of field of the first camera is also large, so the image of QR code 002 is also clear, that is, multiple QR codes in the distance can be recognized at the same time.

请参考图6A-图6B,下面以电子设备的第一摄像头、第二摄像头前方的现实环境是马路,且成像目标为人物为例,对本申请实施例的方法进行介绍。Please refer to Figures 6A-6B. The method of the embodiment of the present application is introduced below by taking the real environment in front of the first camera and the second camera of the electronic device as a road and the imaging target as a person as an example.

图6A、图6B分别图示了电子设备100的相机应用程序界面,其中包括行人04、行人05。其中,用户可以基于相机应用程序界面将采集模式设置为识人模式,以对采集画面中的人物进行识别。6A and 6B illustrate the camera application interface of the electronic device 100, which includes pedestrians 04 and 05. The user can set the acquisition mode to the person recognition mode based on the camera application interface to recognize the person in the acquisition picture.

可以理解,第一摄像头基于由近及远的策略进行对焦,第二摄像头基于由远及近的策略进行对焦。It can be understood that the first camera focuses based on a strategy from near to far, and the second camera focuses based on a strategy from far to near.

首先,如图6A,第一摄像头的对焦点位于近处,即行人04处,此时行人04的成像清晰,即第一摄像头采集的第一采集图像中可以立即检测到行人04。First, as shown in FIG6A , the focus of the first camera is located at a nearby position, namely, at the position of pedestrian 04 . At this time, the image of pedestrian 04 is clear, namely, pedestrian 04 can be immediately detected in the first captured image captured by the first camera.

可选的,在第一摄像头识别到行人04之前,第二摄像头没有识别到行人05。则此时,由于第一摄像头已经识别到人物,因此第二摄像头无需再采集第二采集图像,也无需对第二采集图像进行成像目标识别。Optionally, before the first camera recognizes the pedestrian 04, the second camera does not recognize the pedestrian 05. At this time, since the first camera has recognized the person, the second camera does not need to capture the second captured image, nor does it need to perform imaging target recognition on the second captured image.

在一种可选的实施例中,若用户想要识别的是行人05,则用户可以基于图6B所示的相机应用程序界面手动点击行人05,使第一摄像头聚焦于远景处的行人05,以使电子设备100基于第一采集图像识别到行人05。In an optional embodiment, if the user wants to identify pedestrian 05, the user can manually click on pedestrian 05 based on the camera application interface shown in Figure 6B, so that the first camera focuses on pedestrian 05 in the distance, so that the electronic device 100 can recognize pedestrian 05 based on the first captured image.

参考图7,下面结合图7进一步介绍本申请实施例的一种示例性流程。With reference to FIG. 7 , an exemplary process of an embodiment of the present application is further described below in combination with FIG. 7 .

首先,启动扫码程序701,电子设备100开始通过主摄、超广角摄像头来采集图像,即通知底层启动主摄以及超广角双路出流702,并且,主路送显并进入扫码流程703。可以理解,送显即于电子设备100的屏幕上显示。超广角出流不送显,同时在和主摄共同视场角field of view,FOV的范围内图像进行二维码检测704。First, the code scanning program is started 701, and the electronic device 100 starts to collect images through the main camera and the ultra-wide-angle camera, that is, the bottom layer is notified to start the main camera and the ultra-wide-angle dual-channel output stream 702, and the main channel is sent to display and enters the code scanning process 703. It can be understood that the sending and display means displaying on the screen of the electronic device 100. The ultra-wide-angle output stream is not sent to display, and the image is detected by the QR code within the field of view (FOV) shared with the main camera 704.

如果超广角摄像头是自动对焦,则对焦点从无穷远到微距遍历;如果超广角摄像头是固定对焦则对焦点不变化,然后将每隔N帧的数据送给二维码检测算法进行检测705。例如,将对焦点由无穷远到微距遍历,得到图像,以及放大X倍的图像,对上述的图像进行检测。放大图像到X倍后706,判断是否超广角图像中检测到二维码信息707,若否,继续完成主路扫码流程708,若是,将检测出二维码的图像对应的马达位置记录下来709。If the ultra-wide-angle camera is auto-focusing, the focus point is traversed from infinity to macro; if the ultra-wide-angle camera is fixed focus, the focus point does not change, and then the data of every N frames is sent to the QR code detection algorithm for detection 705. For example, the focus point is traversed from infinity to macro to obtain an image, and an image magnified by X times, and the above image is detected. After the image is magnified to X times 706, it is determined whether the QR code information is detected in the ultra-wide-angle image 707. If not, continue to complete the main road scanning process 708. If so, the motor position corresponding to the image where the QR code is detected is recorded 709.

此时,可以判断是否主摄当时已经检测出二维码710,若是,完成二维码检测流程718,若否,将马达位置转换成物距传给主摄712,主摄将物距转换为主摄马达的目标位置,控制马达从当前对焦位置移动到目标位置713。然后,判断是否超广角检测出的二维码数量大于1个714。若是,显示可选的N个二维码715,用户点击选择二维码716,即根据用户的选择确定需要扫描的二维码,然后完成二维码检测流程718。若否,显示1个二维码717,然后完成二维码检测流程718。At this time, it can be determined whether the main camera has detected the QR code at that time 710. If so, the QR code detection process 718 is completed. If not, the motor position is converted into the object distance and transmitted to the main camera 712. The main camera converts the object distance into the target position of the main camera motor and controls the motor to move from the current focus position to the target position 713. Then, it is determined whether the number of QR codes detected by the ultra-wide angle is greater than 1 714. If so, N optional QR codes are displayed 715, and the user clicks to select a QR code 716, that is, the QR code to be scanned is determined according to the user's selection, and then the QR code detection process 718 is completed. If not, 1 QR code is displayed 717, and then the QR code detection process 718 is completed.

图8示出了电子设备100的硬件结构示意图。FIG. 8 shows a schematic diagram of the hardware structure of the electronic device 100 .

电子设备100可以包括处理器110,外部存储器接口120,内部存储器121,通用串行总线(universal serial bus,USB)接口130,充电管理模块140,电源管理模块141,电池142,天线1,天线2,移动通信模块150,无线通信模块160,音频模块170,扬声器170A,受话器170B,麦克风170C,耳机接口170D,传感器模块180,按键190,马达191,指示器192,摄像头193,显示屏194,以及用户标识模块(subscriber identification module,SIM)卡接口195等。其中传感器模块180可以包括压力传感器180A,陀螺仪传感器180B,气压传感器180C,磁传感器180D,加速度传感器180E,距离传感器180F,接近光传感器180G,指纹传感器180H,温度传感器180J,触摸传感器180K,环境光传感器180L,骨传导传感器180M等。The electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc. The sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, etc.

可以理解的是,本发明实施例示意的结构并不构成对电子设备100的具体限定。在本申请另一些实施例中,电子设备100可以包括比图示更多或更少的部件,或者组合某些部件,或者拆分某些部件,或者不同的部件布置。图示的部件可以以硬件,软件或软件和硬件的组合实现。It is to be understood that the structure illustrated in the embodiment of the present invention does not constitute a specific limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may include more or fewer components than shown in the figure, or combine some components, or split some components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.

处理器110可以包括一个或多个处理单元,例如:处理器110可以包括应用处理器(application processor,AP),调制解调处理器,图形处理器(graphics processingunit,GPU),图像信号处理器(image signal processor,ISP),控制器,视频编解码器,数字信号处理器(digitalsignal processor,DSP),基带处理器,和/或神经网络处理器(neural-network processing unit,NPU)等。其中,不同的处理单元可以是独立的器件,也可以集成在一个或多个处理器中。The processor 110 may include one or more processing units, for example, the processor 110 may include an application processor (AP), a modem processor, a graphics processor (GPU), an image signal processor (ISP), a controller, a video codec, a digital signal processor (DSP), a baseband processor, and/or a neural-network processing unit (NPU), etc. Different processing units may be independent devices or integrated into one or more processors.

处理器110中还可以设置存储器,用于本申请实施例提供的一种图像采集方法对应的存储指令和数据。在一些实施例中,处理器110中的存储器为高速缓冲存储器。该存储器可以保存处理器110刚用过或循环使用的指令或数据。如果处理器110需要再次使用该指令或数据,可从存储器中直接调用。避免了重复存取,减少了处理器110的等待时间,因而提高了系统的效率。A memory may also be provided in the processor 110 for storing instructions and data corresponding to an image acquisition method provided in an embodiment of the present application. In some embodiments, the memory in the processor 110 is a cache memory. The memory may store instructions or data that the processor 110 has just used or circulated. If the processor 110 needs to use the instruction or data again, it may be directly called from the memory. Repeated access is avoided, the waiting time of the processor 110 is reduced, and the efficiency of the system is improved.

在一些实施例中,电子设备100的处理器110通过调用存储器存储的程序指令,用于按照获得的程序指令执行本申请提及的图像采集方法。例如:测到采集指令,控制第一摄像头和第二摄像头进行采集,并显示第一摄像头的采集画面;对应于在第一摄像头采集的图像中未检测到成像目标,并且检测到第二摄像头以第一采集参数采集的第一图像中存在成像目标;根据第一采集参数控制第一摄像头进行采集,得到包括成像目标的第二图像,并显示第二图像。又例如:检测到采集指令,控制第一摄像头和第二摄像头进行采集,并显示第一摄像头的采集画面;对应于在第一摄像头采集的图像中未检测到成像目标,并且检测到第二摄像头采集的第三图像中存在成像目标;将显示的第一摄像头的采集画面切换为第二摄像头的采集画面,其中,第二摄像头的采集画面中显示有成像目标。In some embodiments, the processor 110 of the electronic device 100 is used to execute the image acquisition method mentioned in the present application according to the obtained program instructions by calling the program instructions stored in the memory. For example: when an acquisition instruction is detected, the first camera and the second camera are controlled to acquire, and the acquisition screen of the first camera is displayed; corresponding to the imaging target not being detected in the image acquired by the first camera, and the imaging target being detected in the first image acquired by the second camera with the first acquisition parameter; the first camera is controlled to acquire according to the first acquisition parameter to obtain a second image including the imaging target, and the second image is displayed. For another example: when an acquisition instruction is detected, the first camera and the second camera are controlled to acquire, and the acquisition screen of the first camera is displayed; corresponding to the imaging target not being detected in the image acquired by the first camera, and the imaging target being detected in the third image acquired by the second camera; the acquisition screen of the displayed first camera is switched to the acquisition screen of the second camera, wherein the imaging target is displayed in the acquisition screen of the second camera.

电子设备100的无线通信功能可以通过天线1,天线2,移动通信模块150,无线通信模块160,调制解调处理器以及基带处理器等实现。The wireless communication function of the electronic device 100 can be implemented through the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modem processor and the baseband processor.

电子设备100通过GPU,显示屏194,以及应用处理器等实现显示功能。GPU为图像处理的微处理器,连接显示屏194和应用处理器。GPU用于执行数学和几何计算,用于图形渲染。处理器110可包括一个或多个GPU,其执行程序指令以生成或改变显示信息。The electronic device 100 implements the display function through a GPU, a display screen 194, and an application processor. The GPU is a microprocessor for image processing, which connects the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 110 may include one or more GPUs that execute program instructions to generate or change display information.

显示屏194用于显示图像,视频等。显示屏194包括显示面板。显示面板可以采用液晶显示屏(liquid crystal display,LCD),有机发光二极管(organiclight-emittingdiode,OLED),有源矩阵有机发光二极体或主动矩阵有机发光二极体(active-matrixorganic light emitting diode的,AMOLED),柔性发光二极管(flexlight-emittingdiode,FLED),Miniled,MicroLed,Micro-oLed,量子点发光二极管(quantum dot lightemitting diodes,QLED)等。在一些实施例中,电子设备100可以包括1个或N个显示屏194,N为大于1的正整数。The display screen 194 is used to display images, videos, etc. The display screen 194 includes a display panel. The display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light emitting diode or an active-matrix organic light emitting diode (AMOLED), a flexible light-emitting diode (FLED), Miniled, MicroLed, Micro-oLed, a quantum dot light-emitting diode (QLED), etc. In some embodiments, the electronic device 100 may include 1 or N display screens 194, where N is a positive integer greater than 1.

电子设备100可以通过ISP,摄像头193,视频编解码器,GPU,显示屏194以及应用处理器等实现采集功能。The electronic device 100 can implement the acquisition function through an ISP, a camera 193, a video codec, a GPU, a display screen 194, and an application processor.

ISP用于处理摄像头193反馈的数据。例如,拍照时,打开快门,光线通过镜头被传递到摄像头感光元件上,光信号转换为电信号,摄像头感光元件将所述电信号传递给ISP处理,转化为肉眼可见的图像。ISP还可以对图像的噪点,亮度,肤色进行算法优化。ISP还可以对采集场景的曝光,色温等参数优化。在一些实施例中,ISP可以设置在摄像头193中。ISP is used to process the data fed back by camera 193. For example, when taking a photo, the shutter is opened, and the light is transmitted to the camera photosensitive element through the lens. The light signal is converted into an electrical signal, and the camera photosensitive element transmits the electrical signal to ISP for processing and converts it into an image visible to the naked eye. ISP can also perform algorithm optimization on the noise, brightness, and skin color of the image. ISP can also optimize the exposure, color temperature and other parameters of the captured scene. In some embodiments, ISP can be set in camera 193.

摄像头193用于捕获静态图像或视频。物体通过镜头生成光学图像投射到感光元件。感光元件可以是电荷耦合器件(charge coupled device,CCD)或互补金属氧化物半导体(complementarymetal-oxide-semiconductor,CMOS)光电晶体管。感光元件把光信号转换成电信号,之后将电信号传递给ISP转换成数字图像信号。ISP将数字图像信号输出到DSP加工处理。DSP将数字图像信号转换成标准的RGB,YUV等格式的图像信号。在一些实施例中,电子设备100可以包括1个或N个摄像头193,N为大于1的正整数。The camera 193 is used to capture still images or videos. The object generates an optical image through the lens and projects it onto the photosensitive element. The photosensitive element can be a charge coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The photosensitive element converts the optical signal into an electrical signal, and then passes the electrical signal to the ISP to be converted into a digital image signal. The ISP outputs the digital image signal to the DSP for processing. The DSP converts the digital image signal into an image signal in a standard RGB, YUV or other format. In some embodiments, the electronic device 100 may include 1 or N cameras 193, where N is a positive integer greater than 1.

视频编解码器用于对数字视频压缩或解压缩。电子设备100可以支持一种或多种视频编解码器。这样,电子设备100可以播放或录制多种编码格式的视频,例如:动态图像专家组(moving picture experts group,MPEG)1,MPEG2,MPEG3,MPEG4等。Video codecs are used to compress or decompress digital videos. The electronic device 100 may support one or more video codecs. Thus, the electronic device 100 may play or record videos in a variety of coding formats, such as Moving Picture Experts Group (MPEG) 1, MPEG2, MPEG3, MPEG4, etc.

按键190包括开机键,音量键等。按键190可以是机械按键。也可以是触摸式按键,例如相机应用的采集按键等。电子设备100可以接收按键输入,产生与电子设备100的用户设置以及功能控制有关的键信号输入。The key 190 includes a power key, a volume key, etc. The key 190 may be a mechanical key. It may also be a touch key, such as a capture key of a camera application. The electronic device 100 may receive key input and generate key signal input related to user settings and function control of the electronic device 100.

电子设备100的软件系统可以采用分层架构,事件驱动架构,微核架构,微服务架构,或云架构。本发明实施例以分层架构的Android系统为例,示例性说明电子设备100的软件结构。The software system of the electronic device 100 may adopt a layered architecture, an event-driven architecture, a micro-core architecture, a micro-service architecture, or a cloud architecture. In the embodiment of the present invention, the Android system of the layered architecture is taken as an example to exemplify the software structure of the electronic device 100.

图9是本发明实施例的电子设备100的软件结构框图。FIG. 9 is a software structure block diagram of the electronic device 100 according to an embodiment of the present invention.

分层架构将软件分成若干个层,每一层都有清晰的角色和分工。层与层之间通过软件接口通信。在一些实施例中,将Android系统分为四层,从上至下分别为应用程序层,应用程序框架层,安卓运行时(Android runtime)和系统库,以及内核层。The layered architecture divides the software into several layers, each with clear roles and division of labor. The layers communicate with each other through software interfaces. In some embodiments, the Android system is divided into four layers, from top to bottom: the application layer, the application framework layer, the Android runtime and system library, and the kernel layer.

应用程序层可以包括一系列应用程序包。如图8所示,应用程序包可以包括相机,图库,日历,通话,地图,导航,WLAN,蓝牙,双卡与移动网络等应用程序。其中,用户可以通过唤醒相机应用或者扫码应用,实时采集图像、录制视频。The application layer can include a series of application packages. As shown in Figure 8, the application package can include applications such as camera, gallery, calendar, call, map, navigation, WLAN, Bluetooth, dual SIM and mobile network. Among them, users can capture images and record videos in real time by waking up the camera application or scanning the code application.

应用程序框架层为应用程序层的应用程序提供应用编程接口(applicationprogramming interface,API)和编程框架。应用程序框架层包括一些预先定义的函数。The application framework layer provides an application programming interface (API) and programming framework for applications in the application layer. The application framework layer includes some predefined functions.

如图9所示,应用程序框架层可以包括窗口管理器,内容提供器,视图系统,电话管理器,资源管理器,通知管理器等。As shown in FIG. 9 , the application framework layer may include a window manager, a content provider, a view system, a telephony manager, a resource manager, a notification manager, and the like.

Android Runtime包括核心库和虚拟机。Android runtime负责安卓系统的调度和管理。Android Runtime includes core libraries and virtual machines. Android runtime is responsible for scheduling and management of the Android system.

系统库可以包括多个功能模块。例如:表面管理器(surface manager),媒体库(Media Libraries),三维图形处理库(例如:OpenGL ES),2D图形引擎(例如:SGL)等。The system library can include multiple functional modules, such as surface manager, media library, 3D graphics processing library (such as OpenGL ES), 2D graphics engine (such as SGL), etc.

内核层是硬件和软件之间的层。内核层至少包含显示驱动,摄像头驱动,音频驱动,传感器驱动。The kernel layer is the layer between hardware and software. The kernel layer contains at least display driver, camera driver, audio driver, and sensor driver.

相应地,本申请实施例提供一种电子设备,包括:存储器,用于存储由电子设备的一个或多个处理器执行的指令,以及处理器,用于执行上述的图像采集方法的指令。Accordingly, an embodiment of the present application provides an electronic device, comprising: a memory for storing instructions executed by one or more processors of the electronic device, and a processor for executing instructions of the above-mentioned image acquisition method.

相应地,本申请实施例提供一种存储介质,存储介质上存储有指令,指令在电子设备上执行时使电子设备执行上述的图像采集方法。Accordingly, an embodiment of the present application provides a storage medium on which instructions are stored. When the instructions are executed on an electronic device, the electronic device executes the above-mentioned image acquisition method.

相应地,本申请实施例提供一种芯片,芯片包括可编程逻辑电路和/或程序指令,当芯片运行时,实现上述的图像采集方法。Accordingly, an embodiment of the present application provides a chip, which includes a programmable logic circuit and/or program instructions. When the chip is running, the above-mentioned image acquisition method is implemented.

本说明书提供了如实施例或流程图所示的方法或者流程操作步骤,但基于常规或者无创造性的劳动可以包括更多或者更少的操作步骤。实施例中列举的步骤顺序仅仅为众多执行顺序中的一种方式,不代表唯一的执行顺序,在实际执行时,可以按照实施例或者附图所示的方法或者流程顺序执行或者并行执行(例如并行控制器或者多线程处理的环境)。This specification provides method or process operation steps as shown in the embodiments or flow charts, but more or fewer operation steps may be included based on routine or non-creative work. The order of steps listed in the embodiments is only one of many execution orders and does not represent the only execution order. In actual execution, the method or process sequence shown in the embodiments or drawings may be executed or executed in parallel (for example, in a parallel controller or multi-threaded processing environment).

本申请公开的各实施例可以被实现在硬件、软件、固件或这些实现方法的组合中。本申请的实施例可实现为在可编程系统上执行的计算机程序或程序代码,该可编程系统包括至少一个处理器、存储系统(包括易失性和非易失性存储器和/或存储元件)、至少一个输入设备以及至少一个输出设备。The embodiments disclosed in the present application may be implemented in hardware, software, firmware or a combination of these implementation methods. The embodiments of the present application may be implemented as a computer program or program code executed on a programmable system, the programmable system including at least one processor, a storage system (including volatile and non-volatile memory and/or storage elements), at least one input device and at least one output device.

可将程序代码应用于输入指令,以执行本申请描述的各功能并生成输出信息。可以按已知方式将输出信息应用于一个或多个输出设备。为了本申请的目的,处理系统包括具有诸如例如数字信号处理器(DSP)、微控制器、专用集成电路(ASIC)或微处理器之类的处理器的任何系统。Program code may be applied to input instructions to perform the functions described herein and generate output information. The output information may be applied to one or more output devices in a known manner. For purposes of this application, a processing system includes any system having a processor such as, for example, a digital signal processor (DSP), a microcontroller, an application specific integrated circuit (ASIC), or a microprocessor.

程序代码可以用高级程序化语言或面向对象的编程语言来实现,以便与处理系统通信。在需要时,也可用汇编语言或机器语言来实现程序代码。事实上,本申请中描述的机制 不限于任何特定编程语言的范围。在任一情形下,该语言可以是编译语言或解释语言。Program code can be implemented with high-level programming language or object-oriented programming language to communicate with the processing system. When necessary, program code can also be implemented with assembly language or machine language. In fact, the mechanism described in this application is not limited to the scope of any specific programming language. In either case, the language can be a compiled language or an interpreted language.

在一些情况下,所公开的实施例可以以硬件、固件、软件或其任何组合来实现。所公开的实施例还可以被实现为由一个或多个暂时或非暂时性机器可读(例如,计算机可读)存储介质承载或存储在其上的指令,其可以由一个或多个处理器读取和执行。例如,指令可以通过网络或通过其他计算机可读介质分发。因此,机器可读介质可以包括用于以机器(例如,计算机)可读的形式存储或传输信息的任何机制,包括但不限于,软盘、光盘、光碟、只读存储器(CD-ROMs)、磁光盘、只读存储器(ROM)、随机存取存储器(RAM)、可擦除可编程只读存储器(EPROM)、电可擦除可编程只读存储器(EEPROM)、磁卡或光卡、闪存、或用于利用因特网以电、光、声或其他形式的传播信号来传输信息(例如,载波、红外信号数字信号等)的有形的机器可读存储器。因此,机器可读介质包括适合于以机器(例如,计算机)可读的形式存储或传输电子指令或信息的任何类型的机器可读介质。In some cases, the disclosed embodiments may be implemented in hardware, firmware, software, or any combination thereof. The disclosed embodiments may also be implemented as instructions carried or stored on one or more temporary or non-temporary machine-readable (e.g., computer-readable) storage media, which may be read and executed by one or more processors. For example, the instructions may be distributed over a network or through other computer-readable media. Therefore, machine-readable media may include any mechanism for storing or transmitting information in a form readable by a machine (e.g., a computer), including, but not limited to, floppy disks, optical disks, optical discs, read-only memories (CD-ROMs), magneto-optical disks, read-only memories (ROMs), random access memories (RAMs), erasable programmable read-only memories (EPROMs), electrically erasable programmable read-only memories (EEPROMs), magnetic or optical cards, flash memory, or a tangible machine-readable memory for transmitting information (e.g., carrier waves, infrared signals, digital signals, etc.) using the Internet in electrical, optical, acoustic, or other forms of propagation signals. Therefore, machine-readable media include any type of machine-readable media suitable for storing or transmitting electronic instructions or information in a form readable by a machine (e.g., a computer).

如本文所使用的,术语“模块”可以指代,作为其中的一部分,或者包括:用于运行一个或多个软件或固件程序的存储器(共享、专用或组),专用集成电路(ASIC),电子电路和/或处理器(共享、专用或组),组合逻辑电路,和/或提供所述功能的其他合适组件。As used herein, the term "module" may refer to, be a part of, or include: a memory (shared, dedicated, or group) for running one or more software or firmware programs, an application-specific integrated circuit (ASIC), an electronic circuit and/or processor (shared, dedicated, or group), a combinational logic circuit, and/or other suitable components that provide the functionality.

在附图中,可能以特定布置和/或顺序示出了一些结构或方法特征。然而,应当理解的是,这样的特定布置和/或排序不是必需的。而是,在一些实施例中,这些特征可以以不同于说明性附图中所示的方式和/或顺序来进行说明。另外,特定附图中所包含得结构或方法特征并不意味着所有实施例都需要包含这样的特征,在一些实施例中,可以不包含这些特征,或者可以将这些特征与其他特征进行组合。In the accompanying drawings, some structural or method features may be shown in a specific arrangement and/or order. However, it should be understood that such a specific arrangement and/or order is not required. Instead, in some embodiments, these features may be described in a manner and/or order different from that shown in the illustrative drawings. In addition, the structural or method features included in a specific figure do not mean that all embodiments need to include such features. In some embodiments, these features may not be included, or these features may be combined with other features.

上面结合附图对本申请的实施例做了详细说明,但本申请技术方案的使用不仅仅局限于本专利实施例中提及的各种应用,各种结构和变型都可以参考本申请技术方案轻易地实施,以达到本文中提及的各种有益效果。在本领域普通技术人员所具备的知识范围内,在不脱离本申请宗旨的前提下做出的各种变化,均应归属于本申请专利涵盖范围。The embodiments of the present application are described in detail above in conjunction with the accompanying drawings, but the use of the technical solution of the present application is not limited to the various applications mentioned in the embodiments of the present patent. Various structures and variations can be easily implemented with reference to the technical solution of the present application to achieve the various beneficial effects mentioned herein. Various changes made within the knowledge of ordinary technicians in the field without departing from the purpose of the present application should all fall within the scope of the patent application.

Claims (18)

1. The image acquisition method is applied to electronic equipment and is characterized in that the electronic equipment comprises a first camera and a second camera which are different, the first camera is a main camera, the depth of field range of an image acquired by the first camera is different from that of the second camera, the first camera acquires based on a first focusing strategy, the second camera acquires based on a second focusing strategy, and the first focusing strategy and the second focusing strategy are different; and
The method comprises the following steps:
detecting an acquisition instruction, controlling the first camera and the second camera to acquire, and displaying an acquisition picture of the first camera;
detecting that an imaging target is not detected in the image acquired by the first camera, and detecting that the imaging target exists in a first image acquired by the second camera according to a first acquisition parameter, wherein the imaging target comprises a graphic code;
controlling the first camera to acquire according to the first acquisition parameters to obtain a second image comprising the imaging target, and displaying the second image;
and analyzing the imaging target in the second image.
2. The method of claim 1, wherein the first focus strategy is to acquire a plurality of images from near to far focus, and the second focus strategy is to acquire a plurality of images from far to near focus;
the distance between the imaging target and the electronic equipment is larger than a preset distance.
3. The method of claim 1, wherein the detecting that the second camera has an imaging target in a first image acquired with a first acquisition parameter comprises:
And detecting a plurality of images which are acquired by the second camera and have the acquisition range corresponding to that of the first camera, and detecting a first image of the imaging target.
4. The method of claim 1, wherein controlling the first camera to acquire according to the first acquisition parameter, obtaining a second image including the imaging target, and displaying the second image, comprises:
Determining the distance from the imaging target to the electronic equipment according to the first acquisition parameters;
Determining a second acquisition parameter required by the first camera to acquire the second image based on the distance from the imaging target to the electronic equipment;
And controlling the first camera to acquire the second acquisition parameters to obtain a second image comprising the imaging target.
5. The method of claim 4, wherein the first acquisition parameter and the second acquisition parameter are each a focus parameter.
6. The method according to claim 1, wherein the method further comprises:
and controlling the second camera to stop acquiring images corresponding to the detection of the imaging target in the images acquired by the first camera.
7. The method of claim 1, wherein a plurality of imaging targets are displayed in the second image, and further comprising:
a first imaging target selected by a user from a plurality of the imaging targets is identified.
8. The method of any one of claims 1-7, wherein the number of first cameras is one and the number of second cameras is a plurality,
The detecting that the imaging target exists in the first image acquired by the second camera according to the first acquisition parameter includes:
detecting that an imaging target exists in a first image acquired by one second camera of the plurality of second cameras according to the first acquisition parameters.
9. The method of any one of claims 1-7, wherein the first camera is a wide angle camera and the second camera is an ultra wide angle camera.
10. The image acquisition method is applied to electronic equipment and is characterized in that the electronic equipment comprises a first camera and a second camera which are different, the first camera is a main camera, the depth of field range of an image acquired by the first camera is different from that of the second camera, the first camera acquires based on a first focusing strategy, the second camera acquires based on a second focusing strategy, and the first focusing strategy and the second focusing strategy are different; and
The method comprises the following steps:
detecting an acquisition instruction, controlling the first camera and the second camera to acquire, and displaying an acquisition picture of the first camera;
Corresponding to the absence of an imaging target in an image acquired by the first camera and the presence of an imaging target in a third image acquired by the second camera, wherein the imaging target comprises a graphic code;
Switching the displayed acquisition picture of the first camera to the acquisition picture of the second camera, wherein the imaging target is displayed in the acquisition picture of the second camera;
and analyzing the imaging target in the third image.
11. The method of claim 10, wherein the acquisition frames of the second camera are:
and adjusting the obtained picture corresponding to the acquisition range of the first camera according to the image acquired by the second camera.
12. The method of claim 10, wherein the first focus strategy is to acquire a plurality of images from near to far focus and the second focus strategy is to acquire a plurality of images from far to near focus.
13. The method of claim 10, wherein the detecting that an imaging target is present in the third image acquired by the second camera comprises:
and detecting a plurality of images which are acquired by the second camera and have the acquisition range corresponding to that of the first camera, and detecting a third image of the imaging target.
14. The method of claim 10, wherein the number of imaging targets is plural, and a plurality of imaging targets are displayed in the acquisition frame of the second camera;
the analyzing the imaging target in the third image includes:
and analyzing the first imaging target selected by the user from the plurality of imaging targets.
15. The method of any one of claims 10-14, wherein the number of first cameras is one and the number of second cameras is a plurality,
The detecting that an imaging target exists in the third image acquired by the second camera includes:
detecting that an imaging target exists in a third image acquired by a target camera in the plurality of second cameras;
the switching to the acquisition picture of the second camera includes:
and switching to an acquisition picture of the target camera.
16. The method of any one of claims 10-14, wherein the first camera is a wide angle camera and the second camera is an ultra wide angle camera.
17. An electronic device, comprising:
a memory for storing instructions for execution by one or more processors of the electronic device, and
A processor, which when executing the instructions in the memory, causes the electronic device to perform the method of any one of claims 1-9 or 10-16.
18. A storage medium having stored thereon instructions that, when executed on an electronic device, cause the electronic device to perform the method of any of claims 1-9 or 10-16.
CN202311726713.1A 2023-12-15 2023-12-15 Image acquisition method, electronic equipment and storage medium Active CN117425071B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311726713.1A CN117425071B (en) 2023-12-15 2023-12-15 Image acquisition method, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311726713.1A CN117425071B (en) 2023-12-15 2023-12-15 Image acquisition method, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN117425071A CN117425071A (en) 2024-01-19
CN117425071B true CN117425071B (en) 2024-09-17

Family

ID=89526933

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311726713.1A Active CN117425071B (en) 2023-12-15 2023-12-15 Image acquisition method, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN117425071B (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105530421A (en) * 2014-09-30 2016-04-27 宇龙计算机通信科技(深圳)有限公司 Terminal, focusing method and device based on double cameras
CN107483822A (en) * 2017-08-28 2017-12-15 上海创功通讯技术有限公司 Focusing method, device and the electronic equipment of dual camera
CN112887615A (en) * 2021-01-27 2021-06-01 维沃移动通信有限公司 Shooting method and device

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104410783B (en) * 2014-11-07 2018-02-02 广东欧珀移动通信有限公司 A kind of focusing method and terminal
CN106331484B (en) * 2016-08-24 2020-02-14 维沃移动通信有限公司 Focusing method and mobile terminal
CN110519503B (en) * 2018-05-22 2021-06-22 维沃移动通信有限公司 Method for acquiring scanned image and mobile terminal
CN118138876A (en) * 2022-01-25 2024-06-04 荣耀终端有限公司 Method for switching cameras and electronic device
CN116663587A (en) * 2022-02-17 2023-08-29 荣耀终端有限公司 Two-dimensional code recognition method and recognition device
CN117177062B (en) * 2022-05-30 2024-06-25 荣耀终端有限公司 Camera switching method and electronic device

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105530421A (en) * 2014-09-30 2016-04-27 宇龙计算机通信科技(深圳)有限公司 Terminal, focusing method and device based on double cameras
CN107483822A (en) * 2017-08-28 2017-12-15 上海创功通讯技术有限公司 Focusing method, device and the electronic equipment of dual camera
CN112887615A (en) * 2021-01-27 2021-06-01 维沃移动通信有限公司 Shooting method and device

Also Published As

Publication number Publication date
CN117425071A (en) 2024-01-19

Similar Documents

Publication Publication Date Title
US11968447B2 (en) Long-focus shooting method and electronic device
CN108399349B (en) Image recognition method and device
US9451173B2 (en) Electronic device and control method of the same
CN113810604B (en) Document shooting method, electronic device and storage medium
WO2021185374A1 (en) Image capturing method and electronic device
CN115633255B (en) Video processing method and electronic equipment
CN116668773B (en) Method for enhancing video image quality and electronic equipment
CN113709355B (en) Sliding zoom shooting method and electronic equipment
US20240323518A1 (en) Camera switching method and electronic device
CN117177062B (en) Camera switching method and electronic device
WO2024179070A1 (en) Method for zooming in qr code, and electronic device
CN117119285B (en) A method of shooting
CN120075613A (en) Electronic device and method for displaying image at electronic device
KR20220005283A (en) Electronic device for image improvement and camera operation method of the electronic device
CN117425071B (en) Image acquisition method, electronic equipment and storage medium
CN117692771B (en) Focusing method and related device
CN115460343B (en) Image processing method, device and storage medium
US20240397199A1 (en) Shooting Method and Related Device
WO2023160224A9 (en) Photographing method and related device
CN115601842A (en) Automatic snapshot method, electronic device and storage medium
CN115883958A (en) Portrait shooting method
CN116761082B (en) Image processing methods and devices
CN116055871B (en) Video processing methods and related equipment
US20250077817A1 (en) Code scanning method and electronic device
CN117135451B (en) Focus processing method, 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
CP03 Change of name, title or address

Address after: Unit 3401, unit a, building 6, Shenye Zhongcheng, No. 8089, Hongli West Road, Donghai community, Xiangmihu street, Futian District, Shenzhen, Guangdong 518040

Patentee after: Honor Terminal Co.,Ltd.

Country or region after: China

Address before: 3401, unit a, building 6, Shenye Zhongcheng, No. 8089, Hongli West Road, Donghai community, Xiangmihu street, Futian District, Shenzhen, Guangdong

Patentee before: Honor Device Co.,Ltd.

Country or region before: China

CP03 Change of name, title or address