[go: up one dir, main page]

CN111669462B - Method and related device for displaying image - Google Patents

Method and related device for displaying image Download PDF

Info

Publication number
CN111669462B
CN111669462B CN202010480991.3A CN202010480991A CN111669462B CN 111669462 B CN111669462 B CN 111669462B CN 202010480991 A CN202010480991 A CN 202010480991A CN 111669462 B CN111669462 B CN 111669462B
Authority
CN
China
Prior art keywords
image
horizontal
electronic device
vertical screen
screen state
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
CN202010480991.3A
Other languages
Chinese (zh)
Other versions
CN111669462A (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.)
Huawei Technologies Co Ltd
Original Assignee
Huawei Technologies 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 Huawei Technologies Co Ltd filed Critical Huawei Technologies Co Ltd
Priority to CN202010480991.3A priority Critical patent/CN111669462B/en
Publication of CN111669462A publication Critical patent/CN111669462A/en
Application granted granted Critical
Publication of CN111669462B publication Critical patent/CN111669462B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

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

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Studio Devices (AREA)
  • User Interface Of Digital Computer (AREA)

Abstract

公开了一种显示图像的方法,包括:电子设备显示预览界面,预览界面包括第一摄像头采集的第一图像,第一图像显示于显示屏的第一区域;在预览界面中检测到第一用户操作,通过第一摄像头拍摄第一图像,通过第二摄像头拍摄第二图像;根据第二图像确定电子设备的第一横竖屏状态,并关联存储第一图像和第一横竖屏状态;检测到查看第一图像的第二用户操作,确定电子设备的第二横竖屏状态,并在显示屏的第二区域显示第一图像;在显示屏上第二区域显示的第一图像相对于第一区域显示的第二一图像的第一旋转角度,由第一横竖屏状态和第二横竖屏状态确定,第二区域的尺寸比例和第一区域的尺寸比例相同。这样,能够准确识别电子设备的横竖屏状态。

Figure 202010480991

A method for displaying images is disclosed, including: an electronic device displays a preview interface, the preview interface includes a first image collected by a first camera, and the first image is displayed in a first area of a display screen; a first user is detected in the preview interface operation, the first image is captured by the first camera, and the second image is captured by the second camera; the first horizontal and vertical screen state of the electronic device is determined according to the second image, and the first image and the first horizontal and vertical screen state are stored in association; The second user operation of the first image determines the second horizontal and vertical screen states of the electronic device, and displays the first image in the second area of the display screen; the first image displayed in the second area on the display screen is displayed relative to the first area The first rotation angle of the second first image is determined by the first horizontal and vertical screen state and the second horizontal and vertical screen state, and the size ratio of the second area is the same as that of the first area. In this way, the horizontal and vertical screen states of the electronic device can be accurately identified.

Figure 202010480991

Description

一种显示图像的方法及相关装置A method and related device for displaying images

技术领域technical field

本申请涉及电子技术领域,尤其涉及一种显示图像的方法及相关装置。The present application relates to the field of electronic technology, and in particular, to a method for displaying images and related devices.

背景技术Background technique

随着生活水平的日益提高,智能手机的拍照功能越来越被普通用户所接纳与喜爱。相比专业相机,智能手机更轻巧,操控更简单。用户利用智能手机拍照时可以轻松变化各种机位和角度,满足不同的拍摄需求。With the improvement of living standards, the camera function of smartphones is more and more accepted and loved by ordinary users. Smartphones are lighter and easier to control than professional cameras. Users can easily change various camera positions and angles when taking pictures with smartphones to meet different shooting needs.

目前,大多数移动设备内置的重力加速度传感器,并利用重力加速度传感器检测手机的横竖屏状态,进而可以判断用户拍摄照片的显示方向。但是,由于技术限制,传感器有时无法准确捕捉到手机的横竖屏状态的变化,此时就会出现电子设备显示的照片与用户所见的拍摄界面显示的预览图像不一致的问题。例如,智能手机的使用者将手机平行于地平面、或接近平行于地平面,进行俯拍时,手机的内置传感器无法准确识别手机的横竖屏状态,从而给拍摄者带来困扰与使用上的麻烦。当然,出现上述问题的情况不局限于俯拍,手机的内置传感器在任何场景都有一定概率无法准确识别手机的横竖屏状态。At present, most mobile devices have built-in gravitational acceleration sensors, and use the gravitational acceleration sensor to detect the horizontal and vertical screen states of the mobile phone, so as to determine the display direction of the photos taken by the user. However, due to technical limitations, the sensor sometimes cannot accurately capture the changes in the horizontal and vertical screen states of the mobile phone. At this time, the problem of inconsistency between the photos displayed by the electronic device and the preview images displayed on the shooting interface seen by the user occurs. For example, when a smartphone user places the mobile phone parallel to the ground plane, or nearly parallel to the ground plane, when taking an overhead shot, the built-in sensor of the mobile phone cannot accurately identify the horizontal and vertical screen status of the mobile phone, which brings trouble to the photographer and causes problems in use. trouble. Of course, the above problems are not limited to aerial shots. The built-in sensor of the mobile phone has a certain probability of being unable to accurately identify the horizontal and vertical screen status of the mobile phone in any scene.

综上所述,现有技术中手机无法准确识别电子设备的横竖屏状态。To sum up, in the prior art, the mobile phone cannot accurately identify the horizontal and vertical screen states of the electronic device.

发明内容SUMMARY OF THE INVENTION

本申请实施例提供了一种显示图像的方法及相关装置,能够准确识别电子设备的横竖屏状态。The embodiments of the present application provide a method and a related apparatus for displaying an image, which can accurately identify the horizontal and vertical screen states of an electronic device.

第一方面,本申请提供了一种显示图像的方法,包括:电子设备显示预览界面,预览界面包括第一摄像头采集的第一图像,第一图像显示于显示屏的第一区域;在预览界面中检测到第一用户操作,响应于第一用户操作,通过第一摄像头拍摄第一图像,通过第二摄像头拍摄第二图像;第二图像包括人脸;根据第二图像确定电子设备的第一横竖屏状态,并关联存储第一图像和第一横竖屏状态;检测到查看第一图像的第二用户操作,响应于第二用户操作,确定电子设备的第二横竖屏状态,并在显示屏的第二区域显示第一图像;在显示屏上第二区域显示的第一图像相对于第一区域显示的第二一图像的第一旋转角度,由第一横竖屏状态和第二横竖屏状态确定,第二区域的尺寸比例和第一区域的尺寸比例相同。In a first aspect, the present application provides a method for displaying images, including: an electronic device displays a preview interface, the preview interface includes a first image captured by a first camera, and the first image is displayed in a first area of a display screen; In response to the first user operation, a first user operation is detected, a first image is captured by a first camera, and a second image is captured by a second camera; the second image includes a human face; the first image of the electronic device is determined according to the second image. The horizontal and vertical screen states are stored in association with the first image and the first horizontal and vertical screen states; a second user operation for viewing the first image is detected, and in response to the second user operation, the second horizontal and vertical screen states of the electronic device are determined, and displayed on the display screen The first image is displayed in the second area of It is determined that the size ratio of the second area is the same as that of the first area.

实施本申请实施例,电子设备通过第一摄像头拍摄第一图像时,可以通过第二摄像头拍摄第二图像,并利用第二图像确定第一图像拍摄时电子设备的第一横竖屏状态。用户通过上述电子设备在第二横竖屏状态下查看第一图像时,电子设备根据第一横竖屏状态和第二横竖屏状态确定电子设备显示的第一图像的旋转角度。实施本申请实施例提供的显示图像的方法,不受限于传统传感器的性能限制,通过对用户行为的检测,获取符合用户行为意图的横竖屏状态。从而能够准确识别电子设备的横竖屏状态,提升用户的拍摄体验。Implementing the embodiment of the present application, when the electronic device captures the first image through the first camera, the second image can be captured through the second camera, and the second image is used to determine the first horizontal and vertical screen state of the electronic device when the first image is captured. When the user views the first image in the second horizontal and vertical screen state through the electronic device, the electronic device determines the rotation angle of the first image displayed by the electronic device according to the first horizontal and vertical screen state and the second horizontal and vertical screen state. The implementation of the method for displaying images provided by the embodiments of the present application is not limited by the performance limitations of traditional sensors, and the horizontal and vertical screen states conforming to the user's behavior intention are acquired by detecting the user's behavior. Therefore, the horizontal and vertical screen states of the electronic device can be accurately identified, and the user's shooting experience can be improved.

在一种实现方式中,上述确定电子设备的第二横竖屏状态,包括:通过第二摄像头采集第三图像;第三图像包括人脸;根据第三图像确定电子设备的第二横竖屏状态。In an implementation manner, determining the second horizontal and vertical screen state of the electronic device includes: collecting a third image through a second camera; the third image includes a human face; and determining the second horizontal and vertical screen state of the electronic device according to the third image.

在一种实现方式中,上述电子设备通过第一参数表征第一横竖屏状态,取第一值的第一参数表征向上竖屏,取第二值的第一参数表征左横屏,取第三值的第一参数表征向下竖屏,取第四值的第一参数表征右横屏;关联存储第一图像和第一横竖屏状态,包括:关联存储第一图像和第一参数。In an implementation manner, the electronic device uses the first parameter to represent the first horizontal and vertical screen state, the first parameter with the first value represents the vertical vertical screen, the first parameter with the second value represents the left horizontal screen, and the third The first parameter of the value represents the downward vertical screen, and the first parameter of the fourth value represents the right horizontal screen; the associated storage of the first image and the first horizontal and vertical screen state includes: associated storage of the first image and the first parameter.

在一种实现方式中,上述根据第二图像确定电子设备的第一横竖屏状态,包括:当电子设备的屏幕与水平面的夹角小于预设角度时,根据第二图像确定电子设备的第一横竖屏状态。In an implementation manner, determining the first horizontal and vertical screen state of the electronic device according to the second image includes: when the angle between the screen of the electronic device and the horizontal plane is less than a preset angle, determining the first horizontal and vertical screen state of the electronic device according to the second image. Horizontal and vertical screen status.

在一种实现方式中,上述根据第二图像确定电子设备的第一横竖屏状态,包括:根据第二图像的标准基准线与第二图像对应的人脸基准线的第一夹角确定第一横竖屏状态。In an implementation manner, the above-mentioned determining the first horizontal and vertical screen state of the electronic device according to the second image includes: determining the first horizontal and vertical screen state according to the first angle between the standard reference line of the second image and the face reference line corresponding to the second image. Horizontal and vertical screen status.

在一种实现方式中,当第二图像包含多个人脸时,第二图像对应的人脸基准线为第二图像的多个人脸中面积最大的人脸的人脸基准线。In an implementation manner, when the second image contains multiple faces, the face reference line corresponding to the second image is the face reference line of the face with the largest area among the multiple faces in the second image.

在一种实现方式中,上述根据第二图像的标准基准线与第二图像对应的人脸基准线的第一夹角确定第一横竖屏状态,包括:第一夹角在第一范围内时,确定第一横竖屏状态为向上竖屏;第一夹角在第二范围内时,确定第一横竖屏状态为左横屏;第一夹角在第三范围内时,确定第一横竖屏状态为向下竖屏;第一夹角在第四范围内时,确定第一横竖屏状态为右横屏。In an implementation manner, the above-mentioned determining the first horizontal and vertical screen state according to the first angle between the standard reference line of the second image and the face reference line corresponding to the second image includes: when the first included angle is within the first range , it is determined that the first horizontal and vertical screen state is the upward vertical screen; when the first included angle is within the second range, the first horizontal and vertical screen state is determined to be the left horizontal screen; when the first included angle is within the third range, the first horizontal and vertical screen is determined. The state is the downward vertical screen; when the first included angle is within the fourth range, it is determined that the first horizontal and vertical screen state is the right horizontal screen.

在一种实现方式中,上述第二图像的标准基准线的朝向是沿着第二图像的侧边从第二图像的底部指向第二图像的顶部;第二图像对应的人脸基准线的朝向是沿着第二图像中人脸的双眼连接线的垂直方向,从下巴指向头顶;第一范围为大于-45°小于等于45°,第二范围为大于-135°小于等于-45°,第三范围为大于135°小于等于225°,第四范围为大于45°小于等于135°。In an implementation manner, the orientation of the standard reference line of the second image is from the bottom of the second image to the top of the second image along the side of the second image; the orientation of the face reference line corresponding to the second image It is along the vertical direction of the connecting line between the eyes of the face in the second image, from the chin to the top of the head; the first range is greater than -45° and less than or equal to 45°, the second range is greater than -135° and less than or equal to -45°, and the first range is greater than -45° and less than or equal to 45°. The third range is greater than 135° and less than or equal to 225°, and the fourth range is greater than 45° and less than or equal to 135°.

在一种实现方式中,上述第一参数等于第二横屏状态为向上竖屏时的第二旋转角度;第二横屏状态为左横屏时,第一旋转角度等于第一参数加上90°;第二横屏状态为向下竖屏时,第一旋转角度等于第一参数加上180°;第二横屏状态为右横屏时,第一旋转角度等于第一参数加上-90°。In an implementation manner, the above-mentioned first parameter is equal to the second rotation angle when the second horizontal screen state is the upward vertical screen; when the second horizontal screen state is the left horizontal screen, the first rotation angle is equal to the first parameter plus 90 °; When the second landscape state is vertical downward, the first rotation angle is equal to the first parameter plus 180°; when the second landscape state is right landscape, the first rotation angle is equal to the first parameter plus -90 °.

在一种实现方式中,上述第一横竖屏状态为向上竖屏,第二横屏状态为向上竖屏时,第一旋转角度等于0°;第一横屏状态为左横屏,第二横屏状态为向上竖屏时,第一旋转角度等于-90°;第一横屏状态为向下竖屏,第二横屏状态为向上竖屏时,第一旋转角度等于180°;第一横屏状态为右横屏,第二横屏状态为向上竖屏时,第一旋转角度等于90°。In an implementation manner, when the first horizontal and vertical screen state is the upward vertical screen, and the second horizontal screen state is the upward vertical screen, the first rotation angle is equal to 0°; the first horizontal screen state is the left horizontal screen, and the second horizontal screen state is the left horizontal screen. When the screen state is vertical screen up, the first rotation angle is equal to -90°; when the first horizontal screen state is vertical screen down, and the second horizontal screen state is vertical screen up, the first rotation angle is equal to 180°; When the screen state is the right horizontal screen, and the second horizontal screen state is the upward vertical screen, the first rotation angle is equal to 90°.

在一种实现方式中,上述第一摄像头为后置摄像头,第二摄像头为前置摄像头。In an implementation manner, the above-mentioned first camera is a rear camera, and the second camera is a front camera.

第二方面,本申请提供了一种电子设备,包括:第一摄像头、第二摄像头、显示屏、一个或多个处理器、以及一个或多个存储器;上述一个或多个存储器用于存储计算机程序代码,上述计算机程序代码包括计算机指令;当上述计算机指令在该处理器上运行时,使得该电子设备执行上述任一方面任一种可能的实现方式中的显示图像的方法。In a second aspect, the present application provides an electronic device, comprising: a first camera, a second camera, a display screen, one or more processors, and one or more memories; the one or more memories are used to store a computer Program code, the computer program code includes computer instructions; when the computer instructions are executed on the processor, the electronic device causes the electronic device to execute the method for displaying an image in any possible implementation manner of any of the above aspects.

第三方面,本申请实施例提供了一种计算机存储介质,包括计算机指令,当计算机指令在电子设备上运行时,使得通信装置执行上述任一方面任一项可能的实现方式中的显示图像的方法。In a third aspect, an embodiment of the present application provides a computer storage medium, including computer instructions, when the computer instructions are executed on an electronic device, the communication apparatus is made to perform any of the possible implementations of any of the above aspects of displaying an image. method.

第四方面,本申请实施例提供了一种计算机程序产品,当计算机程序产品在计算机上运行时,使得计算机执行上述任一方面任一项可能的实现方式中的显示图像的方法。In a fourth aspect, the embodiments of the present application provide a computer program product that, when the computer program product runs on a computer, causes the computer to execute the method for displaying an image in any possible implementation manner of any one of the foregoing aspects.

附图说明Description of drawings

图1为本申请实施例提供的一种用户界面示意图;1 is a schematic diagram of a user interface provided by an embodiment of the present application;

图2为本申请实施例提供的一种拍摄界面示意图;2 is a schematic diagram of a shooting interface provided by an embodiment of the present application;

图3为本申请实施例提供的一种相册界面示意图;3 is a schematic diagram of a photo album interface provided by an embodiment of the present application;

图4A至图4D为本申请实施例提供的一种横竖屏状态示意图;4A to 4D are schematic diagrams of a horizontal and vertical screen state according to an embodiment of the present application;

图5为本申请实施例提供的一种电子设备的坐标系示意图;FIG. 5 is a schematic diagram of a coordinate system of an electronic device according to an embodiment of the present application;

图6为本申请实施例提供的另一种横竖屏状态示意图;6 is a schematic diagram of another horizontal and vertical screen state provided by an embodiment of the present application;

图7至图9为本申请实施例提供的拍摄与显示的用户界面示意图;7 to 9 are schematic diagrams of user interfaces for capturing and displaying according to an embodiment of the present application;

图10为本申请实施例提供的一种标准基准线的示意图;10 is a schematic diagram of a standard reference line provided by an embodiment of the present application;

图11A和图11B为本申请实施例提供的人脸基准线的示意图;FIG. 11A and FIG. 11B are schematic diagrams of face baselines provided by the embodiments of the present application;

图12为本申请实施例提供的一种参考图像示意图;FIG. 12 is a schematic diagram of a reference image provided by an embodiment of the present application;

图13和图14为本申请实施例提供的第一夹角的示意图;13 and 14 are schematic diagrams of a first included angle provided by an embodiment of the present application;

图15为本申请实施例提供的一种显示图像的方法流程示意图;15 is a schematic flowchart of a method for displaying an image provided by an embodiment of the present application;

图16为本申请实施例提供的一种电子设备的结构示意图;16 is a schematic structural diagram of an electronic device provided by an embodiment of the present application;

图17为本申请实施例提供的一种软件系统的结构示意图。FIG. 17 is a schematic structural diagram of a software system provided by an embodiment of the present application.

具体实施方式Detailed ways

下面将结合附图对本申请实施例中的技术方案进行清楚、详尽地描述。其中,在本申请实施例的描述中,除非另有说明,“/”表示或的意思,例如,A/B可以表示A或B;文本中的“和/或”仅仅是一种描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B这三种情况,另外,在本申请实施例的描述中,“多个”是指两个或多于两个。The technical solutions in the embodiments of the present application will be described clearly and in detail below with reference to the accompanying drawings. Wherein, in the description of the embodiments of the present application, unless otherwise specified, “/” means or, for example, A/B can mean A or B; “and/or” in the text is only a description of an associated object The association relationship indicates that there can be three kinds of relationships, for example, A and/or B can indicate that A exists alone, A and B exist at the same time, and B exists alone. In addition, in the description of the embodiments of this application , "plurality" means two or more than two.

以下,术语“第一”、“第二”仅用于描述目的,而不能理解为暗示或暗示相对重要性或者隐含指明所指示的技术特征的数量。由此,限定有“第一”、“第二”的特征可以明示或者隐含地包括一个或者更多个该特征,在本申请实施例的描述中,除非另有说明,“多个”的含义是两个或两个以上。Hereinafter, the terms "first" and "second" are only used for descriptive purposes, and should not be construed as implying or implying relative importance or implying the number of indicated technical features. Therefore, the features defined as "first" and "second" may explicitly or implicitly include one or more of the features. In the description of the embodiments of the present application, unless otherwise specified, the "multiple" The meaning is two or more.

下面介绍本申请实施例提供的一些示例性图形用户界面(user interface,UI)。本申请的说明书和权利要求书及附图中的术语“用户界面”,是应用程序或操作系统与用户之间进行交互和信息交换的介质接口,它实现信息的内部形式与用户可以接受形式之间的转换。用户界面常用的表现形式是图形用户界面(graphic user interface,GUI),是指采用图形方式显示的与计算机操作相关的用户界面。它可以是在电子设备的显示屏中显示的一个图标、窗口、控件等界面元素,其中控件可以包括图标、按钮、菜单、选项卡、文本框、对话框、状态栏、导航栏、Widget等可视的界面元素。The following introduces some exemplary graphical user interfaces (user interfaces, UI) provided by the embodiments of the present application. The term "user interface" in the description, claims and drawings of this application is a medium interface for interaction and information exchange between application programs or operating systems and users, which realizes the internal form of information and the form acceptable to users. conversion between. A commonly used form of user interface is a graphical user interface (graphic user interface, GUI), which refers to a user interface related to computer operations displayed in a graphical manner. It can be an icon, window, control and other interface elements displayed on the display screen of the electronic device, wherein the control can include icons, buttons, menus, tabs, text boxes, dialog boxes, status bars, navigation bars, Widgets, etc. visual interface elements.

图1示例性示出了电子设备100上的用于展示电子设备100安装的应用程序的示例性用户界面10。FIG. 1 illustrates an exemplary user interface 10 on an electronic device 100 for presenting applications installed by the electronic device 100 .

用户界面10可包括:状态栏101,导航栏102,日历指示符103,天气指示符104,具有常用应用程序图标的托盘105,以及其他应用程序图标。其中:User interface 10 may include a status bar 101, a navigation bar 102, a calendar indicator 103, a weather indicator 104, a tray 105 with icons of frequently used applications, and other application icons. in:

状态栏101可包括:移动通信信号(又可称为蜂窝信号)的一个或多个信号强度指示符101A、运营商名称(例如“中国移动”)101B、无线高保真(wireless fidelity,Wi-Fi)信号的一个或多个信号强度指示符101C,电池状态指示符101D、时间指示符101E。Status bar 101 may include: one or more signal strength indicators 101A of mobile communication signals (also known as cellular signals), operator name (eg, "China Mobile") 101B, wireless fidelity (Wi-Fi) ) signal of one or more signal strength indicators 101C, battery status indicator 101D, time indicator 101E.

