Camera hardware test method and device and electronic equipment

By obtaining the camera configuration information and using capture screen instructions to detect the camera aperture and TOF sensor, the problem that traditional testing methods cannot detect the camera aperture and TOF sensor is solved, and accurate evaluation of the camera hardware and improving the yield rate is achieved.

CN119697356AActive Publication Date: 2025-03-25HONOR DEVICE CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202311200247.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-09-15
Publication Date
2025-03-25
Estimated Expiration
2043-09-15

AI Technical Summary

Technical Problem

Traditional camera hardware testing methods cannot effectively detect the aperture and TOF sensors in the camera, resulting in the inability to accurately evaluate the camera's pass rate.

Method used

By obtaining the camera configuration information, including multiple aperture values ​​supported by the aperture, it detects whether the aperture can be adjusted to each aperture value to determine whether the aperture has failed. At the same time, using capture screen instructions and preset images, it is determined whether the TOF sensor has failed.

Benefits of technology

It realizes effective detection of the camera aperture and TOF sensor, improves the production yield of the electronic device camera hardware, and ensures the accuracy of the test results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119697356A_ABST
    Figure CN119697356A_ABST
Patent Text Reader

Abstract

The invention discloses a camera hardware testing method and device and electronic equipment. The method is applied to the electronic equipment comprising a camera and comprises the steps that first configuration information of the camera is acquired, the first configuration information comprises a plurality of aperture values supported by an aperture of the camera, and the aperture values are in one-to-one correspondence with a plurality of clear apertures; each aperture value is the ratio of the focal length of the lens of the camera to the clear aperture corresponding to each aperture value, and the plurality of aperture values are different; and detecting whether the aperture can be adjusted to each aperture value in the plurality of aperture values or not according to the first configuration information under the condition that a hardware test function is started, so as to determine whether the aperture has a fault or not. According to the method, the aperture of the camera can be effectively tested, so that the yield of the camera of the electronic equipment can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of camera testing technology, and more specifically, to a camera hardware testing method, device and electronic device. Background Art

[0002] Before electronic devices leave the factory, manufacturers will test the camera hardware of the electronic devices to determine whether the camera hardware has failed, thereby reducing the failure rate of the camera hardware of the electronic devices after leaving the factory and improving user satisfaction.

[0003] Traditional technology involves testing the camera hardware of electronic devices, but can only detect part of the hardware in the camera (for example, autofocus motor, gyroscope, optical image stabilizer), and cannot detect other components such as aperture or time of flight (TOF) sensor, resulting in the inability to test the true pass rate of the camera. Summary of the invention

[0004] The present application provides a camera hardware testing method, device and electronic device, which can effectively test the aperture of a camera, thereby facilitating improving the production yield of the camera of the electronic device.

[0005] In a first aspect, a camera hardware testing method is provided, which is applied to an electronic device including a camera, the method comprising: obtaining first configuration information of the camera, wherein the first configuration information comprises multiple aperture values ​​supported by the aperture of the camera, the multiple aperture values ​​correspond to multiple clear apertures one-to-one, each aperture value is a ratio between the focal length of the camera lens and the clear aperture corresponding to each aperture value, and the multiple aperture values ​​are all different; when a hardware testing function is started, detecting whether the aperture can be adjusted to each aperture value of the multiple aperture values ​​according to the first configuration information to determine whether the aperture is faulty.

[0006] The aperture of the camera in the electronic device supports multiple aperture values, that is, the aperture that is not faulty has the ability to be adjusted to any one of the multiple aperture values. In other words, when the aperture of the camera is not faulty, the electronic device can control the aperture of the camera to be adjusted to any one of the multiple aperture values. It is understandable that when the aperture of the camera is faulty, there is a phenomenon that the aperture of the camera cannot be adjusted to at least one of the multiple aperture values.

[0007] In the embodiment of the present application, an aperture that supports multiple aperture values ​​may be referred to as a variable aperture, and an aperture that supports only one aperture value may be referred to as a fixed aperture.

[0008] In the above technical solution, the first configuration information of the camera in the electronic device indicates that the aperture of the camera supports multiple aperture values; when the hardware test function is started, the aperture is detected through the first configuration information to determine whether the aperture can be adjusted to each aperture value of all aperture values ​​(i.e., multiple aperture values) supported by the aperture, so as to determine whether the aperture fails. Therefore, the method can effectively test the aperture of the camera, thereby facilitating improving the production yield of the camera of the electronic device.

[0009] In a possible implementation, when the hardware test function is started, whether the aperture can be adjusted to each of the multiple aperture values ​​is detected according to the first configuration information to determine whether the aperture is malfunctioning, including: generating an adjustment instruction according to the first configuration information, wherein the adjustment instruction is used to instruct to adjust the size of the aperture to each aperture value in a preset order; and testing the aperture according to the adjustment instruction to determine whether the aperture is malfunctioning.

[0010] It should be noted that in the embodiment of the present application, there is no specific limitation on the implementation method of detecting the aperture according to the first configuration information, and the above implementation method is only for illustration.

[0011] In the above technical solution, an adjustment instruction can be generated according to the first configuration information, and then the aperture is tested according to the adjustment instruction, so that when the aperture of the camera is detected, it can be ensured that each aperture value of the multiple aperture values ​​is tested. Therefore, the method can effectively test the aperture of the camera, which is conducive to improving the production yield of the camera of the electronic device.

[0012] In one possible implementation, the multiple aperture values ​​include a first aperture value and a second aperture value, and the testing of the aperture according to the adjustment instruction to determine whether the aperture fails includes: when the size of the aperture is successfully adjusted from the first aperture value to the second aperture value according to the adjustment instruction, and when the size of the aperture is successfully adjusted from the second aperture value to the first aperture value, determining that the aperture has not failed.

[0013] In the above implementation, the current aperture size of the camera is the first aperture value. When the multiple aperture values ​​supported by the aperture are two aperture values, and the current aperture size is the first aperture value, it is determined that the aperture is not faulty by successfully adjusting the aperture size from the first aperture value to the second aperture value, and by successfully adjusting the aperture size from the second aperture value to the first aperture value.

[0014] In another possible implementation, the multiple aperture values ​​also include a third aperture value, and, in a case where the size of the aperture is successfully adjusted from the first aperture value to the second aperture value according to the adjustment instruction, determining that the aperture has not failed includes: determining that the aperture has not failed when the size of the aperture is successfully adjusted from the first aperture value to the third aperture value according to the adjustment instruction, when the size of the aperture is successfully adjusted from the third aperture value to the second aperture value, and when the size of the aperture is successfully adjusted from the second aperture value to the first aperture value.

[0015] In the above technical solution, the multiple aperture values ​​supported by the aperture are three aperture values, and the size of the aperture is adjusted to each aperture value indicated by the adjustment instruction in sequence through the adjustment instruction, so that it can be determined that the aperture has no fault.

[0016] In the above implementations, the aperture size of the current camera is taken as the first aperture value as an example for description. Optionally, the aperture size of the current camera may also be the second aperture value.

[0017] In one possible implementation, the multiple aperture values ​​include a first aperture value and a second aperture value, and the testing of the aperture according to the adjustment instruction to determine whether the aperture fails includes: when the size of the aperture is successfully adjusted from the second aperture value to the first aperture value according to the adjustment instruction, and when the size of the aperture is successfully adjusted from the first aperture value to the second aperture value, determining that the aperture has not failed.

[0018] In the above implementation, the current aperture size of the camera is the second aperture value. When the multiple aperture values ​​are two aperture values, and the current aperture size is the second aperture value, the aperture can be successfully adjusted from the second aperture value to the first aperture value, and the aperture size can be successfully adjusted from the first aperture value to the second aperture value, and it is determined that the aperture is not faulty.

[0019] In another possible implementation, the multiple aperture values ​​also include a third aperture value, and, in a case where the size of the aperture is successfully adjusted from the second aperture value to the first aperture value and the size of the aperture is successfully adjusted from the first aperture value to the second aperture value according to the adjustment instruction, determining that the aperture has not failed includes: determining that the aperture has not failed when the size of the aperture is successfully adjusted from the second aperture value to the third aperture value and the size of the aperture is successfully adjusted from the third aperture value to the first aperture value and the size of the aperture is successfully adjusted from the first aperture value to the second aperture value according to the adjustment instruction.

[0020] In the above technical solution, the multiple aperture values ​​supported by the aperture are three aperture values, and the size of the aperture is adjusted to each aperture value indicated by the adjustment instruction in sequence through the adjustment instruction, so that it can be determined that the aperture has no fault.

[0021] In another possible implementation, in the case of starting the hardware test function, before detecting whether the aperture can be adjusted to each of the multiple aperture values ​​according to the first configuration information to determine whether the aperture fails, the method also includes: in response to detecting that the test switch of the aperture is turned on, determining to start the hardware test function.

[0022] In the above technical solution, the hardware test function will only be started to execute the step of detecting the aperture according to the first configuration information when it is detected that the aperture test switch is turned on. In this way, it is possible to avoid testing the aperture of the camera when there is no need to do so, which is beneficial to saving resources of the electronic device.

[0023] In another possible implementation, the camera is configured with a time-of-flight TOF sensor, and the method further includes: determining whether the TOF sensor fails based on a capture picture instruction and a preset image, wherein the capture picture instruction is used to instruct a preset number of shots of the target object based on a first aperture value among the multiple aperture values, and the preset image is an image obtained by a camera configured with a TOF sensor that has not failed, shooting the target object based on the first aperture value.

[0024] The first aperture value is any one of the multiple aperture values. For example, if the multiple aperture values ​​supported by the aperture are F1.8 and F2.8, the first aperture value may be F1.8 or F2.8.

[0025] In the above technical solution, the TOF sensor of the camera can be tested for failure according to the capture screen instruction and the preset image. Therefore, the method can realize the effective detection of the TOF sensor of the camera, which is conducive to further improving the production yield of the camera of the electronic device.

[0026] In another possible implementation, determining whether the TOF sensor has failed based on a capture screen instruction and a preset image includes: controlling the camera to perform multiple shots of the target object based on the first aperture value to obtain multiple target images based on the capture screen instruction; determining that the TOF sensor has not failed if the difference between each target image in the multiple target images and the preset image does not exceed a preset threshold; and determining that the TOF sensor has failed if the difference between at least one target image in the multiple target images and the preset image exceeds the preset threshold.

[0027] In the above technical solution, a solution for stress testing the TOF sensor of the camera is provided, that is, when a camera supporting the TOF sensor takes multiple target images of the target object, the difference between the preset image and each of the multiple target images is compared to determine whether the TOF sensor of the camera is faulty. Specifically, when the difference between the preset image and each of the multiple target images does not exceed the preset threshold, it is determined that the TOF sensor is not faulty; when the difference between the preset image and at least one of the multiple target images exceeds the preset threshold, it is determined that the TOF sensor is faulty; therefore, this method can realize effective detection of the TOF sensor of the camera, which is conducive to further improving the production yield of the camera of the electronic device.

[0028] In another possible implementation, the method further includes: obtaining second configuration information of the camera, wherein the second configuration information includes a first field for indicating an identifier of the camera, and a second field for indicating that the camera is configured with the TOF sensor; and determining, based on the second configuration information, that the camera is configured with the TOF sensor.

[0029] The first field is a field for indicating the identification of the camera. For example, the first field may be, but is not limited to, a camera identification code cameraId or a device number of the camera.

[0030] The second field is used to indicate that the camera is equipped with a TOF sensor. Exemplarily, the second field may be, but is not limited to, the isSupportTofSensor field, wherein the value of isSupportTofSensor equals 1 to indicate that the camera is equipped with a TOF sensor; the value of isSupportTofSensor equals 0 to indicate that the camera is not equipped with a TOF sensor; or, the value of isSupportTofSensor equals 0 to indicate that the camera is equipped with a TOF sensor; the value of isSupportTofSensor equals 1 to indicate that the camera is not equipped with a TOF sensor.

[0031] In the above technical solution, only when the camera is equipped with a TOF sensor will the step of determining whether the TOF sensor is faulty according to the capture screen instruction and the preset image be executed. In this way, testing of cameras that are not equipped with a TOF sensor can be avoided, which is beneficial to saving resources of the electronic device.

[0032] In a second aspect, a camera hardware testing method is provided, which is applied to an electronic device including a camera, the method comprising: obtaining a capture screen instruction, wherein the capture screen instruction is used to instruct to perform a preset number of shots of a target object based on a first aperture value configured for the camera; when a hardware testing function is started, determining whether a time-of-flight TOF sensor of the camera fails based on the capture screen instruction and a preset image, wherein the preset image is an image obtained by shooting the target object based on the first aperture value by a camera configured with a TOF sensor that has not failed.

[0033] In the above technical solution, the TOF sensor of the camera located in the electronic device can be tested whether it is faulty according to the capture screen instruction and the preset image. This method can realize the effective detection of the TOF sensor of the camera, which is conducive to further improving the production yield of the camera of the electronic device.

[0034] In a possible implementation, determining whether the time-of-flight TOF sensor of the camera is faulty according to the capture picture instruction and the preset image includes: controlling the camera to perform multiple shots of the target object based on the first aperture value according to the capture picture instruction to obtain multiple target images; determining that the TOF sensor is not faulty when the difference between each target image in the multiple target images and the preset image does not exceed a preset threshold; and determining that the TOF sensor is faulty when the difference between at least one target image in the multiple target images and the preset image exceeds the preset threshold.

[0035] In the above technical solution, a solution for stress testing the TOF sensor of the camera is provided, that is, when a camera supporting the TOF sensor takes multiple target images of the target object, the difference between the preset image and each of the multiple target images is compared to determine whether the TOF sensor of the camera is faulty. Specifically, when the difference between the preset image and each of the multiple target images does not exceed the preset threshold, it is determined that the TOF sensor is not faulty; when the difference between the preset image and at least one of the multiple target images exceeds the preset threshold, it is determined that the TOF sensor is faulty; therefore, this method can realize effective detection of the TOF sensor of the camera, which is conducive to further improving the production yield of the camera of the electronic device.

[0036] In another possible implementation, before determining whether the TOF sensor of the camera fails based on the capture screen instruction and the preset image, the method also includes: obtaining configuration information of the camera, wherein the configuration information includes a first field for indicating an identifier of the camera, and a second field for indicating that the camera is configured with the TOF sensor; and determining that the camera is configured with the TOF sensor based on the configuration information to start the hardware test function.

[0037] In the above technical solution, only when the camera is equipped with a TOF sensor will the step of determining whether the TOF sensor is faulty according to the capture screen instruction and the preset image be executed. In this way, testing of cameras that are not equipped with a TOF sensor can be avoided, which is beneficial to saving resources of the electronic device.

[0038] In a third aspect, a camera hardware testing device is provided, which is applied to an electronic device and is used to execute the camera hardware testing method provided in the first aspect or the second aspect. Specifically, the camera hardware testing device may include a module for executing any possible implementation of the first aspect or the second aspect.

