Camera hardware testing method, apparatus, and electronic device
By detecting multiple aperture values of the camera aperture and TOF sensor and comparing images, the problem of traditional technologies being unable to comprehensively test camera hardware has been solved, enabling more efficient camera hardware testing and improving camera yield.
Patent Information
- Application Number
- CN202311200247.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-15
- Publication Date
- 2026-02-27
- Estimated Expiration
- 2043-09-15
AI Technical Summary
Traditional technologies cannot effectively test components such as aperture or time-of-flight sensors in camera hardware testing of electronic devices, resulting in an inability to accurately assess the true pass rate of cameras.
By acquiring multiple aperture values supported by the camera, using configuration information to detect whether the aperture can be adjusted to each aperture value, and combining the image capture command and preset image to check for malfunctions in the TOF sensor, a comprehensive detection of the aperture and TOF sensor is achieved.
This improves the accuracy of camera hardware testing, ensures fault detection of aperture and TOF sensors, and increases the yield rate of cameras for electronic devices.
Smart Images

Figure CN119697356B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of camera testing, and more particularly, to a camera hardware testing method and device and electronic equipment. BACKGROUND
[0002] Before electronic equipment is shipped, manufacturers will test the camera hardware of the electronic equipment to determine whether the camera hardware has failed, thereby reducing the failure rate of the camera hardware after the electronic equipment is shipped and improving user satisfaction.
[0003] In the prior art, the camera hardware of the electronic equipment is tested, but only part of the hardware in the camera (for example, an autofocus motor, a gyroscope, and an optical image stabilizer) can be detected, and other components such as an aperture or a time of flight (TOF) sensor cannot be detected, which results in that the actual pass rate of the camera cannot be tested. SUMMARY
[0004] The present application provides a camera hardware testing method, device, and electronic equipment, which can effectively test the aperture of the camera, thereby improving the pass rate of the camera of the electronic equipment.
[0005] In a first aspect, a camera hardware testing method is provided, applied to an electronic equipment including a camera, and the method includes: obtaining first configuration information of the camera, wherein the first configuration information includes a plurality of aperture values supported by an aperture of the camera, the plurality of aperture values and a plurality of clear apertures correspond to each other 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 the each aperture value, and the plurality of aperture values are all different; and in a case where a hardware testing function is started, detecting whether the aperture can be adjusted to the each aperture value in the plurality of aperture values according to the first configuration information, to determine whether the aperture has failed.
[0006] The aperture of the camera in the electronic equipment supports a plurality of aperture values, that is, the aperture that has not failed has the ability to be adjusted to any one of the plurality of aperture values. That is, in a case where the aperture of the camera has not failed, the electronic equipment can control the aperture of the camera to be adjusted to any one of the plurality of aperture values. It can be understood that in a case where the aperture of the camera has failed, there is a phenomenon that the aperture of the camera cannot be adjusted to at least one of the plurality of aperture values.
[0007] In the embodiments of the present application, the aperture supporting a plurality of aperture values can be referred to as a variable aperture, and the aperture supporting only one aperture value can be referred to as a fixed aperture.
[0008] In the technical solution, the first configuration information of the camera in the electronic device indicates that the aperture of the camera supports multiple aperture values; and in the case of starting the hardware test function, the first configuration information is used to detect whether the aperture can be adjusted to each aperture value in the multiple aperture values supported by the aperture, so as to determine whether the aperture is faulty. Therefore, the method can effectively test the aperture of the camera, thereby improving the yield of the camera of the electronic device.
[0009] In a possible implementation, in the case of starting the hardware test function, the first configuration information is used to detect whether the aperture can be adjusted to each aperture value in the multiple aperture values, so as to determine whether the aperture is faulty, including: generating an adjustment instruction according to the first configuration information, where 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, so as to determine whether the aperture is faulty.
[0010] It should be noted that in the embodiments of the present application, the implementation of detecting the aperture according to the first configuration information is not limited, and the above implementation is only illustrative.
[0011] In the technical solution, the adjustment instruction can be generated according to the first configuration information, and then the aperture is tested according to the adjustment instruction, so that each aperture value in the multiple aperture values can be tested when the aperture of the camera is detected. Therefore, the method can effectively test the aperture of the camera, thereby improving the yield of the camera of the electronic device.
[0012] In a possible implementation, the multiple aperture values include a first aperture value and a second aperture value, and in the case of testing the aperture according to the adjustment instruction, so as to determine whether the aperture is faulty, including: in the case of successfully adjusting the size of the aperture from the first aperture value to the second aperture value and successfully adjusting the size of the aperture from the second aperture value to the first aperture value according to the adjustment instruction, it is determined that the aperture is not faulty.
[0013] In the above implementation, the size of the aperture of the camera is the first aperture value. In the case of multiple aperture values supported by the aperture being two aperture values and the size of the current aperture being the first aperture value, it is determined that the aperture is not faulty by successfully adjusting the size of the aperture from the first aperture value to the second aperture value and successfully adjusting the size of the aperture from the second aperture value to the first aperture value.
[0014] In another possible implementation, the multiple aperture values further include a third aperture value, and in a case that 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 does not malfunction includes: in a case that the size of the aperture is successfully adjusted from the first aperture value to the third aperture value, from the third aperture value to the second aperture value, and from the second aperture value to the first aperture value according to the adjustment instruction, determining that the aperture does not malfunction.
[0015] In the 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, so that it can be determined that the aperture does not malfunction.
[0016] In the implementation, the size of the aperture of the current camera is taken as the first aperture value as an example. Alternatively, the size of the aperture of the current camera can also be the second aperture value.
[0017] In a possible implementation, the multiple aperture values include a first aperture value and a second aperture value, and in the testing of the aperture according to the adjustment instruction to determine whether the aperture malfunctions, includes: in a case that the size of the aperture is successfully adjusted from the second aperture value to the first aperture value, and from the first aperture value to the second aperture value according to the adjustment instruction, determining that the aperture does not malfunction.
[0018] In the implementation, the size of the aperture of the current camera is the second aperture value. In a case that the multiple aperture values are two aperture values and the size of the current aperture is the second aperture value, it can be determined that the aperture does not malfunction by successfully adjusting the aperture from the second aperture value to the first aperture value, and successfully adjusting the size of the aperture from the first aperture value to the second aperture value.
[0019] In another possible implementation, the multiple aperture values further include a third aperture value, and in a case that the size of the aperture is successfully adjusted from the second aperture value to the first aperture value, and from the first aperture value to the second aperture value according to the adjustment instruction, determining that the aperture does not malfunction includes: in a case that the size of the aperture is successfully adjusted from the second aperture value to the third aperture value, from the third aperture value to the first aperture value, and from the first aperture value to the second aperture value according to the adjustment instruction, determining that the aperture does not malfunction.
[0020] In the 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, so that it can be determined that the aperture is not faulty.
[0021] In another possible implementation, before detecting, according to the first configuration information, whether the aperture can be adjusted to each aperture value in the multiple aperture values to determine whether the aperture is faulty, in the case where the hardware test function is started, the method further includes: determining to start the hardware test function in response to detecting that a test switch of the aperture is turned on.
[0022] In the technical solution, the hardware test function is started to perform the step of detecting the aperture according to the first configuration information only in the case where the test switch of the aperture is turned on, so that the aperture can be tested when it is not necessary to test the aperture of the camera, and resources of the electronic device can be saved.
[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 is faulty according to a capture picture instruction and a preset image, where the capture picture instruction is used to instruct to perform a preset number of shootings on a target object based on a first aperture value in the multiple aperture values, and the preset image is an image obtained by performing shooting on the target object based on the first aperture value by the camera configured with a TOF sensor that is not faulty.
[0024] The first aperture value is any one aperture value in 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 can be F1.8 or F2.8.
[0025] In the technical solution, the TOF sensor of the camera can be tested according to the capture picture instruction and the preset image, so that the method can achieve effective detection of the TOF sensor of the camera, and the yield of the camera of the electronic device can be further improved.
[0026] In another possible implementation, the step of determining whether the TOF sensor is faulty according to the capture picture instruction and the preset image includes: controlling the camera to perform multiple shootings on 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 in the case where a 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 in the case where a difference between at least one target image in the multiple target images and the preset image exceeds the preset threshold.
[0027] In the technical solution, a scheme for testing the TOF sensor of the camera is provided, that is, a plurality of target images of a target object are captured by the camera supporting the TOF sensor, and whether the TOF sensor of the camera fails is determined by comparing the difference between the preset image and each of the plurality of target images. Specifically, when the difference between the preset image and each of the plurality of target images does not exceed the preset threshold, it is determined that the TOF sensor does not fail; when the difference between the preset image and at least one of the plurality of target images exceeds the preset threshold, it is determined that the TOF sensor fails. Therefore, the method can effectively detect the TOF sensor of the camera, thereby facilitating further improvement of the 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, according to the second configuration information, that the camera is configured with the TOF sensor.
[0029] The first field is a field for indicating an identifier of the camera. For example, the first field can be, but is not limited to, a camera identification code cameraId or a device number of the camera.
[0030] The second field is a field for indicating that the camera is configured with the TOF sensor. For example, the second field can be, but is not limited to, an isSupportTofSensor field, wherein a value of the isSupportTofSensor equal to 1 indicates that the camera is configured with the TOF sensor, and a value of the isSupportTofSensor equal to 0 indicates that the camera is not configured with the TOF sensor.
[0031] In the technical solution, in the case that the camera is configured with the TOF sensor, the step of determining whether the TOF sensor fails according to the captured image and the preset image is performed, which can avoid testing the camera not configured with the TOF sensor, and 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, and the method comprises: obtaining a capture picture instruction, wherein the capture picture instruction is used to instruct the camera to perform a preset number of shootings on a target object based on a first aperture value configured to the camera; and determining whether a time-of-flight (TOF) sensor of the camera fails or not according to the capture picture instruction and a preset image, wherein the preset image is an image obtained by performing shooting on the target object based on the first aperture value by the camera with a TOF sensor that does not fail.
[0033] In the above technical solution, the TOF sensor of the camera in the electronic device can be tested according to the capture picture instruction and the preset image, and the TOF sensor of the camera can be effectively detected, thereby further improving the yield of the camera of the electronic device.
[0034] In a possible implementation, the determination of whether the TOF sensor of the camera fails or not according to the capture picture instruction and the preset image comprises: performing multiple shootings on the target object based on the first aperture value by the camera according to the capture picture instruction, to obtain multiple target images; determining that the TOF sensor does not fail when a difference between each target image in the multiple target images and the preset image is less than a preset threshold; and determining that the TOF sensor fails when a difference between at least one target image in the multiple target images and the preset image is greater than the preset threshold.
[0035] In the above technical solution, a pressure test of the TOF sensor of the camera is provided, that is, multiple target images are obtained by performing shooting on the target object by the camera supporting the TOF sensor, and whether the TOF sensor of the camera fails or not is determined by comparing the difference between the preset image and each target image in the multiple target images. Specifically, when the difference between the preset image and each target image in the multiple target images is less than a preset threshold, it is determined that the TOF sensor does not fail; and when the difference between the preset image and at least one target image in the multiple target images is greater than the preset threshold, it is determined that the TOF sensor fails. Therefore, the TOF sensor of the camera can be effectively detected, thereby further improving the yield of the camera of the electronic device.
[0036] In another possible implementation, before the step of determining whether the TOF sensor of the camera fails according to the preset image and the capture picture instruction, the method further includes: obtaining configuration information of the camera, wherein the configuration information includes a first field used to represent an identifier of the camera, and a second field used to represent that the camera is configured with the TOF sensor; and determining, according to the configuration information, that the camera is configured with the TOF sensor, to start the hardware test function.
[0037] In the above technical solution, the step of determining whether the TOF sensor fails according to the preset image and the capture picture instruction is performed only when the camera is configured with the TOF sensor, so that the test on the camera without the TOF sensor can be avoided, and resources of the electronic device are saved.
[0038] In a third aspect, a camera hardware test apparatus is provided, which is applied to an electronic device and used to execute the camera hardware test method provided in the first aspect or the second aspect. Specifically, the camera hardware test apparatus can 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, which includes a unit for executing any method in the first aspect or the second aspect. The device can be a terminal device or a chip in the terminal device. The device can include an input unit and a processing unit.
[0040] When the device is a terminal device, the processing unit can be a processor, and the input unit can be a communication interface. The terminal device can further include a memory for storing computer program code, and when the processor executes the computer program code stored in the memory, the terminal device executes any method in the first aspect or the second aspect.
[0041] When the device is a chip in a terminal device, the processing unit can be a processing unit inside the chip, and the input unit can be an output interface, a pin, or a circuit. The chip can further include a memory, which can be a memory (for example, a register, a cache, or the like) inside the chip or a memory (for example, a read-only memory, a random access memory, or the like) outside the chip. 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 method in the first aspect or the second aspect.
[0042] In a possible implementation, the memory is configured to store computer program code; and the processor is configured to execute the computer program code stored in the memory, and when the computer program code stored in the memory is executed, the processor is configured 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, which stores computer program code, and when the computer program code is executed by a camera hardware testing apparatus, the camera hardware testing apparatus is caused to execute 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, which includes computer program code, and when the computer program code is executed by a camera hardware testing apparatus, the camera hardware testing apparatus is caused to execute any one of the camera hardware testing methods in the first aspect or the second aspect.
[0045] It can be understood that beneficial effects of the second aspect to the sixth aspect described above can be referred to the related description in the first aspect described above, and will not be described 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 can be understood that the description of a feature or a beneficial effect means that the specific technical feature, technical solution or beneficial effect is 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. Further, the technical features, technical solutions and beneficial effects described in this embodiment can be combined in any appropriate manner. Those skilled in the art will understand that the embodiments can be implemented 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 be identified in specific embodiments that do not embody all embodiments. BRIEF DESCRIPTION OF DRAWINGS
[0047] Figure 1 is a schematic diagram of a hardware system of an electronic device 100 provided by an embodiment of the application.
[0048] Figure 2 is a software structure block diagram of the electronic device 100 of the embodiment of the application.
[0049] Figure 3 is a schematic diagram of a camera hardware testing method provided by an embodiment of the application.
[0050] Figure 4 is the above Figure 3A schematic diagram of the aperture of the camera in the method provided.
[0051] Figure 5 A schematic diagram of another camera hardware testing method provided by the embodiments of the present application.
[0052] Figure 6 A schematic diagram of another camera hardware testing method provided by the embodiments of the present application.
[0053] Figure 7 A schematic diagram of another camera hardware testing method provided by the embodiments of the present application.
[0054] Figure 8 A schematic diagram of another camera hardware testing method provided by the embodiments of the present application.
[0055] Figure 9 A schematic diagram of the testing process of the auto-focus motor of the camera, the gyroscope of the camera and the optical image stabilizer of the camera in the step S811 performed by the electronic device.
[0056] Figure 10 A schematic diagram of another camera hardware testing method provided by the embodiments of the present application.
[0057] Figure 11 A schematic diagram of the camera hardware testing device provided by the embodiments of the present application. DETAILED DESCRIPTION
[0058] The technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work fall within the scope of protection of the present application.
[0059] In order to facilitate understanding, the professional terms related to the embodiments of the present application are introduced first.
[0060] (1) Time of flight (TOF) sensor
[0061] The TOF sensor measures the time required for light to reflect from an object to locate and communicate with the object. The TOF sensor uses infrared light. When the light reflects back to the sensor from the object, the time difference between the emission and reflection of the light can be used to calculate the distance between the sensor and the measured object.
[0062] In practical applications, the camera with the TOF sensor is also called a depth camera or a TOF camera. In the embodiments of the present application, the depth camera and the TOF camera have the same meaning, and for the convenience of description, the camera with the TOF sensor is simply referred to as a TOF camera in the following description.
[0063] (2) Aperture
[0064] The aperture is an optical mechanical aperture located inside the camera lens. The aperture can be used to control the amount of light passing through the camera lens. The aperture is composed 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 and unchangeable. 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 one of the two or more aperture values that the variable aperture has can be set for the variable aperture.
[0066] The size of the aperture (i.e., the aperture value of the aperture) is equal to the ratio of the focal length of the objective lens (i.e., the lens) of the camera to the light passing diameter of the 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. Generally, the focal length of the lens of the camera is fixed.
[0067] The larger the size of the aperture (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 size of the aperture (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 the electronic device photographs the same photographed target object at the same position, the image obtained by the lens of the camera based on a large aperture value (i.e., a small aperture) is darker and has a larger depth of field, and the image obtained by the lens of the camera based on a small aperture value (i.e., a large aperture) is brighter and has a smaller depth of field.
[0068] The size of the aperture has two writing methods: large F writing (F2.8) and small f writing (f / 2.8), and the two writing methods are completely equivalent.
[0069] (3) Automatic focus motor (AF) of the camera
[0070] The AF of the camera is used to adjust the focusing of the lens to make the photographed object clear and sharp. It can drive the lens assembly to adjust forward and backward according to the manual operation of the user or the instruction of the automatic focusing system.
[0071] The AF of the camera is usually controlled by an electronic control system or a motor inside the camera, which precisely controls the movement of each lens component according to the user's operation or the instruction of the automatic control algorithm, to achieve the shooting requirements and the desired shooting effect.
[0072] (4) Gyroscope of the camera
[0073] The gyroscope of the camera is a sensor used to measure the rotational motion of the camera. It is usually used in the camera stabilization system to detect the attitude and angular changes of the camera in real time. The gyroscope of the camera calculates the direction and angle of the camera by sensing the rotational motion of the device.
[0074] The gyroscope of the camera usually adopts micro-electro-mechanical system (MEMS) technology, which uses a small mechanical structure and electronic sensor to detect acceleration and angular velocity. It usually contains three axial sensors, which measure the rotational motion of the device on the x, y and z axes of the three-dimensional coordinate respectively.
[0075] By detecting the rotational motion of the device, the gyroscope of the camera can provide real-time attitude information such as the inclination and rotation angle of the camera. These information is very important for the camera stabilization system, which can help to offset the jitter and shaking of the camera during shooting, and provide more stable and clear image or video output.
[0076] (5) Optical image stabilizer (OIS)
[0077] OIS is set in the camera module of the electronic device, and OIS is mainly used to prevent image blur when the electronic device shakes. Its principle is that the gyroscope inside the lens detects small movements, then transmits the signal to the microprocessor, the processor immediately calculates the displacement amount that needs to be compensated, and then compensates the lens group according to the shaking direction and displacement amount of the lens, so as to effectively overcome the image blur caused by the vibration of the electronic device.
[0078] Before the electronic device is shipped, the manufacturer will test the camera hardware of the electronic device to determine whether the camera hardware has failed, so as to reduce the failure rate of the camera hardware of the electronic device after it is shipped, and improve the user satisfaction.
[0079] In the prior art, the camera hardware of an electronic device is tested, and the method can only detect part of the hardware in the camera, including a gyroscope, an auto-focusing motor and an optical image stabilizer. However, in actual application, the camera hardware further includes other hardware such as an aperture or a TOF sensor. Therefore, based on the prior art, only part of the hardware in the camera is tested to determine whether the camera is faulty, which cannot test the actual pass rate of the camera.
[0080] To solve the above problem, the embodiment of the present application provides a camera hardware testing method applied to an electronic device including a camera, and the method comprises the following steps: obtaining first configuration information of the camera, wherein the first configuration information comprises a plurality of aperture values supported by an aperture of the camera, the plurality of aperture values and a plurality of clear apertures correspond to each other, 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 plurality of aperture values are all different; and in the case that a hardware testing function is started, detecting whether the aperture can be adjusted to each aperture value in the plurality of aperture values according to the first configuration information to determine whether the aperture is faulty. In the above technical solution, the first configuration information of the camera in the electronic device indicates that the aperture of the camera supports a plurality of aperture values; in the case that the hardware testing function is started, the first configuration information is used to detect whether the aperture can be adjusted to each aperture value in all aperture values (i.e. the plurality of aperture values) supported by the aperture to determine whether the aperture is faulty; and the above method detects each aperture value supported by the aperture, so that the method can effectively test the aperture of the camera, thereby facilitating to improve the pass rate of the camera of the electronic device.
[0081] In the following, the technical solution provided by the present application is described in detail.
[0082] The camera hardware testing method provided by the embodiment of the present application can be applied to an electronic device. In the following, the hardware structure and software structure of the electronic device are introduced in detail in combination with the drawings.
[0083] Figure 1 FIG. 1 is a schematic diagram of a hardware system of an electronic device 100 provided by the embodiment of the present application.
[0084] The type of the electronic device 100 is not specifically limited, and can be selected according to an actual scenario. For example, the electronic device 100 can be a mobile phone, a smart screen, a tablet computer, a wearable electronic device, a vehicle-mounted electronic device, an augmented reality (AR) device, a virtual reality (VR) device, a notebook computer, an ultra-mobile personal computer (UMPC), a netbook, a personal digital assistant (PDA), a projector, a vehicle-mounted device, or the like. The embodiments of the present application do not limit the specific type of the electronic device 100.
[0085] The electronic device 100 can 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 loudspeaker 170A, a receiver 170B, a microphone 170C, a headset interface 170D, a sensor module 180, a key 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 can include a pressure sensor 180A, a gyroscope sensor 180B, a barometric 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 can include more or fewer components than those shown, or the electronic device 100 can include a combination of some of the components shown, or the electronic device 100 can include sub-components of some of the components shown. 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 can include more or fewer components than those shown, or the electronic device 100 can include a combination of some of the components shown, or the electronic device 100 can include sub-components of some of the components shown. 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 can include more or fewer components than those shown, or the electronic device 100 can include a combination of some of the components shown, or the electronic device 100 can include sub-components of some of the components shown. 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 can include more or fewer components than those shown, or the electronic device 100 can include a combination of some of the components shown, or the electronic device 100 can include sub-components of some of the components shown. Figure 1 The components shown can be implemented in hardware, software, or a combination of software and hardware.
[0087] The processor 110 can include one or more processing units. For example, the processor 110 can 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, a neural-network processing unit (NPU). Among them, different processing units can be independent devices, or can be integrated devices.
[0088] The controller can generate operation control signals according to the instruction operation code and the timing signal, and complete the control of fetching and executing instructions.
[0089] The processor 110 can also be provided with a memory for storing instructions and data. For example, the processor 110 can store instructions for executing the camera hardware test method provided by the embodiments of the present application. For example, the processor 110 can store data obtained by executing the camera hardware test method provided by the embodiments of the present application. In some embodiments, the memory in the processor 110 is a cache memory. The memory can save instructions or data that the processor 110 has just used or repeatedly uses. If the processor 110 needs to use the instructions or data again, it can be directly called from the memory. This avoids repeated access and reduces the waiting time of the processor 110, thereby improving the efficiency of the system. In some embodiments, the processor 110 can include one or more interfaces. For example, the processor 110 can 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, a USB interface.
[0090] Figure 1The connection relationship between the illustrated modules is only illustrative and does not constitute a limitation on the connection relationship between the modules of the electronic device 100. Alternatively, the modules of the electronic device 100 can also adopt a combination of the above-mentioned various connection modes.
[0091] The electronic device 100 can implement a display function through a GPU, a display screen 194, and an application processor. The GPU is a microprocessor for image processing, connected to the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 110 can include one or more GPUs that 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 obtained by a camera application of the electronic device. The display screen 194 includes a display panel. The display panel can adopt 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, or a quantum dot light emitting diode (QLED). In some embodiments, the electronic device 100 can include one or N display screens 194, where N is a positive integer greater than 1.
[0093] The electronic device 100 can implement a shooting function through an ISP, a camera 193, a video codec, a GPU, a display screen 194, and an application processor.
[0094] The ISP is used to process data fed back by the camera 193. For example, when taking a photo, the shutter is opened, 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 to convert it into an image visible to the naked eye. The ISP can algorithmically optimize the noise, brightness, and color of the image, and can also optimize the exposure and color temperature of the shooting scene and other parameters. In some embodiments, the ISP can be disposed in the camera 193.
[0095] The camera 193 is configured to capture still images or videos. An object projects an optical image through a lens to a 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, which is then passed to an ISP for conversion into a digital image signal. The ISP outputs the digital image signal to a DSP for processing. The DSP converts the digital image signal into a standard red green blue (RGB), YUV, or the like format image signal. In some embodiments, the electronic device 100 can include one or N cameras 193, where N is a positive integer greater than one.
[0096] The external memory interface 120 can be configured to connect an external memory card, such as a secure digital (SD) card, to extend the memory capacity of the electronic device 100. The external memory card communicates with the processor 110 via the external memory interface 120 to perform data storage functions.
[0097] The internal memory 121 can be configured to store computer-executable program code including instructions. For example, the internal memory 121 can store instructions for performing the camera hardware test method provided by the embodiments of the present application. The internal memory 121 can include a program storage area and a data storage area. The program storage area can store an operating system and application programs required for at least one function (e.g., a sound play function and an image play function). The data storage area can store data created during use of the electronic device 100 (e.g., audio data and a phonebook). In addition, the internal memory 121 can include a high-speed random access memory, and can further include a non-volatile memory such as at least one of a magnetic disk storage device, a flash memory device, and a universal flash storage (UFS) memory device. The processor 110 performs various processing methods of the electronic device 100 by executing instructions stored in the internal memory 121 and / or instructions stored in a memory disposed in the processor.
[0098] The gyroscope 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 gyroscope sensor 180B. The gyroscope sensor 180B can be used for anti-shake shooting. For example, when the shutter is pressed, the gyroscope sensor 180B detects the angle of shaking of the electronic device 100, calculates the distance that the lens module needs to compensate according to the angle, and lets the lens offset the shaking of the electronic device 100 by reverse movement to achieve anti-shake. The gyroscope sensor 180B can also be used in scenarios such as navigation and motion sensing games.
[0099] The distance sensor 180F is used to measure distance. The electronic device 100 can measure 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 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, also known as a touch device. The touch sensor 180K can be disposed on the display screen 194, and the touch sensor 180K and the display screen 194 together form a touch screen, also known as a touch 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 touch event type. The 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 disposed on the surface of the electronic device 100, and disposed at a different position from the display screen 194.
[0101] The motor 191 can generate vibration. In some implementations, the motor 191 can be a camera automatic focus motor (AF). The 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 focusing system. The camera AF is usually driven by an electronic control system or a motor inside the camera, which 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, the motor 191 can be used for incoming call prompt, and can also be used for touch feedback. The motor 191 can produce different vibration feedback effects for touch operations acting on different application programs. For touch operations acting on different areas of the display screen 194, the motor 191 can also produce different vibration feedback effects. Different application scenarios (e.g., time reminder, receiving information, alarm clock, and game) can correspond to different vibration feedback effects. The touch vibration feedback effect can also be customized.
[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-kernel architecture, a micro-service architecture, or a cloud architecture. Embodiments of the present application take the layered architecture as an example to describe the software system of the electronic device 100.
[0103] Exemplarily, Figure 2 A schematic diagram of the software system of the electronic device is shown. Referring to Figure 2 , the software system adopts a layered architecture. The layered architecture divides software into several layers, each layer has a clear role and division of labor. Layers communicate with each other through software interfaces. In some embodiments, the Android system is divided into five layers, from top to bottom, the application layer 210, the application framework layer 220, the Android runtime and core library layer 230, the hardware abstraction layer (HAL) 240, and the kernel layer 250.
[0104] The application layer 210 can include a series of application packages. For example, the application packages can include camera, gallery, chat, call, map, navigation, calendar, Bluetooth, music, video, and the like.
[0105] Each of the above-mentioned application programs can include more specific functional modules, for example, the gallery can include a business module and a notification module. For example, the camera can include a photographing module.
[0106] Each of the above-mentioned application programs can be used to generate application data, for example, the gallery is used to generate photo data.
[0107] The application framework layer 220 provides application programming interfaces (APIs) and programming frameworks for the application programs of the application layer. The application framework layer 220 includes some pre-defined functions.
[0108] As Figure 2 shown, the application framework layer 220 can 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 a window manager service (WMS), which can be used for window management, window animation management, surface management, and as a relay station for the input system.
[0110] A content provider stores and provides data to be accessed by applications. The data can include videos, images, audios, dialed and received phone numbers, browsing history and bookmarks, phone book, etc.
[0111] A view system includes visual controls, such as a control for displaying text, a control for displaying an image, etc. The view system can be used to build an application. A display interface can be composed of one or more views. For example, a display interface including a short message notification icon can include a view for displaying text and a view for displaying an image.
[0112] A resource manager provides various resources for an application, such as localized strings, icons, images, layout files, video files, etc.
[0113] A notification manager enables an application to display notification information in a status bar, which can be used to convey a message of the notification type, which can automatically disappear after a short stay without user interaction. For example, the notification manager is used to notify a download completion, a message reminder, etc. The notification manager can also be a notification in the form of a chart or a scroll bar text appearing in the top status bar of the system, such as a notification of an application running in the background, and can also be a notification in the form of a dialog window appearing on the screen. For example, a text information is prompted in the status bar, a prompt sound is emitted, the electronic device vibrates, a light flashes, etc.
[0114] An activity manager can provide an activity manager service (AMS), which can be used for the start, switching, scheduling of system components (such as activities, services, content providers, broadcast receivers), and the management and scheduling of application processes.
[0115] An input manager can provide an input manager service (IMS), which can be used to manage the input of the system, such as touch screen input, key input, sensor input, etc. The IMS takes events from input device nodes and distributes the events to appropriate windows through interaction with the WMS.
[0116] An Android runtime includes a core library and a virtual machine. The Android runtime is responsible for the scheduling and management of the Android system.
[0117] The core library includes two parts: one part is a function function that a programming language (such as the java language) needs to call, and the other part is the core library of Android.
[0118] The application program layer 210 and the application framework layer 220 run in a virtual machine. The virtual machine executes the programming files (for example, java files) of the application program layer 210 and the application framework layer 220 into binary files. The virtual machine is used to perform functions such as management of object life cycle, stack management, thread management, management of security and exceptions, and garbage collection.
[0119] The core library layer 230 can include a plurality of functional modules. For example: a surface manager, a media framework, libc, SQLite, OpenGL ES, Webkit, etc.
[0120] The surface manager is used to manage a display subsystem, and provides fusion of two-dimensional (2-Dimensional, 2D) and three-dimensional (3-Dimensional, 3D) layers for a plurality of application programs.
[0121] The media framework supports playback and recording of a plurality of commonly used audio, video formats, and static image files, etc.
[0122] Libc (C library) is a standard library of C language, and the libc is a most bottom layer library in the system, and the libc is implemented by using system calls of Linux. For example, the libc can be used to connect or disconnect a camera service, set a photographing parameter of the camera, start, stop preview, photograph, etc.
[0123] The hardware abstraction layer (HAL) 240 is an interface layer between an operating system kernel and upper layer software, and the purpose is to abstract hardware. The hardware abstraction layer is an abstract interface of a device kernel driver, and is used to implement an application programming interface for providing access to a bottom layer device to a higher level Java API framework. The HAL includes a plurality of library modules, for example, a camera HAL (for example, an aperture, a TOF sensor, a lens, or a focusing motor, etc.), a Vendor repository, a display screen, 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 accessing a hardware component such as a camera to the camera FWK. The Vendor repository can provide an interface for accessing a hardware component such as an encoder to the media FWK. When a system framework layer API requires access to a hardware of a portable device, the Android operating system will load the library module for the hardware component.
[0124] The kernel layer 250 is a basis of the Android operating system, and the ultimate functions of the Android operating system are completed through the kernel layer. The kernel layer can include a display driver, a camera driver, an audio driver, and a sensor driver.
[0125] It should be noted that the application providesFigure 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, refer to the introduction of the software structure of the Android operating system in the conventional technology. In addition, the photographing method provided in the present application can also be implemented based on other operating systems (for example, IOS or Harmony, etc.), which will not be enumerated one by one in the present application.
[0126] As described above, in order to solve the problems in the prior art, the camera hardware test method provided in the embodiments of the present application 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 a plurality of aperture values supported by an aperture of the camera, the plurality of aperture values and a plurality of light apertures correspond one by one, each aperture value is a ratio between a focal length of a lens of the camera and a light aperture corresponding to each aperture value, and the plurality of aperture values are all different; and in the case that a hardware test function is started, detecting whether the aperture can be adjusted to each aperture value in the plurality of aperture values according to the first configuration information, to determine whether the aperture fails. The method can effectively test the aperture of the camera, thereby facilitating to improve the yield of the camera of the electronic device.
[0127] The embodiments of the present application do not particularly limit the specific structure of the execution subject of the camera hardware test method, as long as the code of the camera hardware test method provided in the embodiments of the present application can be run to communicate according to the camera hardware test method provided in the embodiments of the present application. For example, the execution subject of the camera hardware test method provided in the embodiments of the present application can be a functional module capable of calling and executing a program in the electronic device, or a communication device applied to the electronic device, for example, a chip.
[0128] Next, the camera hardware test method provided in the embodiments of the present application will be described in detail. Figures 3 to 10 The camera hardware test method provided in the embodiments of the present application will be described in detail.
[0129] Figure 3 is a schematic diagram of the camera hardware test method provided in the embodiments of the present application. The camera hardware test method provided in the embodiments of the present application can be executed by an electronic device including a camera. It can be understood that the electronic device can be implemented as software, or a combination of software and hardware. For example, the electronic device in the embodiments of the present application can be, but is not limited to, an electronic device 100 shown. Figure 1 As shown in the figure, the camera hardware test method provided in the embodiments of the present application includes steps S310 and S320. Next, S310 and S320 will be described in detail. Figure 3
[0130] At S310, the electronic device acquires first configuration information of the camera, where the first configuration information includes a plurality of aperture values supported by the aperture of the camera, the plurality of aperture values and a plurality of apertures correspond to each other, each aperture value is a ratio between a focal length of a lens of the camera and an aperture corresponding to each aperture value, and the plurality of aperture values are all different.
[0131] The aperture of the camera supports a plurality of aperture values, that is, the aperture has the ability to adjust to each aperture value in the plurality of aperture values. In actual application, the plurality of aperture values supported by the aperture and the plurality of apertures correspond to each other, that is, the aperture supporting each aperture value means that the aperture has the ability to adjust to the aperture corresponding to each aperture value. For example, the electronic device can but not limited to control a plurality of metal leaves of the aperture of the camera to rotate to achieve the purpose of changing the aperture value of the aperture. In the embodiments of the present application, the aperture supporting a plurality of aperture values can be referred to as a variable aperture.
[0132] For example, Figure 4 A schematic diagram of an aperture supporting a plurality of aperture values is shown. Figure 4 (1) in FIG. 1 shows a top view of the aperture of the camera located in the electronic device, the aperture includes a plurality of metal leaves, the plurality of metal leaves can rotate, and the aperture value of the aperture can be changed by rotating the plurality of metal leaves of the aperture. Figure 4 (2) in FIG. 1 shows a test diagram of the aperture of the camera located in the electronic device. Figure 4 (3) in FIG. 1 shows a schematic diagram of the aperture of the camera with a size of F2.8, and Figure 4 (3) in FIG. 1 shows a schematic diagram of the aperture of the camera with a size of F5.6.
[0133] The first configuration information includes a plurality of aperture values supported by the aperture of the camera, where the number of the plurality of 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 to the camera. Optionally, the above first configuration information can further include other information, for example, the other information can but not limited to be an identifier of the aperture.
[0134] For example, in the case that the plurality of aperture values supported by the aperture of the camera includes F2.8 and F5.6, the first configuration information corresponding to the aperture of the camera can include F2.8 and F5.6. For example, in the case that the plurality of aperture values supported by the aperture of the camera includes F2.8, F4.0 and F5.6, the first configuration information corresponding to the aperture of the camera can include F2.8, F4.0 and F5.6.
[0135] The manner in which the electronic device obtains the first configuration information of the camera is not specifically limited. In some implementations, an android.hardware.Camera class is provided in an application framework layer of the electronic device, and a test process in an application layer of the electronic device can issue an "android.lens.info.availableApertures" TAG value to the application framework layer of the electronic device, and obtain the first configuration information according to a return result of the application framework layer for the TAG value.
[0136] In the embodiments 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 requirements. That is, in subsequent use, if new requirements require new aperture values to be added, the attributes of the new aperture values 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 embodiments of the present application, the application layer of the electronic device has downward compatibility, that is, the application layer can normally issue the old "android.lens.info.availableApertures" TAG value or the new "android.lens.info.availableApertures" TAG value.
[0137] S320, in the case of starting the hardware test function, the electronic device detects whether the aperture can be adjusted to each aperture value in the plurality of aperture values according to the first configuration information, to determine whether the aperture fails.
[0138] In the 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 a plurality of aperture values supported by the aperture.
[0139] In the embodiments of the present application, the implementation manner of the electronic device detecting the aperture according to the first configuration information in the step S320 is not specifically limited.
[0140] In some implementations, in response to the hardware test function being started, the electronic device determines whether the aperture is malfunctioning by detecting whether the aperture can be adjusted to each of a plurality of aperture values according to the first configuration information, including: the electronic device generates an adjustment instruction according to the first configuration information, where the adjustment instruction is used to instruct the aperture to be adjusted to each of the aperture values 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 a plurality of aperture values supported by the aperture as F1.8, F2, and F5.6, and the size of the current aperture is F1.8, the adjustment instruction is used to instruct the size of the aperture to be adjusted in the order of F5.6 and F2, i.e., the adjustment instruction instructs the aperture to be adjusted from the current size of F1.8 to F5.6 first, and then to F2 from the size of F5.6.
[0142] Optionally, in the above implementations, the plurality of aperture values includes a first aperture value and a second aperture value, and the testing of the aperture by the electronic device according to the adjustment instruction to determine whether the aperture is malfunctioning includes: in a case where 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, the electronic device determines that the aperture is not malfunctioning.
[0143] In the above implementations, in a case where the plurality of aperture values supported by the aperture are two aperture values, and the size of the current aperture is a first aperture value, the aperture is determined to be not malfunctioning by the size of the aperture being successfully adjusted from the first aperture value to a second aperture value, and the size of the aperture being successfully adjusted from the second aperture value to the first aperture value.
[0144] For example, if the first configuration information includes a plurality of aperture values supported by the aperture as F1.8 and F5.6, and the size of the current aperture is F1.8, the adjustment instruction is used to instruct the size of the aperture to be adjusted in the order of F5.6. Based on this, in a case where the size of the aperture is successfully adjusted from F1.8 to F5.6, and the size of the aperture is successfully adjusted from F5.6 to F1.8, the electronic device determines that the aperture is not malfunctioning.
[0145] Optionally, in the implementation manner above, the multiple aperture values further include a third aperture value, in this implementation manner, the aperture supports the first aperture value, the second aperture value and the third aperture value, and in the case that the size of the aperture is successfully adjusted from the first aperture value to the second aperture value and from the second aperture value to the first aperture value according to the adjustment instruction, determining that the aperture does not malfunction includes: in the case that the size of the aperture is successfully adjusted from the first aperture value to the third aperture value, from the third aperture value to the second aperture value and from the second aperture value to the first aperture value according to the adjustment instruction, determining that the aperture does not malfunction.
[0146] In the technical solution above, 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, so that it can be determined that the aperture does not malfunction.
[0147] For example, if the first configuration information includes the multiple aperture values supported by the aperture as F1.8, F2 and F4, and the size of the current aperture is F2, the adjustment instruction is used to instruct to adjust the size of the aperture in the order of F1.8 and F4. Based on this, in the case that the size of the aperture is successfully adjusted from F2 to F1.8, from F1.8 to F4 and from F4 to F2, the electronic device confirms that the aperture does not malfunction.
[0148] In some other implementation manners, in the case that the hardware test function is started, the electronic device detects whether the aperture can be adjusted to each aperture value in the multiple aperture values according to the first configuration information to determine whether the aperture malfunctions, including: the electronic device adjusts the size of the aperture in the order of the 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, so as to determine whether the aperture malfunctions.
[0149] In the step S320 above, the electronic device detects the aperture according to the first configuration information in the case that the hardware test function is started.
[0150] Optionally, before detecting whether the aperture can be adjusted to each aperture value in the multiple aperture values according to the first configuration information to determine whether the aperture malfunctions in the case that the hardware test function is started, the electronic device can further perform the following step: in response to detecting that the test switch of the aperture is turned on, determining to start the hardware test function.
[0151] In the technical solution above, in the case that the test switch of the aperture is detected to be turned on, the hardware test function is started to perform the step of detecting the aperture according to the first configuration information, so that the aperture can be tested when it is not necessary to test the aperture, which is beneficial to saving the resources of the electronic device.
[0152] In the embodiments of the present application, the modes of the aperture can include an automatic mode and a manual mode, wherein the size of the aperture in the automatic mode cannot be adjusted by the electronic device, and the size of the aperture in the manual mode can be adjusted by the electronic device. Therefore, optionally, in the implementation mode in which the aperture of the camera is in the automatic mode, the electronic device can further perform the following step before performing the above S320: the electronic device adjusts the mode of the aperture from the automatic mode to the manual mode, so that the electronic device can adjust the size of the aperture. The adjustment mode of the electronic device adjusting the mode of the aperture from the automatic mode to the manual mode is not limited specifically. For example, the electronic device adjusts the mode of the aperture 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 realize the adjustment of the mode of the aperture from the automatic mode to the manual mode.
[0153] In the above, the method for testing the aperture of the camera provided by the embodiments of the present application is described in detail in combination with S310 and S320. The camera located in the electronic device can also be configured with a TOF sensor, and the TOF sensor can also be detected for the camera configured with the TOF sensor, so as to further improve the yield of the camera.
[0154] In the embodiments of the present application, the camera supporting the TOF sensor can also be referred to as a 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 point by calculating the flight time of the emitted laser. The original shooting image of the TOF camera is a plurality of two-dimensional (2D) images with laser phase, and the TOF camera can merge the plurality of 2D images into a super frame, and then calculate a three-dimensional image (3D) of the target object (also referred to as a depth map) according to the super frame, and 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 larger the brightness of the photographed image. On the contrary, 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 photographed image.
[0155] Next, the method for testing the TOF sensor of the camera provided by the embodiments of the present application is introduced. It can be understood that the method for testing the TOF sensor provided in the following can be executed after the electronic device executes the above S310 and S320, or can also be executed before the electronic device executes the above S310 and S320, which is not limited specifically.
[0156] Optionally, the camera in the electronic device is configured with a time-of-flight (TOF) sensor, and the electronic device can further execute the following step: determining whether the TOF sensor is malfunctioning according to the capture-picture instruction and a preset image, wherein the capture-picture instruction is used to instruct the camera to perform a preset number of shootings on the target object based on a first aperture value in a plurality of aperture values, and the preset image is an image obtained by the camera configured with a non-malfunctioning TOF sensor performing shooting on the target object based on the first aperture value.
[0157] In some implementations, the electronic device performs the above-mentioned step of determining whether the TOF sensor is malfunctioning according to the capture-picture instruction and the preset image, including: controlling the camera to perform a plurality of shootings on the target object based on the first aperture value to obtain a plurality of target images according to the capture-picture instruction; determining that the TOF sensor is not malfunctioning when a difference between each target image in the plurality of target images and the preset image does not exceed a preset threshold; and determining that the TOF sensor is malfunctioning when a difference between at least one target image in the plurality of target images and the preset image exceeds the preset threshold.
[0158] The capture-picture instruction is used to instruct the camera to perform a preset number of shootings on the target object based on a first aperture value in a plurality of aperture values. It can be understood that after the electronic device performs the capture-picture, the obtained target image can be displayed on the display screen of the electronic device.
[0159] The parameters included in the capture-picture instruction are not specifically limited and can be set according to actual needs. In some implementations, the capture-picture instruction can include parameters for the camera of the electronic device to perform preview shooting on the target object, wherein the parameters for the preview shooting can include, but are not limited to, a preview start time, a preview duration, a preview size, a shooting size, and an aperture value. The values of the preview start time, the preview duration, the preview size, the shooting size, and the target aperture value are not specifically limited and can be set according to actual conditions. The above-mentioned parameters for the preview shooting are not specifically limited, i.e., other camera parameters can also be selected according to actual conditions. For example, the other camera parameters can further include a zoom size and / or automatic focusing.
[0160] In the technical solution, a scheme for pressure testing a TOF sensor of a camera located in an electronic device is provided, that is, a plurality of target images of a target object are captured by the camera supporting the TOF sensor, and whether the TOF sensor of the camera fails is determined by comparing differences between a preset image and each of the plurality of target images. Specifically, when the differences between the preset image and each of the plurality of target images do not exceed a preset threshold, it is determined that the TOF sensor does not fail; when the differences between the preset image and at least one of the plurality of target images exceed the preset threshold, it is determined that the TOF sensor fails. Therefore, the method can effectively detect the TOF sensor of the camera, thereby facilitating further improvement of the yield of the camera of the electronic device.
[0161] It should be noted that in the above implementation, the size of the aperture used by the camera when the electronic device performs multiple shooting is the first aperture value, and after the electronic device performs multiple shooting on the target object based on the first aperture value to obtain a plurality of target images, the obtained plurality of target images are compared with the preset image.
[0162] Optionally, the size of the aperture of the camera used by the electronic device when performing multiple shooting can also be at least two aperture values supported by the aperture. Based on this, the preset image includes at least two preset images, and the at least two preset images and the at least two aperture values correspond one by one. Each preset image is an image obtained by a camera with a non-failed TOF sensor performing shooting on a target object based on a corresponding aperture value.
[0163] For example, in other implementations, the electronic device performs the above determination of whether the TOF sensor fails according to the capture picture instruction and the preset image, including: controlling the camera to perform multiple shooting on the target object based on a plurality of aperture values according to the capture picture instruction, to obtain a plurality of target images corresponding to the plurality of aperture values, the plurality of target images and the plurality of preset images correspond one by one, wherein each target image is obtained by performing shooting on the target object based on a corresponding aperture value, and the preset image corresponding to each target image is an image obtained by a camera with a non-failed TOF sensor performing shooting on the target object based on the aperture value corresponding to the corresponding target image; in the case where the difference between each target image in the plurality of target images and the corresponding preset image does not exceed a preset threshold, it is determined that the TOF sensor does not fail; in the case where the difference between at least one target image in the plurality of target images and the corresponding preset image exceeds the preset threshold, it is determined that the TOF sensor fails.
[0164] Optionally, after obtaining the target image corresponding to each shooting of the target object, the electronic device can perform the next shooting on the target object if the difference between the target image obtained by the current shooting and the preset image is less than the preset threshold. If the difference between the target image obtained by the current shooting and the preset image is greater than the preset threshold, the electronic device does not need to perform the next shooting on the target object according to the capture picture instruction.
[0165] For example, in another implementation, the capture picture instruction indicates to perform M times of shooting on the target object based on the first aperture value, where M is a positive integer greater than 1. The electronic device performs the above-mentioned determination of whether the TOF sensor fails based on the capture picture instruction and the preset image, which includes: controlling the camera to perform the first shooting on the target object based on the first aperture value according to the capture picture instruction to obtain a first target image; controlling the camera to perform the second shooting on the target object based on the first aperture value if the difference between the first target image and the preset image is less than the preset threshold to obtain a second target image; and so on. Controlling the camera to perform the Mth shooting on the target object based on the first aperture value if the difference between the second target image and the preset image is less than the preset threshold to obtain an Mth target image. If the difference between the Mth target image and the preset image is less than the preset threshold, it is determined that the TOF sensor does not fail, and the camera is controlled to stop shooting.
[0166] In the above technical solution, if the electronic device determines that the difference between the target image obtained by the current shooting and the preset image is large, the electronic device does not perform the next shooting indicated by the capture picture instruction. In this way, the test efficiency can be improved, and the resources of the electronic device can be saved.
[0167] In the above-described solution, the test of the TOF sensor of the camera in the electronic device is involved. If the camera in the electronic device is not configured with a TOF sensor, the above-mentioned test steps do not need to be performed on the camera without the TOF sensor. Therefore, in some implementations, the electronic device can further perform the following steps before performing the above-mentioned test steps on the TOF sensor of the camera: obtaining second configuration information of the camera, where the second configuration information includes a first field for indicating the identity of the camera and a second field for indicating that the camera is configured with a TOF sensor; and determining, according to the second configuration information, that the camera is configured with a TOF sensor.
[0168] The first field and the second field are not limited and can be set according to actual needs. For example, the first field can be but is not limited to a camera identity CameraId field. For example, the second field can be but is 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. For example, the format of the second configuration information can be represented as 2:0, where the meaning of each field is as shown in Table 1.
[0170] Table 1
[0171] Value of the field Meaning of the field 2 CameraId (one example of the first field) 0 isSupportTofSensor (one example of the second field)
[0172] In Table 1, the CameraId field as the first field represents the camera identifier. The isSupportTofSensor field as the second field represents whether the camera supports the TOF test. For example, the value of the isSupportTofSensor field is 0, which indicates that the camera supports the TOF test, and the value of the isSupportTofSensor field is 1, which indicates that the camera does not support the TOF test. For another example, the value of the isSupportTofSensor field is 1, which indicates that the camera supports the TOF test, and the value of the isSupportTofSensor field is 0, which indicates that the camera does not support the TOF test.
[0173] In the above implementation, the second configuration information includes the first field and the second field as an example. Optionally, the second configuration information can further include other fields in addition to the first field and the second field, for example, the other field can be but is 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 located in the electronic device is introduced. In actual application, the camera located in the electronic device can further include other hardware, which can be but is not limited to the camera autofocus motor, the camera gyroscope, and the camera optical image stabilizer.
[0175] Optionally, in the embodiments of the present application, after or before the electronic device performs the test method for the aperture of the camera and the TOF sensor of the camera, the camera autofocus motor, the camera gyroscope, the camera optical image stabilizer, and the like can also be tested. The electronic device can test the camera autofocus motor, the camera gyroscope, and the camera optical image stabilizer based on the test method provided in the prior art, and the content not described in detail herein can be referred to the related content in the method shown in the following Figure 8 and Figure 9 .
[0176] It should be understood that the camera hardware test method shown in the above Figure 3 does not constitute any limitation on the camera hardware test method provided by the present application. For example, after the electronic device performs the camera hardware test method shown in the above Figure 3After the illustrated camera hardware testing method, the electronic device can also perform tests on the camera's autofocus motor, tests on the camera's gyroscope, and tests on the camera's optical image stabilizer based on traditional methods.
[0177] In the embodiments of the present application, the first configuration information of the camera located in the electronic device acquired by the electronic device indicates that the aperture of the camera supports multiple aperture values; in the case of starting the hardware test function, it is detected through the aforementioned first configuration information whether the aperture can be adjusted to each aperture value in all aperture values (i.e. multiple aperture values) supported by the aperture to determine whether the aperture has failed; the above-mentioned method detects each aperture value supported by the aperture, so that the method can effectively test the aperture of the camera, thereby facilitating to improve the yield of the camera of the electronic device. In addition, in the case that the camera located in the electronic device is configured with a TOF sensor, the electronic device can also test whether the TOF sensor of the camera located in the electronic device has failed according to the capture picture instruction and the preset image, and the method can realize effective detection of the TOF sensor of the camera, thereby facilitating to further improve the yield of the camera of the electronic device.
[0178] For example, the following will be described in combination with Figure 5 For example, the following will be described in combination with Figure 5 The described camera hardware testing method is the above Figure 3 One specific example of the described camera hardware testing method, Figure 5 The described method is only illustrative and does not constitute any limitation on the camera hardware testing method provided by the present application.
[0179] Figure 5 is a schematic diagram of another camera hardware testing method provided by the embodiments of the present application. The camera hardware testing method provided by the embodiments of the present application can be executed by Figure 1 The electronic device 100 illustrated 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. As Figure 5 As shown, the method includes steps S501 to S511. Next, S501 to S511 will be described in detail.
[0180] S501, the test process in the electronic device determines whether to test the aperture of the camera of the electronic device.
[0181] The test process is a process running in the electronic device, and the test process can include one or more sub-threads, which are not specifically limited. The name of the test process is also not specifically limited, that is, the test process in S501 can also be referred to as a process with another name, for example, the process with another name can be but is not limited to a detection process or a monitoring process.
[0182] In the embodiments of the present application, the determination manner of the test process for determining whether to test the aperture of the camera 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 the opening or closing of the variable aperture test switch. Specifically, in the case where the test process detects that the variable aperture test switch is opened, it is determined that the aperture of the camera needs to be tested; in the case where the test process detects that the variable aperture test switch is closed, it is determined that the aperture of the camera does not need to be tested. For example, in the case where 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. For example, in the case where 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 according to the test information reported by the application layer of the electronic device, and the test information indicates that the aperture of the camera needs to be tested or does not need to be tested.
[0185] The timing of the test process performing S501 is not specifically limited. For example, the test process can perform S501 in the case where the camera of the electronic device is in a preview state for the first time after the electronic device is turned on. For another example, the test process can perform S501 in the case where the camera of the electronic device is in a preview state each time. After the test process performs S501, if it is determined that the aperture of the camera needs to be tested, S502 to S511 are continuously performed thereafter; if it is determined that the aperture of the camera does not need to be tested, the camera hardware test flow ends thereafter.
[0186] S502, the test process acquires an aperture range list of the camera (that is, the aperture range list of the camera in S501). Figure 3 An example of the first configuration information in the method shown.
[0187] The test process performs S502, that is, in the case where the test process determines that the aperture of the camera of the electronic device needs to be tested, the test process acquires the aperture range list of the camera of the electronic device.
[0188] The camera's aperture range list records aperture values supported by the camera's aperture, and the number of aperture values and the value of each aperture value in the camera's aperture range list are not specifically limited.
[0189] In some implementations, the camera's aperture supports multiple aperture values, i.e., the camera's aperture range list includes the multiple aperture values, wherein the multiple aperture values and the multiple clear apertures are one-to-one corresponding, each aperture value is the ratio between the focal length of the camera's lens and the clear aperture (i.e., the inverse of the relative aperture) corresponding to each aperture value, and the multiple aperture values are different. For example, the camera's aperture range list is {TAG1=F1.8, TAG2=F2.8, TAG3=F4.0}. For example, the camera's aperture range list is {TAG1=F4.0, TAG3=F5.6}.
[0190] In other implementations, the camera's aperture supports one aperture value, i.e., the camera's aperture range list includes the one aperture value. For example, the camera's aperture range list is {TAG1=F2.8}. For example, the camera's aperture range list is {TAG1=F4}.
[0191] The acquisition manner of the camera's aperture range list by the test process is not specifically limited. In some implementations, the android.hardware.Camera class is set in the application framework layer of the electronic device, and the test process in the application layer of the electronic device can acquire the camera's aperture range list by issuing the "android.lens.info.availableApertures" TAG value to the application framework layer of the electronic device and through the return result of the application framework layer for the TAG value.
[0192] In the embodiments 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 needs. That is, in subsequent use, if new aperture values need to be added due to new needs, 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 embodiments of the present application, the application layer of the electronic device has downward compatibility, i.e., the application layer can normally issue for the old "android.lens.info.availableApertures" TAG value or the new "android.lens.info.availableApertures" TAG value.
[0193] It can be understood that, in a case where the aperture range list of the camera includes a plurality of aperture values, that is, the aperture of the camera of the electronic device is a variable aperture. In a case where the aperture range list of the camera includes only 1 aperture value, that is, the aperture of the camera of the electronic device is a fixed aperture. In a case where the aperture of the camera is a variable aperture, the purpose of changing the aperture value of the aperture can be achieved by controlling a plurality of metal blades rotating the aperture of the camera, but is not limited thereto.
[0194] S503, the test process judges whether the length of the aperture range list of the camera is less than 2.
[0195] The length of the aperture range list of the camera is equal to the number of TAG values (that is, aperture values) included in the aperture range list of the camera. For example, the aperture range list of the camera is {TAG1=F1.8}, and the length of the aperture range list of the camera is 1. For another example, the aperture range list of the camera is {TAG1=F1.8, TAG2=F2.8}, and 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. The value of the preset value is not specifically limited and can be set according to the number of aperture values supported by the aperture. For example, the number of aperture values supported by the aperture of the camera is 2, and the preset value is equal to 2. For another example, the number of aperture values supported by the aperture of the camera is 3, and the preset value is equal to 3.
[0197] In the embodiments of the present application, if the test process judges that the length of the aperture range list of the camera is less than 2, that is, the test process determines that the camera does not support variable aperture test. If the test process judges that the length of the aperture range list of the camera is not less than 2, that is, the test process determines that the camera supports variable aperture test. Therefore, after the test process executes the above S503, if it is judged that the length of the aperture range list of the camera is less than 2, S504 is executed thereafter; if it is judged 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, in a case where the length of the aperture range list of the camera is less than 2, the test process reports error information.
[0200] The error information 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 the above S504 is executed. 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] The manner in which the test process reports error information is not specifically limited. For example, after the test process performs S504, the display screen of the electronic device can display information that the aperture of the camera of the electronic device is not a variable aperture.
[0202] S505, the test process sets the mode of the aperture to the manual mode.
[0203] S505, the test process sets the mode of the aperture to the manual mode.
[0204] The manner in which the test process sets the aperture to the manual mode is not specifically limited. For example, the test process sets the aperture to the manual mode by issuing a command 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 mode of the aperture is successfully set to the manual mode.
[0206] After the test process performs S505, the application framework layer of the electronic device returns information to the test process about whether the mode of the aperture is successfully set to the manual mode. Therefore, when the test process performs S506, the test process can determine whether the mode of the aperture is the manual mode according to the information returned by the application framework layer.
[0207] After the test process performs S506, if it is determined that the mode of the aperture is successfully set to the manual mode, S507 is then performed; if it is determined that the mode of the aperture is not successfully set to the manual mode, S504 is then performed.
[0208] It can be understood that, in the case where the mode of the aperture is successfully set to the manual mode, the test process can issue the aperture values in the aperture range list of the camera at a preset time interval to perform stress testing on the variable aperture to trigger device defects. The preset time interval is not specifically limited and can be set according to actual conditions. For example, the preset time interval can be, but is not limited to, 0.5 seconds or 1 second.
[0209] S507, the test process issues 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 performs the above S507, i.e., in the case that the mode of the aperture is successfully set to the manual mode, each aperture value (i.e., the jth aperture value) in the aperture range list of the camera is sent to the aperture of the camera to perform stress testing to trigger the failure of the aperture device.
[0211] S508, the test process determines whether the size of the aperture of the camera is successfully adjusted to the jth aperture value.
[0212] After the test process performs the above S507, the application framework layer of the electronic device returns 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, and j is a positive integer. Therefore, according to the adjustment information, the test process can determine whether the size of the aperture of the camera is successfully adjusted to the jth aperture value.
[0213] After the test process performs the above S507, if it is determined that the size of the aperture of the camera is successfully adjusted to the jth aperture value, S510 is performed; if it is determined that the size of the aperture of the camera is not successfully adjusted to the jth aperture value, S509 is performed.
[0214] S509, the test process determines that the aperture of the camera is faulty.
[0215] The test process performs the above S509, i.e., in the case that the size of the aperture of the camera is not successfully adjusted to the jth aperture value, the test process determines that the aperture of the camera is faulty. That is, as long as the test process detects that the aperture of the camera fails to be successfully adjusted to any aperture value in the aperture range list of the camera, the test process can determine that the aperture of the camera is faulty.
[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, i.e., the maximum value of j is equal to 3. Therefore, in the case that the size of the aperture of the camera is not successfully adjusted to the first aperture value, the test process can determine that the aperture of the camera is faulty; in the case that the size of the aperture of the camera is not successfully adjusted to the second aperture value, the test process can determine that the aperture of the camera is faulty; or in the case that the size of the aperture of the camera is not successfully adjusted 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 to the aperture of 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, the test process executes S511; 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 malfunctioning, and closes the manual mode of the aperture to set the mode of the aperture to the automatic mode.
[0221] After the test process executes the above S511, that is, in the case where 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 closes the manual mode of the aperture to set the mode of the aperture 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 (that is, the size of the aperture) of the aperture thereafter.
[0222] The manner in which the test process closes the manual mode of the aperture is not specifically limited. Illustratively, the test process closes the manual mode of the aperture, including: the test process closes the manual mode of the aperture by modifying the permission attribute corresponding to the aperture from 0 to 1, so that the aperture is in the automatic mode after the manual mode of the aperture is closed.
[0223] It should be understood that the above Figure 5 The camera hardware test method shown is only illustrative, and does not constitute any limitation on the camera hardware test method provided by the embodiments 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 the preset value can also be 3 or 5, etc. For 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 method provided.
[0224] In the embodiments of the present application, the test process of the electronic device can perform stress testing on the aperture of the camera according to the plurality of aperture values supported by the aperture of the camera, by continuously issuing each aperture value included in the aperture range list of the camera to the aperture of the camera, so that the aperture of the camera switches the aperture value of the camera to the corresponding issued aperture value by rotating the aperture blade, to realize detection of the aperture of the camera. In the case where the aperture of the camera can successfully switch to each aperture value supported by the aperture of the camera, the test process of the electronic device determines that the aperture of the camera is not malfunctioning. In summary, the test method can realize effective detection of the aperture of the camera, thereby facilitating improvement of the yield of the camera of the electronic device.
[0225] In the above, the test method for the aperture of the camera in the electronic device and the test method for the TOF sensor of the camera in the electronic device before the test for the aperture are introduced. Optionally, in another implementation, the electronic device can only perform the test step for the TOF sensor of the camera in the electronic device. Next, another camera hardware test method provided by the embodiments of the present application is introduced in detail in combination with the drawings.
[0226] Figure 6 is a schematic diagram of another camera hardware test method provided by the embodiments of the present application. The camera hardware test method provided by the embodiments of the present application can be performed by an electronic device including a camera. It can be understood that the electronic device can be implemented as software or a combination of software and hardware. For example, the electronic device in the embodiments of the present application can be, but is not limited to, the electronic device 100 shown in the drawings. Figure 1 As shown in the drawings, the camera hardware test method provided by the embodiments of the present application includes S610 and S620. Next, S610 and S620 are introduced in detail. Figure 6
[0227] S610, the electronic device obtains a capture picture instruction, wherein the capture picture instruction is used to instruct to perform a preset number of shootings on a target object based on a first aperture value configured to the camera.
[0228] In the above S610, the electronic device includes a camera.
[0229] S620, in the case of starting the hardware test function, the electronic device determines whether the time-of-flight (TOF) sensor of the camera fails according to the capture picture instruction and a preset image, wherein the preset image is an image obtained by the camera with the non-failed TOF sensor performing shooting on the target object based on the first aperture value.
[0230] In the embodiments of the present application, the electronic device determines whether the time-of-flight (TOF) sensor of the camera fails according to the capture picture instruction and the preset image, including: the electronic device controls the camera to perform multiple shootings on the target object based on the first aperture value according to the capture picture instruction, and obtains multiple target images; in the case that 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 does not fail; in the case that the difference between at least one target image in the multiple target images and the preset image exceeds the preset threshold, the electronic device determines that the TOF sensor fails.
[0231] Optionally, before determining whether the TOF sensor of the camera fails according to the capture picture instruction and the preset image, the electronic device can further execute the following steps in the case that the hardware test function is started: the electronic device acquires configuration information of the camera, wherein the configuration information comprises 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 the electronic device determines, according to the configuration information, that the camera is configured with the TOF sensor, so as to start the hardware test function.
[0232] The configuration information in the above implementation manner is the same as the second configuration information in the step S320, and details not described herein can be referred to the related description in the step S320.
[0233] It should be noted that details not described herein in the steps S610 and S620 can be referred to the related description in the steps S610 and S620. Figure 3
[0234] It should be understood that the camera hardware test method shown in the above Figure 6 does not constitute any limitation on the camera hardware test method provided by the present application.
[0235] In the embodiments of the present application, in the case that the camera located in the electronic device is configured with the TOF sensor, the electronic device can test whether the TOF sensor of the camera located in the electronic device fails according to the capture picture instruction and the preset image, and the method can realize effective detection of the TOF sensor of the camera, thereby being conducive to further improving the yield of the camera of the electronic device.
[0236] Next, another camera hardware test method provided by the embodiments of the present application will be introduced in combination with Figure 7 It can be understood that Figure 7 the described camera hardware test method is a specific example of the camera hardware test method described in the above Figure 6 , and the described method is only illustrative and does not constitute any limitation on the camera hardware test method provided by the present application. Figure 7
[0237] Figure 7 is a schematic diagram of another camera hardware test method provided by the embodiments of the present application. The camera hardware test method provided by the embodiments of the present application can be executed by the electronic device 100 shown in Figure 1 , 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. For example, as shown in Figure 7 , the method comprises steps S701 to S707. Next, the steps S701 to S707 will be described in detail.
[0238] S701, the test process of the electronic device issues a capture picture instruction i (i.e., one example of the capture picture instruction in the method shown) to the camera of the electronic device, where the capture picture instruction i is used to instruct the camera to capture a target object based on a target aperture value to obtain a target image i, and i is a positive integer. Figure 6
[0239] The camera in S701 above is a 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 an aperture value supported by the aperture of the camera of the electronic device, where the size of the target aperture value is equal to the ratio of the focal length of the lens (i.e., the objective lens) corresponding to the camera to the light passing diameter of the lens of the camera (i.e., the reciprocal 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 can be one or more (e.g., two or five, etc.). It can be understood that in the case where the number of aperture values supported by the aperture of the camera is more than one, the aperture can also be referred to as a variable aperture.
[0242] In S701 above, the capture picture instruction i is used to instruct the camera to capture a target object based on a target aperture value to obtain a target image i, and display the target image i on the display screen of the electronic device. Based on this, the capture picture instruction i can include parameters for the camera of the electronic device to perform the i-th preview shooting on the target object, where the i-th preview shooting parameters can include, but are not limited to, the following parameters: preview start time, preview duration, preview size, shooting size, and target aperture value.
[0243] In the embodiments of the present application, i is a positive integer, and the maximum value of the value of i is a preset value, which can be set according to actual conditions and is not specifically limited. For example, the maximum value of the value of i can be 2, 3, or 5, etc. It can be understood that when the test process performs S701 above for the first time, the value of i is equal to 0, i.e., the camera of the electronic device has not performed a preview operation according to the capture picture instruction i.
[0244] The test process issues a capture picture instruction i to instruct the camera to capture a target object based on a target aperture value to obtain a target image i. Correspondingly, after the camera of the electronic device receives the capture picture instruction i, the camera application executes a preview and shooting process according to the i-th preview and shooting parameter corresponding to the capture picture instruction i. For example, the preview and shooting process involves the camera calling the setRepeatingRequest() method for preview and the capture() method for shooting operation, wherein the camera needs to input a camera request CameraRequest parameter when calling the setRepeatingRequest() method and the capture() method, and the CameraRequest represents a capture request and is used to describe various parameter settings for capturing an image (i.e., the i-th preview and shooting parameter).
[0245] Optionally, before performing the above S701, the electronic device can further perform the following step: in response to a trigger operation, the electronic device starts the camera. The trigger operation is not limited. For example, the trigger operation can be an operation of a user's finger clicking an icon of the camera in the interface of the electronic device. For another example, the trigger operation can be an operation of a mouse clicking an icon of the camera in the interface of the electronic device.
[0246] It should be understood that the above S701 is described by taking the capture picture instruction i as an example, which targets the same target object and the aperture size of the camera as the target aperture value, and does not constitute any limitation on 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 object to be photographed corresponding to each capture picture instruction in the plurality of capture picture instructions can also be different.
[0247] S702, the test process determines whether the currently enabled camera in the electronic device is a camera supporting a TOF sensor.
[0248] The test process performs the above S702, that is, the test process determines whether the currently enabled camera in the electronic device is a front camera supporting a TOF sensor, including: the test process obtains configuration information of the currently enabled camera in the electronic device (i.e., the above Figure 6 An example of the second configuration information in the method shown); the test process determines whether the currently enabled camera is a camera supporting a TOF sensor according to the configuration information of the currently enabled camera in the electronic device. It can be understood that if the currently enabled camera is a camera supporting a TOF sensor, the currently enabled camera is a TOF camera.
[0249] The test process is not specifically limited in the method by which it obtains the camera's configuration information. For example, the test process can interact with the CameraManager located in the application framework layer of the electronic device to obtain the configuration information of the currently active camera on the electronic device.
[0250] The camera configuration information described in S702 above may include a camera identifier and whether the camera corresponding to the camera identifier supports TOF sensor functionality. The camera identifier is used to identify the camera in the electronic device, and there are no specific limitations on the camera identifier. For example, the camera identifier may be the camera's serial number or camera name. Optionally, the above configuration information may also include other information, which may include, 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] There are no specific limitations on the format of the acquired camera configuration information. For example, the format of the camera configuration information can be represented as: TOF:2:1280*2898:0, where the meaning of each field is shown in Table 2 below.
[0252] Table 2
[0253] Value of the field Meaning of the field TOF CameraTitle 2 CameraId 1280*2898 CameraPicSize 0 isSupportTofSensor
[0254] In Table 2 above, CameraTitle represents the camera title. The CameraId field (i.e., the one mentioned above) Figure 6 (An example of the first field in the method shown) represents the camera identifier. The CameraPicSize field represents the size of the image captured by the camera. The isSupportTofSensor field (i.e., the one mentioned above) Figure 6 (An example of the second field in the illustrated method) indicates whether the camera supports Time-of-Flight (TOF) testing. For example, a value of 0 in the `isSupportTofSensor` field indicates that TOF testing is supported, and a value of 1 in the `isSupportTofSensor` field indicates that TOF testing is not supported.
[0255] In this embodiment of the application, after the test process executes the above S702, if it is determined that the camera currently enabled in the electronic device supports a TOF sensor, then S703 is executed thereafter; if it is determined that the camera currently enabled in the electronic device does not support a TOF sensor, then the camera hardware test process ends thereafter.
[0256] S703, The view i of the camera interface of the currently active camera in the electronic device is drawn on the display screen of the electronic device.
[0257] The test process executes S703 described above, that is, in the case where the test process determines that the currently opened camera is a camera supporting a TOF sensor, the test process issues an instruction of drawing a view i of a camera interface to the currently opened camera, where the view i is used to display a target image i obtained according to the capture picture instruction i.
[0258] S704, the currently opened camera in the electronic device performs shooting on the target object according to the capture picture 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 opened camera is normal according to the target image i.
[0260] The test process determines whether the TOF sensor of the currently opened camera is normal according to the target image i, including: the test process determines whether the TOF sensor of the currently opened camera is normal according to the target image i and a preset image, where the preset image is an image obtained by the camera based on a target aperture value on the target object based on a TOF camera without failure; 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 the preset threshold, it is determined that the TOF sensor of the camera is abnormal (i.e. failure occurs).
[0261] After the test process executes S705 described above, if it is determined that the TOF sensor of the currently opened camera fails, S706 is continuously executed thereafter; if the TOF sensor of the currently opened camera is normal (i.e. no failure occurs), S707 is continuously executed thereafter.
[0262] S706, the test process reports the TOF sensor failure.
[0263] S706 is executed, that is, in the case where it is determined that the function of the TOF sensor for generating an image is abnormal, the test process can report information of the TOF sensor failure to an application layer (e.g. a 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 S707 described above, if it is determined that i is less than the preset value, S701 is continuously executed thereafter; if it is determined that i is not less than the preset value, the camera hardware test process is ended thereafter. It can be understood that i not less than the preset value can be i equal to the preset value.
[0266] After the test process determines that i is less than the preset value, the electronic device executes the above S701 to S707 for the second time. It can be understood that the value of i when the electronic device executes the above S701 to S707 for the second time is greater than the value of i when the electronic device executes the above S701 to S707 for the first time by 1, and the aperture value 2 associated with the second photographing instruction 2 when the electronic device executes the above S701 to S707 for the second time is different from the aperture value 1 associated with the first photographing instruction 1 when the electronic device executes the above S701 to S707 for the first time.
[0267] Optionally, after the electronic device executes the above S701 to S707, the electronic device can further 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 test method shown is only illustrative, and does not constitute any limitation on the camera hardware test method provided by the embodiments of the present application. For example, before the test process executes the above S702, a judgment step of judging whether the camera currently turned on in the electronic device is a front camera can also be executed. In this implementation manner, if the test process determines that the camera currently turned on is a front camera, then the above S702 is continuously executed thereafter; if the test process determines that the camera currently turned on is a rear camera, then the camera hardware test process is ended.
[0269] In the embodiments of the present application, a scheme for pressure testing the TOF sensor of a camera is provided, that is, a plurality of target images are obtained by performing photographing on a target object by a camera supporting the TOF sensor within a period of time, and whether the TOF sensor of the camera fails is determined by comparing the differences between a preset image and each target image. In summary, the test method can realize accurate detection of the TOF sensor of the camera, thereby being beneficial to improving the accuracy of the camera hardware test result.
[0270] In the above, the test methods for the aperture of the camera located in the electronic device and the TOF sensor of the camera are introduced. In actual application, the hardware of the camera located in the electronic device further includes other hardware in addition to the aperture and the 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 combination with the drawings, the method steps in which the camera hardware test method provided by the present application is nested to test other hardware of the camera are introduced.
[0271] Figure 8 FIG. 2 is a schematic diagram of another camera hardware test method provided by the embodiments of the present application. The camera hardware test method provided by the embodiments of the present application can be executed by the electronic device Figure 1The electronic device 100 shown 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. For example, as shown, the electronic device 100 includes a processor 101, a memory 102, a display 103, and a camera 104. Figure 8 The method includes steps S801 to S811. Details of S801 to S811 are described below.
[0272] S801, the electronic device obtains configuration information of the camera.
[0273] In the above S810, the configuration information of the camera can include a first field for indicating the identity 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 related description in the above S320, which will not be described in detail here. Optionally, the configuration information of the camera can also include the aperture value supported by the aperture of the camera, which can refer to the related description in the above S310, which will not be described in detail here. Optionally, the configuration information of the camera can also include a field indicating whether the camera is a front camera or a rear camera.
[0274] S802, the electronic device opens the camera.
[0275] The electronic device performs the above S802, which can include the following steps: the electronic device registers a listener (setSurfaceTextureListener) when initializing; in response to the listener detecting that the texture (TextTure) for displaying the camera preview is in an available state, the electronic device calls the onSurfaceTextureAvailable() method to open the camera of the electronic device.
[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 performs the above-mentioned S803 step, which may include the following steps: in response to opening the camera lens, the electronic device records the width and height values of the control texture of the current camera preview; the electronic device obtains the characteristic information (CameraCharacteristics) of the specified camera lens and the available stream configuration supported by the currently opened camera through the camera manager (CameraManager) object, and obtains the target width value and the target height value of the texture of the camera preview according to the direction of the electronic device and the direction of the camera lens; the electronic device sets the result that best matches the target value (i.e., the target width value and the target height value) in the characteristic information of the specified camera lens as the height value and the width value of the texture of the camera preview, 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 performs the above-mentioned S804, in the case of camera preview, the data of the camera preview can be obtained through the image reader.
[0281] S805, the electronic device opens the specified camera lens.
[0282] The camera manager (CameraManager) of the electronic device can be used to manage all cameras (i.e., camera lenses) installed in the electronic device. The function of managing all camera devices in the electronic device is mainly to obtain the camera lens list and open the specified camera lens. Based on this, the above-mentioned S805 is performed, that is, the camera manager of the electronic device calls the openCamera function to open the camera lens 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., the application layer) and the lower layer (i.e., the application framework layer) of the electronic device, through which the camera can be instructed to perform preview, shooting, and video recording operations.
[0285] The electronic device performs the above-mentioned S806 step, which may 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] In the case that the camera capture session is successfully established, the electronic device calls back the onConfigured() function to continue setting the attributes of the preview request object in the onConfigured() function. For example, the attributes of the preview request object can include, but are not limited to, the following attributes: whether to automatically focus, automatically expose, automatically white balance, and the like.
[0288] In S808, the electronic device sends a repeating capture picture request (setRepeatingResquest).
[0289] The electronic device performs the above S808, and an example can 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, so as to realize the preview of the camera through the endless occurrence of the preview request.
[0290] In S809, the electronic device determines whether the currently opened camera is a front camera configured with a TOF sensor according to the configuration information of the camera.
[0291] The configuration information of the camera includes a second field for indicating that the camera is configured with a TOF sensor, and according to the second field, it can be known whether the TOF sensor is a camera supporting the TOF sensor. In the case that 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] In S810, the electronic device performs a TOF sensor test of the camera.
[0293] The detailed steps of the electronic device performing the above S810 can be referred to the related description in the foregoing Figure 3 or the related description in the foregoing Figure 7 , which will not be described in detail here.
[0294] In S811, the electronic device performs a test of the autofocus motor of the camera, the gyroscope of the camera, the optical image stabilizer of the camera, and the aperture of the camera.
[0295] The method of the electronic device performing the aperture test of the camera in the above S811 can be referred to the related description in the foregoing Figure 3 , which will not be described in detail here. The electronic device can first perform the test of the aperture of the camera, and then perform the tests of the autofocus motor of the camera, the gyroscope of the camera, and the optical image stabilizer of the camera, respectively. Alternatively, the electronic device can first perform the tests of the autofocus motor of the camera, the gyroscope of the camera, and the optical image stabilizer of the camera, respectively, and then perform the test of the aperture of the camera.
[0296] In the embodiments of the present application, the flow of the test method of the camera's autofocus motor AF, the camera's gyroscope and the camera's optical image stabilizer in the S811 step described above mainly includes the following flow: firstly, it is judged whether the test step of the corresponding camera hardware needs to be performed; in the case that the test step of the corresponding camera hardware needs to be performed, the test of the camera hardware is realized by issuing the test value. In the case that it is determined that the test step of a certain camera hardware does not need to be performed or the test of the certain camera hardware has been completed (for example, the camera's autofocus motor), it is continued to judge whether the test step of another camera hardware (for example, the camera's gyroscope) needs to be performed.
[0297] For example, the electronic device can first perform the test flow described above on the camera's autofocus motor. Then, the electronic device can perform the test flow described above on the camera's optical image stabilizer. Finally, the electronic device performs the test flow described above on the camera's gyroscope.
[0298] It should be understood that the test flow described above Figure 8 The camera hardware test method shown is only illustrative and does not constitute any limitation on the camera hardware test method provided by the embodiments of the present application. For example, Figure 8 The test order of the camera's autofocus motor, the camera's gyroscope and the camera's optical image stabilizer in the S811 step shown can be arbitrarily changed according to actual needs.
[0299] In the embodiments of the present application, the quality of the key devices such as the camera's aperture, the TOF sensor, the camera's autofocus motor AF, the camera's gyroscope and the camera's optical image stabilizer located in the electronic device is detected by the pressure test method, and the quality of the key devices determines whether the camera fails. The method simultaneously performs the test on multiple hardware of the camera to check whether the camera fails. In this way, in the case that at least one of the multiple hardware of the camera fails, the interception rate of the camera detection can be improved, thereby facilitating the improvement of the yield of the camera of the electronic device. In addition, by using the nested test method, the test on the camera's aperture, the TOF sensor, the camera's autofocus motor AF, the camera's gyroscope and the camera's optical image stabilizer can be completed at one time. In this way, the time cost can be reduced, thereby improving the overall test efficiency.
[0300] Next, the steps of the electronic device performing the test flow of the camera's autofocus motor, the camera's gyroscope and the camera's optical image stabilizer in the S811 step described above will be described by way of example. Figure 9 Next, the steps of the electronic device performing the test flow of the camera's autofocus motor, the camera's gyroscope and the camera's optical image stabilizer in the S811 step described above will be described by way of example.
[0301] Figure 9is a schematic diagram of a test flow of the camera's auto-focus motor, the camera's gyroscope and the camera's optical image stabilizer executed by the electronic device in the above-mentioned S811 step. For example, refer to Figure 9 The test flow includes steps S901 to S919. Hereinafter, S901 to S919 are described.
[0302] S901, set a preview parameter, and issue a preview request and a preview shooting parameter.
[0303] For example, set an endless preview request (i.e., setRepeatingRequest) through a capture session, so as to realize the preview of the camera through the endless preview request.
[0304] The preview shooting parameter can include, but is not limited to, a preview start time, a preview duration, a preview size, a shooting size and an aperture value.
[0305] S902, determine whether the currently opened camera is a rear type camera.
[0306] Optionally, the configuration information of the camera can be acquired before the above-mentioned S902 is executed, and the currently opened camera is determined to be a rear type camera or a front type camera according to the configuration information of the camera.
[0307] After the above-mentioned S902 is executed, if it is determined that the currently opened camera is a rear type camera, S903 is executed thereafter; if it is determined that the currently opened camera is a front type camera, S914 is executed thereafter.
[0308] S903, check whether the AF parameter of the preset rear camera is correct.
[0309] S904, determine whether the AF of the rear camera needs to be tested.
[0310] For example, it is determined that the AF of the rear camera needs to be tested when the rear camera located in the electronic device is configured with AF; and it is determined that the AF of the rear camera does not need to be tested when the rear camera located in the electronic device is not configured with AF.
[0311] After the above-mentioned S904 is executed, if it is determined that the AF of the rear camera needs to be tested, S905 is executed thereafter; if it is determined that the AF of the rear camera does not need to be tested, S907 is executed thereafter.
[0312] S905, open the AF parameter setting attribute of the rear camera.
[0313] S906, set the AF value of the rear camera, and close the parameter setting attribute after 1 second of setting is completed.
[0314] The 1 second mentioned in S906 above is a preset time length, which can be set according to actual conditions.
[0315] S907 determines whether the gyroscope needs to be tested.
[0316] For example, if the rear camera in the electronic device is equipped with a gyroscope, it is determined that the gyroscope needs to be tested; and if 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 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, set the optical image stabilizer switch to an available state.
[0319] S909 determines whether the rear camera's autofocus or gyroscope has been tested.
[0320] For example, after performing an AF or gyroscope test on the rear camera, the electronic device records the results for the corresponding camera hardware. Therefore, the electronic device can determine whether to perform test steps for the corresponding camera hardware based on whether or not the test results for the corresponding camera hardware are recorded.
[0321] After executing 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, disable the test performed in step S909 above.
[0323] For example, if it is determined that the AF of the rear camera has been tested after executing S909, then S910 is executed to turn off the AF test of the rear camera; if it is determined that the gyroscope has been tested after executing S909, then S910 is executed to turn off the gyroscope test; if it is determined that both the AF and gyroscope tests of the rear camera have been tested after executing S909, then S910 is executed to turn off both the AF and gyroscope tests of the rear camera.
[0324] S911 determines whether to test the optical image stabilizer.
[0325] For example, if 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 if 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 the above S911 is executed, if it is judged that the optical image stabilizer needs to be tested, S912 is executed thereafter; if it is judged that the optical image stabilizer does not need to be tested, S913 is executed thereafter.
[0327] S912, starting to test the optical image stabilizer, and recording the test result of the optical image stabilizer.
[0328] S913, starting the subsequent photographing process.
[0329] S914, opening the front camera.
[0330] S915, checking whether the preset AF parameter of the front camera is correct.
[0331] After the above S915 is executed, if it is judged that the AF of the front camera needs to be tested, S916 is executed thereafter; if it is judged that the AF of the front camera does not need to be tested, S913 is executed thereafter.
[0332] S916, judging whether the AF of the front camera needs to be tested.
[0333] For example, in a case where the front camera located in the electronic device is configured with the AF, it is determined that the AF of the front camera needs to be tested; and in a case where the front camera located in the electronic device is not configured with the AF, it is determined that the AF of the front camera does not need to be tested.
[0334] After the above S916 is executed, if it is judged that the AF of the front camera needs to be tested, S917 is executed thereafter; if it is judged that the AF of the front camera does not need to be tested, S913 is executed thereafter.
[0335] S917, opening the AF parameter setting attribute of the front camera.
[0336] S918, setting the AF value of the front camera, and closing the parameter setting attribute after 1 second of setting is completed.
[0337] The 1 second in the above S918 is a preset time length, which can be set according to actual conditions.
[0338] S919, closing the AF test of the front camera.
[0339] It should be understood that the above Figure 9 are only examples, and do not constitute any limitation on the test process of the AF motor of the camera, the gyroscope of the camera, and the optical image stabilizer of the camera in the above S811.
[0340] Figure 10 is a schematic diagram of another camera hardware test method provided by an embodiment of the present application. The camera hardware test method provided by the embodiment of the present application can be executed by the electronic device. Figure 1The electronic device 100 shown 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. For example, as shown, the electronic device 100 includes a processor 1000, a memory 1001, a camera 1002, and a display 1003. Figure 10 The method includes steps S1000 to S1016. Details of S1000 to S1016 are described below.
[0341] S1000, the electronic device acquires configuration information of the camera, and performs initialization processing on the preview interface of the camera.
[0342] The configuration information of the camera includes information related to the hardware configuration of the camera, including the aperture, the TOF sensor, the autofocus motor AF, the gyroscope of the camera, and the optical image stabilizer of the camera.
[0343] The initialization processing on the preview interface of the camera can set the initial height and initial width of the preview interface, and other parameters.
[0344] S1001, the electronic device closes the camera.
[0345] S1002, the electronic device opens the camera.
[0346] For example, in response to the electronic device detecting that the user touches the camera application operation in the desktop of the electronic device, the electronic device opens the camera.
[0347] S1003, the electronic device determines whether the camera is opened.
[0348] After the electronic device performs the above S1002, the application framework layer of the electronic device can return information about whether the camera is opened, so that the electronic device can know whether the camera is opened according to the information.
[0349] After the electronic device performs the above S1003, if it is determined that the camera is opened, S1004 is continued to be executed; if it is determined that the camera is not opened, the camera hardware test process is ended.
[0350] S1004, the electronic device registers a camera state callback and registers a picture callback listener.
[0351] The electronic device can acquire the state change information of the camera through the camera state callback.
[0352] S1005, the electronic device determines whether the camera state callback is successful.
[0353] The electronic device can know whether the camera state callback is successful according to the return result of the registered picture callback listener.
[0354] After the electronic device executes the above S1005, if it is judged that the camera state callback is successful, it continues to execute S1006; if it is judged that the camera state callback is not successful, it ends the camera hardware test process.
[0355] S1006, the electronic device judges whether the callback has data.
[0356] The callback data refers to the data obtained by setting the camera state callback for the camera.
[0357] The electronic device determines whether the callback has data according to the return result of registering the camera state callback. If the return result carries picture data, it can be considered that the callback has data, that is, the callback is successful; if the return result does not carry picture 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 judged whether the callback has data, it continues to execute S1007; if it is judged that the callback has no data, it ends the camera hardware test process.
[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, in the case that 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 API of the camera, 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. the application layer) and the bottom layer (i.e. the application framework layer) of the electronic device, through which the camera can be instructed to perform preview, shooting and video recording, etc.
[0363] S1008, the electronic device judges whether the opened camera is a front TOF camera.
[0364] The electronic device can determine whether the currently opened camera is a front TOF camera according to the configuration information of the camera obtained in the above S1001 step. The front TOF camera refers to a front camera configured with a TOF sensor.
[0365] After the electronic device executes the above S1008, if it is judged that the opened camera is a front TOF camera, it continues to execute S1009; if it is judged that the opened 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 performing the test on the TOF sensor of the camera in the above S1009 step is the same as that in the method provided above, and the content not described in detail here can be referred to the related description in the above. Figure 3 The principle of the electronic device performing the test on the TOF sensor of the camera in the method provided above is the same as that in the method provided above, and the content not described in detail here can be referred to the related description in the above.
[0368] S1010, the electronic device determines whether to test the AF of the camera.
[0369] In a case where the electronic device determines that the camera is configured with the 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 performs a test procedure for the AF of the camera.
[0371] The principle of the electronic device performing the test on the AF of the camera in the above S1011 step is the same as that in the method provided above, and the content not described in detail here can be referred to the related description in the above. Figure 9 The principle of the electronic device performing the test on the AF of the camera in the method provided above is the same as that in the method provided above, and the content not described in detail here can be referred to the related description in the above.
[0372] S1012, the electronic device determines whether to test the gyroscope of the camera.
[0373] In a case where the electronic device determines that the camera is configured with the gyroscope according to the configuration information of the camera, it can be determined that the gyroscope of the camera needs to be tested.
[0374] S1013, the electronic device performs a test procedure for the gyroscope of the camera.
[0375] The principle of the electronic device performing the test on the gyroscope of the camera in the above S1013 step is the same as that in the method provided above, and the content not described in detail here can be referred to the related description in the above. Figure 9 The principle of the electronic device performing the test on the gyroscope of the camera in the method provided above is the same as that in the method provided above, and the content not described in detail here can be referred to the related description in the above.
[0376] S1014, the electronic device determines whether to test the optical image stabilizer of the camera.
[0377] In a case where the electronic device determines that the camera is configured with the optical image stabilizer according to the configuration information of the camera, it can be determined that the optical image stabilizer of the camera needs to be tested.
[0378] S1015, the electronic device performs a test procedure for the optical image stabilizer of the camera.
[0379] The principle of the electronic device performing the test on the optical image stabilizer of the camera in the above S1015 step is the same as that in the method provided above, and the content not described in detail here can be referred to the related description in the above. Figure 9 The principle of the electronic device performing the test on the optical image stabilizer of the camera in the method provided above is the same as that in the method provided above, and the content not described in detail here can be referred to the related description in the above.
[0380] S1016, the electronic device performs a test procedure for the camera's aperture.
[0381] The principle behind the electronic device performing the aperture test on the camera in step S1016 above is the same as described above. Figure 3 The electronic device described in the provided method performs the same test principle for the camera's aperture; for details not elaborated here, please refer to the relevant descriptions above.
[0382] It should be understood that the above Figure 10 The camera hardware testing methods shown are for illustrative purposes only and do not constitute any limitation on the camera hardware testing methods provided in the embodiments of this application. For example, Figure 10 The test sequence shown for the camera's autofocus motor, gyroscope, optical image stabilizer, TOF sensor, and aperture can be arbitrarily changed according to actual needs.
[0383] In this embodiment, stress testing is used to inspect key components of the camera located within the electronic device, such as the aperture, TOF sensor, autofocus motor (AF), gyroscope, and optical image stabilizer. The quality of these key components determines whether the camera malfunctions. This method simultaneously performs tests on multiple hardware components of the camera to verify whether the camera is faulty. Thus, if at least one of these hardware components fails, the interception rate of camera detection can be improved, thereby increasing the yield rate of the camera in the electronic device. Furthermore, through nested testing, tests on the camera's aperture, TOF sensor, AF motor, gyroscope, and optical image stabilizer can be completed simultaneously, reducing time overhead and improving overall testing efficiency.
[0384] The above text combined Figures 1 to 10 The present application describes in detail the camera hardware testing method according to the embodiments of this application. The following will be combined with... Figure 11 This document describes in detail the device embodiments of this application. It should be understood that the camera hardware testing device in the embodiments of this application can execute the various camera hardware testing methods described in the foregoing embodiments of this application. That is, the specific working processes of the various products described below can be referred to the corresponding processes in the foregoing method embodiments.
[0385] Figure 11 This is a schematic diagram of a camera hardware testing apparatus provided in an embodiment of this application. For example, Figure 11 The camera hardware testing apparatus 1100 shown includes a processing unit 1110. The function of the processing unit 1110 will be described in detail below.
[0386] In the first implementation method, the processing unit 1110 in the camera hardware testing device 1100 is used to execute the above... Figure 3The camera hardware test method shown is applied to an electronic device including a camera.
[0387] In the above implementation manner one, the processing unit 1110 is configured to: acquire first configuration information of the camera, wherein the first configuration information includes a plurality of aperture values supported by an aperture of the camera, the plurality of aperture values and a plurality of apertures correspond to each other one by one, each aperture value is a ratio between a focal length of a lens of the camera and an aperture corresponding to the each aperture value, and the plurality of aperture values are all different; and in a case where a hardware test function is started, detecting whether the aperture can be adjusted to the each aperture value in the plurality of aperture values according to the first configuration information, to determine whether the aperture fails.
[0388] In a possible implementation manner, the processing unit 1110 is further configured to: generate an adjustment instruction according to the first configuration information, wherein the adjustment instruction is used to instruct to adjust a size of the aperture to the 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 manner, the plurality of aperture values include a first aperture value and a second aperture value, and the processing unit 1110 is further configured to: in a case where 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, determine that the aperture does not fail.
[0390] In another possible implementation manner, the plurality of aperture values further include a third aperture value, and the processing unit 1110 is further configured to: in a case where 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, determine that the aperture does not fail.
[0391] In another possible implementation manner, 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 a possible implementation, the camera is configured with a time-of-flight (TOF) sensor, and the processing unit 1110 is further configured to: determine whether the TOF sensor is malfunctioning according to the capture instruction and a preset image, where the capture instruction is used to instruct the camera to perform a preset number of photographing operations on a target object based on a first aperture value in the plurality of aperture values, and the preset image is an image obtained by a camera configured with a non-malfunctioning TOF sensor performing photographing on the target object based on the first aperture value.
[0393] In a possible implementation, the processing unit 1110 is further configured to: control the camera to perform a plurality of photographing operations on the target object based on the first aperture value to obtain a plurality of target images according to the capture instruction; determine that the TOF sensor is not malfunctioning when a difference between each target image in the plurality of target images and the preset image is less than a preset threshold; and determine that the TOF sensor is malfunctioning when a difference between at least one target image in the plurality of target images and the preset image is greater than the preset threshold.
[0394] In a possible implementation, the processing unit 1110 is further configured to: obtain second configuration information of the camera, where the second configuration information includes a first field used to represent an identifier of the camera and a second field used to represent that the camera is configured with the TOF sensor; and determine that the camera is configured with the TOF sensor according to the second configuration information.
[0395] In a possible implementation, the processing unit 1110 in the camera hardware testing apparatus 1100 is configured to perform the above-mentioned Figure 6 The camera hardware testing method shown in the apparatus 1100 is applied to an electronic device including a camera.
[0396] In the above-mentioned implementation two, the processing unit 1110 is configured to: obtain a capture instruction, where the capture instruction is used to instruct a camera to perform a preset number of photographing operations on a target object based on a first aperture value configured to the camera; and determine whether a time-of-flight (TOF) sensor of the camera is malfunctioning according to the capture instruction and a preset image when a hardware testing function is started, where the preset image is an image obtained by a camera configured with a non-malfunctioning TOF sensor performing photographing on the target object based on the first aperture value.
[0397] In a possible implementation, the processing unit 1110 is further configured to: according to the capture picture instruction, control the camera to perform multiple shooting on the target object based on the first aperture value, to obtain multiple target images; in a case where a 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 does not malfunction; and in a case where a difference between at least one target image in the multiple target images and the preset image exceeds the preset threshold, determine that the TOF sensor malfunctions.
[0398] In another possible implementation, the processing unit 1110 is further configured to: obtain configuration information of the camera, where the configuration information includes a first field used to represent an identity of the camera, and a second field used to represent that the camera is configured with the TOF sensor; and according to the configuration information, determine that the camera is configured with the TOF sensor, to start the hardware test function.
[0399] It should be noted that the camera hardware test apparatus 1100 is embodied in the form of functional units. The term “unit” herein can be implemented in the form of software and / or hardware, and is not limited specifically.
[0400] For example, the “unit” can be a software program, a hardware circuit, or a combination of both, which implements the above functions. The hardware circuit can include an application specific integrated circuit (ASIC), an electronic circuit, a processor (for example, a shared processor, a dedicated processor, or a group processor) and a memory for executing one or more software or firmware programs, a combination logic circuit, and / or other suitable components supporting the described functions.
[0401] Therefore, the units of each example described in the embodiments of the present application can be implemented in an electronic hardware or a combination of computer software and electronic hardware. Whether the functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. A person skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered 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 test method described in any method embodiment of the present application.
[0403] The application further provides a computer readable storage medium, which stores a computer program. The computer program is executed by a computer to implement the camera hardware testing method described in any of the method embodiments of the application. 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 can be a volatile memory or a non-volatile memory, or the memory can include both volatile memory and non-volatile memory. The non-volatile memory can be a read-only memory (ROM), a programmable ROM (PROM), an erasable PROM (EPROM), an electrically EPROM (EEPROM), or a flash memory. The volatile memory can be a random access memory (RAM) used as an external cache. By way of example, and not limitation, many forms of RAM can be used, such as a static RAM (SRAM), a dynamic RAM (DRAM), a synchronous DRAM (SDRAM), a double data rate SDRAM (DDR SDRAM), an enhanced SDRAM (ESDRAM), a synchlink DRAM (SLDRAM), and a direct rambus RAM (DR RAM).
[0405] In the present application, "at least one" means one or more, and "multiple" means two or more. "At least one of the following" or the like means any combination of the items, including any combination of single item or multiple items. For example, at least one of a, b, or c can represent a, b, c, a-b, a-c, b-c, or a-b-c, where a, b, and c can be single or multiple.
[0406] It should be understood that the size of the sequence number of the above-mentioned processes in various embodiments of the present application does not mean the order of execution, and the execution order of the processes should be determined according to their functions and inherent logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.
[0407] Those skilled in the art can clearly understand that the units and algorithm steps of each example described in combination with the embodiments disclosed herein can be realized by electronic hardware or a combination of computer software and electronic hardware. Whether the functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the present application.
[0408] Those skilled in the art can clearly understand that, for the convenience and brevity of the description, the specific working processes of the above-described system, device and unit can refer to the corresponding processes in the foregoing method embodiments, which will not be repeated here.
[0409] In 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 only schematic; for example, the division of the units is only a logical function division, and actual implementation can have another division manner; for example, a plurality of units or components can be combined or integrated into another system, or some features can be omitted or not executed. In addition, the coupling or direct coupling or communication connection between the units shown or discussed can be indirect coupling or communication connection through some interface, device or unit, and can be electrical, mechanical or other forms.
[0410] The units described as separate components can or can not be physically separated, and the components shown as units can or can not be physical units, i.e. they can be located in one place or distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the embodiment.
[0411] In addition, each functional unit in each embodiment of the present application can be integrated in one processing unit, or each unit can exist physically, or two or more units can be integrated in 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 can easily think of changes or replacements within the technical scope disclosed in the present application, which should be covered within the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.
Claims
1. A camera hardware testing method, characterized by, Applied to an electronic device comprising a camera, the method comprises: obtaining first configuration information of the camera, wherein the first configuration information is obtained by issuing a tag value to an application framework layer of the electronic device, and the first configuration information comprises a plurality of aperture values supported by an aperture of the camera, the plurality of aperture values and a plurality of apertures correspond one by one, each aperture value is a ratio between a focal length of a lens of the camera and an aperture corresponding to the each aperture value, and the plurality of aperture values are all different; in the case of starting a hardware test function, switching the mode of the aperture from an automatic mode to a manual mode to obtain the adjustment authority of the aperture size; 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 the each aperture value in a preset order; determining whether the aperture fails according to the adjustment instruction by testing the aperture to determine whether the aperture can be successfully adjusted to the aperture value.
2. The method of claim 1, wherein, the plurality of aperture values comprise a first aperture value and a second aperture value, and determining whether the aperture fails according to the adjustment instruction by testing the aperture to determine whether the aperture can be successfully adjusted to the aperture value, comprising: in the case that 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 does not fail.
3. The method of claim 2, wherein, the plurality of aperture values further comprise a third aperture value, and in the case that 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 does not fail, comprising: in the case that 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, determining that the aperture does not fail.
4. The method according to any one of claims 1 to 3, characterized in that, in the case of starting the hardware test function, before generating the adjustment instruction according to the first configuration information, the method further comprises: in response to detecting that a test switch of the aperture is turned on, determining to start the hardware test function.
5. The method of claim 1, wherein, the camera is configured with a time-of-flight (TOF) sensor, and the method further comprises: determining whether the TOF sensor fails according to a capture picture instruction and a preset image, wherein the capture picture instruction is used to instruct to perform a preset number of shootings on a target object based on a first aperture value in the plurality of aperture values, and the preset image is an image obtained by performing shooting on the target object based on the first aperture value by a camera configured with a TOF sensor that does not fail.
6. The method of claim 5, wherein, the determining whether the TOF sensor fails according to the capture picture instruction and the preset image, comprising: According to the capture picture instruction, the camera is controlled to perform multiple shootings on the target object based on the first aperture value, and multiple target images are obtained; In a case where a difference between each target image in the multiple target images and the preset image does not exceed a preset threshold, it is determined that the TOF sensor does not malfunction; In a case where a difference between at least one target image in the multiple target images and the preset image exceeds the preset threshold, it is determined that the TOF sensor malfunctions.
7. The method according to claim 5 or 6, characterized in that, The method further comprises: obtaining second configuration information of the camera, wherein the second configuration information comprises a first field for indicating an identity 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.
8. A camera hardware testing method, characterized by, The method is applied to an electronic device comprising a camera, and the method comprises: obtaining configuration information of the camera, wherein the configuration information comprises a first field for indicating an identity of the camera, and a second field for indicating that the camera is configured with a TOF sensor; According to the configuration information, it is determined that the camera is configured with the TOF sensor, so as to start the hardware test function; obtaining a capture picture instruction, wherein the capture picture instruction is used to instruct to perform a preset number of shootings on a target object based on a first aperture value configured to the camera; In a case where the hardware test function is started, according to the capture picture instruction, the camera is controlled to perform multiple shootings on the target object based on the first aperture value, and multiple target images are obtained; In a case where a difference between each target image in the multiple target images and a preset image does not exceed a preset threshold, it is determined that the TOF sensor does not malfunction; In a case where a difference between at least one target image in the multiple target images and the preset image exceeds the preset threshold, it is determined that the TOF sensor malfunctions; The preset image is an image obtained by performing shooting on the target object based on the first aperture value by a camera configured with a TOF sensor that does not malfunction.
9. A camera hardware testing apparatus, characterized by, The device is applied to an electronic device comprising a camera, and the device comprises a processing unit, which is configured to: obtain first configuration information of the camera, wherein the first configuration information is obtained by issuing a label value to an application framework layer of the electronic device, and the first configuration information comprises multiple aperture values supported by an aperture of the camera, the multiple aperture values and multiple light apertures correspond to each other, each aperture value is a ratio between a focal length of a lens of the camera and a light aperture corresponding to the each aperture value, and the multiple aperture values are different; In a case where the hardware test function is started, the mode of the aperture is switched from an automatic mode to a manual mode, so as to obtain an adjustment authority of the aperture size; 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 the each aperture value in a preset order; According to the adjustment instruction, the aperture is tested to determine whether the aperture can be successfully adjusted to the aperture value, so as to determine whether the aperture is faulty.
10. A camera hardware testing apparatus, characterized by, The device is applied to an electronic device including a camera, and the device includes a processing unit configured to: obtain configuration information of the camera, wherein the configuration information includes a first field indicating an identity of the camera and a second field indicating that the camera is configured with a TOF sensor; determine, according to the configuration information, that the camera is configured with the TOF sensor, and start the hardware test function; obtain a capture picture instruction, wherein the capture picture instruction is used to instruct to perform a preset number of shootings on a target object based on a first aperture value configured to the camera; in a case where the hardware test function is started, control the camera to perform a plurality of shootings on the target object based on the first aperture value according to the capture picture instruction, and obtain a plurality of target images; in a case where a difference between each target image in the plurality of target images and a preset image does not exceed a preset threshold, determine that the TOF sensor is not faulty; in a case where a difference between at least one target image in the plurality of target images and the preset image exceeds the preset threshold, determine that the TOF sensor is faulty; wherein the preset image is an image obtained by performing a shooting on the target object based on the first aperture value by the camera configured with the TOF sensor that is not faulty.
11. An electronic device, comprising: The electronic device includes a processor and a memory, the memory is configured to store a computer program, and the processor is configured to call and run the computer program from the memory, so that the processor executes the camera hardware test method in any one of claims 1 to 7 or 8.
12. A chip, characterized by The electronic device includes a processor, and when the processor executes instructions, the processor executes the camera hardware test method in any one of claims 1 to 7 or 8.
13. 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 the processor, the processor executes the camera hardware test method in any one of claims 1 to 7 or 8.
Citation Information
Patent Citations
TOF camera test method and device, control equipment and test equipment
CN113489969A