导航栏102可包括:返回键102A、主屏幕键102B、多任务键102C等系统导航键。当检测到用户点击返回键102A时,电子设备100可显示当前页面的上一个页面。当检测到用户点击主屏幕键102B时,电子设备100可显示主界面。当检测到用户点击多任务键102C时,电子设备100可显示用户最近打开的任务。各导航键的命名还可以为其他,本申请对此不做限制。不限于虚拟按键,导航栏102中的各导航键也可以实现为物理按键。The navigation bar 102 may include system navigation keys such as a back key 102A, a home screen key 102B, and a multitasking key 102C. When detecting that the user clicks the back key 102A, the electronic device 100 may display the previous page of the current page. When detecting that the user taps the home key 102B, the electronic device 100 may display a home interface. When detecting that the user clicks on the multitasking key 102C, the electronic device 100 may display the most recently opened tasks of the user. The names of the navigation keys may also be other, which is not limited in this application. Not limited to virtual keys, each navigation key in the navigation bar 102 can also be implemented as physical keys.

日历指示符103可用于指示当前时间,例如日期、星期几、时分信息等。Calendar indicator 103 may be used to indicate the current time, such as date, day of the week, hour and minute information, and the like.

天气指示符104可用于指示天气类型,例如多云转晴、小雨等,还可以用于指示气温等信息。The weather indicator 104 can be used to indicate the weather type, such as cloudy to sunny, light rain, etc., and can also be used to indicate information such as temperature.

具有常用应用程序图标的托盘105可展示:电话图标105A、联系人图标105B、短信图标105C、相机图标105D。A tray 105 with icons of frequently used applications may display: a phone icon 105A, a contact icon 105B, a text message icon 105C, a camera icon 105D.

其他应用程序图标可例如:互传的图标106、图库的图标107、音乐的图标108、应用的图标109、邮箱的图标110、云共享的图标111、备忘录的图标112、设置的图标113。用户界面10还可包括页面指示符114。其他应用程序图标可分布在多个页面,页面指示符106可用于指示用户当前查看的是哪一个页面中的应用程序。用户可以左右滑动其他应用程序图标的区域,来查看其他页面中的应用程序图标。Other application icons can be, for example, the icon 106 of mutual sharing, the icon 107 of gallery, the icon 108 of music, the icon 109 of application, the icon 110 of mailbox, the icon 111 of cloud sharing, the icon 112 of memo, and the icon 113 of settings. User interface 10 may also include page indicators 114 . Other application icons may be distributed across multiple pages, and the page indicator 106 may be used to indicate which page of the application the user is currently viewing. Users can swipe left and right in the area of other application icons to view application icons in other pages.

在一些实施例中,图1示例性所示的用户界面10可以为主界面(Home screen)。In some embodiments, the user interface 10 exemplarily shown in FIG. 1 may be a Home screen.

在其他一些实施例中,电子设备100还可以包括前置摄像头,前置摄像头还可称作副摄像头,主要位于电子设备100屏幕的上方,前置摄像头可以用于自拍、视频通话等。In some other embodiments, the electronic device 100 may further include a front camera. The front camera may also be referred to as a sub-camera, which is mainly located above the screen of the electronic device 100. The front camera may be used for selfies, video calls, and the like.

可以理解的是,图1仅仅示例性示出了电子设备100上的用户界面,不应构成对本申请实施例的限定。It can be understood that, FIG. 1 only exemplarily shows a user interface on the electronic device 100, and should not constitute a limitation to the embodiments of the present application.

示例性的,如图2所示,用户可点击用户界面10上相机的图标105D,电子设备100检测到上述用户操作,响应于上述用户操作,电子设备100显示相机的拍摄界面11。Exemplarily, as shown in FIG. 2 , the user may click the camera icon 105D on the user interface 10 , the electronic device 100 detects the above-mentioned user operation, and in response to the above-mentioned user operation, the electronic device 100 displays the camera's shooting interface 11 .

用户界面11可包括:导航栏201,拍摄控件202,相册控件203,摄像头切换控件204,拍摄模式205,图像预览区206,闪光图标207,设置图标208。其中:The user interface 11 may include: a navigation bar 201 , a shooting control 202 , an album control 203 , a camera switching control 204 , a shooting mode 205 , an image preview area 206 , a flash icon 207 , and a setting icon 208 . in:

拍摄控件202可接收用户操作(例如触摸操作),响应于检测到的该用户操作,电子设备100可以利用摄像头采集图像数据,并显示上述图像。The shooting control 202 may receive a user operation (eg, a touch operation), and in response to the detected user operation, the electronic device 100 may use a camera to collect image data and display the above-mentioned image.

相册控件203可接收用户操作(例如触摸操作),响应于检测到的该用户操作,电子设备100可以显示相册中最新保存的照片,相册控件203的表现形式可以是上述最新拍摄的照片的缩小图。The album control 203 can receive a user operation (such as a touch operation), and in response to the detected user operation, the electronic device 100 can display the latest saved photo in the album, and the expression form of the album control 203 can be a thumbnail of the above-mentioned latest photographed photo .

摄像头切换控件204用于切换摄像头。电子设备100可以检测到作用于摄像头切换控件204的触控操作(如在摄像头切换控件204上的点击操作),响应于该操作,电子设备100可以切换摄像头。例如,将电子设备100用于拍摄的摄像头从前置摄像头切换为后置摄像头,或者将电子设备100用于拍摄的摄像头从后置摄像头切换为前置摄像头。The camera switch control 204 is used to switch cameras. The electronic device 100 may detect a touch operation (eg, a click operation on the camera switching control 204 ) acting on the camera switching control 204 , and in response to the operation, the electronic device 100 may switch cameras. For example, the camera used by the electronic device 100 for shooting is switched from the front camera to the rear camera, or the camera used by the electronic device 100 for shooting is switched from the rear camera to the front camera.

拍摄模式205可以包括:夜景模式205A、专业模式205B、拍照模式205C、录像模式205D、人像模式205E等。夜景模式205A、专业模式205B和人像模式205E均为针对特定场景进行优化的拍照模式。上述拍摄模式205中任意拍照模式,可接收用户操作(例如触摸操作),响应于检测到的该用户操作,电子设备100可以显示该拍照模式下的拍摄界面。The shooting mode 205 may include: a night scene mode 205A, a professional mode 205B, a photographing mode 205C, a video recording mode 205D, a portrait mode 205E, and the like. The night scene mode 205A, the professional mode 205B and the portrait mode 205E are all photographing modes optimized for specific scenes. Any photographing mode in the above photographing modes 205 can receive a user operation (eg, a touch operation), and in response to the detected user operation, the electronic device 100 can display a photographing interface in the photographing mode.

可以理解,若当前拍摄模式为拍照模式,拍摄控件204可用于拍摄照片;若当前拍摄模式为录像模式,拍摄控件204可用于开启或停止录像。It can be understood that if the current shooting mode is the shooting mode, the shooting control 204 can be used to shoot a photo; if the current shooting mode is the video recording mode, the shooting control 204 can be used to start or stop the video recording.

图像预览区206可以用于显示电子设备100前置或后置摄像头(即当前用于拍摄的摄像头)采集的图像。The image preview area 206 may be used to display images captured by the front or rear camera of the electronic device 100 (ie, the camera currently used for shooting).

可以理解,若电子设备100当前用于拍摄的摄像头为前置摄像头,则图像预览区206用于显示电子设备100前置摄像头采集的图像;若电子设备100当前用于拍摄的摄像头为后置摄像头,则图像预览区206用于显示电子设备100后置摄像头采集的图像。It can be understood that if the camera currently used by the electronic device 100 for shooting is the front camera, the image preview area 206 is used to display the image captured by the front camera of the electronic device 100; if the camera currently used by the electronic device 100 for shooting is the rear camera , the image preview area 206 is used to display the image captured by the rear camera of the electronic device 100 .

闪光图标207可接收用户操作(例如触摸操作),响应于检测到的该用户操作,电子设备100可以显示闪光的设置选项。The flash icon 207 may receive a user operation (eg, a touch operation), and in response to the detected user operation, the electronic device 100 may display setting options for the flash.

设置图标208可接收用户操作(例如触摸操作),响应于检测到的该用户操作,电子设备100可以显示相机的设置界面。The settings icon 208 may receive a user operation (eg, a touch operation), and in response to the detected user operation, the electronic device 100 may display a settings interface for the camera.

示例性的,如图3所示,用户可点击用户界面11上相机的相册控件205,电子设备100检测到上述用户操作,响应于上述用户操作,电子设备100在相册界面12显示最新拍摄的照片。Exemplarily, as shown in FIG. 3 , the user can click on the album control 205 of the camera on the user interface 11, the electronic device 100 detects the above-mentioned user operation, and in response to the above-mentioned user operation, the electronic device 100 displays the latest photographed photos on the album interface 12. .

相册界面12可包括:状态栏301,导航栏302,图像显示区303,返回键304,属性控件305,相册控件306,分享图标307,编辑图标308,删除图标309,更多图标310。其中:The album interface 12 may include: a status bar 301 , a navigation bar 302 , an image display area 303 , a back button 304 , a property control 305 , an album control 306 , a share icon 307 , an edit icon 308 , a delete icon 309 , and a more icon 310 . in:

图像显示区303可以用于显示电子设备100显示最新拍摄的照片,还可以用于显示电子设备100的相册中的其他图像。The image display area 303 may be used to display the latest photograph of the electronic device 100 , and may also be used to display other images in the album of the electronic device 100 .

返回键304可接收用户操作(例如触摸操作),响应于检测到的该用户操作,电子设备100可以显示当前页面的上一页面。The back key 304 may receive a user operation (eg, a touch operation), and in response to the detected user operation, the electronic device 100 may display a previous page of the current page.

属性控件305可接收用户操作(例如触摸操作),响应于检测到的该用户操作,电子设备100可以显示图像显示区304所显示的图像的文件属性。图像的文件属性可以包括创建时间、尺寸、文件大小、存储路径等。The property control 305 may receive a user operation (eg, a touch operation), and in response to the detected user operation, the electronic device 100 may display the file properties of the image displayed in the image display area 304 . The file properties of an image can include creation time, dimensions, file size, storage path, etc.

在本申请的一些实施例中,上述图像的文件属性还可以包括旋转参数,上述旋转参数用于表征用户向上竖屏查看显示屏的图像显示区303所显示的图像时,在电子设备的显示屏上所述图像显示区303显示的图像的方向相对于拍摄时图像预览区206显示的上述图像的方向所需的第二旋转角度。In some embodiments of the present application, the file attribute of the above-mentioned image may further include a rotation parameter, and the above-mentioned rotation parameter is used to represent that when the user views the image displayed in the image display area 303 of the display screen in an upward vertical screen, the display screen of the electronic device The orientation of the image displayed in the image display area 303 is a second rotation angle required relative to the orientation of the image displayed in the image preview area 206 during shooting.

在本申请的一些实施例中,上述图像的文件属性可以包括方向参数,上述方向参数用于表征电子设备100在拍摄图像时,电子设备100的横竖屏状态。In some embodiments of the present application, the file attribute of the above-mentioned image may include an orientation parameter, and the above-mentioned orientation parameter is used to represent the horizontal and vertical screen states of the electronic device 100 when the electronic device 100 captures an image.

可以理解地,上述图像的文件属性可以只包括所述旋转参数和所述方向参数之一。It can be understood that the file attribute of the above-mentioned image may only include one of the rotation parameter and the orientation parameter.

将图像和所述旋转参数/所述方向参数关联存储,可以是将所述旋转参数/所述方向参数存储到该图像的文件属性中。The storing of the image in association with the rotation parameter/the orientation parameter may be storing the rotation parameter/the orientation parameter in a file attribute of the image.

相册控件306可接收用户操作(例如触摸操作),响应于检测到的该用户操作,电子设备100可以显示电子设备100的相册中的更多图像。The album control 306 may receive a user operation (eg, a touch operation), and in response to the detected user operation, the electronic device 100 may display more images in the album of the electronic device 100 .

分享图标307可接收用户操作(例如触摸操作),响应于检测到的该用户操作,电子设备100可以显示图像显示区303所显示的图像的分享界面。The sharing icon 307 may receive a user operation (eg, a touch operation), and in response to the detected user operation, the electronic device 100 may display a sharing interface of the image displayed in the image display area 303 .

编辑图标308可接收用户操作(例如触摸操作),响应于检测到的该用户操作,电子设备100可以显示图像显示区303所显示的图像的编辑界面。The editing icon 308 may receive a user operation (eg, a touch operation), and in response to the detected user operation, the electronic device 100 may display an editing interface of the image displayed in the image display area 303 .

删除图标308可接收用户操作(例如触摸操作),响应于检测到的该用户操作,电子设备100可以删除图像显示区303所显示的图像。The delete icon 308 may receive a user operation (eg, a touch operation), and in response to the detected user operation, the electronic device 100 may delete the image displayed in the image display area 303 .

更多图标310可接收用户操作(例如触摸操作),响应于检测到的该用户操作,电子设备100可以显示图像显示区303所显示的图像的一或多个功能选项。例如,设为壁纸、移动、幅值、重命名等。The more icons 310 may receive a user operation (eg, a touch operation), and in response to the detected user operation, the electronic device 100 may display one or more function options of the image displayed in the image display area 303 . For example, set as wallpaper, move, amplitude, rename, etc.

本申请实施例中,图2所示的用户界面中,当前拍摄模式为拍照模式。拍摄控件202可接收用户操作(例如触摸操作),响应于检测到的该用户操作,电子设备100拍摄照片并可以显示用户相册界面12,且用户相册界面12的图像显示区303用于显示上述照片。或者,拍摄控件204可接收用户操作(例如触摸操作),响应于检测到的该用户操作,电子设备100拍摄并保存照片,且电子设备100可以继续显示拍摄界面11,用户可以通过点击拍摄界面11上的相册控件203,查看拍摄的照片。本申请实施例对此不做具体限定。In the embodiment of the present application, in the user interface shown in FIG. 2 , the current shooting mode is the shooting mode. The capture control 202 can receive a user operation (eg, a touch operation), and in response to the detected user operation, the electronic device 100 captures a photo and can display the user album interface 12, and the image display area 303 of the user album interface 12 is used to display the above-mentioned photos . Alternatively, the capture control 204 may receive a user operation (eg, a touch operation), and in response to the detected user operation, the electronic device 100 captures and saves a photo, and the electronic device 100 may continue to display the capture interface 11 , and the user can click the capture interface 11 On the album control 203, view the photos taken. This embodiment of the present application does not specifically limit this.

可以理解的是,图1至图3仅仅示例性示出了电子设备100上的用户界面,不应构成对本申请实施例的限定。It can be understood that, FIG. 1 to FIG. 3 merely illustrate the user interface on the electronic device 100 by way of example, and should not constitute a limitation to the embodiments of the present application.

电子设备100的应用程序相机获取的图像数据来自于摄像头的图像传感器(ImageSensor)。用户拍照时能以任意角度旋转电子设备100。电子设备在拍摄界面的图像预览区显示后置摄像头采集的图像;电子设备100接收用户的拍摄操作后,响应于上述拍摄操作,电子设备100利用保存上述图像。为了保证用户查看照片时,电子设备100显示的图像方向与拍摄照片时用户在预览图像区所看到的图像的方向保持一致,电子设备100通常根据电子设备100拍摄时该图像的横竖屏状态在显示屏上显示上述图像,使得无论用户拍摄照片时怎么旋转电子设备100,在显示屏上显示的上述图像都能与拍摄时用户在图像预览区所看见的预览图像一致的照片。电子设备100的横竖屏状态可以包括向上竖屏、右横屏、向下竖屏和左横屏这四种状态。The image data acquired by the application camera of the electronic device 100 comes from an image sensor (ImageSensor) of the camera. The user can rotate the electronic device 100 at any angle when taking pictures. The electronic device displays the image captured by the rear camera in the image preview area of the shooting interface; after the electronic device 100 receives the user's shooting operation, in response to the above-mentioned shooting operation, the electronic device 100 saves the above-mentioned image by using. In order to ensure that the orientation of the image displayed by the electronic device 100 is consistent with the orientation of the image that the user sees in the preview image area when the user is viewing the photo, the electronic device 100 usually has a horizontal and vertical screen state of the image when the electronic device 100 takes the photo. The above-mentioned image is displayed on the display screen, so that no matter how the user rotates the electronic device 100 when taking the photo, the above-mentioned image displayed on the display screen can be the same photo as the preview image the user sees in the image preview area when taking the photo. The landscape and portrait screen states of the electronic device 100 may include four states of up portrait, right landscape, down portrait, and left landscape.

示例性的,图4A至图4D是本申请实施例提供的电子设备100向上竖屏、左横屏、向下竖屏和右横屏拍摄的示意图。如图4A至图4D所示,电子设备100拍摄照片时,摄像头采集的图像数据的第一行为上述图像数据中靠近电子设备100顶部的第一行,上述图像数据的第一列为上述图像数据中靠近电子设备100左边的第一列。电子设备100的顶部、底部、左边、右边是固定的,即电子设备100向上竖屏时的顶部、底部、左边、右边,在电子设备100向下竖屏或者横屏时,电子设备100的顶部、底部、左边、右边不变。比如电子设备100的顶部设有摄像头,无论电子设备竖屏或横屏,电子设备100的顶部均是指有摄像头的一端。Exemplarily, FIGS. 4A to 4D are schematic diagrams of photographing the electronic device 100 in a vertical upward screen, a left horizontal screen, a downward vertical screen, and a right horizontal screen according to an embodiment of the present application. As shown in FIG. 4A to FIG. 4D , when the electronic device 100 takes a photo, the first row of the image data collected by the camera is the first row near the top of the electronic device 100 in the above-mentioned image data, and the first row of the above-mentioned image data is the above-mentioned image data. in the first column near the left of the electronic device 100 . The top, bottom, left, and right sides of the electronic device 100 are fixed, that is, the top, bottom, left, and right sides of the electronic device 100 when the electronic device 100 is vertically screened upward, and the top of the electronic device 100 when the electronic device 100 is vertically screened downward or horizontally. , bottom, left, and right remain unchanged. For example, the top of the electronic device 100 is provided with a camera. Regardless of whether the electronic device has a vertical screen or a horizontal screen, the top of the electronic device 100 refers to the end with the camera.

如图4A所示,电子设备100向上竖屏进行拍摄照片,用户向上竖屏查看该照片时,图像数据的第一行位于该照片的顶部,图像数据的第一列位于该照片的左边。As shown in FIG. 4A , the electronic device 100 takes a photo in a vertical screen upward, and when a user views the photo in a vertical screen upward, the first row of image data is at the top of the photo, and the first column of image data is at the left of the photo.

如图4B所示,电子设备100左横屏进行拍摄照片。为保证电子设备100显示的照片与拍摄时用户在预览图像区所见图像一致,用户向上竖屏查看该照片时,该照片的图像数据的第一行位于电子设备100显示的图像的左边,该照片的图像数据的第一列位于电子设备100显示的图像的底部,此时,在电子设备100显示屏显示的上述图像相对于预览图像区显示的图像旋转-90°,即逆时针旋转90°。As shown in FIG. 4B , the electronic device 100 takes a photo in the left horizontal screen. In order to ensure that the photo displayed by the electronic device 100 is consistent with the image that the user sees in the preview image area when shooting, when the user views the photo vertically upward, the first line of the image data of the photo is located on the left side of the image displayed by the electronic device 100. The first column of image data of the photo is located at the bottom of the image displayed by the electronic device 100. At this time, the above-mentioned image displayed on the display screen of the electronic device 100 is rotated by -90° relative to the image displayed in the preview image area, that is, rotated 90° counterclockwise. .

如图4C所示,电子设备100向下竖屏进行拍摄照片。为保证电子设备100显示的照片与拍摄时用户在预览图像区所见图像一致,用户向上竖屏查看该照片时,该照片的图像数据的第一行位于电子设备100显示的图像的底部,该照片的图像数据的第一列位于电子设备100显示的图像的右边。此时,在电子设备100显示屏显示的上述图像相对于预览图像区显示的图像旋转180°。As shown in FIG. 4C , the electronic device 100 takes a picture with the downward vertical screen. In order to ensure that the photo displayed by the electronic device 100 is consistent with the image that the user sees in the preview image area when the photo is taken, when the user views the photo vertically upwards, the first line of the image data of the photo is located at the bottom of the image displayed by the electronic device 100. The first column of image data of the photo is located to the right of the image displayed by the electronic device 100 . At this time, the above-mentioned image displayed on the display screen of the electronic device 100 is rotated by 180° relative to the image displayed in the preview image area.

如图4D所示,电子设备100右横屏进行拍摄照片。为保证电子设备100显示的照片与拍摄时用户在预览图像区所见图像一致,用户向上竖屏查看该照片时,该照片的图像数据的第一行位于电子设备100显示的图像的右边,该照片的图像数据的第一列位于电子设备100显示的图像的顶部。此时,在电子设备100显示屏显示的上述图像相对于预览图像区显示的图像旋转90°。As shown in FIG. 4D , the electronic device 100 takes a photo in the right horizontal screen. In order to ensure that the photo displayed by the electronic device 100 is consistent with the image that the user sees in the preview image area when shooting, when the user views the photo vertically upwards, the first line of the image data of the photo is located to the right of the image displayed by the electronic device 100. The first column of image data of the photo is at the top of the image displayed by the electronic device 100 . At this time, the above-mentioned image displayed on the display screen of the electronic device 100 is rotated by 90° relative to the image displayed in the preview image area.

综上所述,用户在查看拍摄的图像时,电子设备100根据上述图像拍摄时的横竖屏状态确定在显示屏上待显示的图像相对于预览图像区显示的图像所需的第一旋转角度,进而电子设备100根据上述第一旋转角度确定显示屏上该图像的显示区域,以及对该图像进行绘制,并在上述显示区域内显示绘制后的上述图像。To sum up, when the user is viewing the captured image, the electronic device 100 determines the first rotation angle required by the image to be displayed on the display screen relative to the image displayed in the preview image area according to the horizontal and vertical screen states when the image is captured, Further, the electronic device 100 determines a display area of the image on the display screen according to the first rotation angle, draws the image, and displays the drawn image in the display area.

针对如何确定电子设备100的横竖屏状态,目前常用的一种技术方案是,使用三轴重力加速度传感器确定电子设备100的X轴、Y轴和Z轴三个方向上的重力加速度,并通过上述三个方向上的重力加速度判断电子设备100是横屏还是竖屏的状态;或者,使用方向传感器确定电子设备100的X轴、Y轴和Z轴与重力方向的夹角,并通过上述夹角判断电子设备100是横屏还是竖屏的状态。Regarding how to determine the horizontal and vertical screen states of the electronic device 100, a commonly used technical solution is to use a three-axis gravitational acceleration sensor to determine the gravitational acceleration in the three directions of the X-axis, the Y-axis, and the Z-axis of the electronic device 100. The gravitational acceleration in the three directions determines whether the electronic device 100 is in a horizontal or vertical screen state; alternatively, the angle between the X-axis, Y-axis, and Z-axis of the electronic device 100 and the direction of gravity is determined by using a direction sensor, and the angle is determined by the above-mentioned angle. It is determined whether the electronic device 100 is in a landscape or portrait state.