[0039] In a fourth aspect, an electronic device is provided, comprising a unit for executing any one of the methods in the first aspect or the second aspect. The device may be a terminal device or a chip in the terminal device. The device may include an input unit and a processing unit.

[0040] When the device is a terminal device, the processing unit may be a processor, and the input unit may be a communication interface; the terminal device may also include a memory, which is used to store computer program code. When the processor executes the computer program code stored in the memory, the terminal device executes any one of the methods in the first aspect or the second aspect.

[0041] When the device is a chip in a terminal device, the processing unit may be a processing unit inside the chip, and the input unit may be an output interface, a pin or a circuit, etc.; the chip may also include a memory, which may be a memory inside the chip (for example, a register, a cache, etc.) or a memory located outside the chip (for example, a read-only memory, a random access memory, etc.); the memory is used to store computer program code, and when the processor executes the computer program code stored in the memory, the chip executes any one of the methods in the first aspect or the second aspect.

[0042] In one possible implementation, a memory is used to store computer program code; a processor executes the computer program code stored in the memory, and when the computer program code stored in the memory is executed, the processor is used to execute any one of the methods in the first aspect or the second aspect.

[0043] In a fifth aspect, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores a computer program code. When the computer program code is executed by a camera hardware testing device, the camera hardware testing device performs any one of the camera hardware testing methods in the first aspect or the second aspect.

[0044] In a sixth aspect, a computer program product is provided, the computer program product comprising: a computer program code, when the computer program code is executed by a camera hardware testing device, the camera hardware testing device executes any one of the camera hardware testing methods in the first aspect or the second aspect.

[0045] It can be understood that the beneficial effects of the second to sixth aspects mentioned above can be found in the relevant description of the first aspect mentioned above, and will not be repeated here.

[0046] It should be understood that the description of technical features, technical solutions, beneficial effects or similar language in this application does not imply that all features and advantages can be realized in any single embodiment. On the contrary, it is understood that the description of features or beneficial effects means that specific technical features, technical solutions or beneficial effects are included in at least one embodiment. Therefore, the description of technical features, technical solutions or beneficial effects in this specification does not necessarily refer to the same embodiment. Furthermore, the technical features, technical solutions and beneficial effects described in the present embodiment can also be combined in any appropriate manner. Those skilled in the art will understand that the embodiment can be realized without one or more specific technical features, technical solutions or beneficial effects of a specific embodiment. In other embodiments, additional technical features and beneficial effects can also be identified in specific embodiments that do not embody all embodiments. BRIEF DESCRIPTION OF THE DRAWINGS

[0047] Figure 1 It is a schematic diagram of the hardware system of the electronic device 100 provided in an embodiment of the present application.

[0048] Figure 2 It is a software structure block diagram of the electronic device 100 according to an embodiment of the present application.

[0049] Figure 3 It is a schematic diagram of a camera hardware testing method provided in an embodiment of the present application.

[0050] Figure 4 is the above Figure 3A schematic diagram of the aperture of a camera in the provided method.

[0051] Figure 5 It is a schematic diagram of another camera hardware testing method provided in an embodiment of the present application.

[0052] Figure 6 It is a schematic diagram of another camera hardware testing method provided in an embodiment of the present application.

[0053] Figure 7 It is a schematic diagram of another camera hardware testing method provided in an embodiment of the present application.

[0054] Figure 8 It is a schematic diagram of another camera hardware testing method provided in an embodiment of the present application.

[0055] Fig. 9 It is a schematic diagram of the test process of the electronic device executing the above-mentioned step S811 of the camera's autofocus motor, the camera's gyroscope and the camera's optical image stabilizer.

[0056] Fig.10 It is a schematic diagram of another camera hardware testing method provided in an embodiment of the present application.

[0057] Fig.11 is a schematic diagram of a camera hardware testing device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0058] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0059] To facilitate understanding, the professional terms involved in the embodiments of the present application are first introduced.

[0060] (1) Time of flight (TOF) sensor

[0061] The TOF sensor locates and communicates with objects by measuring the time it takes for light to reflect from an object. The TOF sensor uses infrared light. When the light is reflected from an object back to the sensor, the distance between the sensor and the measured object can be calculated based on the time difference between the emission and reflection of the light.

[0062] In practical applications, a camera equipped with a TOF sensor is also called a depth camera or a TOF camera. In the embodiments of the present application, a depth camera and a TOF camera have the same meaning. For ease of description, the camera equipped with a TOF sensor is referred to as a TOF camera as an example.

[0063] (2) Aperture

[0064] The aperture is an optical mechanical stop located inside a camera lens that controls the amount of light that passes through the camera lens. The aperture is made up of multiple thin metal blades.

[0065] In practical applications, the aperture can be divided into a fixed aperture and a variable aperture according to whether the aperture value of the aperture can be adjusted. The fixed aperture has one aperture value, and the aperture value is fixed. The variable aperture has two or more aperture values, and the aperture value of the variable aperture can be controlled by adjusting the aperture blades of the camera lens. That is, by adjusting the aperture blades of the camera lens, any aperture value of the two or more aperture values ​​of the variable aperture can be set for the variable aperture.

[0066] The aperture size (i.e. the aperture value) is equal to the ratio of the focal length of the camera's objective lens (i.e. the lens) to the diameter of the camera's lens (i.e. the reciprocal of the relative aperture). The focal length of the objective lens refers to the distance from the aperture to the film, and the focal length of a general camera lens is fixed.

[0067] The larger the aperture size (i.e., the aperture value), the brighter the image and the smaller the depth of field (i.e., the image is out of focus); the smaller the aperture size (i.e., the aperture value), the darker the image and the larger the depth of field (i.e., the image is clearer and sharper). It should also be understood that when the camera of an electronic device shoots the same target object at the same location, the darker the image obtained by the camera lens based on a large aperture value (i.e., a small aperture) and the larger the depth of field, the brighter the image obtained by the camera lens based on a small aperture value (i.e., a large aperture) and the smaller the depth of field.

[0068] There are two ways to write the aperture size: large F (F2.8) and small f (f / 2.8). These two ways are completely equivalent.

[0069] (3) Camera's automatic focus motor (AF)

[0070] The camera's AF is used to adjust the focus of the lens to make the subject clear and sharp. It can drive the lens assembly to adjust forward and backward according to the user's manual operation or the command of the autofocus system.

[0071] The AF of a camera is usually driven by an electronic control system or motor inside the camera, which accurately controls the movement of each lens component according to the user's operation or the instructions of the automatic control algorithm to achieve the shooting needs and the desired shooting effect.

[0072] (4) Camera gyroscope (gyroscope, gyro)

[0073] A camera's gyroscope is a sensor used to measure the rotational motion of a camera. A camera's gyroscope is often used in camera stabilization systems to detect the camera's attitude and angle changes in real time. A camera's gyroscope calculates the camera's direction and angle by sensing the device's rotational motion.

[0074] The camera's gyroscope usually uses micro-electro-mechanical system (MEMS) technology, which uses tiny mechanical structures and electronic sensors to detect acceleration and angular velocity. It usually contains three axial sensors to measure the rotational motion of the device on the x, y and z axes of the three-dimensional coordinate system.

[0075] By detecting the rotational motion of the device, the camera's gyroscope can provide real-time attitude information, such as the camera's tilt, rotation angle, etc. This information is very important for the camera stabilization system, which can help offset the camera's shaking and shaking during shooting, thereby providing a more stable and clear image or video output.

[0076] (5) Optical image stabilizer (OIS)

[0077] OIS is set in the camera module of electronic devices. It is mainly used to prevent image blur when the electronic device shakes. The principle is that the gyroscope in the lens detects tiny movements and then transmits the signal to the microprocessor. The processor immediately calculates the displacement that needs to be compensated, and then compensates according to the shaking direction and displacement of the lens through the compensation lens group, thereby effectively overcoming the image blur caused by the vibration of the electronic device.

[0078] Before electronic devices leave the factory, manufacturers will test the camera hardware of the electronic devices to determine whether the camera hardware has failed, thereby reducing the failure rate of the camera hardware of the electronic devices after leaving the factory and improving user satisfaction.

[0079] In traditional technology, the camera hardware of electronic devices is tested. This method can only detect part of the hardware in the camera, including the gyroscope, autofocus motor and optical image stabilizer. However, in actual applications, the camera hardware also includes other hardware such as aperture or TOF sensor. Therefore, based on the traditional technology, only part of the hardware in the camera is tested to determine whether the camera is faulty. This will result in the inability to test the true pass rate of the camera.

[0080] In order to solve the above problems, the embodiment of the present application provides a camera hardware testing method, which is applied to an electronic device including a camera, and the method includes: obtaining first configuration information of the camera, wherein the first configuration information includes multiple aperture values ​​supported by the aperture of the camera, the multiple aperture values ​​correspond to multiple clear apertures one by one, each aperture value is the ratio between the focal length of the lens of the camera and the clear aperture corresponding to each aperture value, and the multiple aperture values ​​are different; when the hardware test function is started, according to the first configuration information, whether the aperture can be adjusted to each aperture value in the multiple aperture values ​​is detected to determine whether the aperture fails. In the above technical solution, the first configuration information of the camera located in the electronic device obtained indicates that the aperture of the camera supports multiple aperture values; when the hardware test function is started, the aperture can be adjusted to each aperture value in all aperture values ​​(i.e., multiple aperture values) supported by the aperture is detected through the above first configuration information to determine whether the aperture fails; the above method detects each aperture value supported by the aperture, so the method can effectively test the aperture of the camera, thereby facilitating improving the production yield of the camera of the electronic device.

[0081] The technical solution provided by this application is described in detail below.

[0082] The camera hardware testing method provided in the embodiment of the present application can be applied to electronic devices. The hardware structure and software structure of the electronic device are described in detail below in conjunction with the accompanying drawings.

[0083] Figure 1 It is a schematic diagram of the hardware system of the electronic device 100 provided in an embodiment of the present application.

[0084] There is no specific limitation on the type of the electronic device 100, and it can be selected according to the actual scenario. For example, the electronic device 100 can be a mobile phone, a smart screen, a tablet computer, a wearable electronic device, an in-vehicle electronic device, an augmented reality (AR) device, a virtual reality (VR) device, a laptop computer, an ultra-mobile personal computer (UMPC), a netbook, a personal digital assistant (PDA), a projector, an in-vehicle device, etc. The embodiment of the present application does not impose any limitation on the specific type of the electronic device 100.

[0085] The electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc. The sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, etc.

[0086] It should be noted that Figure 1 The structure shown does not constitute a specific limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may include Figure 1 More or fewer components than those shown, or the electronic device 100 may include Figure 1 Combinations of some of the components shown, or the electronic device 100 may include Figure 1 Subassemblies of some of the components shown. Figure 1 The components shown may be implemented in hardware, software, or a combination of software and hardware.

[0087] The processor 110 may include one or more processing units. For example, the processor 110 may include at least one of the following processing units: an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, a video codec, a digital signal processor (DSP), a baseband processor, and a neural-network processing unit (NPU). Different processing units may be independent devices or integrated devices.

[0088] The controller can generate operation control signals according to the instruction operation code and timing signal to complete the control of instruction fetching and execution.

[0089] A memory may also be provided in the processor 110 for storing instructions and data. For example, instructions for executing the camera hardware testing method provided in the embodiment of the present application may be stored in the processor 110. For example, data obtained by executing the camera hardware testing method provided in the embodiment of the present application may be stored in the processor 110. In some embodiments, the memory in the processor 110 is a cache memory. The memory may store instructions or data that the processor 110 has just used or circulated. If the processor 110 needs to use the instruction or data again, it may be directly called from the memory. Repeated access is avoided, the waiting time of the processor 110 is reduced, and the efficiency of the system is improved. In some embodiments, the processor 110 may include one or more interfaces. For example, the processor 110 may include at least one of the following interfaces: an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a SIM interface, and a USB interface.

[0090] Figure 1The connection relationship between the modules shown is only a schematic illustration and does not constitute a limitation on the connection relationship between the modules of the electronic device 100. Optionally, the modules of the electronic device 100 may also adopt a combination of multiple connection modes in the above embodiments.

[0091] The electronic device 100 can realize the display function through the GPU, the display screen 194 and the application processor. The GPU is a microprocessor for image processing, which connects the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 110 may include one or more GPUs, which execute program instructions to generate or change display information.

[0092] The display screen 194 can be used to display images or videos. For example, the display screen 194 can display images or videos taken by the camera application of the electronic device. The display screen 194 includes a display panel. The display panel can use a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), a mini light-emitting diode (Mini LED), a micro light-emitting diode (Micro LED), a micro OLED (Micro OLED) or a quantum dot light emitting diode (QLED). In some embodiments, the electronic device 100 may include 1 or N display screens 194, where N is a positive integer greater than 1.

[0093] The electronic device 100 can realize the shooting function through the ISP, the camera 193, the video codec, the GPU, the display screen 194 and the application processor.

[0094] The ISP is used to process the data fed back by the camera 193. For example, when taking a photo, the shutter is opened, and the light is transmitted to the camera photosensitive element through the lens. The light signal is converted into an electrical signal, and the camera photosensitive element transmits the electrical signal to the ISP for processing and converts it into an image visible to the naked eye. The ISP can perform algorithm optimization on the noise, brightness and color of the image. The ISP can also optimize the exposure and color temperature of the shooting scene. In some embodiments, the ISP can be set in the camera 193.

[0095] The camera 193 is used to capture still images or videos. The object generates an optical image through the lens and projects it onto the photosensitive element. The photosensitive element can be a charge coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The photosensitive element converts the optical signal into an electrical signal, and then passes the electrical signal to the ISP to be converted into a digital image signal. The ISP outputs the digital image signal to the DSP for processing. The DSP converts the digital image signal into an image signal in a standard red green blue (RGB), YUV or other format. In some embodiments, the electronic device 100 may include 1 or N cameras 193, where N is a positive integer greater than 1.

[0096] The external memory interface 120 can be used to connect an external memory card, such as a secure digital (SD) card, to expand the storage capacity of the electronic device 100. The external memory card communicates with the processor 110 via the external memory interface 120 to implement a data storage function.

[0097] The internal memory 121 can be used to store computer executable program codes, which include instructions. For example, the internal memory 121 may store instructions for executing the camera hardware testing method provided in the embodiment of the present application. The internal memory 121 may include a program storage area and a data storage area. Among them, the program storage area may store an operating system, and an application required for at least one function (for example, a sound playback function and an image playback function). The data storage area may store data created during the use of the electronic device 100 (for example, audio data and a phone book). In addition, the internal memory 121 may include a high-speed random access memory, and may also include a non-volatile memory, such as: at least one disk storage device, a flash memory device, and a universal flash storage (UFS). The processor 110 executes various processing methods of the electronic device 100 by running instructions stored in the internal memory 121 and / or instructions stored in a memory provided in the processor.