示例性的,如图5所示,电子设备100的坐标系以如下方式定义:X轴平行于电子设备100屏幕的短边方向,从屏幕左侧边指向屏幕右侧边;Y轴平行于屏幕的长边方向,从屏幕下边指向屏幕上边;Z轴垂直于X轴和Y轴构成的平面,即Z轴垂直于屏幕所在平面。当电子设备100水平放置且屏幕朝上,Z轴与重力方向相反,X轴、Y轴、Z轴三个轴的重力加速度值分别为0、0、-9.8(重力加速度为9.8)。当电子设备100翻转的时候,对应的X轴、Y轴和Z轴的重力加速度值也会随着变化。Exemplarily, as shown in FIG. 5 , the coordinate system of the electronic device 100 is defined in the following manner: the X axis is parallel to the short side direction of the screen of the electronic device 100, from the left side of the screen to the right side of the screen; the Y axis is parallel to the screen The long side direction of the screen points from the bottom of the screen to the top of the screen; the Z axis is perpendicular to the plane formed by the X axis and the Y axis, that is, the Z axis is perpendicular to the plane where the screen is located. When the electronic device 100 is placed horizontally with the screen facing upward, the Z axis is opposite to the direction of gravity, and the gravitational acceleration values of the X, Y, and Z axes are 0, 0, and -9.8 respectively (the gravitational acceleration is 9.8). When the electronic device 100 is turned over, the corresponding gravitational acceleration values of the X-axis, the Y-axis and the Z-axis will also change accordingly.

例如,如图4A至图4D所示,电子设备100向上竖屏时,对应的X轴、Y轴和Z轴的重力加速度值分别是0、-9.8、0;向下竖屏时,对应的X轴、Y轴和Z轴的重力加速度值分别是0、9.8、0。电子设备100左横屏时,对应的X轴、Y轴和Z轴的重力加速度值分别是-9.8、0、0;电子设备100右横屏时,对应的X轴、Y轴和Z轴的重力加速度值据分别是9.8、0、0。可以理解地,用户在握持电子设备100时,不完全是与图4A至图4D一致,根据上述三轴的重力加速度值属于横屏或竖屏对应的三轴重力加速度值的预设范围,电子设备100可以确定电子设备100的横屏或竖屏状态。For example, as shown in FIGS. 4A to 4D , when the electronic device 100 is vertically screened upward, the corresponding gravitational acceleration values of the X-axis, Y-axis, and Z-axis are 0, -9.8, and 0, respectively; when the electronic device 100 is vertically screened, the corresponding The gravitational acceleration values for the X-axis, Y-axis, and Z-axis are 0, 9.8, and 0, respectively. When the electronic device 100 is in the left horizontal screen, the corresponding gravitational acceleration values of the X-axis, Y-axis and Z-axis are -9.8, 0, and 0 respectively; when the electronic device 100 is in the right horizontal screen, the corresponding X-axis, Y-axis and Z-axis The gravitational acceleration values are 9.8, 0, and 0, respectively. It can be understood that when the user holds the electronic device 100, it is not completely consistent with FIG. 4A to FIG. 4D. According to the above-mentioned three-axis gravitational acceleration value belonging to the preset range of the three-axis gravitational acceleration value corresponding to the horizontal screen or the vertical screen, the electronic The device 100 may determine the landscape or portrait state of the electronic device 100 .

如图4A至图4D所示,电子设备100向上竖屏时,对应的重力加速度方向与X轴、Y轴和Z轴的夹角分别是90°、-180°、90°;向下竖屏时,对应的重力加速度方向与X轴、Y轴和Z轴的夹角分别是-90°、180°、90°。电子设备100左横屏时,对应的重力加速度方向与X轴、Y轴和Z轴的夹角分别是-180°、-90°、90°;电子设备100右横屏时,对应的重力加速度方向与X轴、Y轴和Z轴的夹角分别是180°、90°、90°。可以理解,用户在握持电子设备100时,不完全是与图4A至图4D一致,根据重力加速度方向与上述三轴的夹角属于横屏或竖屏对应的三轴的夹角的预设范围,电子设备100可以确定电子设备100的横屏或竖屏状态。As shown in FIGS. 4A to 4D , when the electronic device 100 is vertically screened upward, the angles between the corresponding gravitational acceleration direction and the X-axis, Y-axis, and Z-axis are 90°, -180°, and 90°, respectively; , the angles between the corresponding gravitational acceleration direction and the X-axis, Y-axis and Z-axis are -90°, 180°, and 90°, respectively. When the electronic device 100 is in the left horizontal screen, the corresponding angles of the gravitational acceleration direction and the X axis, the Y axis and the Z axis are -180°, -90° and 90° respectively; when the electronic device 100 is in the right horizontal screen, the corresponding gravitational acceleration The included angles between the direction and the X, Y and Z axes are 180°, 90°, and 90°, respectively. It can be understood that when the user holds the electronic device 100, it is not completely consistent with FIG. 4A to FIG. 4D. According to the angle between the gravitational acceleration direction and the above-mentioned three axes, it belongs to the preset range of the angle between the three axes corresponding to the horizontal screen or the vertical screen. , the electronic device 100 may determine the landscape or portrait state of the electronic device 100 .

示例性的,如图6所示,重力加速度方向与Z轴的夹角为90°。当重力加速度方向与Y轴的夹角在-135°到-180°或者135°到180°之间时,电子设备100处于向上竖屏状态;当重力加速度方向与Y轴的夹角在-45°到-135°之间时,电子设备100处于左横屏状态;当重力加速度方向与Y轴的夹角在-45°到0°或者0°到180°之间时,电子设备100处于向下竖屏状态;当重力加速度方向与Y轴的夹角在45°到135°之间时,电子设备100处于右横屏状态。Exemplarily, as shown in FIG. 6 , the included angle between the direction of the gravitational acceleration and the Z axis is 90°. When the angle between the gravitational acceleration direction and the Y-axis is between -135° and -180° or between 135° and 180°, the electronic device 100 is in a vertical screen-up state; when the angle between the gravitational acceleration direction and the Y-axis is -45° When between ° and -135°, the electronic device 100 is in the left horizontal screen state; when the angle between the direction of gravitational acceleration and the Y axis is between -45° and 0° or between 0° and 180°, the electronic device 100 is in the horizontal direction. The lower vertical screen state; when the included angle between the gravitational acceleration direction and the Y axis is between 45° and 135°, the electronic device 100 is in the right horizontal screen state.

除了重力加速度传感器,电子设备100还可以通过磁力传感器和加速度传感器获取电子设备100的三轴上的重力加速度。In addition to the gravitational acceleration sensor, the electronic device 100 can also acquire the gravitational acceleration on the three axes of the electronic device 100 through the magnetic sensor and the acceleration sensor.

当电子设备100水平放置(或接近水平放置)时,重力加速度g的方向与前述坐标系中的z轴重合或接近重合,重力加速度的矢量在X轴和Y轴的分量值为0(或接近0)。上述情况下,电子设备100无法获得有效的X轴和Y轴加速度的重力加速度分量,导致无法准确确定电子设备100的横竖屏状态。因此,用户查看拍摄的照片时,电子设备100显示的照片的方向与用户拍摄时所见的预览图像的方向可能不一致,降低了用户体验。When the electronic device 100 is placed horizontally (or nearly horizontally), the direction of the gravitational acceleration g is coincident or nearly coincident with the z-axis in the aforementioned coordinate system, and the component values of the gravitational acceleration vector on the X-axis and the Y-axis are 0 (or close to 0). In the above situation, the electronic device 100 cannot obtain effective gravitational acceleration components of the X-axis and Y-axis accelerations, so that the horizontal and vertical screen states of the electronic device 100 cannot be accurately determined. Therefore, when a user views a photographed photo, the direction of the photograph displayed by the electronic device 100 may be inconsistent with the direction of the preview image seen by the user when photographing, which reduces user experience.

出现上述问题的一种比较常见的拍摄场景是,用户将电子设备100平行于地平面、或接近平行于地平面进行俯拍。事实上,除了上述拍摄场景,在现有技术的限制下,电子设备100内置的重力加速度传感器在任何场景都有一定概率无法准确识别电子设备100的横竖屏状态,从而给用户带来使用上的麻烦,降低了用户体验。A relatively common shooting scenario in which the above problem occurs is that the user takes an overhead shot of the electronic device 100 parallel to, or nearly parallel to, the ground plane. In fact, in addition to the above-mentioned shooting scenes, under the limitation of the prior art, the built-in gravitational acceleration sensor of the electronic device 100 has a certain probability that it cannot accurately identify the horizontal and vertical screen states of the electronic device 100 in any scene, thereby bringing the user experience Trouble and reduce the user experience.

为解决上述问题,本申请实施例提供了一种显示图像的方法,能够准确获取电子设备100拍摄照片时的第一横竖屏状态。进而在用户查看该照片时,能够确定显示屏显示的该照片相对于该照片拍摄时预览图像区显示的图像所需的第一旋转角度。In order to solve the above problem, an embodiment of the present application provides a method for displaying an image, which can accurately acquire the first horizontal and vertical screen state when the electronic device 100 takes a photo. Furthermore, when the user views the photo, the first rotation angle required for the photo displayed on the display screen relative to the image displayed in the preview image area when the photo is taken can be determined.

用户想要利用电子设备100的后置摄像头拍摄照片时,用户可通过拍照应用(例如,如图2所示的相机应用)打开拍摄界面,拍摄界面可以显示后置摄像头采集的第一图像。此时,电子设备100处于第一横竖屏状态(例如,如图7所示的左横屏)。When the user wants to use the rear camera of the electronic device 100 to take a photo, the user can open a shooting interface through a camera application (eg, the camera application shown in FIG. 2 ), and the shooting interface can display the first image captured by the rear camera. At this time, the electronic device 100 is in the first horizontal and vertical screen state (for example, the left horizontal screen as shown in FIG. 7 ).

示例性的,如图7所示,用户向左横屏手持电子设备100,电子设备100的拍摄界面的图像预览区206用于显示后置摄像头采集的图像。图7所示的电子设备100当前的拍摄模式是拍照。Exemplarily, as shown in FIG. 7 , the user holds the electronic device 100 horizontally to the left, and the image preview area 206 of the shooting interface of the electronic device 100 is used to display the image captured by the rear camera. The current photographing mode of the electronic device 100 shown in FIG. 7 is photographing.

除了通过拍照应用打开拍摄界面,用户还可以通过其他方式打开拍摄界面。例如,用户可以通过其他应用程序中的拍照功能打开拍摄界面,其他应用程序可以是即时通讯软件,美图软件等等。In addition to opening the shooting interface through the camera application, users can also open the shooting interface in other ways. For example, the user can open the shooting interface through the camera function in other applications, and the other applications can be instant messaging software, Meitu software and so on.

在本申请的一些实施例中,电子设备100接收用户的拍摄操作,响应于检测上述拍摄操作,电子设备100利用后置摄像头拍摄第一图像,并利用前置摄像头采集第一参考图像。所述第一参考图像用于确定电子设备的第一横竖屏状态,第一横竖屏状态是拍摄时电子设备100的横竖屏状态。电子设备100确定上述第一横竖屏状态后,保存第一图像和第一图像的第一参数,第一参数可以用于表征拍摄照片时电子设备100的横竖屏状态。In some embodiments of the present application, the electronic device 100 receives a user's shooting operation, and in response to detecting the above shooting operation, the electronic device 100 uses the rear camera to capture the first image, and uses the front camera to capture the first reference image. The first reference image is used to determine the first horizontal and vertical screen states of the electronic device, and the first horizontal and vertical screen states are the horizontal and vertical screen states of the electronic device 100 when shooting. After the electronic device 100 determines the above-mentioned first horizontal and vertical screen state, it saves the first image and the first parameter of the first image, and the first parameter can be used to represent the horizontal and vertical screen state of the electronic device 100 when taking a photo.

示例性的,如图8所示,上述拍摄操作可以是的用户点击拍摄界面11上的拍摄控件202。如图8所示,响应于用户的拍摄操作,前置摄像头采集第一参考图像。电子设备100根据第一参考图像可以确定第一横竖屏状态为左横屏。Exemplarily, as shown in FIG. 8 , the above shooting operation may be that the user clicks the shooting control 202 on the shooting interface 11 . As shown in FIG. 8 , in response to the user's shooting operation, the front camera captures the first reference image. The electronic device 100 may determine, according to the first reference image, that the first horizontal and vertical screen state is the left horizontal screen.

在本申请的一些实施例中,显示屏配置有触控面板,可用于接收用户的拍摄操作,响应于上述拍摄操作,电子设备100利用后置摄像头拍摄照片。上述拍摄操作可以指用户手部、手肘、触控笔等接触显示屏的触控操作。例如,单击、双击、长按、通过指关节绘制特定形状(如Z形、矩形、圆圈等)等等。除了触控操作,在具体实现中还可以有其他的方式实施上述用户操作。例如,用户可通过按压按键开启后置摄像头进行拍摄;或者,通过检测用户输入的语音开启后置摄像头进行拍摄;或者,通过特定手势开启后置摄像头进行拍摄。本申请实施例中对此不做具体限定。In some embodiments of the present application, the display screen is configured with a touch panel, which can be used to receive a user's shooting operation. In response to the above shooting operation, the electronic device 100 uses the rear camera to shoot a picture. The above-mentioned photographing operation may refer to a touch operation of a user's hand, elbow, stylus, or the like touching the display screen. For example, click, double-click, long-press, draw specific shapes (like Z, rectangles, circles, etc.) with knuckles, etc. In addition to the touch operation, in a specific implementation, there may also be other ways to implement the above-mentioned user operation. For example, the user can turn on the rear camera for shooting by pressing a button; or turn on the rear camera for shooting by detecting the voice input by the user; or turn on the rear camera for shooting by using a specific gesture. This is not specifically limited in the embodiments of the present application.

在本申请的一些实施例中,电子设备100接收用户的查看操作,响应于检测到的上述查看操作,电子设备100利用前置摄像头采集第二参考图像,根据第二参考图像确定电子设备100的第二横竖屏状态;然后,根据第一参数和第二横竖屏状态确定待显示的第一图像所需的第一旋转角度,并根据上述第一旋转角度显示上述第一图像。In some embodiments of the present application, the electronic device 100 receives a user's viewing operation, and in response to the detection of the above-mentioned viewing operation, the electronic device 100 uses the front camera to capture a second reference image, and determines the position of the electronic device 100 according to the second reference image. The second horizontal and vertical screen state; then, the first rotation angle required for the first image to be displayed is determined according to the first parameter and the second horizontal and vertical screen state, and the above-mentioned first image is displayed according to the above-mentioned first rotation angle.

示例性的,如图9所示,在图8所示的用户左横屏拍摄照片后,用户想要查看已拍摄的图像,用户向上竖屏手持电子设备,并点击拍摄界面11的相册控件203,响应于上述查看操作,电子设备100根据前置摄像头采集的参考图像确定电子设备100的第二横竖屏状态为左横屏,并根据该图像的第一参数和第二横竖屏状态确定照片所需的第一旋转角度为-90°,电子设备100根据上述第一旋转角度确定显示屏上该图像的显示区域304并对该图像进行绘制,然后在相册界面12的显示区域304显示该图像。Exemplarily, as shown in FIG. 9 , after the user takes a photo in the left horizontal screen shown in FIG. 8 , the user wants to view the captured image, the user holds the electronic device in the vertical screen upward, and clicks the album control 203 of the shooting interface 11 . , in response to the above viewing operation, the electronic device 100 determines that the second horizontal and vertical screen state of the electronic device 100 is the left horizontal screen according to the reference image collected by the front camera, and determines the location of the photo according to the first parameter of the image and the second horizontal and vertical screen state. The required first rotation angle is -90°. The electronic device 100 determines the display area 304 of the image on the display screen according to the first rotation angle, draws the image, and then displays the image in the display area 304 of the album interface 12 .

除了通过点击拍摄界面11的相册控件203查看照片,用户还可以通过其他方式查看照片。此处不做具体限定。例如,用户还可以通过图1所示的图库图标107对应的图库应用查看照片,用户还可以通过即时通讯软件、购物软件等其他应用程序调用图库,进而查看图库中的照片。In addition to viewing photos by clicking the album control 203 of the shooting interface 11, the user can also view photos in other ways. There is no specific limitation here. For example, the user can also view photos through the gallery application corresponding to the gallery icon 107 shown in FIG. 1 , and the user can also call the gallery through other applications such as instant messaging software and shopping software, and then view the photos in the gallery.

在本申请的一些实施例中,上述第一参数可以为方向参数,也可以为旋转参数。例如,方向参数可以是照片的可交换图像文件格式(exchangeable image file format,Exif)中的参数“Orientation”。In some embodiments of the present application, the above-mentioned first parameter may be a direction parameter or a rotation parameter. For example, the orientation parameter may be the parameter "Orientation" in the exchangeable image file format (Exif) of the photo.

本申请实施所提方案不受限于电子设备100内置传感器的性能缺陷,通过对用户行为的检测,获取符合用户行为意图的横竖屏状态。因此,通过本申请实施所提方案可以降低横竖屏状态不准确的可能性,提升用户的拍摄体验。The solution proposed in the implementation of the present application is not limited by the performance defects of the built-in sensor of the electronic device 100, and the horizontal and vertical screen states conforming to the user's behavior intention are obtained by detecting the user's behavior. Therefore, by implementing the proposed solution in the present application, the possibility of inaccurate horizontal and vertical screen states can be reduced, and the user's shooting experience can be improved.

下面介绍本申请实施例中如何确定电子设备100的横竖屏状态。The following describes how to determine the horizontal and vertical screen states of the electronic device 100 in the embodiments of the present application.

本申请实施例中,可以根据第一参考图像确定电子设备100拍摄时的横竖屏状态,根据第二参考图像确定电子设备100接收查看操作时的横竖屏状态。In this embodiment of the present application, the horizontal and vertical screen states when the electronic device 100 is photographed may be determined according to the first reference image, and the horizontal and vertical screen states when the electronic device 100 receives a viewing operation may be determined according to the second reference image.

在本申请的一些实施例中,电子设备100可以根据第一夹角确定电子设备100的横竖屏状态,第一夹角为参考图像的标准基准线相对于参考图像中的人脸基准线的夹角。参考图像为所述第一参考图像,或所述第二参考图像。In some embodiments of the present application, the electronic device 100 may determine the horizontal and vertical screen states of the electronic device 100 according to a first included angle, where the first included angle is the clip between the standard reference line of the reference image and the face reference line in the reference image horn. The reference image is the first reference image or the second reference image.

在本申请的一些实施例中,标准基准线的朝向可以是沿着参考图像的第一列所在侧边指向参考图像的顶部(即参考图像第一行所在边),示例性的,如图10所示。In some embodiments of the present application, the standard reference line may be oriented along the side of the first column of the reference image to the top of the reference image (that is, the side of the first row of the reference image), for example, as shown in FIG. 10 shown.

在本申请的一些实施例中,人脸基准线可以是根据上述人脸的双眼位置、鼻子位置、嘴巴位置中的一或多个确定的。例如,上述人脸基准线包括人脸的双眼中间点、鼻子中间点、嘴巴中间点中的至少两个。In some embodiments of the present application, the face reference line may be determined according to one or more of the position of the eyes, the position of the nose, and the position of the mouth of the above-mentioned face. For example, the above-mentioned face reference line includes at least two of the middle point of the eyes, the middle point of the nose, and the middle point of the mouth of the human face.

示例性的,如图11A所示,人脸基准线的朝向可以是沿着双眼连接线的垂直直线从下巴指向头顶方向。例如,人脸基准线是人脸的双眼连接线的垂直直线。Exemplarily, as shown in FIG. 11A , the orientation of the face reference line may be a vertical line along the connecting line of the eyes, from the chin to the top of the head. For example, the face reference line is a vertical straight line connecting the eyes of the face.

示例性的,如图11B所示,人脸基准线的朝向可以是沿着双眼连接线从右眼指向左眼。例如,人脸基准线还可以是平行于双眼连接线的直线。Exemplarily, as shown in FIG. 11B , the orientation of the face reference line may be from the right eye to the left eye along the connection line between the eyes. For example, the face reference line may also be a straight line parallel to the connection line between the eyes.

需要说明的是,上述标准基准线的朝向和人脸基准线的朝向是本申请实施例提供的示例性的朝向,不应对本申请实施例构成限定。It should be noted that the orientation of the above-mentioned standard reference line and the orientation of the face reference line are exemplary orientations provided by the embodiments of the present application, and should not be construed as limitations to the embodiments of the present application.

下面介绍本申请实施例中如何根据参考图像确定电子设备100的横竖屏状态。The following describes how to determine the horizontal and vertical screen states of the electronic device 100 according to the reference image in the embodiments of the present application.

(1)首先,确定参考图像是否包含人脸。(1) First, it is determined whether the reference image contains a human face.

在本申请的一些实施例中,电子设备100对参考图像进行人脸识别,确定参考图像中是否包含人脸。当参考图像中包含人脸时,确定上述人脸的人脸基准线为参考图像的人脸基准线;当参考图像中不包含人脸时,电子设备100按照传统方式确定电子设备100的横竖屏状态。In some embodiments of the present application, the electronic device 100 performs face recognition on the reference image to determine whether the reference image contains a human face. When the reference image includes a human face, the face reference line of the above-mentioned face is determined as the face reference line of the reference image; when the reference image does not include a human face, the electronic device 100 determines the horizontal and vertical screen of the electronic device 100 in a conventional manner. state.

在本申请的一些实施例中,将参考图像输入训练好的人脸检测模型,获取人脸检测模型输出的分类信息,分类信息是神经网络的处理结果,用于指示参考图像中是否包含人脸。In some embodiments of the present application, the reference image is input into the trained face detection model, and the classification information output by the face detection model is obtained. The classification information is the processing result of the neural network and is used to indicate whether the reference image contains a human face. .

具体的,电子设备100通过人脸检测模型提取参考图像上的人脸特征,并将提取的人脸特征与人脸模板的人脸特征进行匹配,获取人脸图像与人脸模板之间的相关值。然后根据上述相关值,利用分类器进行判断是否有人脸。Specifically, the electronic device 100 extracts the face features on the reference image through the face detection model, matches the extracted face features with the face features of the face template, and obtains the correlation between the face image and the face template. value. Then, according to the above correlation value, the classifier is used to judge whether there is a face.

在本申请的一些实施例中,电子设备100可以使用Viola-Jones人脸检测算法判断参考图像中是否包括人脸。Viola-Jones人脸检测算法利用Haar特征描述人脸的共性特征,例如,一张正脸图像中人眼睛区域会比脸颊区域暗,嘴唇区域也会比四周的区域暗,但鼻子区域会比两边脸颊要亮。In some embodiments of the present application, the electronic device 100 may use the Viola-Jones face detection algorithm to determine whether the reference image includes a human face. The Viola-Jones face detection algorithm uses Haar features to describe the common features of human faces. For example, in a frontal image, the eye area will be darker than the cheek area, the lip area will also be darker than the surrounding area, but the nose area will be darker than both sides. Cheeks should be bright.

除上述人脸识别方案外,还可以通过其他方案确定参考图像中是否包含人脸,本申请实施例对此不做具体限定。In addition to the above face recognition scheme, other schemes may also be used to determine whether the reference image contains a face, which is not specifically limited in this embodiment of the present application.

在本申请的一些实施例中,电子设备100对参考图像进行人脸识别,确定参考图像中是否包含预设用户的人脸。当参考图像中包含预设用户的人脸时,确定参考图像中上述预设用户的人脸基准线为参考图像的人脸基准线;当参考图像中不包含预设用户的人脸时,电子设备100按照传统方式电子设备100的横竖屏状态。In some embodiments of the present application, the electronic device 100 performs face recognition on the reference image to determine whether the reference image contains the face of a preset user. When the reference image contains the face of the preset user, determine that the above-mentioned preset user's face baseline in the reference image is the face baseline of the reference image; when the reference image does not contain the preset user's face, the electronic The device 100 follows the landscape and portrait state of the electronic device 100 in a conventional manner.

可以理解,电子设备100中存储了上述预设用户的人脸图像。It can be understood that the above-mentioned preset user's face image is stored in the electronic device 100 .

具体的,当电子设备100识别到上述参考图像中包括一或多个人脸时,电子设备100可以将上述一或多个人脸图像与预设用户的人脸图像进行匹配,当第一人脸图像与预设用户的人脸图像的人脸特征匹配度超过一定阈值时,确定上述参考图像包括预设用户的人脸,上述一或多个人脸图像包括第一人脸图像。Specifically, when the electronic device 100 recognizes that the above-mentioned reference image includes one or more faces, the electronic device 100 can match the above-mentioned one or more face images with the preset user's face image, and when the first face image When the facial feature matching degree with the preset user's face image exceeds a certain threshold, it is determined that the reference image includes the preset user's face, and the one or more face images include the first face image.

(2)参考图像包含人脸时,确定参考图像的人脸基准线。(2) When the reference image contains a human face, determine the face reference line of the reference image.

在本申请的一些实施例中,当电子设备100识别到上述参考图像中包括一或多个人脸时,电子设备100确定上述一或多个人脸中面积最大的人脸的人脸基准线为参考图像的人脸基准线。In some embodiments of the present application, when the electronic device 100 recognizes that the reference image includes one or more faces, the electronic device 100 determines the face reference line of the face with the largest area among the one or more faces as the reference The face baseline of the image.

示例性的,如图12所示,参考图像中包括用户1的人脸和用户2的人脸,参考图像中用户2的人脸面积大于用户1的人脸面积,确定用户2的人脸基准线为参考图像的人脸基准线。Exemplarily, as shown in FIG. 12 , the reference image includes the face of user 1 and the face of user 2, the face area of user 2 in the reference image is larger than the face area of user 1, and the face benchmark of user 2 is determined. The line is the face reference line of the reference image.

在本申请的一些实施例中,将参考图像输入训练好的人脸检测模型,获取人脸检测模型输出的分类信息和定点位置信息,分类信息和定点位置信息是神经网络的处理结果。定点位置信息可以用于指示参考图像中双眼、鼻子和嘴巴在参考图像中的位置。In some embodiments of the present application, the reference image is input into the trained face detection model, and the classification information and fixed-point position information output by the face detection model are obtained, and the classification information and fixed-point position information are the processing results of the neural network. The fixed point position information can be used to indicate the positions of the eyes, nose and mouth in the reference image in the reference image.

在本申请的一些实施例中,将参考图像输入训练好的人脸检测模型,获取人脸检测模型输出的分类信息和定线位置信息,分类信息和位置信息是神经网络的处理结果,定线位置信息用于指示参考图像中人脸基准线在参考图像中的位置。In some embodiments of the present application, the reference image is input into the trained face detection model, and the classification information and alignment position information output by the face detection model are obtained. The classification information and position information are the processing results of the neural network. The position information is used to indicate the position of the face reference line in the reference image in the reference image.

人脸检测模型在本申请实施例中可以是卷积神经网络(convolutional neuronnetwork,CNN)、多任务卷积神经网络(Multi-task convolutional neural network,MTCNN)、深度卷积神经网络(deep convolutional neuralnetworks,DCNN)、区域卷积神经网络(region-based CNN或regions with CNN,RCNN)、生成式对抗网络(generativeadversarial networks,GAN)、超分辨率生成对抗网络(super-resolution generativeadversarial networks,SRGAN)等模型。此处不作具体限定。The face detection model can be a convolutional neural network (convolutional neuronnetwork, CNN), a multi-task convolutional neural network (Multi-task convolutional neural network, MTCNN), a deep convolutional neural network (deep convolutional neuralnetworks, DCNN), region-based CNN or regions with CNN (RCNN), generative adversarial networks (GAN), super-resolution generative adversarial networks (SRGAN) and other models. There is no specific limitation here.

在本申请的一些实施例中,人脸检测模型可以包括MTCNN模型中的全部或部分。MTCNN包括四个子模型:人脸分类模型、人脸框回归模型、人脸关键点定位模型以及人脸关键线定位模型。每个子模型均为CNN模型。人脸分类模型输出两个值,分别为人脸的概率和非人脸的概率。人脸检测模型可以根据人脸分类模型的输出值判断参考图像中是否包含人脸。人脸框回归模型输出一个四维向量,包括人脸区域的左上角坐标和宽高。人脸关键点定位模型输出一个十维向量,分别是左眼、右眼、鼻子、左嘴、右嘴的坐标。人脸检测模型可以根据人脸关键点定位模型的输出值确定参考图像中人脸的双眼中间点、鼻子中间点和/或嘴巴中间点的坐标。人脸关键点定位模型输出一个四维向量,人脸基准线中任意两个不同点的坐标。In some embodiments of the present application, the face detection model may include all or part of the MTCNN model. MTCNN includes four sub-models: face classification model, face frame regression model, face key point location model and face key line location model. Each sub-model is a CNN model. The face classification model outputs two values, which are the probability of a face and the probability of a non-face. The face detection model can judge whether the reference image contains a face according to the output value of the face classification model. The face frame regression model outputs a four-dimensional vector, including the upper left corner coordinates and width and height of the face area. The facial key point location model outputs a ten-dimensional vector, which are the coordinates of the left eye, right eye, nose, left mouth, and right mouth. The face detection model may determine the coordinates of the midpoint of the eyes, the midpoint of the nose and/or the midpoint of the mouth of the face in the reference image according to the output value of the facial key point location model. The face key point location model outputs a four-dimensional vector, the coordinates of any two different points in the face baseline.

不限于上述人脸基准线的确定方式,本申请实施例中还可以采用其他方式确定人脸基准线,此处不作具体限定。It is not limited to the above-mentioned way of determining the face reference line, and other ways may also be used to determine the face reference line in the embodiment of the present application, which is not specifically limited here.

(3)最后,电子设备100根据参考图像中的人脸基准线确定电子设备100的横竖屏状态。(3) Finally, the electronic device 100 determines the horizontal and vertical screen states of the electronic device 100 according to the face reference line in the reference image.

下面分别针对图11A和图11B所示的两种类型的人脸基准线,对如何确定电子设备100的横竖屏状态进行介绍。The following describes how to determine the horizontal and vertical screen states of the electronic device 100 with respect to the two types of face reference lines shown in FIG. 11A and FIG. 11B respectively.

在本申请的一些实施例中,人脸基准线的朝向可以是沿着双眼连接线的垂直直线从下巴指向头顶。当第一夹角在-45°到45°之间时,电子设备100的横竖屏状态为向上竖屏。当第一夹角在45°到135°之间时,电子设备100的横竖屏状态为右横屏。当第一夹角在135°到180°或-135°(225°)到-180°(180°)之间时,电子设备100的横竖屏状态为向下竖屏。当第一夹角在-45°(225°)到-135°(315°)之间时,电子设备100的横竖屏状态为左横屏。In some embodiments of the present application, the orientation of the face reference line may be from the chin to the top of the head along the vertical line of the eye-connecting line. When the first included angle is between -45° and 45°, the horizontal and vertical screen state of the electronic device 100 is the upward vertical screen. When the first included angle is between 45° and 135°, the horizontal and vertical screen state of the electronic device 100 is the right horizontal screen. When the first included angle is between 135° and 180° or -135° (225°) and -180° (180°), the horizontal and vertical screen state of the electronic device 100 is the downward vertical screen. When the first included angle is between -45° (225°) and -135° (315°), the horizontal and vertical screen state of the electronic device 100 is the left horizontal screen.

示例性的,如图13所示的第一夹角等于-88°,第一夹角在-45°到-135°之间,电子设备100确定电子设备100采集该参考图像时,电子设备100的横竖屏状态为左横屏。Exemplarily, as shown in FIG. 13 , the first included angle is equal to -88°, and the first included angle is between -45° and -135°. When the electronic device 100 determines that when the electronic device 100 collects the reference image, the electronic device 100 The horizontal and vertical screen status is left horizontal screen.

在本申请的一些实施例中,人脸基准线的朝向可以是沿着双眼连接线从右眼指向左眼。当第一夹角在45°到135°之间时,电子设备100的横竖屏状态为向上竖屏。当第一夹角在135°到180°或-135°(225°)到-180°(180°)之间时,电子设备100的横竖屏状态为右横屏。当第一夹角在-45°(225°)到-135°(315°)之间时,电子设备100的横竖屏状态为向下竖屏。当第一夹角在-45°到45°之间时,电子设备100的横竖屏状态为左横屏。In some embodiments of the present application, the orientation of the face reference line may be from the right eye to the left eye along the binocular connecting line. When the first included angle is between 45° and 135°, the horizontal and vertical screen state of the electronic device 100 is the upward vertical screen. When the first included angle is between 135° and 180° or -135° (225°) and -180° (180°), the horizontal and vertical screen state of the electronic device 100 is the right horizontal screen. When the first included angle is between -45° (225°) and -135° (315°), the horizontal and vertical screen state of the electronic device 100 is the downward vertical screen. When the first included angle is between -45° and 45°, the horizontal and vertical screen state of the electronic device 100 is the left horizontal screen.

示例性的,如图14所示的第一夹角等于2°,第一夹角在-45°到45°之间,电子设备100确定电子设备100采集该参考图像时,电子设备100的横竖屏状态为左横屏。Exemplarily, as shown in FIG. 14 , the first included angle is equal to 2°, and the first included angle is between -45° and 45°. The screen status is left horizontal screen.

下面介绍如何根据电子设备100拍摄图像时的横竖屏状态确定该图像的第一参数,第一参数可以为方向参数或旋转参数。The following describes how to determine the first parameter of the image according to the horizontal and vertical screen states when the electronic device 100 captures the image, and the first parameter may be an orientation parameter or a rotation parameter.

在本申请的一些实施例中,电子设备100确定拍摄图像时的第一横竖屏状态后,根据第一横竖屏状态确定该图像的方向参数。电子设备100保存上述图像和该图像的方向参数。In some embodiments of the present application, after the electronic device 100 determines the first horizontal and vertical screen state when capturing an image, the orientation parameter of the image is determined according to the first horizontal and vertical screen state. The electronic device 100 stores the above-mentioned image and the orientation parameters of the image.

在本申请的一些实施例中,电子设备100拍摄图像时的横竖屏状态为竖屏向上时,该照片的方向参数等于1;电子设备100拍摄像时的横竖屏状态为左横屏时,该图像的方向参数等于8;电子设备100拍摄图像时的横竖屏状态为竖屏向下时,该图像的方向参数等于3;电子设备100拍摄图像时的横竖屏状态为表征右横屏,该图像的方向参数等于6。In some embodiments of the present application, when the horizontal and vertical screen state when the electronic device 100 takes an image is the vertical screen up, the orientation parameter of the photo is equal to 1; when the horizontal and vertical screen state when the electronic device 100 takes an image is the left horizontal screen, the The orientation parameter of the image is equal to 8; the orientation parameter of the image is equal to 3 when the horizontal and vertical screen state when the electronic device 100 captures the image is that the vertical screen is down; The direction parameter is equal to 6.

本申请实施例中,除上述表征方式,方向参数还可以通过其他的数值或字符表征电子设备100的横竖屏状态,此处不做具体限定。In this embodiment of the present application, in addition to the above-mentioned representation methods, the direction parameter may also represent the horizontal and vertical screen states of the electronic device 100 by other numerical values or characters, which are not specifically limited here.

在本申请的一些实施例中,电子设备100确定拍摄图像时电子设备100的第一横竖屏状态后,根据第一横竖屏状态确定该图像的旋转参数。电子设备100保存上述图像和该图像的旋转参数。上述旋转参数用于表征用户向上竖屏查看该图像时,电子设备100显示该照片所需的第二旋转角度。In some embodiments of the present application, after the electronic device 100 determines the first horizontal and vertical screen state of the electronic device 100 when capturing an image, the rotation parameter of the image is determined according to the first horizontal and vertical screen state. The electronic device 100 stores the above-mentioned image and the rotation parameters of the image. The above-mentioned rotation parameters are used to represent the second rotation angle required for the electronic device 100 to display the photo when the user views the image in the vertical screen upward.

由图4A所示,拍摄照片时若电子设备100的横竖屏状态为向上竖屏,该照片的旋转参数应等于0°;由图4B所示,若上述横竖屏状态为左横屏,该照片的旋转参数应等于-90°;由图4C所示,若上述横竖屏状态为向下竖屏,该照片的旋转参数应等于180°;由图4D所示,若上述横竖屏状态为左横屏,该照片的旋转参数应等于90°。As shown in FIG. 4A , if the horizontal and vertical screen state of the electronic device 100 is the upward vertical screen when taking a photo, the rotation parameter of the photo should be equal to 0°; as shown in FIG. 4B , if the above-mentioned horizontal and vertical screen state is the left horizontal screen, the photo. The rotation parameter of the photo should be equal to -90°; as shown in Figure 4C, if the above-mentioned horizontal and vertical screen state is the downward vertical screen, the rotation parameter of the photo should be equal to 180°; as shown in Figure 4D, if the above-mentioned horizontal and vertical screen state is left horizontal screen, the rotation parameter of the photo should be equal to 90°.

可以理解,第一参考图像的人脸基准线可以是用户实际人脸的人脸基准线在电子设备100屏幕上的投影,标准基准线可以平行于电子设备100侧边。若人脸标准线垂直于双眼连接线,当标准基准线相对于第一参考图像的人脸基准线旋转了第一夹角时,为保证用户通过电子设备100竖屏查看的图像与拍摄该时用户看到的预览图像一致,电子设备100显示屏上显示的该图像为预览图像旋转第一夹角后的图像,此时电子设备100显示的图像和预览图像长宽尺寸比例相同。由于电子设备100显示的图像的旋转角度只有0°、90°、180°和-90°(270°)这四种情况,因此,第一夹角在-45°到-135°之间时,旋转参数等于-90°;第一夹角在135°到225°之间时,旋转参数等于180°;第一夹角在45°到135°之间时,旋转参数等于90°。It can be understood that the face reference line of the first reference image may be the projection of the actual face reference line of the user on the screen of the electronic device 100 , and the standard reference line may be parallel to the side of the electronic device 100 . If the face standard line is perpendicular to the eye connecting line, when the standard reference line is rotated by a first angle relative to the face reference line of the first reference image, in order to ensure that the image viewed by the user through the vertical screen of the electronic device 100 is the same as the time when the image was shot The preview images seen by the user are the same, and the image displayed on the display screen of the electronic device 100 is the image after the preview image is rotated by the first included angle. At this time, the image displayed by the electronic device 100 and the preview image have the same aspect ratio. Since there are only four rotation angles of the image displayed by the electronic device 100, 0°, 90°, 180° and -90° (270°), therefore, when the first included angle is between -45° and -135°, The rotation parameter is equal to -90°; when the first angle is between 135° and 225°, the rotation parameter is equal to 180°; when the first angle is between 45° and 135°, the rotation parameter is equal to 90°.

综上所述,人脸基准线的朝向是沿着双眼连接线的垂直直线从下巴指向头顶时,如表1所示,是本申请实施例提供的第一夹角、第一横竖屏状态、方向参数和旋转参数的对应关系。To sum up, the orientation of the face reference line is from the chin to the top of the head along the vertical line of the connecting line between the eyes, as shown in Table 1, is the first angle, the first horizontal and vertical screen state, Correspondence between orientation parameters and rotation parameters.

表1Table 1

第一夹角first angle 第一横竖屏状态The first horizontal and vertical screen state 方向参数Orientation parameter 旋转参数Rotation parameter -45°至45°-45° to 45° 向上竖屏vertical screen up 11 -135°至-45°-135° to -45° 左横屏left horizontal screen 88 -90°-90° 135°至225°135° to 225° 向下竖屏vertical screen down 33 180°180° 45°至135°45° to 135° 右横屏Right horizontal screen 66 90°90°

综上所述,人脸基准线的朝向是沿着双眼连接线从第一参考图像的底部指向第一参考图像的顶部时,如表2所示,是本申请实施例提供的第一夹角、第一横竖屏状态、方向参数和旋转参数的对应关系。To sum up, when the orientation of the face reference line is from the bottom of the first reference image to the top of the first reference image along the eye-connecting line, as shown in Table 2, it is the first included angle provided by the embodiment of the present application. , the first horizontal and vertical screen state, the corresponding relationship between the orientation parameter and the rotation parameter.

表2Table 2

第一夹角first angle 第一横竖屏状态The first horizontal and vertical screen state 方向参数Orientation parameter 旋转参数Rotation parameter 45°至135°45° to 135° 向上竖屏vertical screen up 11 -45°至45°-45° to 45° 左横屏left horizontal screen 88 -90°-90° -135°至-45°-135° to -45° 向下竖屏vertical screen down 33 180°180° 135°至225°135° to 225° 右横屏Right horizontal screen 66 90°90°

下面介绍用户查看拍摄的第一图像时,电子设备100如何根据电子设备100的第二横竖屏状态和该图像的第一参数,确定待显示的第一图像所需的第一旋转角度。下面针对第一参数为方向参数和旋转参数分别进行介绍。The following describes how the electronic device 100 determines the first rotation angle required for the first image to be displayed according to the second horizontal and vertical screen state of the electronic device 100 and the first parameter of the image when the user views the captured first image. In the following, the first parameters are respectively introduced as a direction parameter and a rotation parameter.

(1)第一参数为方向参数。(1) The first parameter is a direction parameter.

本申请实施例中,电子设备100接收用户的查看操作,响应于检测到的上述查看操作,电子设备100根据电子设备100当前的横竖屏状态(即第二横竖屏状态)和第一图像的方向参数,确定该图像所需的第一旋转角度,并根据上述第一旋转角度显示第一图像。下面针对第二横竖屏状态的4种可能的朝向分别进行介绍。In this embodiment of the present application, the electronic device 100 receives a user's viewing operation, and in response to the detected viewing operation, the electronic device 100 determines the orientation of the first image according to the current horizontal and vertical screen state of the electronic device 100 (ie, the second horizontal and vertical screen state) and the orientation of the first image. parameters, determine the first rotation angle required for the image, and display the first image according to the first rotation angle. The following describes the four possible orientations of the second horizontal and vertical screen state respectively.

在本申请的一些实施例中,用户竖屏查看第一图像时,电子设备100确定电子设备100的第二横竖屏状态为向上竖屏。参考图4A,用户意图查看的图像的方向参数表征向上竖屏时,上述图像所需的第一旋转角度为0°;参考图4B,用户意图查看的图像的方向参数表征左横屏时,上述图像所需的第一旋转角度为-90°;参考图4C,用户意图查看的图像的方向参数表征向下竖屏时,上述图像所需的第一旋转角度为180°;参考图4D,用户意图查看的图像的方向参数表征右横屏时,上述图像所需的第一旋转角度为90°。第二横竖屏状态为向上竖屏时,第一旋转角度等于第二旋转角度。In some embodiments of the present application, when the user views the first image in the vertical screen, the electronic device 100 determines that the second horizontal and vertical screen state of the electronic device 100 is the vertical screen up. Referring to FIG. 4A , when the orientation parameter of the image the user intends to view represents the upward vertical screen, the required first rotation angle of the above image is 0°; with reference to FIG. 4B , when the orientation parameter of the image the user intends to view represents the left horizontal screen, the above The first rotation angle required for the image is -90°; with reference to FIG. 4C , when the orientation parameter of the image the user intends to view represents the downward vertical screen, the first rotation angle required for the above image is 180°; with reference to FIG. 4D , the user When the orientation parameter of the image intended to be viewed represents the right horizontal screen, the first rotation angle required for the above image is 90°. When the second horizontal and vertical screen state is the upward vertical screen, the first rotation angle is equal to the second rotation angle.

在本申请的一些实施例中,用户左横屏实施查看操作时,电子设备100确定电子设备100的第二横竖屏状态为左横屏,第一图像所需的第一旋转角度可以是在用户竖屏查看该图像时所需的第一旋转角度的基础上,再旋转90°。因此,第一图像的方向参数表征向上竖屏时,上述图像所需的第一旋转角度为90°;第一图像的方向参数表征左横屏时,上述图像所需的第一旋转角度为0°;第一图像的方向参数表征向下竖屏时,上述图像所需的第一旋转角度为-90°;第一图像的方向参数表征右横屏时,上述图像所需的第一旋转角度为180°。In some embodiments of the present application, when the user performs a viewing operation on the left horizontal screen, the electronic device 100 determines that the second horizontal and vertical screen state of the electronic device 100 is the left horizontal screen, and the first rotation angle required for the first image may be the user On the basis of the first rotation angle required when viewing the image in vertical screen, rotate it by 90°. Therefore, when the orientation parameter of the first image represents the vertical screen up, the required first rotation angle of the above image is 90°; when the orientation parameter of the first image represents the left horizontal screen, the required first rotation angle of the above image is 0 °; when the orientation parameter of the first image represents the downward vertical screen, the required first rotation angle of the above image is -90°; when the orientation parameter of the first image represents the right horizontal screen, the required first rotation angle of the above image is is 180°.