[0098] The gyro sensor 180B can be used to determine the motion posture of the electronic device 100. In some embodiments, the angular velocity of the electronic device 100 around three axes (i.e., the x-axis, the y-axis, and the z-axis) can be determined by the gyro sensor 180B. The gyro sensor 180B can be used for anti-shake shooting. For example, when the shutter is pressed, the gyro sensor 180B detects the angle of the electronic device 100 shaking, calculates the distance that the lens module needs to compensate based on the angle, and allows the lens to offset the shaking of the electronic device 100 through reverse movement to achieve anti-shake. The gyro sensor 180B can also be used in scenes such as navigation and somatosensory games.

[0099] The distance sensor 180F is used to measure the distance. The electronic device 100 can measure the distance by infrared or laser. In some embodiments, for example, in a shooting scene, the electronic device 100 can use the distance sensor 180F to measure the distance to achieve fast focusing. For example, the distance sensor 180F can be, but is not limited to, a TOF sensor.

[0100] The touch sensor 180K is also called a touch control device. The touch sensor 180K can be set on the display screen 194. The touch sensor 180K and the display screen 194 form a touch screen, which is also called a touch control screen. The touch sensor 180K is used to detect touch operations acting on or near it. The touch sensor 180K can pass the detected touch operation to the application processor to determine the type of touch event. Visual output related to the touch operation can be provided through the display screen 194. In other embodiments, the touch sensor 180K can also be set on the surface of the electronic device 100 and set at a different position from the display screen 194.

[0101] Motor 191 can generate vibration. In some implementations, motor 191 can be a camera automatic focus motor (automatic focus, AF). Camera AF is used to adjust the focus of the lens to make the subject clear and sharp. It can drive the lens assembly to adjust forward and backward according to the user's manual operation or the instruction of the automatic focus system. Camera AF is usually driven by an electronic control system or motor inside the camera, and accurately controls the movement of each lens assembly according to the user's operation or the instruction of the automatic control algorithm to achieve the shooting requirements and the desired shooting effect. In other implementations, motor 191 can be used for incoming call reminders or touch feedback. Motor 191 can generate different vibration feedback effects for touch operations acting on different applications. For touch operations acting on different areas of the display screen 194, motor 191 can also generate different vibration feedback effects. Different application scenarios (for example, time reminders, receiving information, alarm clocks, and games) can correspond to different vibration feedback effects. The touch vibration feedback effect can also support customization.

[0102] The hardware system of the electronic device 100 is described in detail above, and the software system of the electronic device 100 is introduced below. The software system can adopt a layered architecture, an event-driven architecture, a micro-core architecture, a micro-service architecture, or a cloud architecture. The embodiment of the present application takes the layered architecture as an example to exemplarily describe the software system of the electronic device 100.

[0103] For example, Figure 2 A schematic diagram of a software system of an electronic device is shown. Figure 2 , the software system adopts a layered architecture. The layered architecture divides the software into several layers, each layer has a clear role and division of labor. The layers communicate with each other through software interfaces. In some embodiments, the Android system is divided into five layers, from top to bottom, respectively, the application layer 210, the application framework layer 220, the Android runtime (Android Runtime) and the core library layer 230, the hardware abstract layer (hardware abstract layer, HAL) 240 and the kernel layer 250.

[0104] The application layer 210 may include a series of application packages. For example, the application package may include applications such as camera, gallery, chat, call, map, navigation, calendar, Bluetooth, music, video, etc.

[0105] Each of the above applications may include more specific functional modules, for example, a gallery may include a service module and a notification module. For example, a camera may include a photo taking module.

[0106] The above-mentioned various application programs may be used to generate application data. For example, the gallery is used to generate photo data.

[0107] The application framework layer 220 provides an application programming interface (API) and a programming framework for the applications of the application layer. The application framework layer 220 includes some predefined functions.

[0108] like Figure 2 As shown, the application framework layer 220 may include a window manager, a notification manager, an activity manager, an input manager, a view system, a content provider, a resource manager, and the like.

[0109] The window manager provides window management services (WMS). WMS can be used for window management, window animation management, surface management, and as a transfer station for the input system.

[0110] Content providers are used to store and retrieve data and make it accessible to applications. This data can include videos, images, audio, calls made and received, browsing history and bookmarks, phone books, etc.

[0111] The view system includes visual controls, such as controls for displaying text, controls for displaying images, etc. The view system can be used to build applications. A display interface can be composed of one or more views. For example, a display interface including a text notification icon can include a view for displaying text and a view for displaying images.

[0112] The resource manager provides various resources for applications, such as localized strings, icons, images, layout files, video files, and so on.

[0113] The notification manager enables applications to display notification information in the status bar. It 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 be a notification that appears in the system top status bar in the form of a chart or scroll bar text, such as notifications of applications running in the background, or a notification that appears on the screen in the form of a dialog window. For example, a text message is displayed in the status bar, a prompt sound is emitted, an electronic device vibrates, an indicator light flashes, etc.

[0114] The activity manager can provide activity management services (AMS), which can be used to start, switch, and schedule system components (such as activities, services, content providers, and broadcast receivers) as well as manage and schedule application processes.

[0115] The input manager can provide input management services (IMS), which can be used to manage system input, such as touch screen input, key input, sensor input, etc. IMS takes events from input device nodes and distributes them to appropriate windows through interaction with WMS.

[0116] Android Runtime includes core libraries and virtual machines. Android Runtime is responsible for scheduling and management of the Android system.

[0117] The core library consists of two parts: one part is the function that the programming language (for example, Java language) needs to call, and the other part is the Android core library.

[0118] The application layer 210 and the application framework layer 220 run in a virtual machine. The virtual machine executes the programming files (e.g., java files) of the application layer 210 and the application framework layer 220 as binary files. The virtual machine is used to perform functions such as object life cycle management, stack management, thread management, security and exception management, and garbage collection.

[0119] The core library layer 230 may include multiple functional modules, such as surface manager, media framework, libc, SQLite, OpenGL ES, Webkit, etc.

[0120] The surface manager is used to manage the display subsystem and provide the fusion of two-dimensional (2D) and three-dimensional (3D) layers for multiple applications.

[0121] The media framework supports playback and recording of a variety of commonly used audio and video formats, as well as static image files, etc.

[0122] libc (C library) is the standard library of C language. libc is the lowest level library in the system and is implemented through Linux system calls. For example, libc can be used to connect or disconnect camera services, set camera shooting parameters, start or stop preview, take pictures, etc.

[0123] The hardware abstraction layer (HAL) 240 is an interface layer between the operating system kernel and the upper software, and its purpose is to abstract the hardware. The hardware abstraction layer is an abstract interface driven by the device kernel, which is used to implement the application programming interface that provides access to the underlying device to the higher-level Java API framework. HAL contains multiple library modules, such as camera HAL (such as aperture, TOF sensor, lens or focus motor, etc.), Vendor warehouse, display, Bluetooth, audio, etc. Each library module implements an interface for a specific type of hardware component. It can be understood that the camera HAL can provide an interface for the camera FWK to access hardware components such as the camera. The Vendor warehouse can provide an interface for the media FWK to access hardware components such as encoders. When the system framework layer API requires access to the hardware of the portable device, the Android operating system will load the library module for the hardware component.

[0124] The kernel layer 250 is the foundation of the Android operating system, and the final functions of the Android operating system are all completed through the kernel layer. The kernel layer may include display drivers, camera drivers, audio drivers, and sensor drivers.

[0125] It should be noted that the application provides Figure 2 The software structure diagram of the electronic device shown is only an example and does not limit the specific module division in different layers of the Android operating system. For details, please refer to the introduction of the Android operating system software structure in conventional technology. In addition, the shooting method provided in this application can also be implemented based on other operating systems (for example, IOS or Hongmeng, etc.), and this application will not give examples one by one.

[0126] As mentioned above, in order to solve the problems existing in the conventional technology, the camera hardware testing method provided in the embodiment of the present application is applied to an electronic device including a camera, and the method includes: obtaining the first configuration information of the camera, wherein the first configuration information includes multiple aperture values ​​supported by the aperture of the camera, the multiple aperture values ​​correspond to multiple clear apertures one by one, each aperture value is the ratio between the focal length of the lens of the camera and the clear aperture corresponding to each aperture value, and the multiple aperture values ​​are all different; when the hardware testing function is started, the aperture is detected according to the first configuration information whether it can be adjusted to each aperture value in the multiple aperture values ​​to determine whether the aperture fails. The method can effectively test the aperture of the camera, thereby facilitating improving the production yield of the camera of the electronic device.

[0127] The embodiment of the present application does not particularly limit the specific structure of the execution subject of a camera hardware testing method, as long as the code of a camera hardware testing method of the embodiment of the present application can be run to communicate according to the camera hardware testing method provided by the embodiment of the present application. For example, the execution subject of a camera hardware testing method provided by the embodiment of the present application can be a functional module in an electronic device that can call and execute a program, or a communication device applied to an electronic device, such as a chip.

[0128] Next, combine Figures 3 to 10 The camera hardware testing method provided in the embodiment of the present application is introduced in detail.

[0129] Figure 3 is a schematic diagram of a camera hardware testing method provided in an embodiment of the present application. The camera hardware testing method provided in an embodiment of the present application can be performed by an electronic device including a camera. It is understood that the electronic device can be implemented as software, or a combination of software and hardware. Exemplarily, the electronic device in the embodiment of the present application can be, but is not limited to, Figure 1 The electronic device 100 is shown. Figure 3 As shown, the camera hardware testing method provided in the embodiment of the present application includes step S310 and step S320. S310 and S320 are described in detail below.

[0130] S310, the electronic device obtains first configuration information of the camera, wherein the first configuration information includes multiple aperture values ​​supported by the aperture of the camera, the multiple aperture values ​​correspond to the multiple clear apertures one-to-one, each aperture value is the ratio between the focal length of the camera lens and the clear aperture corresponding to each aperture value, and the multiple aperture values ​​are different.

[0131] The aperture of the camera supports multiple aperture values, which means that the aperture has the ability to adjust to each of the multiple aperture values. In practical applications, the multiple aperture values ​​supported by the aperture correspond to multiple clear apertures one by one, that is, the aperture supporting each aperture value means that the aperture has the ability to adjust to the clear aperture corresponding to each aperture value. Exemplarily, the electronic device can, but is not limited to, achieve the purpose of changing the aperture value of the aperture by controlling multiple metal blades of the aperture of the rotating camera. In the embodiment of the present application, the aperture that supports multiple aperture values ​​can be referred to as a variable aperture.

[0132] For example, Figure 4 A schematic diagram showing an aperture supporting multiple aperture values ​​is shown. Figure 4 (1) shows a top view of the aperture of a camera located in an electronic device, wherein the aperture includes a plurality of metal blades that can rotate, and the aperture value of the aperture can be changed by rotating the plurality of metal blades of the aperture. Figure 4 (2) in FIG. 1 shows a test chart of the aperture of a camera located within an electronic device. Figure 4 (3) in FIG. 1 shows a schematic diagram of an aperture of F2.8 located in a camera, and Figure 4 (3) in the figure shows a schematic diagram of an aperture of F5.6 located in the camera.

[0133] The first configuration information includes multiple aperture values ​​supported by the aperture of the camera, wherein the number of the multiple aperture values ​​supported by the aperture and the size of each aperture value are not specifically limited and can be determined according to the aperture configured for the camera. Optionally, the first configuration information may also include other information, such as, but not limited to, the identifier of the aperture.

[0134] For example, when the aperture values ​​supported by the camera include F2.8 and F5.6, the first configuration information corresponding to the aperture of the camera may include F2.8 and F5.6. For example, when the aperture values ​​supported by the camera include F2.8, F4.0, and F5.6, the first configuration information corresponding to the aperture of the camera may include F2.8, F4.0, and F5.6.

[0135] There is no specific limitation on the method for the electronic device to obtain the first configuration information of the camera. In some implementations, the application framework layer of the electronic device is provided with an android.hardware.Camera class, and the test process located in the application layer of the electronic device can send the "android.lens.info.availableApertures" TAG value to the application framework layer of the electronic device, and obtain the first configuration information through the return result of the application framework layer for the TAG value.

[0136] In the embodiment of the present application, the "android.lens.info.availableApertures" TAG value negotiated by the application layer and the application framework layer in the electronic device can be dynamically adjusted according to demand. That is to say, in subsequent use, if there is a new demand to add a new aperture value, the attributes of the newly added aperture value can be directly added to the "android.lens.info.availableApertures" TAG value to obtain a new "android.lens.info.availableApertures" TAG value. It can be understood that in the embodiment of the present application, the application layer of the electronic device has backward compatibility, that is, the application layer can issue the old "android.lens.info.availableApertures" TAG value or the new "android.lens.info.availableApertures" TAG value normally.

[0137] S320, when the hardware test function is started, the electronic device detects whether the aperture can be adjusted to each aperture value of the plurality of aperture values ​​according to the first configuration information to determine whether the aperture fails.

[0138] In the above step S320, the electronic device detects the aperture of the camera according to the first configuration information to determine whether the aperture fails, wherein the first configuration information includes multiple aperture values ​​supported by the aperture.

[0139] In the embodiment of the present application, there is no specific limitation on the implementation manner in which the electronic device detects the aperture according to the first configuration information in the above S320.

[0140] In some implementations, when a hardware test function is activated, the electronic device detects whether the aperture can be adjusted to each aperture value of multiple aperture values ​​according to the first configuration information to determine whether the aperture is malfunctioning, including: the electronic device generates an adjustment instruction according to the first configuration information, wherein the adjustment instruction is used to instruct to adjust the size of the aperture to each aperture value in a preset order; and the electronic device tests the aperture according to the adjustment instruction to determine whether the aperture is malfunctioning.

[0141] For example, if the first configuration information includes multiple aperture values ​​supported by the aperture, namely F1.8, F2 and F5.6, and the current aperture size is F1.8, the adjustment instruction is used to indicate that the aperture size is adjusted in the order of F5.6 and F2, that is, the adjustment instruction indicates that the current aperture size of F1.8 is first adjusted to F5.6, and then the aperture size of F5.6 is adjusted to F2.

[0142] Optionally, in the above implementation, the multiple aperture values ​​include a first aperture value and a second aperture value, and the electronic device tests the aperture according to the adjustment instruction to determine whether the aperture fails, including: when the size of the aperture is successfully adjusted from the first aperture value to the second aperture value according to the adjustment instruction, and the size of the aperture is successfully adjusted from the second aperture value to the first aperture value, the electronic device determines that the aperture is not faulty.

[0143] In the above implementation, when the multiple aperture values ​​supported by the aperture are two aperture values ​​and the current aperture size is the first aperture value, the aperture size can be successfully adjusted from the first aperture value to the second aperture value, and the aperture size can be successfully adjusted from the second aperture value to the first aperture value, thereby determining that the aperture is not faulty.

[0144] For example, if the first configuration information includes multiple aperture values ​​supported by the aperture, which are F1.8 and F5.6, and the current aperture size is F1.8, the adjustment instruction is used to instruct to adjust the aperture size in the order of F5.6. Based on this, when the aperture size is successfully adjusted from F1.8 to F5.6, and the aperture size is successfully adjusted from F5.6 to F1.8, the electronic device confirms that the aperture is not faulty.

[0145] Optionally, in the above implementation, the multiple aperture values ​​also include a third aperture value. In this implementation, the aperture supports a first aperture value, a second aperture value and a third aperture value, and, when the size of the aperture is successfully adjusted from the first aperture value to the second aperture value and the size of the aperture is successfully adjusted from the second aperture value to the first aperture value according to the adjustment instruction, determining that the aperture has not failed includes: determining that the aperture has not failed when the size of the aperture is successfully adjusted from the first aperture value to the third aperture value and the size of the aperture is successfully adjusted from the third aperture value to the second aperture value and the size of the aperture is successfully adjusted from the second aperture value to the first aperture value.

[0146] In the above technical solution, the multiple aperture values ​​supported by the aperture are three aperture values, and the size of the aperture is adjusted to each aperture value indicated by the adjustment instruction in sequence through the adjustment instruction, so that it can be determined that the aperture has no fault.

[0147] For example, if the first configuration information includes multiple aperture values ​​supported by the aperture, namely, F1.8, F2, and F4, and the current aperture size is F2, the adjustment instruction is used to instruct to adjust the aperture size in the order of F1.8 and F4. Based on this, when the aperture size is successfully adjusted from F2 to F1.8, the aperture size is successfully adjusted from F1.8 to F4, and the aperture size is successfully adjusted from F4 to F2, the electronic device confirms that the aperture is not faulty.

[0148] In other implementations, when the hardware test function is started, the electronic device detects whether the aperture can be adjusted to each aperture value of multiple aperture values ​​according to the first configuration information to determine whether the aperture is malfunctioning, including: the electronic device adjusts the size of the aperture in the order of multiple aperture values ​​supported by the aperture recorded in the first configuration information to detect whether the aperture can be adjusted to each aperture value, thereby determining whether the aperture is malfunctioning.

[0149] In the above step S320, the electronic device detects the aperture according to the first configuration information when the hardware test function is enabled.

[0150] Optionally, when the hardware test function is started, before detecting whether the aperture can be adjusted to each aperture value of multiple aperture values ​​according to the first configuration information to determine whether the aperture fails, the electronic device may also perform the following steps: in response to detecting that the test switch of the aperture is turned on, determining to start the hardware test function.

[0151] In the above technical solution, the hardware test function is started to execute the step of detecting the aperture according to the first configuration information only when it is detected that the test switch of the aperture is turned on. In this way, it is possible to avoid testing the aperture when it is not necessary, which is beneficial to saving resources of the electronic device.

[0152] In an embodiment of the present application, the aperture mode may include an automatic mode and a manual mode, wherein the electronic device cannot adjust the size of the aperture in the automatic mode, and the electronic device can adjust the size of the aperture in the manual mode. Therefore, optionally, in the implementation method in which the aperture of the camera is in the automatic mode, the electronic device may further perform the following steps before executing the above S320: the electronic device adjusts the aperture mode from the automatic mode to the manual mode, so that the electronic device can adjust the size of the aperture. There is no specific limitation on the adjustment method of the electronic device to adjust the aperture mode from the automatic mode to the manual mode. For example, the electronic device adjusts the aperture mode from the automatic mode to the manual mode, including: the electronic device modifies the permission attribute corresponding to the aperture from 0 to 1, so as to adjust the aperture mode from the automatic mode to the manual mode.

[0153] In the above, the method for testing the aperture of a camera provided by the embodiment of the present application is described in detail in combination with S310 and S320. The camera in the electronic device can also be configured with a TOF sensor, and the camera configured with a TOF sensor can also be tested by testing the TOF sensor to further improve the camera's production yield.

[0154] In the embodiment of the present application, the camera supporting the TOF sensor can be referred to as the TOF camera, that is, the camera supporting the TOF sensor and the TOF camera have the same meaning. The TOF camera can obtain the depth information of the corresponding pixel by calculating the flight time of the emitted laser. The original image captured by the TOF camera is a lot of two-dimensional (two dimensions, 2D) images with laser phase. The TOF camera can merge multiple 2D images into a super frame, and then calculate the three-dimensional (three-dimensional image, 3D) image (also called depth map) of the target object according to the super frame. The pixel value of the 3D image contains distance information. It can be understood that the closer the distance between the target object and the TOF camera, the stronger the infrared laser reflected back to the TOF camera, and the greater the brightness of the captured image. Conversely, the farther the distance between the target object and the TOF camera, the weaker the infrared laser reflected back to the TOF camera, and the smaller the brightness of the captured image.

[0155] The following is an introduction to a method for testing a TOF sensor of a camera provided in an embodiment of the present application. It is understandable that the method for testing a TOF sensor provided below can be performed after the electronic device executes the above S310 and S320, or can also be performed before the electronic device executes the above S310 and S320, and there is no specific limitation on this.

[0156] Optionally, a camera located in the electronic device is configured with a time-of-flight TOF sensor, and the electronic device may further perform the following steps: determine whether the TOF sensor fails based on a capture picture instruction and a preset image, wherein the capture picture instruction is used to instruct a preset number of shots of a target object based on a first aperture value among multiple aperture values, and the preset image is an image obtained by a camera configured with a TOF sensor that has not failed, shooting the target object based on the first aperture value.

[0157] In some implementations, the electronic device executes the above-mentioned determination of whether the TOF sensor has failed based on the capture screen instruction and the preset image, including: according to the capture screen instruction, controlling the camera to perform multiple shots of the target object based on the first aperture value to obtain multiple target images; when the difference between each target image in the multiple target images and the preset image does not exceed a preset threshold, determining that the TOF sensor has not failed; when the difference between at least one target image in the multiple target images and the preset image exceeds a preset threshold, determining that the TOF sensor has failed.

[0158] The capture screen instruction is used to instruct to perform a preset number of shots of the target object based on a first aperture value among multiple aperture values. It is understandable that after the electronic device executes the capture screen, the captured target image can be displayed on the display screen of the electronic device.

[0159] There is no specific limitation on the parameters included in the capture screen instruction, and they can be set according to actual needs. In some implementations, the capture screen instruction may include parameters for the camera of the electronic device to perform preview shooting of the target object, wherein the preview shooting parameters may include, but are not limited to, parameters such as preview start time, preview duration, preview size, photo size, and aperture value. There is no specific limitation on the values ​​of preview start time, preview duration, preview size, preview size, and target aperture value, and they can be set according to actual conditions. There is no specific limitation on the above-mentioned preview shooting parameters, that is, the above-mentioned preview shooting parameters can also select other camera parameters according to actual conditions. For example, other camera parameters can also include zoom size and / or autofocus, etc.

[0160] In the above technical solution, a solution for stress testing the TOF sensor of the camera in the electronic device is provided, that is, when a camera supporting the TOF sensor takes multiple target images of the target object, the difference between the preset image and each of the multiple target images is compared to determine whether the TOF sensor of the camera is faulty. Specifically, when the difference between the preset image and each of the multiple target images does not exceed the preset threshold, it is determined that the TOF sensor is not faulty; when the difference between the preset image and at least one of the multiple target images exceeds the preset threshold, it is determined that the TOF sensor is faulty; therefore, the method can realize the effective detection of the TOF sensor of the camera, which is conducive to further improving the production yield of the camera of the electronic device.

[0161] It should be noted that, in the above implementation method, an example is given in which the aperture size used by the camera when the electronic device performs multiple shooting is the first aperture value, and after the electronic device performs multiple shooting of the target object based on the first aperture value to obtain multiple target images, the obtained multiple target images are compared with the preset images respectively.

[0162] Optionally, the aperture size of the camera used by the above-mentioned electronic device when performing multiple shooting can also be at least two aperture values ​​among the multiple aperture values ​​supported by the aperture. Based on this, the above-mentioned preset image includes at least two preset images, and the at least two preset images correspond one-to-one to at least two aperture values. Each preset image is an image obtained by shooting the target object based on the corresponding aperture value when a camera equipped with a TOF sensor that has not failed is used.

[0163] Exemplarily, in other implementations, the electronic device executes the above-mentioned determination of whether the TOF sensor fails based on the capture screen instruction and the preset image, including: according to the capture screen instruction, controlling the camera to perform multiple shots of the target object based on multiple aperture values ​​to obtain multiple target images corresponding to the multiple aperture values, the multiple target images and the multiple preset images corresponding to each other, wherein each target image is obtained by shooting the target object based on the corresponding aperture value, and the preset image corresponding to each target image is an image obtained by shooting the target object based on the aperture value corresponding to the corresponding target image by a camera equipped with a TOF sensor that has not failed; when the difference between each target image in the multiple target images and the corresponding preset image does not exceed a preset threshold, determining that the TOF sensor has not failed; when the difference between at least one target image in the multiple target images and the corresponding preset image exceeds a preset threshold, determining that the TOF sensor has failed.

[0164] Optionally, after performing each shooting of the target object to obtain the corresponding target image, the electronic device may perform the next shooting of the target object if it is determined that the difference between the target image obtained by this shooting and the preset image does not exceed a preset threshold. If it is determined that the difference between the target image obtained by this shooting and the preset image exceeds the preset threshold, the electronic device does not need to perform the next shooting of the target object according to the capture screen instruction.

[0165] Exemplarily, in some other implementations, the capture screen instruction instructs to perform M shots of the target object based on the first aperture value, where M is a positive integer greater than 1, and the electronic device executes the above-mentioned determination based on the capture screen instruction and the preset image to determine whether the TOF sensor fails, including: according to the capture screen instruction, controlling the camera to perform a first shot of the target object based on the first aperture value to obtain a first target image; when the difference between the first target image and the preset image does not exceed a preset threshold, controlling the camera to perform a second shot of the target object based on the first aperture value to obtain a second target image; and so on, when the difference between the second target image and the preset image does not exceed the preset threshold, controlling the camera to perform the Mth shot of the target object based on the first aperture value to obtain the Mth target image; when the difference between the Mth target image and the preset image does not exceed the preset threshold, determining that the TOF sensor has not failed, and controlling the camera to stop shooting.

[0166] In the above technical solution, when the electronic device determines that the target image obtained by the current number of shooting times is significantly different from the preset image, the electronic device no longer executes the next shooting indicated by the capture screen instruction. This can improve the test efficiency and is also beneficial for saving the resources of the electronic device.

[0167] The solution described above involves testing the TOF sensor of a camera located in an electronic device. If the camera located in the electronic device is not equipped with a TOF sensor, there is no need to perform the above test steps on the camera that is not equipped with a TOF sensor. Therefore, in some implementations, the electronic device may also perform the following steps before performing the above test steps on the TOF sensor of the camera: obtaining second configuration information of the camera, wherein the second configuration information includes a first field for indicating an identifier of the camera, and a second field for indicating that the camera is equipped with a TOF sensor; and determining that the camera is equipped with a TOF sensor according to the second configuration information.

[0168] The first field and the second field are not specifically limited and can be set according to actual needs. For example, the first field can be, but not limited to, a camera identifier CameraId field. For example, the second field can be, but not limited to, an isSupportTofSensor field.

[0169] The format of the second configuration information of the camera acquired by the electronic device is not specifically limited. Exemplarily, the format of the second configuration information can be expressed as: 2:0, wherein the meaning of each field is as shown in Table 1 below.

[0170] Table 1

[0171] Field value Field meaning 2 CameraId (an example of the first field) 0 isSupportTofSensor (an example of the second field)

[0172] In the above Table 1, the CameraId field as the first field indicates the camera identifier. The isSupportTofSensor field as the second field indicates whether the camera supports the TOF test. For example, the value of the isSupportTofSensor field is 0, which indicates that the TOF test is supported, and the value of the isSupportTofSensor field is 1, which indicates that the TOF test is not supported. For another example, the value of the isSupportTofSensor field is 1, which indicates that the TOF test is supported, and the value of the isSupportTofSensor field is 0, which indicates that the TOF test is not supported.

[0173] In the above implementation, the second configuration information includes the first field and the second field as an example for description. Optionally, the second configuration information may also include other fields except the first field and the second field. For example, the other fields may be, but are not limited to, the size of the image captured by the camera corresponding to the camera identifier, such as the CameraPicSize field.

[0174] In the above, the test method for the aperture of the camera and the TOF sensor of the camera provided by the embodiment of the present application is introduced. In practical applications, the camera located in the electronic device may also include other hardware, which may be, but is not limited to, a camera autofocus motor, a camera gyroscope, and a camera optical image stabilizer.

[0175] Optionally, in the embodiment of the present application, after or before the electronic device executes the test method for the camera aperture and the camera TOF sensor, it may also involve testing the camera autofocus motor, camera gyroscope, camera optical image stabilizer, etc. The electronic device can test the camera autofocus motor, camera gyroscope, and camera optical image stabilizer based on the test method provided in the traditional technology. For details not described in detail here, please refer to the following Figure 8 and Fig. 9 The relevant content in the method shown.

[0176] It should be understood that the above Figure 3 The camera hardware testing method shown is only for illustration and does not constitute any limitation on the camera hardware testing method provided in this application. Figure 3After the camera hardware testing method is shown, the electronic device can also perform tests on the camera's autofocus motor, the camera's gyroscope, and the camera's optical image stabilizer based on traditional methods.

[0177] In an embodiment of the present application, the first configuration information of the camera located in the electronic device obtained by the electronic device indicates that the aperture of the camera supports multiple aperture values; when the hardware test function is started, the aperture can be adjusted to each aperture value of all aperture values ​​(i.e., multiple aperture values) supported by the aperture through the aforementioned first configuration information to detect whether the aperture is faulty; the above method detects each aperture value supported by the aperture, so the method can effectively test the aperture of the camera, which is beneficial to improve the production yield of the camera of the electronic device. In addition, in the case where the camera located in the electronic device is equipped with a TOF sensor, the electronic device can also test whether the TOF sensor of the camera located in the electronic device is faulty according to the capture screen instruction and the preset image. The method can realize the effective detection of the TOF sensor of the camera, which is beneficial to further improve the production yield of the camera of the electronic device.

[0178] For example, the following is combined Figure 5 Taking the aperture test of the camera in the electronic device as an example, another camera hardware test method provided by the embodiment of the present application is introduced. It can be understood that, Figure 5 The camera hardware testing method described above is Figure 3 A specific example of the described camera hardware testing method, Figure 5 The described method is for illustration only and does not constitute any limitation to the camera hardware testing method provided in this application.

[0179] Figure 5 is a schematic diagram of another camera hardware testing method provided in an embodiment of the present application. The camera hardware testing method provided in an embodiment of the present application can be Figure 1 The electronic device 100 shown in the figure is executed, wherein the electronic device 100 can be, but is not limited to, a mobile phone or a tablet. It can be understood that the electronic device 100 can be implemented as software, or a combination of software and hardware. Figure 5 As shown, the method includes steps S501 to S511. S501 to S511 are described in detail below.