在本申请的一些实施例中,同理,用户向下竖屏实施查看操作时,电子设备100确定电子设备100的第二横竖屏状态为向下竖屏,第一图像所需的第一旋转角度可以是在用户竖屏查看该图像时所需的第一旋转角度的基础上,再旋转180°。因此,第一图像的方向参数表征向上竖屏时,上述图像所需的第一旋转角度为180°;第一图像的方向参数表征左横屏时,上述图像所需的第一旋转角度为90°;第一图像的方向参数表征向下竖屏时,上述图像所需的第一旋转角度为0°;第一图像的方向参数表征右横屏时,上述图像所需的第一旋转角度为-90°。In some embodiments of the present application, in the same way, when the user performs a viewing operation in the downward vertical screen, the electronic device 100 determines that the second horizontal and vertical screen state of the electronic device 100 is the downward vertical screen, and the first rotation required for the first image The angle may be rotated by 180° on the basis of the first rotation angle required when the user views the image in the vertical screen. Therefore, when the orientation parameter of the first image represents the upward vertical screen, the required first rotation angle of the above image is 180°; when the orientation parameter of the first image represents the left horizontal screen, the required first rotation angle of the above image is 90° °; when the orientation parameter of the first image represents the downward vertical screen, the required first rotation angle of the above image is 0°; when the orientation parameter of the first image represents the right horizontal screen, the required first rotation angle of the above image is -90°.

在本申请的一些实施例中,同理,用户右横屏实施查看操作时,电子设备100确定电子设备100的第二横竖屏状态为右横屏,第一图像所需的第一旋转角度可以是在用户竖屏查看该图像时所需的第一旋转角度的基础上,再旋转-90°。因此,第一图像的方向参数表征向上竖屏时,上述图像所需的第一旋转角度为-90°;第一图像的方向参数表征左横屏时,上述图像所需的第一旋转角度为180°;第一图像的方向参数表征向下竖屏时,上述图像所需的第一旋转角度为90°;第一图像的方向参数表征右横屏时,上述图像所需的第一旋转角度为0°。In some embodiments of the present application, similarly, when the user performs a viewing operation on the right horizontal screen, the electronic device 100 determines that the second horizontal and vertical screen state of the electronic device 100 is the right horizontal screen, and the first rotation angle required for the first image can be It is based on the first rotation angle required by the user to view the image in the vertical screen, and then rotates it by -90°. Therefore, when the orientation parameter of the first image represents the upward vertical screen, the required first rotation angle of the above image is -90°; when the orientation parameter of the first image represents the left horizontal screen, the required first rotation angle of the above image is 180°; when the orientation parameter of the first image represents the downward vertical screen, the required first rotation angle of the above image is 90°; when the orientation parameter of the first image represents the right horizontal screen, the required first rotation angle of the above image is is 0°.

(2)第一参数为旋转参数。(2) The first parameter is a rotation parameter.

可以理解,旋转参数即第二横竖屏状态为向上竖屏时电子设备100显示的图像所需的第二旋转角度。旋转参数本质上也用于表征照片拍摄时的横竖屏状态,方向参数与旋转参数的表现形式不同。It can be understood that the rotation parameter, that is, the second horizontal and vertical screen state is the second rotation angle required for the image displayed by the electronic device 100 when the vertical screen is upward. The rotation parameter is also essentially used to represent the horizontal and vertical screen state when the photo is taken, and the orientation parameter is different from the rotation parameter.

本申请实施例中,电子设备100接收用户针对第一图像的查看操作,响应于检测到的上述查看操作,电子设备100根据电子设备100的第二横竖屏状态和第一图像的旋转参数,确定该图像所需的第一旋转角度,并根据上述第一旋转角度显示第一图像。In this embodiment of the present application, the electronic device 100 receives a user's viewing operation for the first image, and in response to the detected viewing operation, the electronic device 100 determines the second horizontal and vertical screen state of the electronic device 100 and the rotation parameter of the first image to determine The first rotation angle required for the image, and the first image is displayed according to the first rotation angle.

在本申请的一些实施例中,用户向上竖屏查看第一图像(即第二横竖屏状态为向上竖屏)时,第一图像所需的第一旋转角度即等于旋转参数。旋转参数可以参考前述实施例,此处不再赘述。In some embodiments of the present application, when the user views the first image in the vertical screen upward (that is, the second horizontal and vertical screen state is the vertical screen upward), the first rotation angle required for the first image is equal to the rotation parameter. For the rotation parameters, reference may be made to the foregoing embodiments, and details are not described herein again.

类似于方向参数,本申请实施例中,用户左横屏实施查看操作(即第二横竖屏状态为左横屏)时,第一图像所需的第一旋转角度可以是旋转参数直接加上90°。用户向下竖屏实施查看操作(即第二横竖屏状态为向下竖屏)时,第一图像所需的第一旋转角度可以是旋转参数直接加上180°。用户右横屏实施查看操作(即第二横竖屏状态为右横屏)时,第一图像所需的第一旋转角度可以是旋转参数直接加上-90°。Similar to the orientation parameter, in the embodiment of the present application, when the user performs the viewing operation on the left horizontal screen (that is, the second horizontal and vertical screen state is the left horizontal screen), the first rotation angle required for the first image may be the rotation parameter directly plus 90 °. When the user performs a viewing operation on the downward vertical screen (that is, the second horizontal and vertical screen state is the downward vertical screen), the first rotation angle required for the first image may be the rotation parameter directly plus 180°. When the user performs a viewing operation on the right horizontal screen (that is, the second horizontal and vertical screen state is the right horizontal screen), the first rotation angle required for the first image may be the rotation parameter directly plus -90°.

综上所述,如表3所示,是本申请实施例提供的第二横竖屏状态、方向参数、旋转参数和待显示照片所需第一旋转角度的一种对应关系。To sum up, as shown in Table 3, it is a correspondence between the second horizontal and vertical screen state, the orientation parameter, the rotation parameter and the first rotation angle required for the photo to be displayed provided in the embodiment of the present application.

表3table 3

Figure BDA0002517362510000131
Figure BDA0002517362510000131

Figure BDA0002517362510000141
Figure BDA0002517362510000141

在一些实施例中,第二横竖屏状态为预设横竖屏状态时,电子设备100显示第一图像所需的第一旋转角度为零。即在第二横竖屏状态为预设横竖屏状态时,电子设备100显示的第一图像的方向和第一图像拍摄时的预览图像的方向一致。例如,上述预设横竖屏状态为向下竖屏,用户向下竖屏进行查看第一图像时,第一图像所需的第一旋转角度为零。预设横竖屏状态可以是电子设备100默认设置的,也可以是用户预设的。In some embodiments, when the second horizontal and vertical screen state is the preset horizontal and vertical screen state, the first rotation angle required by the electronic device 100 to display the first image is zero. That is, when the second horizontal and vertical screen state is the preset horizontal and vertical screen state, the orientation of the first image displayed by the electronic device 100 is consistent with the orientation of the preview image when the first image is captured. For example, the preset horizontal and vertical screen state is the downward vertical screen, and when the user views the first image in the downward vertical screen, the first rotation angle required for the first image is zero. The preset horizontal and vertical screen states may be set by the electronic device 100 by default, or may be preset by the user.

下面详细介绍本申请实施例提供的显示图像的方法。The method for displaying images provided by the embodiments of the present application will be described in detail below.

图15是本申请实施例提供的一种显示图像的方法的示意性流程图。如图15所示,本申请实施例提供的显示图像的方法包括但不限于步骤S101至S108。下面对该方法实施例的可能实现方式做进一步的描述。FIG. 15 is a schematic flowchart of a method for displaying an image provided by an embodiment of the present application. As shown in FIG. 15 , the method for displaying an image provided by this embodiment of the present application includes, but is not limited to, steps S101 to S108 . A possible implementation manner of this method embodiment is further described below.

S101、电子设备100接收用户的拍摄操作。S101. The electronic device 100 receives a user's photographing operation.

示例性的,如图8或图9所示,电子设备100可以通过相机应用接收用户的拍摄操作,上述拍摄操作可以是用户点击拍摄界面11的拍摄控件202。Exemplarily, as shown in FIG. 8 or FIG. 9 , the electronic device 100 may receive a user's photographing operation through a camera application, and the above photographing operation may be that the user clicks on the photographing control 202 of the photographing interface 11 .

S102、响应于检测到的上述拍摄操作,电子设备100利用第一摄像头拍摄第一图像,并获取第二摄像头采集的第一参考图像。S102. In response to the detected shooting operation, the electronic device 100 uses the first camera to shoot the first image, and obtains the first reference image collected by the second camera.

在本申请的一些实施例中,第一摄像头为后置摄像头,第二摄像头可以为前置摄像头;在另一些实施例中,第一摄像头为前置摄像头,第二摄像头可以为前置摄像头。此处不做具体限定。In some embodiments of the present application, the first camera is a rear camera, and the second camera may be a front camera; in other embodiments, the first camera is a front camera, and the second camera may be a front camera. There is no specific limitation here.

不限于通过用户的手指点击拍摄控件202控制第一摄像头进行拍摄,本申请实施例还可以通过其他用户操作控制第一摄像头进行拍摄。此处不作具体限定。It is not limited to controlling the first camera to perform shooting by clicking the shooting control 202 with the user's finger, and the embodiment of the present application may also control the first camera to perform shooting through other user operations. There is no specific limitation here.

示例性的,第一参考图像如图9所示。Exemplarily, the first reference image is shown in FIG. 9 .

在本申请的一些实施例中,响应于用户的拍摄操作,电子设备100利用第一摄像头拍摄第一图像,并利用第二摄像头采集第一参考图像。In some embodiments of the present application, in response to a user's shooting operation, the electronic device 100 uses the first camera to capture the first image, and uses the second camera to capture the first reference image.

在本申请的一些实施例中,电子设备100开机后,电子设备100利用第二摄像头定时采集图像。上述第一参考图像可以是电子设备100接收用户的拍摄操作时第二摄像头最新采集的图像。In some embodiments of the present application, after the electronic device 100 is powered on, the electronic device 100 uses the second camera to periodically capture images. The above-mentioned first reference image may be an image newly collected by the second camera when the electronic device 100 receives the user's shooting operation.

在本申请的一些实施例中,电子设备100开启相机,且电子设备100当前用于拍照的摄像头为第一摄像头时,电子设备100利用第二摄像头定时采集图像。上述第一参考图像可以是电子设备100接收用户的拍摄操作时第二摄像头最新采集的图像。In some embodiments of the present application, when the electronic device 100 turns on the camera and the camera currently used by the electronic device 100 for taking pictures is the first camera, the electronic device 100 uses the second camera to periodically capture images. The above-mentioned first reference image may be an image newly collected by the second camera when the electronic device 100 receives the user's shooting operation.

在本申请的一些实施例中,电子设备100开启相机,且电子设备100满足预设条件时,电子设备100利用第二摄像头采集第一参考图像。上述第一参考图像可以是电子设备100接收用户的拍摄操作时第二摄像头最新采集的图像。In some embodiments of the present application, when the electronic device 100 turns on the camera and the electronic device 100 satisfies the preset condition, the electronic device 100 uses the second camera to capture the first reference image. The above-mentioned first reference image may be an image newly collected by the second camera when the electronic device 100 receives the user's shooting operation.

在本申请的一些实施例中,上述预设条件可以是电子设备100的屏幕与水平面的夹角小于预设角度。上述预设条件还可以为电子设备100的三轴的重力加速度在第一预设范围内。上述预设条件还可以为重力加速度方向与电子设备100的三轴的夹角在第二预设范围内。In some embodiments of the present application, the above-mentioned preset condition may be that the angle between the screen of the electronic device 100 and the horizontal plane is smaller than the preset angle. The above preset condition may also be that the gravitational acceleration of the three axes of the electronic device 100 is within the first preset range. The above preset condition may also be that the angle between the direction of the gravitational acceleration and the three axes of the electronic device 100 is within the second preset range.

例如,上述预设角度等于10°、20°或30°。For example, the above-mentioned preset angle is equal to 10°, 20° or 30°.

可以理解,电子设备100不满足预设条件时,可以按照传统方式确定电子设备100的横竖屏状态。例如,利用重力加速度传感器或方向传感器确定电子设备100的横竖屏状态。电子设备100满足预设条件时,即当电子设备100在接近水平放置时,可以使用本申请实施例所提方案确定电子设备100的横竖屏状态。It can be understood that when the electronic device 100 does not meet the preset conditions, the horizontal and vertical screen states of the electronic device 100 can be determined in a conventional manner. For example, the horizontal and vertical screen states of the electronic device 100 are determined by using a gravitational acceleration sensor or an orientation sensor. When the electronic device 100 satisfies the preset condition, that is, when the electronic device 100 is placed nearly horizontally, the solution proposed in the embodiments of the present application can be used to determine the horizontal and vertical screen states of the electronic device 100 .

需要说明的是,本申请实施例提及的第二摄像头可以是低功耗摄像头。It should be noted that, the second camera mentioned in the embodiment of the present application may be a low-power camera.

示例性的,如图8所示,用户点击拍摄控件202,响应于上述用户操作,电子设备100利用第一摄像头拍摄图像,并利用第二摄像头采集第一参考图像。Exemplarily, as shown in FIG. 8 , the user clicks the shooting control 202, and in response to the above-mentioned user operation, the electronic device 100 uses the first camera to capture an image, and uses the second camera to capture the first reference image.

S103、当第一参考图像中包括人脸时,确定上述第一参考图像的人脸基准线。S103. When the first reference image includes a human face, determine the human face reference line of the first reference image.

在本申请的一些实施例中,人脸基准线可以是根据上述人脸的双眼位置、鼻子位置、嘴巴位置中的一或多个确定的。例如,上述人脸基准线包括人脸的双眼中间点、鼻子中间点、嘴巴中间点中的至少两个。In some embodiments of the present application, the face reference line may be determined according to one or more of the position of the eyes, the position of the nose, and the position of the mouth of the above-mentioned face. For example, the above-mentioned face reference line includes at least two of the middle point of the eyes, the middle point of the nose, and the middle point of the mouth of the human face.

示例性的,如图11A所示,人脸基准线的朝向可以是沿着上述双眼连接线垂直直线从下巴指向头顶。示例性的,如图11B所示,人脸基准线的朝向还可以是沿着双眼连接线从第一参考图像的底部指向第一参考图像的顶部。Exemplarily, as shown in FIG. 11A , the orientation of the face reference line may be from the chin to the top of the head along the above-mentioned vertical line connecting the eyes. Exemplarily, as shown in FIG. 11B , the orientation of the face reference line may also be from the bottom of the first reference image to the top of the first reference image along the eye connecting line.

可以理解,图11A和图11B所示的人脸基准线的朝向是本申请实施例提供的示例性的朝向,不应对本申请实施例构成限定,本申请实施例中人脸基准线还可以有其他朝向。It can be understood that the orientations of the face baselines shown in FIGS. 11A and 11B are exemplary orientations provided by the embodiments of the present application, and should not be limited to the embodiments of the present application. The face baselines in the embodiments of the present application may also have other orientations.

在本申请的一些实施例中,当第一参考图像中包括预设用户的人脸时,确定上述第一参考图像中预设用户的人脸基准线为第一参考图像的人脸基准线。In some embodiments of the present application, when the first reference image includes a preset user's face, it is determined that the preset user's face reference line in the first reference image is the face reference line of the first reference image.

在本申请的一些实施例中,第一参考图像中包括一或多个人脸时,电子设备100确定上述一或多个人脸中面积最大的人脸的人脸基准线为第一参考图像的人脸基准线。示例性的,如图12所示。In some embodiments of the present application, when the first reference image includes one or more faces, the electronic device 100 determines that the face reference line of the face with the largest area among the one or more faces is the person in the first reference image face baseline. Illustratively, as shown in FIG. 12 .

本申请实施例中,若第一参考图像中不包括人脸,电子设备100可以按照传统方式确定当前电子设备100的横竖屏状态。In this embodiment of the present application, if the first reference image does not include a human face, the electronic device 100 may determine the current horizontal and vertical screen states of the electronic device 100 in a conventional manner.

不限于上述人脸基准线的确定方式,本申请实施例中还可以采用其他方式确定人脸基准线,此处不作具体限定。如何确定第一参考图像是否包含人脸可以参考前述实施例,此处不再赘述。It is not limited to the above-mentioned way of determining the face reference line, and other ways may also be used to determine the face reference line in the embodiment of the present application, which is not specifically limited here. How to determine whether the first reference image contains a human face may refer to the foregoing embodiments, and details will not be repeated here.

S104、根据第一参考图像的标准基准线相对于第一参考图像中的人脸基准线的第一夹角,确定电子设备100拍照时的第一横竖屏状态。S104: Determine the first horizontal and vertical screen state when the electronic device 100 takes a picture according to the first included angle between the standard reference line of the first reference image and the face reference line in the first reference image.

其中,标准基准线的朝向可以是沿着第一参考图像的第一列所在侧边指向第一参考图像的顶部(第一参考图像的第一行)。示例性的,标准基准线可如图10所示。第一夹角为标准基准线相对于第一参考图像中的人脸基准线的夹角。示例性的,第一夹角可如图13或图14所示。The standard reference line may be oriented along the side of the first column of the first reference image to the top of the first reference image (the first row of the first reference image). Exemplarily, the standard reference line may be as shown in FIG. 10 . The first included angle is an included angle between the standard reference line and the face reference line in the first reference image. Exemplarily, the first included angle may be as shown in FIG. 13 or FIG. 14 .

可以理解,第一参考图像是电子设备100接收用户拍摄操作时最新采集的第一参考图像,电子设备100采集第一参考图像时的横竖屏状态,可视为电子设备100响应于上述拍摄操作进行拍摄时的横竖屏状态。It can be understood that the first reference image is the first reference image newly collected when the electronic device 100 receives the user's shooting operation, and the horizontal and vertical screen states when the electronic device 100 collects the first reference image can be regarded as the electronic device 100 responding to the above shooting operation. The horizontal and vertical screen state when shooting.

在本申请的一些实施例中,第一夹角在第一范围内时,确定第一横竖屏状态为向上竖屏;第一夹角在第二范围内时,确定第一横竖屏状态为左横屏;第一夹角在第三范围内时,确定第一横竖屏状态为向下竖屏;第一夹角在第四范围内时,确定第一横竖屏状态为右横屏。In some embodiments of the present application, when the first included angle is within the first range, it is determined that the first horizontal and vertical screen state is the upward vertical screen; when the first included angle is within the second range, it is determined that the first horizontal and vertical screen state is left Horizontal screen; when the first included angle is within the third range, it is determined that the first horizontal and vertical screen state is the downward vertical screen; when the first included angle is within the fourth range, the first horizontal and vertical screen state is determined to be the right horizontal screen.

在本申请的一些实施例中,当人脸基准线的朝向是沿着上述双眼连接线垂直直线从下巴指向头顶时,第一夹角和横竖屏状态的对应关系可参考表1,该情况下,第一范围可以为大于-45°小于等于45°,第二范围可以为大于-135°小于等于-45°,第三范围可以为大于135°小于等于225°,第四范围可以为大于45°小于等于135°。当人脸基准线的朝向是沿着双眼连接线从第一参考图像的底部指向第一参考图像的顶部时,第一夹角和横竖屏状态的对应关系可参考表2。此处不再赘述。In some embodiments of the present application, when the orientation of the face reference line is from the chin to the top of the head along the above-mentioned vertical line connecting the eyes, the corresponding relationship between the first angle and the horizontal and vertical screen states can refer to Table 1. In this case , the first range may be greater than -45° and less than or equal to 45°, the second range may be greater than -135° and less than or equal to -45°, the third range may be greater than 135° and less than or equal to 225°, and the fourth range may be greater than 45° ° is less than or equal to 135°. When the orientation of the face reference line is from the bottom of the first reference image to the top of the first reference image along the eye connecting line, the corresponding relationship between the first angle and the horizontal and vertical screen states can refer to Table 2. It will not be repeated here.

S105、电子设备100保存第一图像以及该图像对应的第一参数,第一参数用于表征该图像拍摄时的第一横竖屏状态。S105 , the electronic device 100 saves the first image and the first parameter corresponding to the image, where the first parameter is used to represent the first horizontal and vertical screen state when the image is captured.

电子设备100保存的图像通常由两部分组成。一部分是图像数据本身,它记录了图像中每个像素的颜色值;另一部分是该图像的文件头,这里面记录着图像的属性信息,例如,图像的宽度,高度等信息。The image saved by the electronic device 100 generally consists of two parts. One part is the image data itself, which records the color value of each pixel in the image; the other part is the file header of the image, which records the attribute information of the image, such as the width and height of the image.

在本申请的一些实施例中,电子设备通过第一参数表征第一横竖屏状态,取第一值的第一参数表征向上竖屏,取第二值的第一参数表征左横屏,取第三值的第一参数表征向下竖屏,取第四值的第一参数表征右横屏。In some embodiments of the present application, the electronic device uses the first parameter to represent the first horizontal and vertical screen state, the first parameter with the first value represents the vertical up screen, the first parameter with the second value represents the left horizontal screen, and the first parameter with the first value represents the left horizontal screen. The first parameter of three values represents the downward vertical screen, and the first parameter of the fourth value represents the right horizontal screen.

在本申请的一些实施例中,第一参数可以是方向参数。例如,第一参数为图像文件头中Exif的参数“Orientation”。在一些实施例中,方向参数为1表征向上竖屏;方向参数为8表征右横屏;方向参数为3表征向下竖屏;方向参数为6表征左横屏。In some embodiments of the present application, the first parameter may be a direction parameter. For example, the first parameter is the parameter "Orientation" of Exif in the image file header. In some embodiments, an orientation parameter of 1 indicates a vertical screen up; an orientation parameter of 8 indicates a right landscape screen; an orientation parameter of 3 indicates a vertical screen down; and an orientation parameter of 6 indicates a left landscape screen.

在本申请的一些实施例中,第一参数可以是旋转参数。参考图4A至图4D,旋转参数等于0°,表征第一横竖屏状态为向上竖屏;旋转参数等于-90°,表征第一横竖屏状态为左横屏;旋转参数等于180°,表征第一横竖屏状态为向下竖屏;旋转参数等于90°,表征第一横竖屏状态为右横屏。In some embodiments of the present application, the first parameter may be a rotation parameter. 4A to 4D , the rotation parameter is equal to 0°, indicating that the first horizontal and vertical screen state is vertical upward screen; the rotation parameter is equal to -90°, indicating that the first horizontal and vertical screen state is the left horizontal screen; A horizontal and vertical screen state is a downward vertical screen; the rotation parameter is equal to 90°, indicating that the first horizontal and vertical screen state is a right horizontal screen.