[0180] S501: A test process in an electronic device determines whether to test an aperture of a camera of the electronic device.

[0181] The test process is a process running in the electronic device, wherein the test process may include one or more sub-threads, which is not specifically limited. The name of the test process is also not specifically limited, that is, the test process in S501 above may also be called a process with other names, for example, a process with other names may be, but is not limited to, a detection process or a monitoring process, etc.

[0182] In the embodiment of the present application, the method for determining whether to test the aperture of the camera during the test process is not specifically limited.

[0183] In some implementations, the test process determines whether to test the aperture of the camera of the electronic device according to whether the variable aperture test switch is turned on or off. Specifically, when the test process detects that the variable aperture test switch is turned on, it is determined that the aperture of the camera needs to be tested; when the test process detects that the variable aperture test switch is turned off, it is determined that the aperture of the camera does not need to be tested. Exemplarily, when the aperture of the camera of the electronic device only supports one aperture value, the variable aperture test switch of the electronic device can be in a closed state, and therefore, the test process can determine that the aperture of the camera does not need to be tested. Exemplarily, when the aperture of the camera of the electronic device supports multiple aperture values, the variable aperture test switch can be in an open state, and therefore, the test process can determine that the aperture of the camera needs to be tested.

[0184] In other implementations, the test process determines whether to test the aperture of the camera of the electronic device based on test information reported by the application layer of the electronic device, and the test information indicates whether the aperture of the camera needs to be tested or not.

[0185] The timing of executing the above S501 in the test process is not specified. For example, the test process may be to execute the above S501 when the electronic device's camera is in the preview state for the first time after the electronic device is turned on. For another example, the test process may be to execute the above S501 each time the electronic device's camera is in the preview state. After the test process executes the above S501, if it is determined that the aperture of the camera needs to be tested, then S502 to S511 will continue to be executed; if it is determined that the aperture of the camera does not need to be tested, then the camera hardware test process will end thereafter.

[0186] S502, the test process obtains the aperture range list of the camera (i.e., the above Figure 3 An example of the first configuration information in the method shown).

[0187] The test process executes the above S502, that is, when the test process determines that the aperture of the camera of the electronic device needs to be tested, the test process obtains the aperture range list of the camera of the electronic device.

[0188] The aperture range list of the camera records the aperture values ​​supported by the aperture of the camera. The aperture range list of the camera includes the number of aperture values ​​and the value of each aperture value, and there is no specific limitation.

[0189] In some implementations, the aperture of the camera supports multiple aperture values, that is, the aperture range list of the camera includes the multiple aperture values, wherein the multiple aperture values ​​correspond to the multiple clear apertures one by one, each aperture value is the ratio between the focal length of the camera lens and the clear aperture corresponding to each aperture value (that is, the inverse of the relative aperture), and the multiple aperture values ​​are different. For example, the aperture range list of the camera is {TAG1=F1.8, TAG2=F2.8, TAG3=F4.0}. For example, the aperture range list of the camera is {TAG1=F4.0, TAG3=F5.6}.

[0190] In some other implementations, the aperture of the camera supports one aperture value, that is, the aperture range list of the camera includes the one aperture value. For example, the aperture range list of the camera is {TAG1=F2.8}. For example, the aperture range list of the camera is {TAG1=F4}.

[0191] There is no specific limitation on the method for the test process to obtain the aperture range list of the camera. In some implementations, the application framework layer of the electronic device is provided with the android.hardware.Camera class, and the test process in the application layer of the electronic device can send the "android.lens.info.availableApertures" TAG value to the application framework layer of the electronic device, and obtain the aperture range list of the camera through the return result of the application framework layer for the TAG value.

[0192] In the embodiment of the present application, the "android.lens.info.availableApertures" TAG value negotiated by the application layer and the application framework layer can be dynamically adjusted according to demand. That is to say, in subsequent use, if there is a new demand to add a new aperture value, the new aperture value attribute can be directly added to the "android.lens.info.availableApertures" TAG value to obtain a new "android.lens.info.availableApertures" TAG value. It can be understood that in the embodiment of the present application, the application layer of the electronic device has backward compatibility, that is, the application layer can issue the old "android.lens.info.availableApertures" TAG value or the new "android.lens.info.availableApertures" TAG value normally.

[0193] It is understood that, when the aperture range list of the camera includes multiple aperture values, the aperture of the camera of the electronic device is a variable aperture. When the aperture range list of the camera includes only one aperture value, the aperture of the camera of the electronic device is a fixed aperture. When the aperture of the camera is a variable aperture, the purpose of changing the aperture value of the aperture can be achieved by, but not limited to, controlling and rotating multiple metal blades of the aperture of the camera.

[0194] S503, the test process determines whether the length of the camera's aperture range list is less than 2.

[0195] The length of the aperture range list of the camera is equal to the number of TAG values ​​(i.e., aperture values) included in the aperture range list of the camera. For example, if the aperture range list of the camera is {TAG1=F1.8}, the length of the aperture range list of the camera is 1. For another example, if the aperture range list of the camera is {TAG1=F1.8, TAG2=F2.8}, the length of the aperture range list of the camera is 2.

[0196] The 2 in the above S503 is a preset value, which is a positive integer greater than or equal to 2. There is no specific limitation on the value of the preset value, and it can be set according to the number of aperture values ​​supported by the aperture. For example, if the number of aperture values ​​supported by the aperture of the camera is 2, the preset value is equal to 2. For another example, if the number of aperture values ​​supported by the aperture of the camera is 3, the preset value is equal to 3.

[0197] In the embodiment of the present application, if the test process determines that the length of the aperture range list of the camera is less than 2, the test process determines that the camera does not support the variable aperture test. If the test process determines that the length of the aperture range list of the camera is not less than 2, the test process determines that the camera supports the variable aperture test. Therefore, after the test process executes the above S503, if it is determined that the length of the aperture range list of the camera is less than 2, S504 is executed thereafter; if it is determined that the length of the aperture range list of the camera is not less than 2, S505 is executed thereafter.

[0198] S504, the test process reports error information.

[0199] The above S504 is executed, that is, when the length of the aperture range list of the camera is less than 2, the test process reports an error message.

[0200] The error message indicates that the aperture of the camera of the electronic device is not a variable aperture, that is, the variable aperture test process ends after executing the above S504. It can be understood that the aperture of the camera is not a variable aperture, that is, the aperture of the camera only supports one aperture value.

[0201] There is no specific limitation on the way in which the test process reports the error information. For example, after the test process executes the above S504, the display screen of the electronic device may display information that the aperture of the camera of the electronic device is not a variable aperture.

[0202] S505, the test process sets the aperture mode to manual mode.

[0203] Executing the above S505, that is, when the aperture of the camera of the electronic device is a variable aperture (that is, the aperture supports multiple aperture values), the test process has the authority to modify the aperture value of the camera aperture. It is understandable that before the test process executes the above S505, the aperture mode of the electronic device is automatic mode, and the test process cannot modify the aperture value of the aperture in automatic mode.

[0204] There is no specific limitation on the setting method of setting the aperture to manual mode in the test process. Exemplarily, the test process sets the aperture to manual mode, including: the test process sends to the application framework layer of the electronic device to modify the permission attribute corresponding to the aperture to 0, so that the aperture is adjusted from the automatic mode to the manual mode.

[0205] S506, the test process determines whether the aperture mode is successfully set to the manual mode.

[0206] After the test process executes S505, the application framework layer of the electronic device returns information to the test process whether the aperture mode is set to manual mode successfully. Therefore, when the test process executes S506, it can know whether the aperture mode is manual mode according to the information returned by the application framework layer.

[0207] After the test process executes the above S506, if it is determined that the aperture mode has been successfully set to the manual mode, then continue to execute S507; if it is determined that the aperture mode has not been successfully set to the manual mode, then continue to execute S504.

[0208] It is understandable that, when the aperture mode has been successfully set to manual mode, the test process can send the aperture value in the aperture range list of the camera at a preset time interval to perform stress testing on the variable aperture to stimulate device defects. There is no specific limitation on the preset time length, and it can be set according to actual conditions. For example, the preset time length can be, but is not limited to, 0.5 seconds or 1 second.

[0209] S507, the test process sends the jth aperture value corresponding to the aperture list index number j in the aperture range list of the camera to the aperture of the camera, and increases the value of j by 1.

[0210] The test process executes the above S507, that is, when the aperture mode is successfully set to manual mode, each aperture value (i.e., the jth aperture value) in the aperture range list of the camera is sent down to perform a stress test on the aperture of the camera to stimulate the defect of the aperture device.

[0211] S508, the test process determines whether the aperture size of the camera is successfully adjusted to the jth aperture value.

[0212] After the test process executes the above S507, the application framework layer of the electronic device will return the adjustment information of the aperture of the camera, wherein the adjustment information indicates whether the aperture of the camera is successfully switched to the jth aperture value, where j is a positive integer. Therefore, the test can determine whether the aperture size of the camera is successfully adjusted to the jth aperture value based on the adjustment information.

[0213] After the test process executes the above S507, if it is determined that the aperture size of the camera is successfully adjusted to the jth aperture value, then continue to execute S510; if it is determined that the aperture size of the camera is failed to be adjusted to the jth aperture value, then continue to execute S509.

[0214] S509, the test process determines that the aperture of the camera fails.

[0215] The test process executes the above S509, that is, the test process determines that the camera's aperture is faulty when the camera's aperture size is not successfully adjusted to the jth aperture value. In other words, the test process can determine that the camera's aperture is faulty as long as it is detected that the camera's aperture is not successfully adjusted to any aperture value in the camera's aperture range list.

[0216] For example, the aperture range list of the camera includes aperture list index number 1, aperture list index number 2, and aperture list index number 3, that is, the maximum value of j is equal to 3. Therefore, when the test process fails to successfully adjust the aperture size of the camera to the first aperture value, the test process can determine that the aperture of the camera is faulty; when the test process fails to successfully adjust the aperture size of the camera to the second aperture value, the test process can determine that the aperture of the camera is faulty; or when the test process fails to successfully adjust the aperture size of the camera to the third aperture value, the test process can determine that the aperture of the camera is faulty.

[0217] S510, the test process determines whether the aperture list index number j is less than the length of the aperture range list of the camera.

[0218] The aperture list index number j represents the serial number of the jth aperture value in the aperture range list of the camera, and the aperture value currently configured for the camera is the aperture value corresponding to the aperture list index number j.

[0219] After the test process executes the above S510, if it is determined that the aperture list index number j is not less than the length of the aperture range list of the camera, S511 is then executed; if it is determined that the aperture list index number j is less than the length of the aperture range list of the camera, the test process increases the value of j by 1 and executes S507. It can be understood that the aperture list index number j is not less than the length of the aperture range list of the camera, that is, the aperture list index number j is greater than the length of the aperture range list of the camera.

[0220] S511, the test process determines that the aperture of the camera is not faulty, and turns off the manual mode of the aperture to set the mode of the aperture to the automatic mode.

[0221] The test process executes the above S511, that is, when it is determined that the aperture list index number j is not less than the length of the aperture range list of the camera, the test process turns off the aperture manual mode to set the aperture mode to the automatic mode. After the test process executes the above S511, the aperture of the electronic device is in the automatic mode, that is, the test process cannot modify the aperture value (i.e., the size of the aperture) thereafter.

[0222] There is no specific limitation on the setting method of closing the aperture manual mode in the test process. Exemplarily, closing the aperture manual mode in the test process includes: the test process changes the permission attribute corresponding to the aperture from 0 to 1 to close the aperture manual mode, so that the aperture is in automatic mode after closing the aperture manual mode.

[0223] It should be understood that the above Figure 5 The camera hardware testing method shown is only for illustration and does not constitute any limitation on the camera hardware testing method provided in the embodiment of the present application. For example, the preset value 2 in the above S503 can also be replaced by other values ​​greater than 2, such as 3 or 5. For another example, after executing the above S501 to S511, the test process can also execute the above Figure 3 The method steps for testing the TOF sensor of the camera in the provided method.

[0224] In an embodiment of the present application, the test process of the electronic device can perform a stress test on the aperture of the camera according to the multiple aperture values ​​supported by the aperture of the camera, by continuously sending each aperture value of the multiple aperture values ​​included in the aperture range list of the camera to the aperture of the camera, so that the aperture of the camera rotates the aperture blades to switch the aperture value of the camera to the corresponding issued aperture value, so as to realize the detection of the aperture of the camera. In the case where the aperture of the camera can be successfully switched to each aperture value of the multiple aperture values ​​supported by the aperture of the camera, the test process of the electronic device determines that the aperture of the camera has not failed. In summary, this test method can realize the effective detection of the aperture of the camera, which is conducive to improving the production yield of the camera of the electronic device.

[0225] In the above, the test method for the aperture of the camera located in the electronic device provided by the embodiment of the present application is introduced, as well as the test method for the TOF sensor of the camera located in the electronic device before the aperture test. Optionally, in some other implementations, the electronic device can also only perform the test steps for the TOF sensor of the camera located in the electronic device. Next, in conjunction with the accompanying drawings, another camera hardware test method provided by the embodiment of the present application is introduced in detail.

[0226] Figure 6 is a schematic diagram of another camera hardware testing method provided in an embodiment of the present application. The camera hardware testing method provided in an embodiment of the present application can be performed by an electronic device including a camera. It is understood that the electronic device can be implemented as software, or a combination of software and hardware. Exemplarily, the electronic device in the embodiment of the present application can be, but is not limited to, Figure 1 The electronic device 100 is shown. Figure 6 As shown, the camera hardware testing method provided in the embodiment of the present application includes S610 and S620. S610 and S620 are described in detail below.

[0227] S610, the electronic device obtains a picture capturing instruction, wherein the picture capturing instruction is used to instruct to perform a preset number of shots of a target object based on a first aperture value configured for the camera.

[0228] In the above S610, the electronic device includes a camera.

[0229] S620, when the hardware test function is started, the electronic device determines whether the time-of-flight TOF sensor of the camera is faulty according to the capture screen instruction and the preset image, wherein the preset image is an image obtained by shooting the target object based on the first aperture value by a camera equipped with a TOF sensor that has not failed.

[0230] In an embodiment of the present application, the electronic device determines whether a time-of-flight TOF sensor of a camera fails according to a capture screen instruction and a preset image, including: the electronic device controls the camera to perform multiple shots of a target object based on a first aperture value according to the capture screen instruction to obtain multiple target images; when the difference between each target image in the multiple target images and the preset image does not exceed a preset threshold, the electronic device determines that the TOF sensor has not failed; when the difference between at least one target image in the multiple target images and the preset image exceeds a preset threshold, the electronic device determines that the TOF sensor has failed.

[0231] Optionally, when the hardware test function is started, before determining whether the TOF sensor of the camera is faulty based on the capture screen instruction and the preset image, the electronic device may also perform the following steps: the electronic device obtains configuration information of the camera, wherein the configuration information includes a first field for indicating an identifier of the camera, and a second field for indicating that the camera is configured with a TOF sensor; the electronic device determines, based on the configuration information, that the camera is configured with a TOF sensor to start the hardware test function.