在本申请的一些实施例中,电子设备100开机时,或者,电子设备100开启相机且电子设备100当前用于拍照的摄像头为第一摄像头时,或者,电子设备100开启相机且电子设备100满足前述预设条件时,电子设备100利用第二摄像头定时采集图像。上述情况下,在一种实现方式中,电子设备100可以在第二摄像头定时采集每张图像时,生成该图像的第一参数。电子设备100接收用户的拍摄操作时,电子设备100直接获取最新采集图像已生成的第一参数。这样,可以提高第一参数获取速度。上述情况下,在另一种实现方式中,电子设备100在接收用户的拍摄操作时,才生成第二摄像头最新采集图像的第一参数。这样,可以节省电子设备100的功耗。In some embodiments of the present application, when the electronic device 100 is turned on, or when the electronic device 100 turns on the camera and the camera currently used by the electronic device 100 to take pictures is the first camera, or when the electronic device 100 turns on the camera and the electronic device 100 satisfies the Under the aforementioned preset conditions, the electronic device 100 uses the second camera to periodically capture images. In the above case, in an implementation manner, the electronic device 100 may generate the first parameter of the image when the second camera periodically captures each image. When the electronic device 100 receives the user's photographing operation, the electronic device 100 directly obtains the first parameter generated by the latest captured image. In this way, the acquisition speed of the first parameter can be improved. In the above case, in another implementation manner, the electronic device 100 generates the first parameter of the latest image captured by the second camera only when the electronic device 100 receives the user's shooting operation. In this way, the power consumption of the electronic device 100 can be saved.

不同于传统的第一参数的确定方法,本申请实施例提供了的第一参数的确定方法通过对用户行为意图的检测,准确的获取电子设备100的横竖屏状态,进而确定第一参数。因此,在用户查看照片时,可以显示符合用户行为意图的照片。Different from the traditional method for determining the first parameter, the method for determining the first parameter provided by the embodiment of the present application accurately acquires the horizontal and vertical screen states of the electronic device 100 by detecting the user's behavioral intention, and then determines the first parameter. Therefore, when a user views a photo, a photo that conforms to the user's behavioral intent can be displayed.

S106、电子设备100接收用户的查看操作。S106, the electronic device 100 receives the user's viewing operation.

示例性的,如图15所示,上述查看操作可以是用户点击拍摄界面11上的相册控件203。Exemplarily, as shown in FIG. 15 , the above-mentioned viewing operation may be that the user clicks on the album control 203 on the shooting interface 11 .

S107、响应于检测到的查看操作,电子设备100根据电子设备100的第一参数、电子设备100当前的横竖屏状态确定待显示的第一图像所需的第一旋转角度。S107. In response to the detected viewing operation, the electronic device 100 determines a first rotation angle required for the first image to be displayed according to the first parameter of the electronic device 100 and the current horizontal and vertical screen states of the electronic device 100.

其中,电子设备100当前的横竖屏状态可参考前述实施例中的第二横竖屏状态。The current horizontal and vertical screen states of the electronic device 100 may refer to the second horizontal and vertical screen states in the foregoing embodiments.

在本申请的一些实施例中,电子设备100接收到用户的查看操作时,若电子设备100满足前述预设条件,则电子设备100通过第二摄像头采集的参考图像确定电子设备100的第二横竖屏状态;若电子设备100不满足前述预设条件,则电子设备100通过传统方式确定电子设备100的第二横竖屏状态。在一些实施例中,电子设备100通过传统方式确定电子设备100的第二横竖屏状态,不用考虑前述预设条件。In some embodiments of the present application, when the electronic device 100 receives the user's viewing operation, if the electronic device 100 satisfies the foregoing preset conditions, the electronic device 100 determines the second horizontal and vertical orientation of the electronic device 100 through the reference image collected by the second camera. screen state; if the electronic device 100 does not meet the aforementioned preset conditions, the electronic device 100 determines the second horizontal and vertical screen state of the electronic device 100 in a conventional manner. In some embodiments, the electronic device 100 determines the second horizontal and vertical screen state of the electronic device 100 in a conventional manner, without considering the aforementioned preset conditions.

在本申请的一些实施例中,响应于检测到的查看操作,电子设备100获取第二摄像头采集的第二参考图像,并根据第二参考图像确定电子设备100的第二横竖屏状态。然后,电子设备100根据电子设备100的第一参数、电子设备100的第二横竖屏状态确定待显示图像所需的第一旋转角度。In some embodiments of the present application, in response to the detected viewing operation, the electronic device 100 acquires a second reference image captured by the second camera, and determines a second horizontal and vertical screen state of the electronic device 100 according to the second reference image. Then, the electronic device 100 determines the first rotation angle required for the image to be displayed according to the first parameter of the electronic device 100 and the second horizontal and vertical screen states of the electronic device 100 .

类似于第一横竖屏状态,电子设备100可以根据第二参考图像的标准基准线相对于第二参考图像的人脸基准线的夹角,确定电子设备100的第二横竖屏状态。此处不再赘述。Similar to the first horizontal and vertical screen state, the electronic device 100 may determine the second horizontal and vertical screen state of the electronic device 100 according to the angle between the standard reference line of the second reference image and the face reference line of the second reference image. It will not be repeated here.

参考前述实施例,第一参数为方向参数或旋转参数时,电子设备100的第一参数、第二横竖屏状态和待显示照片所需的第一旋转角度的对应关系可如表3所示。Referring to the foregoing embodiment, when the first parameter is an orientation parameter or a rotation parameter, the corresponding relationship between the first parameter, the second horizontal and vertical screen state of the electronic device 100 and the first rotation angle required for the photo to be displayed may be as shown in Table 3.

S108、电子设备100根据上述第一图像所需的第一旋转角度显示第一图像。S108 , the electronic device 100 displays the first image according to the first rotation angle required by the first image.

电子设备100根据上述第一旋转角度确定显示屏上第一图像的显示区域,以及对第一图像进行绘制,并在上述显示区域内显示绘制后的第一图像。The electronic device 100 determines a display area of the first image on the display screen according to the above-mentioned first rotation angle, draws the first image, and displays the drawn first image in the above-mentioned display area.

本申请实施例中,拍摄界面也可以被称为预览界面,拍摄界面的预览图像区也可以被称为第一区域;拍摄操作也可以被称为第一用户操作;查看操作也可以被称为第二用户操作;第一参考图像也可以被称为第二图像;相册界面的图像显示区也可以被称为第二区域;第二参考图像也可以被称为第三图像。此处不做具体限定。In this embodiment of the present application, the shooting interface may also be referred to as a preview interface, and the preview image area of the shooting interface may also be referred to as the first area; the shooting operation may also be referred to as the first user operation; the viewing operation may also be referred to as The second user operation; the first reference image may also be referred to as the second image; the image display area of the album interface may also be referred to as the second area; the second reference image may also be referred to as the third image. There is no specific limitation here.

下面,介绍本申请实施例中涉及的电子设备。本申请对提及的电子设备的类型不做具体限定,电子设备100可以为手机、平板电脑、个人数字助理(personal digitalassistant,PDA)、可穿戴设备、膝上型计算机(laptop)等便携式电子设备。便携式电子设备的示例性实施例包括但不限于搭载iOS、android、microsoft或者其他操作系统的便携式电子设备。上述便携式电子设备也可以是其他便携式电子设备,诸如具有触敏表面(例如触控面板)的膝上型计算机(laptop)等。还应当理解的是,在本申请其他一些实施例中,电子设备也可以不是便携式电子设备,而是具有触敏表面(例如触控面板)的台式计算机,或者是智能电视机等。Next, the electronic devices involved in the embodiments of the present application are introduced. This application does not specifically limit the types of electronic devices mentioned, and the electronic device 100 may be a portable electronic device such as a mobile phone, a tablet computer, a personal digital assistant (PDA), a wearable device, and a laptop computer (laptop). . Exemplary embodiments of portable electronic devices include, but are not limited to, portable electronic devices powered by iOS, android, microsoft, or other operating systems. The portable electronic device described above may also be other portable electronic devices, such as a laptop or the like having a touch-sensitive surface (eg, a touch panel). It should also be understood that, in some other embodiments of the present application, the electronic device may not be a portable electronic device, but a desktop computer with a touch-sensitive surface (eg, a touch panel), or a smart TV or the like.

参见图16,图16示出了本申请实施例提供的示例性电子设备100的结构示意图。Referring to FIG. 16 , FIG. 16 shows a schematic structural diagram of an exemplary electronic device 100 provided by an embodiment of the present application.

电子设备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 charge management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2 , mobile communication module 150, wireless communication module 160, audio module 170, speaker 170A, receiver 170B, microphone 170C, headphone jack 170D, sensor module 180, buttons 190, motor 191, indicator 192, camera 193, display screen 194, and Subscriber identification module (SIM) card interface 195 and the like. 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, and ambient light. Sensor 180L, bone conduction sensor 180M, etc.

可以理解的是,本申请实施例示意的结构并不构成对电子设备100的具体限定。在本申请另一些实施例中,电子设备100可以包括比图示更多或更少的部件,或者组合某些部件,或者拆分某些部件,或者不同的部件布置。图示的部件可以以硬件,软件或软件和硬件的组合实现。It can be understood that the structures illustrated in the embodiments of the present application do 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 less components than shown, or combine some components, or separate some components, or arrange different components. The illustrated components 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),控制器,存储器,视频编解码器,数字信号处理器(digital signal 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 (application processor, AP), a modem processor, a graphics processor (graphics processing unit, GPU), an image signal processor ( image signal processor, ISP), controller, memory, video codec, digital signal processor (DSP), baseband processor, and/or neural-network processing unit (NPU), etc. . Wherein, different processing units may be independent devices, or may be integrated in one or more processors.

其中,控制器可以是电子设备100的神经中枢和指挥中心。控制器可以根据指令操作码和时序信号,产生操作控制信号,完成取指令和执行指令的控制。The controller may be the nerve center and command center of the electronic device 100 . The controller can generate an operation control signal according to the instruction operation code and timing signal, and complete the control of fetching and executing instructions.

NPU可以利用进行卷积神经网络(Convolutional Neural Networks,CNN)处理进行人工智能运算。例如,利用CNN模型做大量的信息识别和信息筛选,可实现情景智能的训练和识别。The NPU can perform artificial intelligence operations using Convolutional Neural Networks (CNN) processing. For example, using the CNN model to do a lot of information identification and information screening can realize the training and identification of situational intelligence.

处理器110中还可以设置存储器,用于存储指令和数据。在一些实施例中,处理器110中的存储器为高速缓冲存储器。该存储器可以保存处理器110刚用过或循环使用的指令或数据。如果处理器110需要再次使用该指令或数据,可从所述存储器中直接调用。避免了重复存取,减少了处理器110的等待时间,因而提高了系统的效率。A memory may also be provided in the processor 110 for storing instructions and data. In some embodiments, the memory in processor 110 is cache memory. This memory may hold instructions or data that have just been used or recycled by the processor 110 . If the processor 110 needs to use the instruction or data again, it can be called directly from the memory. Repeated accesses are avoided and the latency of the processor 110 is reduced, thereby increasing the efficiency of the system.

在一些实施例中,处理器110可以包括一个或多个接口。接口可以包括集成电路(inter-integrated circuit,I2C)接口,集成电路内置音频(inter-integrated circuitsound,I2S)接口,脉冲编码调制(pulse code modulation,PCM)接口,通用异步收发传输器(universal asynchronous receiver/transmitter,UART)接口,移动产业处理器接口(mobile industry processor interface,MIPI),通用输入输出(general-purposeinput/output,GPIO)接口,用户标识模块(subscriber identity module,SIM)接口,和/或通用串行总线(universal serial bus,USB)接口等。In some embodiments, the processor 110 may include one or more interfaces. The interface may include an integrated circuit (inter-integrated circuit, I2C) interface, an integrated circuit built-in audio (inter-integrated circuitsound, I2S) interface, a pulse code modulation (pulse code modulation, PCM) interface, a universal asynchronous receiver (universal asynchronous receiver) interface /transmitter, UART) interface, mobile industry processor interface (MIPI), general-purpose input/output (GPIO) interface, subscriber identity module (SIM) interface, and/or Universal serial bus (universal serial bus, USB) interface, etc.

充电管理模块140用于从充电器接收充电输入。其中,充电器可以是无线充电器,也可以是有线充电器。The charging management module 140 is used to receive charging input from the charger. The charger may be a wireless charger or a wired charger.

电源管理模块141用于连接电池142,充电管理模块140与处理器110。电源管理模块141接收电池142和/或充电管理模块140的输入,为处理器110,内部存储器121,外部存储器,显示屏194,摄像头193,和无线通信模块160等供电。The power management module 141 is used for connecting the battery 142 , the charging management module 140 and the processor 110 . The power management module 141 receives input from the battery 142 and/or the charging management module 140 and supplies power to the processor 110 , the internal memory 121 , the external memory, the display screen 194 , the camera 193 , and the wireless communication module 160 .

电源管理模块141还可以用于监测电池容量,电池循环次数,电池健康状态(漏电,阻抗)等参数。在其他一些实施例中,电源管理模块141也可以设置于处理器110中。在另一些实施例中,电源管理模块141和充电管理模块140也可以设置于同一个器件中。The power management module 141 can also be used to monitor parameters such as battery capacity, battery cycle times, battery health status (leakage, impedance). In some other embodiments, the power management module 141 may also be provided in the processor 110 . In other embodiments, the power management module 141 and the charging management module 140 may also be provided in the same device.

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

天线1和天线2用于发射和接收电磁波信号。电子设备100中的每个天线可用于覆盖单个或多个通信频带。不同的天线还可以复用,以提高天线的利用率。例如:可以将天线1复用为无线局域网的分集天线。在另外一些实施例中,天线可以和调谐开关结合使用。Antenna 1 and Antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in electronic device 100 may be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve antenna utilization. For example, the antenna 1 can be multiplexed as a diversity antenna of the wireless local area network. In other embodiments, the antenna may be used in conjunction with a tuning switch.

移动通信模块150可以提供应用在电子设备100上的包括2G/3G/4G/5G等无线通信的解决方案。移动通信模块150可以包括至少一个滤波器,开关,功率放大器,低噪声放大器(low noise amplifier,LNA)等。移动通信模块150可以由天线1接收电磁波,并对接收的电磁波进行滤波,放大等处理,传送至调制解调处理器进行解调。移动通信模块150还可以对经调制解调处理器调制后的信号放大,经天线1转为电磁波辐射出去。在一些实施例中,移动通信模块150的至少部分功能模块可以被设置于处理器110中。在一些实施例中,移动通信模块150的至少部分功能模块可以与处理器110的至少部分模块被设置在同一个器件中。The mobile communication module 150 may provide wireless communication solutions including 2G/3G/4G/5G etc. applied on the electronic device 100 . The mobile communication module 150 may include at least one filter, switch, power amplifier, low noise amplifier (low noise amplifier, LNA) and the like. The mobile communication module 150 can receive electromagnetic waves from the antenna 1, filter and amplify the received electromagnetic waves, and transmit them to the modulation and demodulation processor for demodulation. The mobile communication module 150 can also amplify the signal modulated by the modulation and demodulation processor, and then turn it into an electromagnetic wave for radiation through the antenna 1 . In some embodiments, at least part of the functional modules of the mobile communication module 150 may be provided in the processor 110 . In some embodiments, at least part of the functional modules of the mobile communication module 150 may be provided in the same device as at least part of the modules of the processor 110 .

调制解调处理器可以包括调制器和解调器。其中,调制器用于将待发送的低频基带信号调制成中高频信号。解调器用于将接收的电磁波信号解调为低频基带信号。随后解调器将解调得到的低频基带信号传送至基带处理器处理。低频基带信号经基带处理器处理后,被传递给应用处理器。应用处理器通过音频设备(不限于扬声器170A,受话器170B等)输出声音信号,或通过显示屏194显示图像或视频。在一些实施例中,调制解调处理器可以是独立的器件。在另一些实施例中,调制解调处理器可以独立于处理器110,与移动通信模块150或其他功能模块设置在同一个器件中。The modem processor may include a modulator and a demodulator. Wherein, the modulator is used to modulate the low frequency baseband signal to be sent into a medium and high frequency signal. The demodulator is used to demodulate the received electromagnetic wave signal into a low frequency baseband signal. Then the demodulator transmits the demodulated low-frequency baseband signal to the baseband processor for processing. The low frequency baseband signal is processed by the baseband processor and passed to the application processor. The application processor outputs sound signals through audio devices (not limited to the speaker 170A, the receiver 170B, etc.), or displays images or videos through the display screen 194 . In some embodiments, the modem processor may be a stand-alone device. In other embodiments, the modem processor may be independent of the processor 110, and may be provided in the same device as the mobile communication module 150 or other functional modules.

无线通信模块160可以提供应用在电子设备100上的包括无线局域网(wirelesslocal area networks,WLAN)(如无线保真(wireless fidelity,Wi-Fi)网络),蓝牙(bluetooth,BT),全球导航卫星系统(global navigation satellite system,GNSS),调频(frequency modulation,FM),近距离无线通信技术(near field communication,NFC),红外技术(infrared,IR)等无线通信的解决方案。无线通信模块160可以是集成至少一个通信处理模块的一个或多个器件。无线通信模块160经由天线2接收电磁波,将电磁波信号调频以及滤波处理,将处理后的信号发送到处理器110。无线通信模块160还可以从处理器110接收待发送的信号,对其进行调频,放大,经天线2转为电磁波辐射出去。The wireless communication module 160 can provide wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), bluetooth (BT), and global navigation satellite systems applied on the electronic device 100 . (global navigation satellite system, GNSS), frequency modulation (frequency modulation, FM), near field communication technology (near field communication, NFC), infrared technology (infrared, IR) and other wireless communication solutions. The wireless communication module 160 may be one or more devices integrating at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via the antenna 2 , frequency modulates and filters the electromagnetic wave signals, and sends the processed signals to the processor 110 . The wireless communication module 160 can also receive the signal to be sent from the processor 110 , perform frequency modulation on it, amplify it, and convert it into electromagnetic waves for radiation through the antenna 2 .

在一些实施例中,电子设备100的天线1和移动通信模块150耦合,天线2和无线通信模块160耦合,使得电子设备100可以通过无线通信技术与网络以及其他设备通信。所述无线通信技术可以包括全球移动通讯系统(global system for mobile communications,GSM),通用分组无线服务(general packet radio service,GPRS),码分多址接入(codedivision multiple access,CDMA),宽带码分多址(wideband code division multipleaccess,WCDMA),时分码分多址(time-division code division multiple access,TD-SCDMA),长期演进(long term evolution,LTE),BT,GNSS,WLAN,NFC,FM,和/或IR技术等。In some embodiments, the antenna 1 of the electronic device 100 is coupled with the mobile communication module 150, and the antenna 2 is coupled with the wireless communication module 160, so that the electronic device 100 can communicate with the network and other devices through wireless communication technology. The wireless communication technology may include global system for mobile communications (GSM), general packet radio service (GPRS), code division multiple access (CDMA), wideband code Wideband code division multiple access (WCDMA), time-division code division multiple access (TD-SCDMA), long term evolution (LTE), BT, GNSS, WLAN, NFC, FM , and/or IR technology, etc.

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

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

在本申请的一些实施例中,显示屏194中显示有系统当前输出的界面内容。例如,界面内容为即时通讯应用提供的界面。In some embodiments of the present application, the display screen 194 displays the interface content currently output by the system. For example, the interface content is an interface provided by an instant messaging application.

电子设备100可以通过ISP,摄像头193,视频编解码器,GPU,显示屏194以及应用处理器等实现拍摄功能。ISP用于处理摄像头193反馈的数据。The electronic device 100 may implement a shooting function through an ISP, a camera 193, a video codec, a GPU, a display screen 194, an application processor, and the like. The ISP is used to process the data fed back by the camera 193 .

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

数字信号处理器用于处理数字信号,除了可以处理数字图像信号,还可以处理其他数字信号。例如,当电子设备100在频点选择时,数字信号处理器用于对频点能量进行傅里叶变换等。A digital signal processor is used to process digital signals, in addition to processing digital image signals, it can also process other digital signals. For example, when the electronic device 100 selects a frequency point, the digital signal processor is used to perform Fourier transform on the frequency point energy and so on.

视频编解码器用于对数字视频压缩或解压缩。电子设备100可以支持一种或多种视频编解码器。这样,电子设备100可以播放或录制多种编码格式的视频,例如:动态图像专家组(moving picture experts group,MPEG)1,MPEG2,MPEG3,MPEG4等。Video codecs are used to compress or decompress digital video. The electronic device 100 may support one or more video codecs. In this way, the electronic device 100 can play or record videos in various encoding formats, for example, moving picture experts group (MPEG) 1, MPEG2, MPEG3, MPEG4, and so on.

NPU为神经网络(neural-network,NN)计算处理器,通过借鉴生物神经网络结构,例如借鉴人脑神经元之间传递模式,对输入信息快速处理,还可以不断的自学习。通过NPU可以实现电子设备100的智能认知等应用,例如:图像识别,人脸识别,语音识别,文本理解等。The NPU is a neural-network (NN) computing processor. By drawing on the structure of biological neural networks, such as the transfer mode between neurons in the human brain, it can quickly process the input information, and can continuously learn by itself. Applications such as intelligent cognition of the electronic device 100 can be implemented through the NPU, such as image recognition, face recognition, speech recognition, text understanding, and the like.

内部存储器121可以用于存储计算机可执行程序代码,所述可执行程序代码包括指令。处理器110通过运行存储在内部存储器121的指令,从而执行电子设备100的各种功能应用以及数据处理。内部存储器121可以包括存储程序区和存储数据区。其中,存储程序区可存储操作系统,至少一个功能所需的应用程序(比如声音播放功能,图像播放功能等)等。存储数据区可存储电子设备100使用过程中所创建的数据(比如音频数据,电话本等)等。此外,内部存储器121可以包括高速随机存取存储器,还可以包括非易失性存储器,例如至少一个磁盘存储器件,闪存器件,通用闪存存储器(universal flash storage,UFS)等。Internal memory 121 may be used to store computer executable program code, which includes instructions. The processor 110 executes various functional applications and data processing of the electronic device 100 by executing the instructions stored in the internal memory 121 . The internal memory 121 may include a storage program area and a storage data area. The storage program area can store an operating system, an application program required for at least one function (such as a sound playback function, an image playback function, etc.), and the like. The storage data area may store data (such as audio data, phone book, etc.) created during the use of the electronic device 100 and the like. In addition, the internal memory 121 may include high-speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, universal flash storage (UFS), and the like.