[0232] The configuration information in the above implementation is the same as the second configuration information in step S320 above. For the contents not described in detail here, please refer to the relevant description in step S320 above.

[0233] It should be noted that the contents not described in detail in the above S610 and S620 can be referred to in the above Figure 3 Related description in .

[0234] It should be understood that the above Figure 6 The camera hardware testing method shown is for illustration only and does not constitute any limitation to the camera hardware testing method provided in this application.

[0235] In an embodiment of the present application, when a camera located in an electronic device is equipped with a TOF sensor, the electronic device can test whether the TOF sensor of the camera located in the electronic device is faulty based on a capture screen instruction and a preset image. This method can achieve effective detection of the TOF sensor of the camera, thereby facilitating further improving the production yield of the camera of the electronic device.

[0236] Next, combine Figure 7 Another camera hardware testing method provided by an embodiment of the present application is introduced. It can be understood that, Figure 7 The camera hardware testing method described above is Figure 6 A specific example of the described camera hardware testing method, Figure 7 The described method is for illustration only and does not constitute any limitation to the camera hardware testing method provided in this application.

[0237] Figure 7 is a schematic diagram of another camera hardware testing method provided in an embodiment of the present application. The camera hardware testing method provided in an embodiment of the present application can be Figure 1 The electronic device 100 shown is executed, wherein the electronic device 100 may be, but is not limited to, a mobile phone or a tablet. It is understood that the electronic device 100 may be implemented as software, or a combination of software and hardware. For example, Figure 7 As shown, the method includes steps S701 to S707. Steps S701 to S707 are described in detail below.

[0238] S701, the test process of the electronic device sends a capture screen instruction i to the camera of the electronic device (i.e., the above Figure 6 An example of a capture screen instruction in the method shown), wherein the capture screen instruction i is used to instruct the camera to shoot the target object based on the target aperture value to display the obtained target image i on the display screen of the electronic device, and i is a positive integer.

[0239] The camera in S701 is the camera currently turned on in the electronic device. The number of cameras in the electronic device is not specifically limited and can be set according to actual conditions. For example, the electronic device includes only one front camera. For another example, the electronic device includes one front camera and one rear camera.

[0240] The target aperture value is the aperture value supported by the aperture of the camera of the electronic device, wherein the target aperture value is equal to the ratio of the focal length of the camera lens (i.e., the objective lens) corresponding to the camera to the light-clearance diameter of the camera lens (i.e., the inverse of the relative aperture).

[0241] The number of aperture values ​​supported by the aperture of the camera is not specifically limited. For example, the number of aperture values ​​supported by the aperture of the camera may be 1 or more (e.g., 2 or 5, etc.). It is understood that when the number of aperture values ​​supported by the aperture of the camera is more than one, the aperture may also be called a variable aperture.

[0242] In the above S701, the capture picture instruction i is used to instruct the camera to shoot the target object based on the target aperture value to display the obtained target image i on the display screen of the electronic device. Based on this, the capture picture instruction i may include parameters for the camera of the electronic device to perform the i-th preview shooting of the target object, wherein the parameters of the i-th preview shooting may include but are not limited to the following parameters: preview start time, preview duration, preview size, photo size and target aperture value.

[0243] In the embodiment of the present application, i is a positive integer, and the maximum value of i is a preset value, which can be set according to the actual situation without specific limitation. For example, the maximum value of i can be 2, 3 or 5. It can be understood that when the test process executes the above S701 for the first time, the value of i is equal to 0, that is, the camera of the electronic device has not yet performed the preview operation according to the capture screen instruction i after it is started.

[0244] The capture screen instruction i issued by the test process commands the camera to shoot the target object based on the target aperture value to obtain the target image i. Accordingly, after the camera of the electronic device receives the capture screen instruction i, the camera application will execute the relevant processes of preview and photo taking according to the parameters of the i-th preview shooting corresponding to the capture screen instruction i. For example, the relevant processes of preview and photo taking involve the camera calling the setRepeatingRequest() method to preview the screen and calling the capture() method to take photos, etc., wherein the camera needs to pass in the camera request CameraRequest parameter when calling the setRepeatingRequest() method and the capture() method. CameraRequest represents a capture request, which is used to describe the various parameter settings of the captured image (i.e., the parameters of the i-th preview shooting mentioned above).

[0245] Optionally, before executing the above S701, the electronic device may further perform the following steps: in response to a trigger operation, the electronic device activates a camera. The trigger operation is not specifically limited. For example, the trigger operation may be an operation in which a user clicks a camera icon in an interface of the electronic device with a finger. For another example, the trigger operation may be an operation in which a mouse clicks a camera icon in an interface of the electronic device.

[0246] It should be understood that in the above S701, the capture screen instruction i is described as an example for the same target object and the aperture size of the camera as the target aperture value, which does not constitute any limitation to the embodiments of the present application. For example, when the value of i is greater than or equal to 2, in the above S701, the captured object corresponding to each capture screen instruction in the multiple capture screen instructions can also be different.

[0247] S702, the test process determines whether the currently turned on camera in the electronic device is a camera that supports the TOF sensor.

[0248] The test process executes the above S702, that is, the test process determines whether the camera currently turned on in the electronic device is a front camera that supports the TOF sensor, including: the test process obtains the configuration information of the camera currently turned on in the electronic device (that is, the above Figure 6 The test process determines whether the currently turned on camera is a camera that supports the TOF sensor according to the configuration information of the currently turned on camera in the electronic device. It can be understood that if the currently turned on camera supports the TOF sensor, the currently turned on camera is a TOF camera.

[0249] There is no specific limitation on the way in which the test process determines to obtain the configuration information of the camera. For example, the test process can obtain the configuration information of the camera currently turned on in the electronic device by interacting with the camera manager (CameraManager) located in the application framework layer of the electronic device.

[0250] The configuration information of the camera described in S702 above may include a camera identifier and whether the camera corresponding to the camera identifier supports the TOF sensor function. The camera identifier is used to identify the camera in the electronic device, and the camera identifier is not specifically limited. For example, the camera identifier may be the camera number or the camera name, etc. Optionally, the above configuration information may also include other information, which may be, but is not limited to, the size of the image captured by the camera corresponding to the camera identifier and / or the camera title.

[0251] The format of the acquired camera configuration information is not specifically limited. Exemplarily, the format of the camera configuration information can be expressed as: TOF:2:1280*2898:0, wherein the meaning of each field is as shown in Table 2 below.

[0252] Table 2

[0253] Field value Field meaning TOF CameraTitle 2 CameraId 1280*2898 CameraPicSize 0 isSupportTofSensor

[0254] In the above Table 2, CameraTitle indicates the camera title. The CameraId field (i.e. Figure 6 The isSupportTofSensor field (i.e., the first field in the method shown above) indicates the camera ID. The CameraPicSize field indicates the size of the image captured by the camera. Figure 6 An example of the second field in the method shown) indicates whether the camera supports TOF test. For example, the value of the isSupportTofSensor field is 0, indicating that the TOF test is supported, and the value of the isSupportTofSensor field is 1, indicating that the TOF test is not supported. For example, the value of the isSupportTofSensor field is 1, indicating that the TOF test is supported, and the value of the isSupportTofSensor field is 0, indicating that the TOF test is not supported.

[0255] In an embodiment of the present application, after the test process executes the above S702, if it is determined that the camera currently turned on in the electronic device supports the camera of the TOF sensor, then continue to execute S703; if it is determined that the camera currently turned on in the electronic device is not a camera that supports the TOF sensor, then the camera hardware test process is terminated.

[0256] S703, the currently turned on camera in the electronic device draws a view i of the camera interface on the display screen of the electronic device.

[0257] The test process executes the above S703, that is, when the test process determines that the currently turned on camera is a camera that supports the TOF sensor, the test process will send an instruction to the currently turned on camera to draw view i of the camera interface, wherein the view i is used to display the target image i obtained according to the capture screen instruction i.

[0258] S704, the currently turned on camera in the electronic device shoots the target object according to the capture image instruction i, and draws the obtained target image i on the view i.

[0259] S705, the test process determines whether the TOF sensor of the currently turned on camera is normal according to the target image i.

[0260] The test process determines whether the TOF sensor of the currently turned-on camera is normal according to the target image i, including: the test process determines whether the TOF sensor of the currently turned-on camera is normal according to the target image i and a preset image, wherein the preset image is an image obtained by the camera based on a non-faulty TOF camera shooting the target object based on the target aperture value; if the difference between the target image i and the preset image does not exceed a preset threshold, it is determined that the TOF sensor of the camera is normal; or, if the difference between the target image i and the preset image exceeds a preset threshold, it is determined that the TOF sensor of the camera is abnormal (i.e., a fault occurs).

[0261] After the test process executes the above S705, if it is determined that the TOF sensor of the currently turned on camera fails, then continue to execute S706; if the TOF sensor of the currently turned on camera is normal (ie, no failure occurs), then continue to execute S707.

[0262] S706: The test process reports a TOF sensor failure.

[0263] When executing S706 , that is, when it is determined that the function of the TOF sensor to generate images is abnormal, the test process may report the TOF sensor failure information to the application layer (eg, camera application) of the electronic device.

[0264] S707, the test process determines whether i is less than a preset value.

[0265] After the test process executes the above S707, if it is determined that i is less than the preset value, then S701 is continued; if it is determined that i is not less than the preset value, then the camera hardware test process is terminated. It can be understood that i is not less than the preset value can be i is equal to the preset value.

[0266] When the test process determines that i is less than the preset value, the electronic device then executes S701 to S707 for the second time. It is understandable that the value of i when the electronic device executes S701 to S707 for the second time is 1 greater than the value of i when the electronic device executes S701 to S707 for the first time, and the aperture value 2 associated with the corresponding photographing instruction 2 when the electronic device executes S701 to S707 for the second time is different from the aperture value 1 associated with the corresponding photographing instruction 1 when the electronic device executes S701 to S707 for the first time.

[0267] Optionally, after the electronic device executes the above S701 to S707, the electronic device may also execute the above Figure 5 The camera hardware test process described in S501 to S511 is shown.

[0268] It should be understood that the above Figure 7 The camera hardware testing method shown is for illustration only and does not constitute any limitation on the camera hardware testing method provided in the embodiment of the present application. For example, before the test process executes the above S702, a step of determining whether the camera currently turned on in the electronic device is a front camera may also be executed. In this implementation, if the test process determines that the currently turned on camera is a front camera, then the above S702 will continue to be executed; if the test process determines that the currently turned on camera is a rear camera, then the camera hardware testing process will end thereafter.

[0269] In an embodiment of the present application, a scheme for stress testing a camera's TOF sensor is provided, namely, a target object is photographed by a camera supporting a TOF sensor within a period of time to obtain multiple target images, and the difference between a preset image and each target image is compared to determine whether the camera's TOF sensor is faulty. In summary, this testing method can achieve accurate detection of the camera's TOF sensor, thereby helping to improve the accuracy of the camera hardware test results.

[0270] In the above, the test method for the aperture of the camera and the TOF sensor of the camera provided by the present application is introduced. In practical applications, the hardware of the camera located in the electronic device also includes other hardware in addition to the aperture and TOF sensor. For example, the other hardware can be but is not limited to the autofocus motor of the camera, the gyroscope of the camera, and the optical image stabilizer of the camera. Next, in conjunction with the accompanying drawings, the camera hardware testing method provided by the present application is introduced to be nested in the method steps for testing other hardware of the camera.

[0271] Figure 8 is a schematic diagram of another camera hardware testing method provided in an embodiment of the present application. The camera hardware testing method provided in an embodiment of the present application can be Figure 1The electronic device 100 shown is executed, wherein the electronic device 100 may be, but is not limited to, a mobile phone or a tablet. It is understood that the electronic device 100 may be implemented as software, or a combination of software and hardware. For example, Figure 8 As shown, the method includes steps S801 to S811. S801 to S811 are described in detail below.

[0272] S801, the electronic device obtains configuration information of the camera.

[0273] In the above step S810, the configuration information of the camera may include a first field for indicating the identification of the camera, and a second field for indicating that the camera is configured with a TOF sensor. The description of the first field and the second field can refer to the relevant description in the above step S320, which will not be repeated here. Optionally, the configuration information of the camera may also include the aperture value supported by the aperture of the camera. The aperture value supported by the aperture of the camera can refer to the relevant description in the above step S310, which will not be repeated here. Optionally, the configuration information of the camera may also include a field indicating whether the camera is a front camera or a rear camera.

[0274] S802, the electronic device turns on the camera.

[0275] The electronic device executes the above S802, which may exemplarily include the following steps: the electronic device registers a listener (setSurfaceTextureListener) when initialized; in response to the listener detecting that the texture (TextTure) displaying the camera preview is in an available state, the electronic device calls the onSurfaceTextureAvailable() method to open the camera of the electronic device through the method.

[0276] S803, the electronic device sets the preview size of the camera.

[0277] The method for setting the preview size of the camera of the electronic device is not specifically limited and can be set according to actual needs.

[0278] The electronic device executes the above-mentioned S803 step, which may exemplarily include the following steps: in response to turning on the camera, the electronic device records the width and height values ​​of the control texture currently previewed by the camera; obtains the characteristic information (CameraCharacteristics) of the specified camera and the available stream configurations supported by the currently opened camera through the camera manager (cameramanager) object of the electronic device, and obtains the target width value and target height value of the texture previewed by the camera according to the direction of the electronic device and the camera direction of the camera; the electronic device sets the result in the characteristic information of the specified camera that best matches the target value (i.e., the target width value and the target height value) as the height value and width value of the texture previewed by the camera, so as to achieve the purpose of setting the preview size of the camera.

[0279] S804, the electronic device creates an image reader (ImageReader).

[0280] After the electronic device executes the above S804, when the camera performs preview, the camera preview data can be obtained through the image reader.

[0281] S805, the electronic device turns on a designated camera.

[0282] The camera manager (CameraManager) of the electronic device can be used to manage all cameras (i.e., cameras) installed in the electronic device. It manages all camera devices installed in the electronic device. Its main function is to obtain a camera list and open a specified camera. Based on this, the above S805 is executed, that is, the camera manager of the electronic device calls openCamera to open the camera specified by the function.

[0283] S806, the electronic device creates a camera capture session (CameraCaptureSession).

[0284] The camera capture session represents a session between the upper layer (i.e., application layer) and the lower layer (i.e., application framework layer) of the electronic device. Through this camera capture session, instructions can be sent to the camera to allow the camera to perform operations such as previewing, taking photos and recording videos.

[0285] The electronic device executes the above step S806, which may exemplarily include the following steps: the electronic device creates a camera capture session through a camera device (CameraDevice).

[0286] S807, the camera of the electronic device starts previewing.

[0287] When the camera capture session is successfully established, the electronic device will call back the onConfigured() function to continue setting the properties of the preview request object in the onConfigured() function. For example, the properties of the preview request object may include, but are not limited to, the following properties: whether to auto focus, auto exposure, auto white balance, etc.

[0288] S808, the electronic device sends a request for repeated screen capture (setRepeatingRequest).

[0289] The electronic device executes the above S808, exemplarily, and may include the following steps: the preview request builder object of the electronic device calls the build() method to build a capture request object, and sets an endless preview request (i.e., setRepeatingRequest) through the capture session (captureSession), thereby realizing the camera preview through this endless occurrence of preview requests.

[0290] S809: The electronic device determines, based on the camera configuration information, whether the currently turned on camera is a front camera equipped with a TOF sensor.

[0291] The configuration information of the camera includes a second field for indicating that the camera is equipped with a TOF sensor, and whether the TOF sensor is a camera that supports the TOF sensor can be known according to the second field. In the case where the configuration information of the camera includes a field indicating whether the camera is a front camera or a rear camera, the electronic device can determine whether the currently opened camera is a front camera or a rear camera according to the field.

[0292] S810, the electronic device performs a TOF sensor test of the camera.

[0293] The detailed steps of the electronic device executing the above S810 can be found in the above Figure 3 or see the relevant description in the above Figure 7 The relevant description will not be repeated in detail here.

[0294] S811, the electronic device performs a test of an auto focus motor of a camera, a gyroscope of the camera, an optical image stabilizer of the camera, and an aperture of the camera.

[0295] The method for the electronic device to perform the aperture test of the camera in S811 can be seen above. Figure 3 The relevant description in will not be repeated here in detail. The electronic device may first test the aperture of the camera, and then test the autofocus motor of the camera, the gyroscope of the camera, and the optical image stabilizer of the camera respectively. Alternatively, the electronic device may first test the autofocus motor of the camera, the gyroscope of the camera, and the optical image stabilizer of the camera respectively, and finally test the aperture of the camera.

[0296] In an embodiment of the present application, the process of the electronic device executing the test method of the camera's autofocus motor AF, the camera's gyroscope, and the camera's optical image stabilizer in the above step S811 mainly includes the following process: first, determine whether it is necessary to execute the test steps of the corresponding camera hardware; if it is necessary to execute the test steps of the corresponding camera hardware, implement the test of the camera hardware by sending the test value. If it is determined that it is not necessary to execute the test steps of a certain camera hardware or the test of the certain camera hardware has been completed (for example, the camera's autofocus motor), continue to determine whether it is necessary to execute the test steps of another camera hardware (for example, the camera's gyroscope).

[0297] For example, the electronic device may first perform the above test process on the camera's autofocus motor. Then, the electronic device may perform the above test process on the camera's optical image stabilizer. Finally, the electronic device performs the above test process on the camera's gyroscope.

[0298] It should be understood that the above Figure 8 The camera hardware testing method shown is for illustration only and does not constitute any limitation on the camera hardware testing method provided in the embodiments of the present application. Figure 8 The test order of the autofocus motor, the camera's gyroscope, and the camera's optical image stabilizer in step S811 can be arbitrarily changed according to actual needs.

[0299] In an embodiment of the present application, the aperture, TOF sensor, autofocus motor AF, camera gyroscope, and camera optical image stabilizer of the camera located in the electronic device are detected by stress testing. The quality of these key components determines whether the camera fails. The method simultaneously performs tests on multiple hardware of the camera to check whether the camera fails. In this way, in the event that at least one of the multiple hardware of the camera fails, the interception rate of the camera detection can be improved, which is conducive to improving the production yield of the camera of the electronic device. In addition, through the nested test method, the test of the aperture, TOF sensor, autofocus motor AF, camera gyroscope, and camera optical image stabilizer of the camera can be completed at one time, so that a certain amount of time overhead can be reduced, thereby improving the overall test efficiency.

[0300] Next, combine Fig. 9 The following describes the steps of the electronic device executing the test flow of the camera's autofocus motor, the camera's gyroscope, and the camera's optical image stabilizer in the above step S811 by way of example.

[0301] Fig. 9Schematic diagram of the electronic device executing the test flow of the camera's autofocus motor, the camera's gyroscope, and the camera's optical image stabilizer in the above step S811. Fig. 9 The test process includes steps S901 to S919. S901 to S919 are described below.

[0302] S901, setting preview parameters, and sending a preview request and preview shooting parameters.

[0303] Exemplarily, an endless preview request (ie, setRepeatingRequest) is set through a capture session (captureSession), so that the camera preview is implemented through the endless occurrence of the preview request.

[0304] The preview shooting parameters may include, but are not limited to, preview start time, preview duration, preview size, photo size, aperture value and other parameters.

[0305] S902: Determine whether the currently opened camera is a rear-mounted camera.

[0306] Optionally, before executing the above S902, camera configuration information may be obtained, and it is determined whether the currently opened camera is a rear-facing camera or a front-facing camera according to the camera configuration information.

[0307] After executing the above S902, if it is determined that the currently opened camera is a rear-facing camera, then S903 is executed; if it is determined that the currently opened camera is a front-facing camera, then S914 is executed.

[0308] S903, checking whether the preset AF parameters of the rear camera are correct.

[0309] S904: Determine whether the AF of the rear camera needs to be tested.

[0310] For example, when the rear camera in the electronic device is equipped with AF, it is determined that the AF of the rear camera needs to be tested; and when the rear camera in the electronic device is not equipped with AF, it is determined that the AF of the rear camera does not need to be tested.

[0311] After executing the above S904, if it is determined that the AF of the rear camera needs to be tested, then S905 is executed; if it is determined that the AF of the rear camera does not need to be tested, then S907 is executed.

[0312] S905, opening the AF parameter setting properties of the rear camera.

[0313] S906, setting the AF value of the rear camera, and closing the parameter setting attribute 1 second after the setting is completed.

[0314] The 1 second in the above S906 is a preset time length, and the preset time length can be set according to actual conditions.

[0315] S907, determine whether the gyroscope needs to be tested.

[0316] For example, when the rear camera in the electronic device is equipped with a gyroscope, it is determined that the gyroscope needs to be tested; and when the rear camera in the electronic device is not equipped with a gyroscope, it is determined that the gyroscope does not need to be tested.

[0317] After executing the above S907, if it is determined that the gyroscope needs to be tested, then S908 is executed; if it is determined that the gyroscope does not need to be tested, then S909 is executed.

[0318] S908, setting the optical image stabilizer switch to an available state.

[0319] S909, determining whether the AF or gyroscope of the rear camera has been tested.

[0320] For example, after executing the AF or gyroscope test of the rear camera, the electronic device will record the result of the corresponding camera hardware. Therefore, the electronic device can determine whether to execute the test steps for the corresponding camera hardware according to whether the test result of the corresponding camera hardware is recorded.

[0321] After executing the above S909, if it is determined that the AF or gyroscope of the rear camera has been tested, then S910 is executed; if it is determined that the AF and gyroscope of the rear camera have not been tested, then S911 is executed.

[0322] S910, closing the test executed in the above step S909.

[0323] Exemplarily, if it is determined after executing S909 that the AF of the rear camera has been tested, S910 is executed, i.e., the AF test of the rear camera is turned off; if it is determined after executing S909 that the gyroscope has been tested, S910 is executed, i.e., the gyroscope test is turned off; if it is determined after executing S909 that the AF and gyroscope tests of the rear camera have been tested, S910 is executed, i.e., the AF test and gyroscope test of the rear camera are turned off.

[0324] S911, determining whether to test the optical image stabilizer.

[0325] For example, when the rear camera in the electronic device is equipped with an optical image stabilizer, it is determined that the optical image stabilizer needs to be tested; and when the rear camera in the electronic device is not equipped with an optical image stabilizer, it is determined that the optical image stabilizer does not need to be tested.

[0326] After executing the above S911, if it is determined that the optical image stabilizer needs to be tested, then S912 is executed; if it is determined that the optical image stabilizer does not need to be tested, then S913 is executed.

[0327] S912, start testing the optical image stabilizer and record the test result of the optical image stabilizer.

[0328] S913, start the subsequent photo-taking process.

[0329] S914, open the front camera.

[0330] S915, checking whether the preset AF parameters of the front camera are correct.

[0331] After executing the above S915, if it is determined that the AF of the front camera needs to be tested, S916 is then executed; if it is determined that the AF of the front camera does not need to be tested, S913 is then executed.

[0332] S916, determining whether to test the AF of the front camera.

[0333] For example, when the front camera in the electronic device is equipped with AF, it is determined that the AF of the front camera needs to be tested; and when the front camera in the electronic device is not equipped with AF, it is determined that the AF of the front camera does not need to be tested.

[0334] After executing the above S916, if it is determined that the AF of the front camera needs to be tested, then S917 is executed; if it is determined that the AF of the front camera does not need to be tested, then S913 is executed.

[0335] S917, open the AF parameter setting properties of the front camera.

[0336] S918, setting the AF value of the front camera, and closing the parameter setting attribute 1 second after the setting is completed.

[0337] The 1 second in the above S918 is a preset time length, and the preset time length can be set according to actual conditions.

[0338] S919, turn off the AF test of the front camera.

[0339] It should be understood that the above Fig. 9 This is only an example and does not constitute any limitation on the test process of the camera's autofocus motor, the camera's gyroscope, and the camera's optical image stabilizer in the above step S811 executed by the electronic device.

[0340] Fig.10 is a schematic diagram of another camera hardware testing method provided in an embodiment of the present application. The camera hardware testing method provided in an embodiment of the present application can be Figure 1The electronic device 100 shown is executed, wherein the electronic device 100 may be, but is not limited to, a mobile phone or a tablet. It is understood that the electronic device 100 may be implemented as software, or a combination of software and hardware. For example, Fig.10 As shown, the method includes steps S1000 to S1016. Below, S1000 to S1016 are described in detail.

[0341] S1000: The electronic device obtains configuration information of the camera and performs initialization processing on the preview interface of the camera.

[0342] The camera configuration information includes relevant information about the hardware configured in the camera, including an aperture, a TOF sensor, an autofocus motor AF, a gyroscope of the camera, and an optical image stabilizer of the camera.

[0343] Initialize the preview interface of the camera, that is, set the initial height and initial width of the preview interface.

[0344] S1001, the electronic device turns off the camera.

[0345] S1002, the electronic device turns on the camera.

[0346] Exemplarily, in response to the electronic device detecting that a user touches the desktop of the electronic device to operate a camera application, the electronic device turns on the camera.

[0347] S1003, the electronic device determines whether the camera is turned on.

[0348] After the electronic device executes the above S1002, the application framework layer of the electronic device can return information on whether the camera is turned on, so that the electronic device can know whether the camera is turned on based on the information.

[0349] After the electronic device executes the above S1003, if it is determined that the camera is turned on, it continues to execute S1004; if it is determined that the camera is not turned on, the camera hardware test process ends.

[0350] S1004, the electronic device registers a camera status callback and registers a picture callback monitor.

[0351] Electronic devices can obtain camera status change information through camera status callback.

[0352] S1005, the electronic device determines whether the camera status callback is successful.

[0353] The electronic device can learn whether the camera status callback is successful based on the result returned by the registered picture callback monitoring.

[0354] After the electronic device executes the above S1005, if it is determined that the camera status callback is successful, it continues to execute S1006; if it is determined that the camera status callback is unsuccessful, the camera hardware test process ends.

[0355] S1006, the electronic device determines whether the callback has data.

[0356] Callback data refers to the data obtained by setting the camera status callback for the camera.

[0357] The electronic device determines whether the callback has data based on the return result of the registered camera status callback. If the return result carries the image data, it can be considered that the callback has data, that is, the callback is successful; if the return result does not carry the image data, it can be considered that the callback has no data, that is, the callback fails.

[0358] After the electronic device executes the above S1006, if it is determined whether the callback has data, it continues to execute S1007; if it is determined that the callback has no data, the camera hardware test process ends.

[0359] S1007, the electronic device creates a preview window and registers a camera capture session.

[0360] The electronic device executes the above S1007, that is, when the callback has data, the electronic device creates a preview window and registers a camera capture session.

[0361] The electronic device can create a preview window through the camera API, and the preview window is used to display the preview result of the camera.

[0362] The camera capture session represents a session between the upper layer (i.e., application layer) and the lower layer (i.e., application framework layer) of the electronic device. Through this camera capture session, instructions can be sent to the camera to allow the camera to perform operations such as previewing, taking photos and recording videos.

[0363] S1008, the electronic device determines whether the turned-on camera is a front-facing TOF camera.

[0364] The electronic device can determine whether the currently turned on camera is a front-facing TOF camera according to the camera configuration information obtained in the above step S1001. The front-facing TOF camera means that the front-facing camera is equipped with a TOF sensor.

[0365] After the electronic device executes the above S1008, if it is determined that the turned-on camera is a front TOF camera, it continues to execute S1009; if it is determined that the turned-on camera is not a front TOF camera, it continues to execute S1010.

[0366] S1009, the electronic device executes a test process for the TOF sensor of the camera.

[0367] The principle of the electronic device testing the TOF sensor of the camera in the above step S1009 is similar to the above Figure 3 The electronic device described in the provided method performs the same test principle on the TOF sensor of the camera. For matters not described in detail here, please refer to the relevant description above.

[0368] S1010, the electronic device determines whether to test the AF of the camera.

[0369] When the electronic device determines that the camera is equipped with AF according to the configuration information of the camera, it can be determined that the AF of the camera needs to be tested.

[0370] S1011, the electronic device executes a test process for the AF of the camera.

[0371] The principle of the electronic device executing the above step S1011 is the same as that in the above Fig. 9 The principle of testing the AF of the camera in the provided method is the same. For the contents not described in detail here, please refer to the relevant description above.

[0372] S1012, the electronic device determines whether to test the gyroscope of the camera.

[0373] When the electronic device determines, based on the configuration information of the camera, that the camera is equipped with a gyroscope, it can be determined that the gyroscope of the camera needs to be tested.

[0374] S1013, the electronic device executes a test process for the gyroscope of the camera.

[0375] The principle of the electronic device executing the above step S1013 is the same as that in the above Fig. 9 The principle of testing the camera's gyroscope in the provided method is the same. For matters not described in detail here, please refer to the relevant description above.

[0376] S1014, the electronic device determines whether to test the optical image stabilizer of the camera.

[0377] When the electronic device determines, according to the configuration information of the camera, that the camera is equipped with an aperture image stabilizer, it may be determined that the aperture image stabilizer of the camera needs to be tested.

[0378] S1015, the electronic device executes a test process for the optical image stabilizer of the camera.

[0379] The principle of the electronic device executing the above step S1015 is the same as that in the above Fig. 9 The principle of testing the optical image stabilizer of the camera in the provided method is the same. For matters not described in detail here, please refer to the relevant description above.

[0380] S1016, the electronic device executes a test process for the aperture of the camera.

[0381] The principle of the electronic device testing the aperture of the camera in the above step S1016 is similar to the above Figure 3 The electronic device described in the provided method performs the same test on the aperture of the camera in principle. For matters not described in detail here, please refer to the relevant description above.

[0382] It should be understood that the above Fig.10 The camera hardware testing method shown is for illustration only and does not constitute any limitation on the camera hardware testing method provided in the embodiments of the present application. Fig.10 The test order shown for the camera's autofocus motor, the camera's gyroscope, the camera's optical image stabilizer, the camera's TOF sensor, and the camera's aperture can be arbitrarily changed according to actual needs.

[0383] In an embodiment of the present application, the aperture, TOF sensor, autofocus motor AF, camera gyroscope, and camera optical image stabilizer of the camera located in the electronic device are detected by stress testing. The quality of these key components determines whether the camera fails. The method simultaneously performs tests on multiple hardware of the camera to check whether the camera fails. In this way, in the event that at least one of the multiple hardware of the camera fails, the interception rate of the camera detection can be improved, which is conducive to improving the production yield of the camera of the electronic device. In addition, through the nested test method, the test of the aperture, TOF sensor, autofocus motor AF, camera gyroscope, and camera optical image stabilizer of the camera can be completed at one time, so that a certain amount of time overhead can be reduced, thereby improving the overall test efficiency.

[0384] Combination of the above Figures 1 to 10 , describes in detail the camera hardware testing method of the embodiment of the present application, and will be combined with Fig.11 , describes the device embodiment of the present application in detail. It should be understood that the camera hardware testing device in the embodiment of the present application can execute the various camera hardware testing methods in the aforementioned embodiment of the present application, that is, the specific working process of the following various products can refer to the corresponding process in the aforementioned method embodiment.

[0385] Fig.11 is a schematic diagram of a camera hardware testing device provided in an embodiment of the present application. For example, Fig.11 The camera hardware testing device 1100 shown includes a processing unit 1110. The function of the processing unit 1110 is described in detail below.

[0386] Implementation method 1: the processing unit 1110 in the camera hardware testing device 1100 is used to execute the above Figure 3The camera hardware testing method shown in the figure, the apparatus 1100 is applied to an electronic device including a camera.

[0387] In the above-mentioned implementation method 1, the processing unit 1110 is used to: obtain first configuration information of the camera, wherein the first configuration information includes multiple aperture values ​​supported by the aperture of the camera, the multiple aperture values ​​correspond to multiple clear apertures one by one, each aperture value is the ratio between the focal length of the lens of the camera and the clear aperture corresponding to each aperture value, and the multiple aperture values ​​are all different; when the hardware test function is started, detect whether the aperture can be adjusted to each aperture value of the multiple aperture values ​​according to the first configuration information to determine whether the aperture is faulty.

[0388] In a possible implementation, the processing unit 1110 is further used to: generate an adjustment instruction based on the first configuration information, wherein the adjustment instruction is used to instruct to adjust the size of the aperture to each aperture value in a preset order; and test the aperture according to the adjustment instruction to determine whether the aperture fails.

[0389] In another possible implementation, the multiple aperture values ​​include a first aperture value and a second aperture value, and the processing unit 1110 is further used to determine that the aperture is not faulty when the size of the aperture is successfully adjusted from the first aperture value to the second aperture value according to the adjustment instruction, and when the size of the aperture is successfully adjusted from the second aperture value to the first aperture value.

[0390] In another possible implementation, the multiple aperture values ​​also include a third aperture value, and the processing unit 1110 is further used to determine that the aperture is not faulty when the size of the aperture is successfully adjusted from the first aperture value to the third aperture value according to the adjustment instruction, the size of the aperture is successfully adjusted from the third aperture value to the second aperture value, and the size of the aperture is successfully adjusted from the second aperture value to the first aperture value.

[0391] In another possible implementation, the processing unit 1110 is further configured to: in response to detecting that a test switch of the aperture is turned on, determine to start the hardware test function.

[0392] In another possible implementation, the camera is configured with a time-of-flight TOF sensor, and the processing unit 1110 is further used to determine whether the TOF sensor fails based on a capture screen instruction and a preset image, wherein the capture screen instruction is used to instruct a preset number of shots of the target object based on a first aperture value among the multiple aperture values, and the preset image is an image obtained by a camera configured with a TOF sensor that has not failed, shooting the target object based on the first aperture value.

[0393] In another possible implementation, the processing unit 1110 is further used to: control the camera to perform multiple shots of the target object based on the first aperture value according to the capture picture instruction to obtain multiple target images; determine that the TOF sensor is not faulty when the difference between each target image in the multiple target images and the preset image does not exceed a preset threshold; determine that the TOF sensor is faulty when the difference between at least one target image in the multiple target images and the preset image exceeds the preset threshold.

[0394] In another possible implementation, the processing unit 1110 is further used to: obtain second configuration information of the camera, wherein the second configuration information includes a first field for indicating an identifier of the camera, and a second field for indicating that the camera is configured with the TOF sensor; and determine, based on the second configuration information, that the camera is configured with the TOF sensor.

[0395] Implementation method 2: the processing unit 1110 in the camera hardware testing device 1100 is used to execute the above Figure 6 The camera hardware testing method shown in the figure, the apparatus 1100 is applied to an electronic device including a camera.

[0396] In the above-mentioned second implementation method, the processing unit 1110 is used to: obtain a capture screen instruction, wherein the capture screen instruction is used to instruct to perform a preset number of shots of the target object based on a first aperture value configured for the camera; when the hardware test function is started, determine whether the time-of-flight TOF sensor of the camera is faulty based on the capture screen instruction and a preset image, wherein the preset image is an image obtained by shooting the target object based on the first aperture value by a camera configured with a TOF sensor that has not failed.

[0397] In a possible implementation, the processing unit 1110 is further used to: control the camera to perform multiple shots of the target object based on the first aperture value according to the capture image instruction to obtain multiple target images; determine that the TOF sensor is not faulty when the difference between each target image in the multiple target images and the preset image does not exceed a preset threshold; determine that the TOF sensor is faulty when the difference between at least one target image in the multiple target images and the preset image exceeds the preset threshold.

[0398] In another possible implementation, the processing unit 1110 is further used to: obtain configuration information of the camera, wherein the configuration information includes a first field for indicating an identifier of the camera, and a second field for indicating that the camera is configured with the TOF sensor; and determine, based on the configuration information, that the camera is configured with the TOF sensor to start the hardware test function.

[0399] It should be noted that the camera hardware testing device 1100 is implemented in the form of a functional unit. The term "unit" here can be implemented in the form of software and / or hardware, and is not specifically limited to this.

[0400] For example, a "unit" may be a software program, a hardware circuit, or a combination of the two that implements the above functions. The hardware circuit may include an application specific integrated circuit (ASIC), an electronic circuit, a processor (e.g., a shared processor, a dedicated processor, or a group processor, etc.) and a memory for executing one or more software or firmware programs, a combined logic circuit, and / or other suitable components that support the described functions.

[0401] Therefore, the units of each example described in the embodiments of the present application can be implemented by electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present application.

[0402] The present application also provides a computer program product, which, when executed by a processor, implements the camera hardware testing method described in any method embodiment of the present application.

[0403] The present application also provides a computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a computer, the camera hardware testing method described in any method embodiment of the present application is implemented. The computer program can be a high-level language program or an executable target program.

[0404] The computer-readable storage medium is, for example, a memory. The memory may be a volatile memory or a nonvolatile memory, or the memory may include both a volatile memory and a nonvolatile memory. Among them, the nonvolatile memory may be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory may be a random access memory (RAM), which is used as an external cache. By way of example and not limitation, many forms of RAM are available, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM), and direct rambus RAM (DR RAM).