电子设备100可以通过音频模块170,扬声器170A,受话器170B,麦克风170C,耳机接口170D,以及应用处理器等实现音频功能。例如音乐播放,录音等。The electronic device 100 may implement audio functions through an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, an application processor, and the like. Such as music playback, recording, etc.

音频模块170用于将数字音频信息转换成模拟音频信号输出,也用于将模拟音频输入转换为数字音频信号。音频模块170还可以用于对音频信号编码和解码。在一些实施例中,音频模块170可以设置于处理器110中,或将音频模块170的部分功能模块设置于处理器110中。The audio module 170 is used for converting digital audio information into analog audio signal output, and also for converting analog audio input into digital audio signal. Audio module 170 may also be used to encode and decode audio signals. In some embodiments, the audio module 170 may be provided in the processor 110 , or some functional modules of the audio module 170 may be provided in the processor 110 .

扬声器170A,也称“喇叭”,用于将音频电信号转换为声音信号。电子设备100可以通过扬声器170A收听音乐,或收听免提通话。Speaker 170A, also referred to as a "speaker", is used to convert audio electrical signals into sound signals. The electronic device 100 can listen to music through the speaker 170A, or listen to a hands-free call.

受话器170B,也称“听筒”,用于将音频电信号转换成声音信号。当电子设备100接听电话或语音信息时,可以通过将受话器170B靠近人耳接听语音。The receiver 170B, also referred to as "earpiece", is used to convert audio electrical signals into sound signals. When the electronic device 100 answers a call or a voice message, the voice can be answered by placing the receiver 170B close to the human ear.

麦克风170C,也称“话筒”,“传声器”,用于将声音信号转换为电信号。The microphone 170C, also called "microphone" or "microphone", is used to convert sound signals into electrical signals.

耳机接口170D用于连接有线耳机。The earphone jack 170D is used to connect wired earphones.

压力传感器180A用于感受压力信号,可以将压力信号转换成电信号。在一些实施例中,压力传感器180A可以设置于显示屏194。在本申请一些可选的实施例中,压力传感器180A可用于捕获用户手指部位接触显示屏时生成的压力值,并将该压力值传输给处理器,以使得处理器识别用户通过哪个手指部位输入用户操作。The pressure sensor 180A is used to sense pressure signals, and can convert the pressure signals into electrical signals. In some embodiments, the pressure sensor 180A may be provided on the display screen 194 . In some optional embodiments of the present application, the pressure sensor 180A can be used to capture the pressure value generated when the user's finger part touches the display screen, and transmit the pressure value to the processor, so that the processor can identify which finger part the user inputs through User action.

压力传感器180A的种类很多,如电阻式压力传感器,电感式压力传感器,电容式压力传感器等。电容式压力传感器可以是包括至少两个具有导电材料的平行板。当有力作用于压力传感器180A,电极之间的电容改变。电子设备100根据电容的变化确定压力的强度。当有触摸操作作用于显示屏194,电子设备100根据压力传感器180A检测所述触摸操作强度。电子设备100也可以根据压力传感器180A的检测信号计算触摸的位置。在一些实施例中,作用于相同触摸位置,但不同触摸操作强度的触摸操作,可以对应不同的操作指令。例如:当有触摸操作强度小于第一压力阈值的触摸操作作用于短消息应用图标时,执行查看短消息的指令。当有触摸操作强度大于或等于第一压力阈值的触摸操作作用于短消息应用图标时,执行新建短消息的指令。There are many types of pressure sensors 180A, such as resistive pressure sensors, inductive pressure sensors, capacitive pressure sensors, and the like. The capacitive pressure sensor may be comprised of at least two parallel plates of conductive material. When a force is applied to the pressure sensor 180A, the capacitance between the electrodes changes. The electronic device 100 determines the intensity of the pressure according to the change in capacitance. When a touch operation acts on the display screen 194, the electronic device 100 detects the intensity of the touch operation according to the pressure sensor 180A. The electronic device 100 may also calculate the touched position according to the detection signal of the pressure sensor 180A. In some embodiments, touch operations acting on the same touch position but with different touch operation intensities may correspond to different operation instructions. For example, when a touch operation whose intensity is less than the first pressure threshold acts on the short message application icon, the instruction for viewing the short message is executed. When a touch operation with a touch operation intensity greater than or equal to the first pressure threshold acts on the short message application icon, the instruction to create a new short message is executed.

在本申请一些可选的实施例中,压力传感器180A可将检测到的电容值传输给处理器,以使得处理器识别用户通过哪个手指部位(指关节或指肚等)输入用户操作。在本申请一些可选的实施例中,压力传感器180A还可根据检测到的信号计算触摸点的数量,并将计算值传输给处理器,以使得处理器识别用户通过单指或多指输入用户操作。In some optional embodiments of the present application, the pressure sensor 180A can transmit the detected capacitance value to the processor, so that the processor can identify which finger part (knuckle or finger pad, etc.) the user uses to input the user operation. In some optional embodiments of the present application, the pressure sensor 180A may also calculate the number of touch points according to the detected signal, and transmit the calculated value to the processor, so that the processor recognizes that the user inputs the user through a single finger or multiple fingers operate.

陀螺仪传感器180B可以用于确定电子设备100的运动姿态。在一些实施例中,可以通过陀螺仪传感器180B确定电子设备100围绕三个轴(即,x,y和z轴)的角速度。陀螺仪传感器180B可以用于拍摄防抖。示例性的,当按下快门,陀螺仪传感器180B检测电子设备100抖动的角度,根据角度计算出镜头模组需要补偿的距离,让镜头通过反向运动抵消电子设备100的抖动,实现防抖。陀螺仪传感器180B还可以用于导航,体感游戏场景。The gyro sensor 180B may be used to determine the motion attitude of the electronic device 100 . In some embodiments, the angular velocity of electronic device 100 about three axes (ie, x, y, and z axes) may be determined by gyro sensor 180B. The gyro sensor 180B can be used for image stabilization. Exemplarily, when the shutter is pressed, the gyro sensor 180B detects the shaking angle of the electronic device 100, calculates the distance that the lens module needs to compensate according to the angle, and allows the lens to offset the shaking of the electronic device 100 through reverse motion to achieve anti-shake. The gyro sensor 180B can also be used for navigation and somatosensory game scenarios.

气压传感器180C用于测量气压。在一些实施例中,终端100通过气压传感器180C测得的气压值计算海拔高度,辅助定位和导航。The air pressure sensor 180C is used to measure air pressure. In some embodiments, the terminal 100 calculates the altitude through the air pressure value measured by the air pressure sensor 180C to assist in positioning and navigation.

磁传感器180D包括霍尔传感器。终端100可以利用磁传感器180D检测翻盖皮套的开合。在一些实施例中,当终端100是翻盖机时,终端100可以根据磁传感器180D检测翻盖的开合。进而根据检测到的皮套的开合状态或翻盖的开合状态,设置翻盖自动解锁等特性。The magnetic sensor 180D includes a Hall sensor. The terminal 100 can detect the opening and closing of the flip holster using the magnetic sensor 180D. In some embodiments, when the terminal 100 is a flip machine, the terminal 100 can detect the opening and closing of the flip according to the magnetic sensor 180D. Further, according to the detected opening and closing state of the leather case or the opening and closing state of the flip cover, characteristics such as automatic unlocking of the flip cover are set.

加速度传感器180E可检测终端100在各个方向上(一般为三轴)加速度的大小。当终端100静止时可检测出重力的大小及方向。还可以用于识别电子设备姿态,应用于横竖屏切换,计步器等应用。在本申请一些可选的实施例中,加速度传感器180E可用于捕获用户手指部位接触显示屏时生成的加速度值,并将该加速度值传输给处理器,以使得处理器识别用户通过哪个手指部位输入用户操作。The acceleration sensor 180E can detect the magnitude of the acceleration of the terminal 100 in various directions (generally three axes). When the terminal 100 is stationary, the magnitude and direction of gravity can be detected. It can also be used to identify the posture of electronic devices, and can be used in applications such as horizontal and vertical screen switching, pedometers, etc. In some optional embodiments of the present application, the acceleration sensor 180E can be used to capture the acceleration value generated when the user's finger part touches the display screen, and transmit the acceleration value to the processor, so that the processor can identify which finger part the user inputs through User action.

距离传感器180F,用于测量距离。终端100可以通过红外或激光测量距离。在一些实施例中,拍摄场景,终端100可以利用距离传感器180F测距以实现快速对焦。Distance sensor 180F for measuring distance. The terminal 100 can measure the distance through infrared or laser. In some embodiments, when shooting a scene, the terminal 100 can use the distance sensor 180F to measure the distance to achieve fast focusing.

接近光传感器180G可以包括例如发光二极管(LED)和光检测器,例如光电二极管。发光二极管可以是红外发光二极管。终端100通过发光二极管向外发射红外光。终端100使用光电二极管检测来自附近物体的红外反射光。当检测到充分的反射光时,可以确定终端100附近有物体。当检测到不充分的反射光时,终端100可以确定终端100附近没有物体。终端100可以利用接近光传感器180G检测用户手持终端100贴近耳朵通话,以便自动熄灭显示屏达到省电的目的。接近光传感器180G也可用于皮套模式,口袋模式自动解锁与锁屏。Proximity light sensor 180G may include, for example, light emitting diodes (LEDs) and light detectors, such as photodiodes. The light emitting diodes may be infrared light emitting diodes. The terminal 100 emits infrared light to the outside through light emitting diodes. The terminal 100 detects infrared reflected light from nearby objects using a photodiode. When sufficient reflected light is detected, it can be determined that there is an object near the terminal 100 . When insufficient reflected light is detected, the terminal 100 may determine that there is no object near the terminal 100 . The terminal 100 can use the proximity light sensor 180G to detect that the user holds the terminal 100 close to the ear to talk, so as to automatically turn off the display screen to save power. Proximity light sensor 180G can also be used in holster mode, pocket mode automatically unlocks and locks the screen.

环境光传感器180L用于感知环境光亮度。终端100可以根据感知的环境光亮度自适应调节显示屏194亮度。环境光传感器180L也可用于拍照时自动调节白平衡。环境光传感器180L还可以与接近光传感器180G配合,检测终端100是否在口袋里,以防误触。The ambient light sensor 180L is used to sense ambient light brightness. The terminal 100 can adaptively adjust the brightness of the display screen 194 according to the perceived ambient light brightness. The ambient light sensor 180L can also be used to automatically adjust the white balance when taking pictures. The ambient light sensor 180L can also cooperate with the proximity light sensor 180G to detect whether the terminal 100 is in a pocket, so as to prevent accidental touch.

指纹传感器180H用于采集指纹。终端100可以利用采集的指纹特性实现指纹解锁,访问应用锁,指纹拍照,指纹接听来电等。The fingerprint sensor 180H is used to collect fingerprints. The terminal 100 can use the collected fingerprint characteristics to unlock the fingerprint, access the application lock, take a picture with the fingerprint, answer the incoming call with the fingerprint, and the like.

温度传感器180J用于检测温度。在一些实施例中,终端100利用温度传感器180J检测的温度,执行温度处理策略。例如,当温度传感器180J上报的温度超过阈值,终端100执行降低位于温度传感器180J附近的处理器的性能,以便降低功耗实施热保护。在另一些实施例中,当温度低于另一阈值时,终端100对电池142加热,以避免低温导致终端100异常关机。在其他一些实施例中,当温度低于又一阈值时,终端100对电池142的输出电压执行升压,以避免低温导致的异常关机。The temperature sensor 180J is used to detect the temperature. In some embodiments, the terminal 100 uses the temperature detected by the temperature sensor 180J to execute a temperature processing strategy. For example, when the temperature reported by the temperature sensor 180J exceeds a threshold value, the terminal 100 reduces the performance of the processor located near the temperature sensor 180J, so as to reduce power consumption and implement thermal protection. In other embodiments, when the temperature is lower than another threshold, the terminal 100 heats the battery 142 to avoid abnormal shutdown of the terminal 100 due to low temperature. In some other embodiments, when the temperature is lower than another threshold, the terminal 100 boosts the output voltage of the battery 142 to avoid abnormal shutdown caused by low temperature.

触摸传感器180K,也称“触控面板”。触摸传感器180K可以设置于显示屏194,由触摸传感器180K与显示屏194组成触摸屏,也称“触控屏”。触摸传感器180K用于检测作用于其上或附近的触摸操作,该触摸触控操作是指用户手部、手肘、触控笔等接触显示屏194的操作。触摸传感器可以将检测到的触摸操作传递给应用处理器,以确定触摸事件类型。可以通过显示屏194提供与触摸操作相关的视觉输出。在另一些实施例中,触摸传感器180K也可以设置于电子设备100的表面,与显示屏194所处的位置不同。Touch sensor 180K, also called "touch panel". The touch sensor 180K may be disposed on the display screen 194 , and the touch sensor 180K and the display screen 194 form a touch screen, also called a “touch screen”. The touch sensor 180K is used to detect a touch operation acting on or near it, and the touch touch operation refers to an operation of a user's hand, elbow, stylus, etc. touching the display screen 194 . The touch sensor can pass the detected touch operation to the application processor to determine the type of touch event. Visual output related to touch operations may be provided through display screen 194 . In other embodiments, the touch sensor 180K may also be disposed on the surface of the electronic device 100 , which is different from the location where the display screen 194 is located.

骨传导传感器180M可以获取振动信号。在一些实施例中,骨传导传感器180M可以获取人体声部振动骨块的振动信号。骨传导传感器180M也可以接触人体脉搏,接收血压跳动信号。在一些实施例中,骨传导传感器180M也可以设置于耳机中,结合成骨传导耳机。音频模块170可以基于所述骨传导传感器180M获取的声部振动骨块的振动信号,解析出语音信号,实现语音功能。应用处理器可以基于所述骨传导传感器180M获取的血压跳动信号解析心率信息,实现心率检测功能。The bone conduction sensor 180M can acquire vibration signals. In some embodiments, the bone conduction sensor 180M can acquire the vibration signal of the vibrating bone mass of the human voice. The bone conduction sensor 180M can also contact the pulse of the human body and receive the blood pressure beating signal. In some embodiments, the bone conduction sensor 180M can also be disposed in the earphone, combined with the bone conduction earphone. The audio module 170 can analyze the voice signal based on the vibration signal of the vocal vibration bone block obtained by the bone conduction sensor 180M, so as to realize the voice function. The application processor can analyze the heart rate information based on the blood pressure beat signal obtained by the bone conduction sensor 180M, and realize the function of heart rate detection.

按键190包括开机键,音量键等。按键190可以是机械按键。也可以是触摸式按键。终端100可以接收按键输入,产生与终端100的用户设置以及功能控制有关的键信号输入。The keys 190 include a power-on key, a volume key, and the like. Keys 190 may be mechanical keys. It can also be a touch key. The terminal 100 may receive key input and generate key signal input related to user settings and function control of the terminal 100 .

马达191可以产生振动提示。马达191可以用于来电振动提示,也可以用于触摸振动反馈。例如,作用于不同应用(例如拍照,音频播放等)的触摸操作,可以对应不同的振动反馈效果。作用于显示屏194不同区域的触摸操作,马达191也可对应不同的振动反馈效果。不同的应用场景(例如:时间提醒,接收信息,闹钟,游戏等)也可以对应不同的振动反馈效果。触摸振动反馈效果还可以支持自定义。Motor 191 can generate vibrating cues. The motor 191 can be used for vibrating alerts for incoming calls, and can also be used for touch vibration feedback. For example, touch operations acting on different applications (such as taking pictures, playing audio, etc.) can correspond to different vibration feedback effects. The motor 191 can also correspond to different vibration feedback effects for touch operations on different areas of the display screen 194 . Different application scenarios (for example: time reminder, receiving information, alarm clock, games, etc.) can also correspond to different vibration feedback effects. The touch vibration feedback effect can also support customization.

指示器192可以是指示灯,可以用于指示充电状态,电量变化,也可以用于指示消息,未接来电,通知等。The indicator 192 can be an indicator light, which can be used to indicate the charging state, the change of the power, and can also be used to indicate a message, a missed call, a notification, and the like.

SIM卡接口195用于连接SIM卡。SIM卡可以通过插入SIM卡接口195,或从SIM卡接口195拔出,实现和终端100的接触和分离。The SIM card interface 195 is used to connect a SIM card. The SIM card can be contacted and separated from the terminal 100 by inserting into the SIM card interface 195 or pulling out from the SIM card interface 195 .

电子设备100的软件系统可以采用分层架构,事件驱动架构,微核架构,微服务架构,或云架构。本申请实施例以分层架构的Android系统为例,示例性说明电子设备100的软件结构。The software system of the electronic device 100 may adopt a layered architecture, an event-driven architecture, a microkernel architecture, a microservice architecture, or a cloud architecture. The embodiments of the present application take an Android system with a layered architecture as an example to exemplarily describe the software structure of the electronic device 100 .

图17是本申请实施例的电子设备100的软件结构框图。FIG. 17 is a block diagram of the software structure of the electronic device 100 according to the embodiment of the present application.

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

应用程序层可以包括一系列应用程序包。The application layer can include a series of application packages.

如图17所示,应用程序包可以包括相机,图库,日历,通话,地图,导航,WLAN,蓝牙,音乐,视频,短信息等应用程序。As shown in Figure 17, the application package can include applications such as camera, gallery, calendar, call, map, navigation, WLAN, Bluetooth, music, video, short message and so on.

本申请中,应用程序层还可新增浮窗启动组件(floating launcher),用于在上述提及的悬浮窗口中作为默认的显示应用,并提供给用户进入其他应用的入口。In the present application, a floating launcher component may be added to the application layer, which is used to display the application in the above-mentioned floating window by default, and provides the user with an entrance to other applications.

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

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

窗口管理器用于管理窗口程序。窗口管理器可以获取显示屏大小,判断是否有状态栏,锁定显示屏,截取显示屏等。本申请中,可基于Android原生的PhoneWindow,扩展出FloatingWindow,专门用于显示上述提及的悬浮窗口,以区别于普通的窗口,该窗口具有悬浮显示在系列窗口最顶层的属性。在一些可选的实施例中,该窗口大小可根据实际屏幕的大小,根据最优显示算法,给出合适的值。在一些可能的实施例中,该窗口的宽高比,可默认为常规主流手机的屏幕宽高比。同时,为方便用户关闭退出、隐藏悬浮窗口,可在右上角额外绘制一个关闭按键和一个最小化按键。A window manager is used to manage window programs. The window manager can get the size of the display screen, determine whether there is a status bar, lock the display screen, take a screenshot of the display screen, etc. In this application, a FloatingWindow can be extended based on Android's native PhoneWindow, which is specially used to display the above-mentioned floating window, so as to be different from an ordinary window, and the window has the property of being displayed floating at the top level of a series of windows. In some optional embodiments, the window size can be given an appropriate value according to the size of the actual screen and an optimal display algorithm. In some possible embodiments, the aspect ratio of the window may be the screen aspect ratio of a conventional mainstream mobile phone by default. At the same time, in order to facilitate the user to close and exit and hide the floating window, an additional close button and a minimize button can be drawn in the upper right corner.

内容提供器用来存放和获取数据,并使这些数据可以被应用程序访问。所述数据可以包括视频,图像,音频,拨打和接听的电话,查看历史和书签,电话簿等。Content providers are used to store and retrieve data and make these data accessible to applications. The data may include video, images, audio, calls made and received, viewing history and bookmarks, phone book, etc.

视图系统包括可视控件,例如显示文字的控件,显示图片的控件等。视图系统可用于构建应用程序。显示界面可以由一个或多个视图组成的。例如,包括短信通知图标的显示界面,可以包括显示文字的视图以及显示图片的视图。本申请中,可相应增加悬浮窗口上用于关闭、最小化等操作的按键视图,并绑定到上述窗口管理器中的FloatingWindow上。The view system includes visual controls, such as controls for displaying text, controls for displaying pictures, and so on. View systems can be used to build applications. A display interface can consist of one or more views. For example, the display interface including the short message notification icon may include a view for displaying text and a view for displaying pictures. In the present application, a button view for closing, minimizing and other operations on the floating window can be correspondingly added, and bound to the FloatingWindow in the above-mentioned window manager.

电话管理器用于提供电子设备100的通信功能。例如通话状态的管理(包括接通,挂断等)。The phone manager is used to provide the communication function of the electronic device 100 . For example, the management of call status (including connecting, hanging up, etc.).

资源管理器为应用程序提供各种资源,比如本地化字符串,图标,图片,布局文件,视频文件等等。The resource manager provides various resources for the application, such as localization strings, icons, pictures, layout files, video files and so on.

通知管理器使应用程序可以在状态栏207中显示通知信息,可以用于传达告知类型的消息,可以短暂停留后自动消失,无需用户交互。比如通知管理器被用于告知下载完成,消息提醒等。通知管理器还可以是以图表或者滚动条文本形式出现在系统顶部状态栏的通知,例如后台运行的应用程序的通知,还可以是以对话窗口形式出现在显示屏上的通知。例如在状态栏提示文本信息,发出提示音,电子设备振动,指示灯闪烁等。The notification manager enables the application to display notification information in the status bar 207, which can be used to convey notification-type messages, and can disappear automatically after a short stay without user interaction. For example, the notification manager is used to notify download completion, message reminders, etc. The notification manager can also display notifications in the status bar at the top of the system in the form of graphs or scroll bar text, such as notifications from applications running in the background, and notifications on the display in the form of dialog windows. For example, text information is prompted in the status bar, a prompt sound is issued, the electronic device vibrates, and the indicator light flashes.

活动管理器用于管理系统里正在运行的activities,包括进程(process)、应用程序、服务(service)、任务(task)信息等。本申请中,可在活动管理器模块中,新增专门用于管理上述悬浮窗口中显示应用Activity的活动任务堆栈,以保证悬浮窗口中的应用activity、task不会和屏幕中全屏显示的应用产生冲突。The activity manager is used to manage the activities running in the system, including process, application, service, task information and so on. In this application, an activity task stack dedicated to managing the application activity displayed in the above floating window can be added to the activity manager module, so as to ensure that the application activity and task in the floating window will not be generated from the application displayed in full screen on the screen. conflict.