[0405] In this application, "at least one" means one or more, and "more than one" means two or more. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, at least one of a, b, or c can be represented by: a, b, c, ab, ac, bc, or abc, where a, b, c can be single or multiple.

[0406] It should be understood that in the various embodiments of the present application, the size of the serial numbers of the above-mentioned processes does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.

[0407] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0408] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0409] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are merely schematic; for example, the division of the units is only a logical function division, and there may be other division methods in actual implementation; for example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0410] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0411] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.

[0412] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

Claims

1. A camera hardware testing method, characterized in that: Applied to an electronic device including a camera, the method comprises: Acquire first configuration information of the camera, wherein the first configuration information includes multiple aperture values ​​supported by the aperture of the camera, the multiple aperture values ​​correspond to multiple clear apertures one by one, each aperture value is a ratio between a focal length of a lens of the camera and a clear aperture corresponding to each aperture value, and the multiple aperture values ​​are all different; When the hardware test function is started, it is detected whether the aperture can be adjusted to each of the multiple aperture values ​​according to the first configuration information to determine whether the aperture fails.

2. The method according to claim 1, characterized in that In the case of starting the hardware test function, detecting whether the aperture can be adjusted to each of the multiple aperture values ​​according to the first configuration information to determine whether the aperture fails, includes: Generate an adjustment instruction according to the first configuration information, wherein the adjustment instruction is used to instruct to adjust the size of the aperture to each aperture value according to a preset order; The aperture is tested according to the adjustment instruction to determine whether the aperture fails.

3. The method according to claim 2, characterized in that The plurality of aperture values ​​include a first aperture value and a second aperture value, and, The step of testing the aperture according to the adjustment instruction to determine whether the aperture fails includes: When the size of the aperture is successfully adjusted from the first aperture value to the second aperture value according to the adjustment instruction, and when the size of the aperture is successfully adjusted from the second aperture value to the first aperture value, it is determined that the aperture has not failed.

4. The method according to claim 3, characterized in that The plurality of aperture values ​​further include a third aperture value, and, In the case where the size of the aperture is successfully adjusted from the first aperture value to the second aperture value according to the adjustment instruction, and the size of the aperture is successfully adjusted from the second aperture value to the first aperture value, determining that the aperture has no fault includes: When the size of the aperture is successfully adjusted from the first aperture value to the third aperture value, the size of the aperture is successfully adjusted from the third aperture value to the second aperture value, and the size of the aperture is successfully adjusted from the second aperture value to the first aperture value according to the adjustment instruction, it is determined that the aperture is not faulty.

5. The method according to any one of claims 1 to 4, characterized in that: In the case of starting the hardware test function, before detecting whether the aperture can be adjusted to each of the multiple aperture values ​​according to the first configuration information to determine whether the aperture fails, the method further includes: In response to detecting that the test switch of the aperture is turned on, it is determined to start the hardware test function.

6. The method according to any one of claims 1 to 5, characterized in that: The camera is configured with a time-of-flight TOF sensor, and, The method further comprises: Determine whether the TOF sensor fails based on a capture screen instruction and a preset image, wherein the capture screen instruction is used to instruct a preset number of shots of a target object based on a first aperture value among the multiple aperture values, and the preset image is an image obtained by a camera equipped with a TOF sensor that is not failed, shooting the target object based on the first aperture value.

7. The method according to claim 6, characterized in that The determining whether the TOF sensor fails according to the capture screen instruction and the preset image includes: According to the capture picture instruction, controlling the camera to perform multiple shots of the target object based on the first aperture value to obtain multiple target images; When the difference between each target image in the plurality of target images and the preset image does not exceed a preset threshold, determining that the TOF sensor has not failed; When a difference between at least one target image among the plurality of target images and the preset image exceeds the preset threshold, it is determined that the TOF sensor fails.

8. The method according to claim 6 or 7, characterized in that: The method further comprises: Acquire second configuration information of the camera, wherein the second configuration information includes a first field for indicating an identifier of the camera, and a second field for indicating that the camera is configured with the TOF sensor; According to the second configuration information, it is determined that the camera is configured with the TOF sensor.

9. A camera hardware testing method, characterized in that: Applied to an electronic device including a camera, the method comprises: Obtaining a capture picture instruction, wherein the capture picture instruction is used to instruct to perform a preset number of shots of the target object based on a first aperture value configured for the camera; When the hardware test function is started, it is determined whether the time-of-flight TOF sensor of the camera is faulty according to the capture screen instruction and the preset image, wherein the preset image is an image obtained by shooting the target object based on the first aperture value by a camera equipped with a TOF sensor that has not failed.

10. The method according to claim 9, characterized in that The determining, according to the capture picture instruction and the preset image, whether a TOF sensor of the camera fails includes: According to the capture picture instruction, controlling the camera to perform multiple shots of the target object based on the first aperture value to obtain multiple target images; When the difference between each target image in the plurality of target images and the preset image does not exceed a preset threshold, determining that the TOF sensor has not failed; When a difference between at least one target image among the plurality of target images and the preset image exceeds the preset threshold, it is determined that the TOF sensor fails.

11. The method according to claim 9 or 10, characterized in that: Before determining whether the TOF sensor of the camera fails according to the capture screen instruction and the preset image, the method further includes: Acquire configuration information of the camera, wherein the configuration information includes a first field for indicating an identifier of the camera, and a second field for indicating that the camera is configured with the TOF sensor; According to the configuration information, it is determined that the camera is configured with the TOF sensor to start the hardware test function.

12. A camera hardware testing device, characterized in that: Applied to an electronic device including a camera, the device includes a processing unit, and the processing unit is used to: Acquire first configuration information of the camera, wherein the first configuration information includes multiple aperture values ​​supported by the aperture of the camera, the multiple aperture values ​​correspond to multiple clear apertures one by one, each aperture value is a ratio between a focal length of a lens of the camera and a clear aperture corresponding to each aperture value, and the multiple aperture values ​​are different; When the hardware test function is started, it is detected whether the aperture can be adjusted to each of the multiple aperture values ​​according to the first configuration information to determine whether the aperture fails.

13. A camera hardware testing device, characterized in that: Applied to an electronic device including a camera, the device includes a processing unit, and the processing unit is used to: Obtaining a capture picture instruction, wherein the capture picture instruction is used to instruct to perform a preset number of shots of the target object based on a first aperture value configured for the camera; When the hardware test function is started, it is determined whether the TOF sensor of the camera is faulty according to the capture screen instruction and the preset image, wherein the preset image is an image obtained by shooting the target object based on the first aperture value by a camera equipped with a TOF sensor that is not faulty.

14. An electronic device, characterized in that: The electronic device includes a processor and a memory, the memory is used to store a computer program, and the processor is used to call and run the computer program from the memory, so that the processor executes the camera hardware testing method according to any one of claims 1 to 8 or 9 to 11.

15. A chip, characterized in that: The method comprises a processor, and when the processor executes instructions, the processor performs the camera hardware testing method according to any one of claims 1 to 8 or 9 to 11.

16. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the processor executes the camera hardware testing method according to any one of claims 1 to 8 or 9 to 11.

Citation Information

Patent Citations

  • Distance detection device and imaging apparatus

    CN112305552A

  • TOF camera test method and device, control equipment and test equipment

    CN113489969A

  • Light-running time camera with adjustable aperture

    DE102015218822A1

  • Imaging device, aperture value setting method, and aperture value setting program

    JP2020165997A