本申请中,应用程序框架层还可新增运动探测组件(motion detector),用于获取到的输入事件进行逻辑判断,识别输入事件的类型。例如,通过输入事件中包括的触摸坐标,触摸操作的时间戳等信息,判断该输入事件为指关节触摸事件或指肚触摸事件等。同时,运动探测组件还可记录输入事件的轨迹,并判定输入事件的手势规律,根据不同的手势,响应不同的操作。In the present application, a motion detector may be added to the application framework layer, which is used to perform logical judgment on the acquired input events and identify the type of the input events. For example, it is determined that the input event is a knuckle touch event or a finger pad touch event, etc., according to the touch coordinates included in the input event, the time stamp of the touch operation, and other information. At the same time, the motion detection component can also record the trajectory of the input event, determine the gesture rule of the input event, and respond to different operations according to different gestures.

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

核心库包含两部分:一部分是java语言需要调用的功能函数,另一部分是安卓的核心库。The core library consists of two parts: one is the function functions that the java language needs to call, and the other is the core library of Android.

应用程序层和应用程序框架层运行在虚拟机中。虚拟机将应用程序层和应用程序框架层的java文件执行为二进制文件。虚拟机用于执行对象生命周期的管理,堆栈管理,线程管理,安全和异常的管理,以及垃圾回收等功能。The application layer and the application framework layer run in virtual machines. The virtual machine executes the java files of the application layer and the application framework layer as binary files. The virtual machine is used to perform functions such as object lifecycle management, stack management, thread management, safety and exception management, and garbage collection.

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

输入管理器负责从底层的输入驱动获取事件数据,解析并封装后传给输入调度管理器。The input manager is responsible for obtaining event data from the underlying input driver, parsing and encapsulating it, and passing it to the input dispatch manager.

输入调度管理器用于保管窗口信息,其收到来自输入管理器的输入事件后,会在其保管的窗口中寻找合适的窗口,并将事件派发给此窗口。The input scheduling manager is used to store window information. After it receives the input event from the input manager, it will look for a suitable window in its managed window and dispatch the event to this window.

表面管理器用于对显示子系统进行管理,并且为多个应用程序提供了2D和3D图层的融合。The Surface Manager is used to manage the display subsystem and provides a fusion of 2D and 3D layers for multiple applications.

媒体库支持多种常用的音频,视频格式回放和录制,以及静态图像文件等。媒体库可以支持多种音视频编码格式,例如:MPEG4,H.264,MP3,AAC,AMR,JPG,PNG等。The media library supports playback and recording of a variety of commonly used audio and video formats, as well as still image files. The media library can support a variety of audio and video encoding formats, such as: MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, etc.

三维图形处理库用于实现三维图形绘图,图像渲染,合成,和图层处理等。The 3D graphics processing library is used to implement 3D graphics drawing, image rendering, compositing, and layer processing.

2D图形引擎是2D绘图的绘图引擎。2D graphics engine is a drawing engine for 2D drawing.

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

下面结合捕获拍照场景,示例性说明电子设备100软件以及硬件的工作流程。In the following, the workflow of the software and hardware of the electronic device 100 is exemplarily described in conjunction with the capturing and photographing scene.

当触摸传感器180K接收到触摸操作,相应的硬件中断被发给内核层。内核层将触摸操作加工成原始输入事件(包括触摸坐标,触摸操作的时间戳等信息)。原始输入事件被存储在内核层。应用程序框架层从内核层获取原始输入事件,识别该输入事件所对应的控件。以该触摸操作是触摸单击操作,该单击操作所对应的控件为相机应用图标的控件为例,相机应用调用应用框架层的接口,启动相机应用,进而通过调用内核层启动摄像头驱动,通过摄像头193捕获静态图像或视频。When the touch sensor 180K receives a touch operation, a corresponding hardware interrupt is sent to the kernel layer. The kernel layer processes touch operations into raw input events (including touch coordinates, timestamps of touch operations, etc.). Raw input events are stored at the kernel layer. The application framework layer obtains the original input event from the kernel layer, and identifies the control corresponding to the input event. Taking the touch operation as a touch click operation, and the control corresponding to the click operation is the control of the camera application icon, for example, the camera application calls the interface of the application framework layer to start the camera application, and then starts the camera driver by calling the kernel layer. The camera 193 captures still images or video.

通过以上的实施方式的描述,所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,仅以上述各功能模块的划分进行举例说明,实际应用中,可以根据需要而将上述功能分配由不同的功能模块完成,即将装置的内部结构划分成不同的功能模块,以完成以上描述的全部或者部分功能。上述描述的系统,装置和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。From the description of the above embodiments, those skilled in the art can clearly understand that for the convenience and brevity of the description, only the division of the above functional modules is used as an example for illustration. In practical applications, the above functions can be allocated as required. It is completed by different functional modules, that is, the internal structure of the device is divided into different functional modules, so as to complete all or part of the functions described above. For the specific working process of the system, apparatus and unit described above, reference may be made to the corresponding process in the foregoing method embodiments, and details are not described herein again.

在本申请实施例各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。Each functional unit in each of the embodiments of the embodiments of the present application may be integrated into one processing unit, or each unit may exist physically alone, or two or more units may be integrated into one unit. The above-mentioned integrated units may be implemented in the form of hardware, or may be implemented in the form of software functional units.

所述集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请实施例的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)或处理器执行本申请各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:快闪存储器、移动硬盘、只读存储器、随机存取存储器、磁碟或者光盘等各种可以存储程序代码的介质。The integrated unit, if implemented in the form of a software functional unit and sold or used as an independent product, may be stored in a computer-readable storage medium. Based on this understanding, the technical solutions of the embodiments of the present application can be embodied in the form of software products in essence, or the parts that contribute to the prior art, or all or part of the technical solutions, and the computer software products are stored in a storage The medium includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) or a processor to execute all or part of the steps of the methods described in the various embodiments of the present application. The aforementioned storage medium includes: flash memory, removable hard disk, read-only memory, random access memory, magnetic disk or optical disk and other media that can store program codes.

以上所述,仅为本申请的具体实施方式,但本申请的保护范围并不局限于此,任何在本申请揭露的技术范围内的变化或替换,都应涵盖在本申请的保护范围之内。因此,本申请的保护范围应以所述权利要求的保护范围为准。The above are only specific embodiments of the present application, but the protection scope of the present application is not limited to this, and any changes or substitutions within the technical scope disclosed in the present application should be covered within the protection scope of the present application. . Therefore, the protection scope of the present application should be subject to the protection scope of the claims.

Claims (13)

1.一种显示图像的方法,其特征在于,包括:1. A method for displaying an image, comprising: 电子设备显示预览界面,所述预览界面包括第一摄像头采集的第一图像,所述第一图像显示于显示屏的第一区域;The electronic device displays a preview interface, the preview interface includes a first image captured by a first camera, and the first image is displayed in a first area of the display screen; 在所述预览界面中检测到第一用户操作,响应于所述第一用户操作,通过第一摄像头拍摄所述第一图像,通过第二摄像头拍摄第二图像;A first user operation is detected in the preview interface, and in response to the first user operation, the first image is captured by the first camera, and the second image is captured by the second camera; 当所述第二图像包括预设用户的人脸时,根据所述第二图像确定所述电子设备的第一横竖屏状态;当所述第二图像不包括所述预设用户的人脸时,利用传感器确定所述电子设备的第一横竖屏状态;关联存储所述第一图像和所述第一横竖屏状态,所述第一横竖屏状态包括:左横屏或右横屏;When the second image includes the face of the preset user, determine the first horizontal and vertical screen state of the electronic device according to the second image; when the second image does not include the face of the preset user , using the sensor to determine the first horizontal and vertical screen state of the electronic device; storing the first image and the first horizontal and vertical screen state in association, and the first horizontal and vertical screen state includes: left horizontal screen or right horizontal screen; 检测到查看所述第一图像的第二用户操作,响应于所述第二用户操作,确定所述电子设备的第二横竖屏状态,并在所述显示屏的第二区域显示所述第一图像;在所述显示屏上第二区域显示的所述第一图像相对于所述第一区域显示的所述第一图像的第一旋转角度,由所述第一横竖屏状态和所述第二横竖屏状态确定,所述第二横竖屏状态包括:右横屏或左横屏,所述第一旋转角度包括180°,所述第二区域的尺寸比例和所述第一区域的尺寸比例相同。Detecting a second user operation for viewing the first image, determining a second horizontal and vertical screen state of the electronic device in response to the second user operation, and displaying the first image in a second area of the display screen image; the first rotation angle of the first image displayed in the second area on the display screen relative to the first image displayed in the first area is determined by the first horizontal and vertical screen state and the first Two horizontal and vertical screen states are determined, the second horizontal and vertical screen state includes: right horizontal screen or left horizontal screen, the first rotation angle includes 180°, the size ratio of the second area and the size ratio of the first area same. 2.根据权利要求1所述的方法,其特征在于,所述确定所述电子设备的第二横竖屏状态,包括:2. The method according to claim 1, wherein the determining the second horizontal and vertical screen state of the electronic device comprises: 通过第二摄像头采集第三图像;所述第三图像包括人脸;A third image is collected by the second camera; the third image includes a human face; 根据所述第三图像确定所述电子设备的第二横竖屏状态。A second horizontal and vertical screen state of the electronic device is determined according to the third image. 3.根据权利要求1所述的方法,其特征在于,所述电子设备通过第一参数表征所述第一横竖屏状态,取第一值的所述第一参数表征向上竖屏,取第二值的所述第一参数表征左横屏,取第三值的所述第一参数表征向下竖屏,取第四值的所述第一参数表征右横屏;3 . The method according to claim 1 , wherein the electronic device represents the first horizontal and vertical screen state by a first parameter, the first parameter with a first value represents the vertical screen upward, and the second The first parameter of the value represents the left horizontal screen, the first parameter of the third value represents the downward vertical screen, and the first parameter of the fourth value represents the right horizontal screen; 所述关联存储所述第一图像和所述第一横竖屏状态,包括:The associated storage of the first image and the first horizontal and vertical screen state includes: 关联存储所述第一图像和所述第一参数。The first image and the first parameter are stored in association. 4.根据权利要求1所述的方法,其特征在于,所述根据所述第二图像确定所述电子设备的第一横竖屏状态,包括:4. The method according to claim 1, wherein the determining the first horizontal and vertical screen state of the electronic device according to the second image comprises: 当所述电子设备的屏幕与水平面的夹角小于预设角度时,根据所述第二图像确定所述电子设备的所述第一横竖屏状态。When the included angle between the screen of the electronic device and the horizontal plane is smaller than a preset angle, the first horizontal and vertical screen state of the electronic device is determined according to the second image. 5.根据权利要求1所述的方法,其特征在于,所述根据所述第二图像确定所述电子设备的第一横竖屏状态,包括:5. The method according to claim 1, wherein the determining the first horizontal and vertical screen state of the electronic device according to the second image comprises: 根据所述第二图像的标准基准线与所述第二图像对应的人脸基准线的第一夹角确定所述第一横竖屏状态。The first horizontal and vertical screen state is determined according to the first included angle between the standard reference line of the second image and the face reference line corresponding to the second image. 6.根据权利要求5所述的方法,其特征在于,当所述第二图像包含多个人脸时,所述第二图像对应的人脸基准线为所述第二图像的所述多个人脸中面积最大的人脸的人脸基准线。6 . The method according to claim 5 , wherein when the second image includes multiple faces, the face reference line corresponding to the second image is the multiple faces of the second image. 7 . The face baseline of the face with the largest area. 7.根据权利要求5或6所述的方法,其特征在于,所述根据所述第二图像的标准基准线与所述第二图像对应的人脸基准线的第一夹角确定所述第一横竖屏状态,包括:7 . The method according to claim 5 or 6 , wherein the first angle is determined according to a standard reference line of the second image and a face reference line corresponding to the second image. 8 . A horizontal and vertical screen state, including: 所述第一夹角在第一范围内时,确定所述第一横竖屏状态为向上竖屏;When the first included angle is within the first range, it is determined that the first horizontal and vertical screen state is the upward vertical screen; 所述第一夹角在第二范围内时,确定所述第一横竖屏状态为左横屏;When the first included angle is within the second range, determine that the first horizontal and vertical screen state is the left horizontal screen; 所述第一夹角在第三范围内时,确定所述第一横竖屏状态为向下竖屏;When the first included angle is within the third range, it is determined that the first horizontal and vertical screen state is the downward vertical screen; 所述第一夹角在第四范围内时,确定所述第一横竖屏状态为右横屏。When the first included angle is within the fourth range, it is determined that the first horizontal and vertical screen state is the right horizontal screen. 8.根据权利要求7所述的方法,其特征在于,所述第二图像的标准基准线的朝向是沿着所述第二图像的侧边从所述第二图像的底部指向所述第二图像的顶部;所述第二图像对应的人脸基准线的朝向是沿着所述第二图像中人脸的双眼连接线的垂直方向,从下巴指向头顶;所述第一范围为大于-45°小于等于45°,所述第二范围为大于-135°小于等于-45°,所述第三范围为大于135°小于等于225°,所述第四范围为大于45°小于等于135°。8 . The method according to claim 7 , wherein the orientation of the standard reference line of the second image is from the bottom of the second image to the second image along the side of the second image. 9 . The top of the image; the orientation of the face reference line corresponding to the second image is along the vertical direction of the connecting line between the eyes of the face in the second image, from the chin to the top of the head; the first range is greater than -45 ° is less than or equal to 45°, the second range is greater than -135° and less than or equal to -45°, the third range is greater than 135° and less than or equal to 225°, and the fourth range is greater than 45° and less than or equal to 135°. 9.根据权利要求3所述的方法,其特征在于,所述第一参数等于所述第二横竖 屏状态为向上竖屏时的第二旋转角度;所述第二横竖 屏状态为左横屏时,所述第一旋转角度等于所述第一参数加上90°;所述第二横竖 屏状态为向下竖屏时,所述第一旋转角度等于所述第一参数加上180°;所述第二横竖 屏状态为右横屏时,所述第一旋转角度等于所述第一参数加上-90°。9 . The method according to claim 3 , wherein the first parameter is equal to the second rotation angle when the second horizontal and vertical screen state is the upward vertical screen; the second horizontal and vertical screen state is the left horizontal screen. 10 . , the first rotation angle is equal to the first parameter plus 90°; when the second horizontal and vertical screen state is the downward vertical screen, the first rotation angle is equal to the first parameter plus 180°; When the second horizontal and vertical screen state is the right horizontal screen, the first rotation angle is equal to the first parameter plus -90°. 10.根据权利要求1所述的方法,其特征在于,所述第一横竖屏状态为向上竖屏,所述第二横竖 屏状态为向上竖屏时,所述第一旋转角度等于0°;10. method according to claim 1, is characterized in that, described first horizontal and vertical screen state is upward vertical screen, when described second horizontal and vertical screen state is upward vertical screen, described first rotation angle is equal to 0 °; 所述第一横竖 屏状态为左横屏,所述第二横竖 屏状态为向上竖屏时,所述第一旋转角度等于-90°;When the first horizontal and vertical screen state is the left horizontal screen, and the second horizontal and vertical screen state is the upward vertical screen, the first rotation angle is equal to -90°; 所述第一横竖 屏状态为向下竖屏,所述第二横竖 屏状态为向上竖屏时,所述第一旋转角度等于180°;The first horizontal and vertical screen state is a downward vertical screen, and when the second horizontal and vertical screen state is an upward vertical screen, the first rotation angle is equal to 180°; 所述第一横竖 屏状态为右横屏,所述第二横竖 屏状态为向上竖屏时,所述第一旋转角度等于90°。When the first horizontal and vertical screen state is the right horizontal screen, and the second horizontal and vertical screen state is the upward vertical screen, the first rotation angle is equal to 90°. 11.根据权利要求1所述的方法,其特征在于,所述第一摄像头为后置摄像头,所述第二摄像头为前置摄像头。11. The method of claim 1, wherein the first camera is a rear camera, and the second camera is a front camera. 12.一种电子设备,其特征在于,包括:第一摄像头、第二摄像头、显示屏、一个或多个处理器、以及一个或多个存储器,所述一个或多个存储器用于存储计算机程序代码,所述计算机程序代码包括计算机指令;当所述计算机指令在所述一个或多个处理器上运行时,使得所述电子设备执行如权利要求1-11中任一项所述的方法。12. An electronic device, comprising: a first camera, a second camera, a display screen, one or more processors, and one or more memories, wherein the one or more memories are used to store computer programs Code, the computer program code comprising computer instructions; when executed on the one or more processors, the computer instructions cause the electronic device to perform the method of any of claims 1-11. 13.一种计算机可读存储介质,其特征在于,包括计算机指令,当所述计算机指令在电子设备上运行时,使得所述电子设备执行如权利要求1-11中任一项所述的方法。13. A computer-readable storage medium, characterized by comprising computer instructions that, when the computer instructions are executed on an electronic device, cause the electronic device to perform the method according to any one of claims 1-11 .
CN202010480991.3A 2020-05-30 2020-05-30 Method and related device for displaying image Active CN111669462B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010480991.3A CN111669462B (en) 2020-05-30 2020-05-30 Method and related device for displaying image

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010480991.3A CN111669462B (en) 2020-05-30 2020-05-30 Method and related device for displaying image

Publications (2)

Publication Number Publication Date
CN111669462A CN111669462A (en) 2020-09-15
CN111669462B true CN111669462B (en) 2022-09-02

Family

ID=72385330

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010480991.3A Active CN111669462B (en) 2020-05-30 2020-05-30 Method and related device for displaying image

Country Status (1)

Country Link
CN (1) CN111669462B (en)

Families Citing this family (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112121415B (en) * 2020-09-30 2025-06-27 腾讯科技(深圳)有限公司 A method, device, equipment and storage medium for controlling interface display
CN112465910B (en) * 2020-11-26 2021-12-28 成都新希望金融信息有限公司 Target shooting distance obtaining method and device, storage medium and electronic equipment
CN112637497B (en) * 2020-12-21 2022-04-01 维沃移动通信有限公司 Shooting control method, device and electronic device
CN112702527A (en) * 2020-12-28 2021-04-23 维沃移动通信(杭州)有限公司 Image shooting method and device and electronic equipment
CN112714257B (en) * 2020-12-30 2022-01-14 维沃移动通信(杭州)有限公司 Display control method, display control device, electronic device, and medium
CN115484390B (en) * 2021-06-16 2023-12-19 荣耀终端有限公司 Video shooting method and electronic equipment
CN115484392B (en) * 2021-06-16 2023-12-19 荣耀终端有限公司 Video shooting method and electronic equipment
CN117609547A (en) * 2021-08-12 2024-02-27 荣耀终端有限公司 Video thumbnail display method, apparatus and storage medium
CN115118879B (en) * 2022-06-23 2025-01-07 维沃移动通信有限公司 Image capturing and displaying method, device, electronic device and readable storage medium
CN120031075B (en) * 2025-04-18 2025-06-20 南京邮电大学 Quantum coupling-based network design method for generating countermeasure

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102065183A (en) * 2010-12-31 2011-05-18 惠州Tcl移动通信有限公司 Mobile phone and image pickup processing method thereof
CN107943443A (en) * 2017-12-13 2018-04-20 广东欧珀移动通信有限公司 Photo display control method and device, storage medium and electronic equipment
CN108540718A (en) * 2018-04-08 2018-09-14 Oppo广东移动通信有限公司 Shooting method and device, mobile terminal and storage medium
CN110059211A (en) * 2019-03-28 2019-07-26 华为技术有限公司 Record the method and relevant apparatus of user feeling

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6895126B2 (en) * 2000-10-06 2005-05-17 Enrico Di Bernardo System and method for creating, storing, and utilizing composite images of a geographic location
CN103294358B (en) * 2013-05-17 2016-12-28 小米科技有限责任公司 A kind of control the method for screen rotation, device and equipment
CN104346030A (en) * 2013-08-01 2015-02-11 腾讯科技(深圳)有限公司 Display direction switching method, device and electronic equipment
CN104991723A (en) * 2015-07-08 2015-10-21 上海斐讯数据通信技术有限公司 Transverse and vertical screen switching system and method
CN106203254B (en) * 2016-06-23 2020-02-07 青岛海信移动通信技术股份有限公司 Method and device for adjusting photographing direction

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102065183A (en) * 2010-12-31 2011-05-18 惠州Tcl移动通信有限公司 Mobile phone and image pickup processing method thereof
CN107943443A (en) * 2017-12-13 2018-04-20 广东欧珀移动通信有限公司 Photo display control method and device, storage medium and electronic equipment
CN108540718A (en) * 2018-04-08 2018-09-14 Oppo广东移动通信有限公司 Shooting method and device, mobile terminal and storage medium
CN110059211A (en) * 2019-03-28 2019-07-26 华为技术有限公司 Record the method and relevant apparatus of user feeling

Also Published As

Publication number Publication date
CN111669462A (en) 2020-09-15

Similar Documents

Publication Publication Date Title
CN111669462B (en) Method and related device for displaying image
CN112130742B (en) Full screen display method and device of mobile terminal
CN109445572B (en) Method for quickly calling up small window in full-screen display video, graphical user interface and terminal
CN113645351B (en) Application interface interaction method, electronic device and computer-readable storage medium
CN113542485B (en) Notification processing method, electronic equipment and computer readable storage medium
CN111669459B (en) Keyboard display method, electronic device and computer readable storage medium
CN113986070B (en) A quick viewing method and electronic device for an application card
WO2021000881A1 (en) Screen splitting method and electronic device
CN114710576A (en) Display method and related device
CN110231905A (en) A kind of screenshotss method and electronic equipment
CN112751954B (en) Operation prompting method and electronic equipment
CN117908733A (en) Display control method of system navigation bar, graphical user interface and electronic equipment
WO2021036571A1 (en) Desktop editing method and electronic device
WO2023280021A1 (en) Method for generating theme wallpaper, and electronic device
CN110059211B (en) Method and related device for recording emotion of user
CN110633043A (en) A split-screen processing method and terminal device
CN112150499B (en) Image processing method and related device
WO2021190524A1 (en) Screenshot processing method, graphic user interface and terminal
CN113497888B (en) Photo preview method, electronic device and storage medium
CN112449101A (en) Shooting method and electronic equipment
CN111768352A (en) Image processing method and device
CN110830645A (en) Operation method and electronic equipment
CN112584037B (en) Method and electronic device for saving images
CN118444832A (en) Touch operation method and electronic equipment
WO2023116411A1 (en) Management method for application card, 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