Image data processing method and device
By combining the data of the image collection unit and the infrared distance unit, calculate the distance between the terminal device and the user, and to obtain the panoramic distance through the depth diagram to solve the problem of low single -eye camera test accuracy, realize higher higher Calculate accuracy with screen distance and posture.
Patent Information
- Application Number
- CN202411897614.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-23
- Publication Date
- 2025-01-24
- Estimated Expiration
- 2044-12-23
AI Technical Summary
In the prior art, when measuring screen distance and screen posture by relying on a monocular camera, the measurement error is large, resulting in low calculation accuracy.
Provide image acquisition units and infrared distance measurement units through terminal devices, collect the current face image and depth diagram of target users, combined with the key point spacing determined by the infrared test distance unit, calculate the current distance between the target user and the terminal equipment, and and and and and and and. Get the panoramic distance from the depth diagram to determine the current posture of the target user.
The accuracy of calculation accuracy with screen distance and screen posture was improved, and the error problem of the monocular camera distance measurement method was avoided, and the accuracy of the posture calculation was enhanced by the depth diagram.
Smart Images

Figure CN119360431A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of image processing technology, and in particular to a method and device for processing image data. Background Art
[0002] With the rapid development of digital technology, people use electronic devices more and more often and in more and more scenarios. For example, smart phones, tablets, computer monitors, TVs and other electronic devices have become part of daily life. This trend not only affects people's vision health, but may also have adverse effects on posture, sleep quality and even physical health. Therefore, it is crucial to accurately monitor the user's screen distance and screen posture.
[0003] At present, a monocular camera is usually used to obtain a face image of the target user when viewing a terminal device, and distance measurement is performed based on the obtained face image to determine the distance between the target user and the electronic device and the posture of the user using the electronic device. This method of relying on a monocular camera for distance measurement has the advantages of low cost and simple implementation, but the measurement error is large, resulting in low calculation accuracy of the screen distance and screen posture between the user and the electronic device. Summary of the invention
[0004] In view of this, the purpose of the present application is to provide a method and device for processing image data to solve the problem of low calculation accuracy of screen distance and screen posture.
[0005] In a first aspect, an embodiment of the present application provides a method for processing image data, wherein an image acquisition unit and an infrared ranging unit are provided by a terminal device, and the method includes: Using an image acquisition unit to acquire a current face image of a target user, and determining current face parameters and a depth map of the target user based on the current face image, wherein the current face parameters include current face features; Obtaining the key point distance between two preset facial key points corresponding to the current facial feature and used to characterize the actual distance between the target user, and determining the current interval distance between the target user and the terminal device according to the key point distance and the current facial parameters, wherein the key point distance is determined based on the infrared ranging unit; For each preset facial key point, obtain the pixel value of the target pixel point corresponding to the preset facial key point on the depth map; The depth map is corrected using pixel values and the current interval distance to obtain the panoramic distance at the current moment, so as to use the panoramic distance to determine the current posture of the target user. The panoramic distance is used to reflect the distance between each position on the target user in the depth map and the terminal device.
[0006] Optionally, the pixel value includes a first pixel value and a second pixel value, and the depth map is corrected using the pixel value and the key point spacing, including: normalizing the first pixel value and the second pixel value to obtain a normalized distance; determining a distance correction value based on the normalized distance and the current interval distance; and using the distance correction value to correct the depth map matrix corresponding to the depth map to determine the panoramic distance corresponding to the target user at the current moment.
[0007] Optionally, an infrared ranging unit is provided by the terminal device. Before the image acquisition unit is used to acquire the current facial image of the target user, the method further includes: when the target user performs facial recognition registration for the terminal device, using the image acquisition unit to acquire an initial facial image of the target user, and acquiring initial facial parameters based on the initial facial image, wherein the initial facial parameters include an initial facial rotation angle and an initial pixel distance corresponding to two preset facial key points; using the infrared ranging unit to determine an initial interval distance between the target user and the terminal device; and using the initial interval distance, the initial facial rotation angle and the device parameters of the image acquisition unit to correct the initial pixel distance to obtain the key point spacing.
[0008] Optionally, the initial pixel distance is corrected using the initial interval distance, the initial facial rotation angle and the equipment parameters of the image acquisition unit, including: constructing an interval distance equation based on the pinhole imaging principle, the interval distance equation including the key point spacing; substituting the initial pixel distance, the initial interval distance, the initial facial rotation angle and the equipment parameters into the interval distance equation to determine the key point spacing.
[0009] Optionally, the current facial parameters also include the current facial rotation angle, the current pixel distance between two preset facial key points on the current face image, and determine the current interval distance between the target user and the terminal device based on the key point spacing and the current facial parameters, including: substituting the key point spacing, the current pixel distance, the current facial rotation angle and the device parameters of the image acquisition unit into the interval distance equation to determine the current interval distance.
[0010] Optionally, the device parameters include the focal length and internal parameters of the image acquisition unit, and based on the pinhole imaging principle, an interval distance expression is constructed, including: determining a first expression based on the ratio of the pixel distance to the cosine value of the facial rotation angle; determining a second expression based on the ratio of the product of the internal parameter, the key point spacing and the focal length to the interval distance; establishing an interval distance expression based on the equation relationship between the first expression and the second expression.
[0011] Optionally, the initial facial parameters also include initial facial features. After substituting the initial pixel distance, initial interval distance, initial facial rotation angle and device parameters into the interval distance equation to determine the key point spacing, the method also includes: establishing and saving the correspondence between the initial facial features and the key point spacing, so as to use the correspondence to obtain the key point spacing corresponding to the target user at the current moment.
[0012] Optionally, determining the distance correction parameter according to the normalized distance and the current interval distance includes: determining the distance correction parameter according to a ratio of the current interval distance to the normalized distance.
[0013] Optionally, obtaining the pixel value of the target pixel point corresponding to the preset facial key point on the depth map includes: obtaining the position information of the preset facial key point in the current face image; selecting the target pixel point corresponding to the position information in the depth map, and obtaining the pixel value of the target pixel point corresponding to the position information.
[0014] In a second aspect, an embodiment of the present application further provides an image data processing device, which provides an image acquisition unit and an infrared ranging unit through a terminal device, and the device includes: A parameter and image acquisition module, used to acquire a current face image of a target user using an image acquisition unit, and determine a current face parameter and a depth map of the target user based on the current face image, wherein the current face parameter includes current face features; A distance determination module is used to obtain the key point distance between two preset facial key points corresponding to the current facial features and used to characterize the actual distance between the target user, and determine the current interval distance between the target user and the terminal device according to the key point distance and the current facial parameters, wherein the key point distance is determined based on the infrared ranging unit; A pixel value acquisition module is used to acquire the pixel value of a target pixel point corresponding to each preset facial key point on the depth map; The panoramic distance determination module is used to correct the depth map using pixel values and the current interval distance to obtain the panoramic distance at the current moment, so as to use the panoramic distance to determine the current posture of the target user. The panoramic distance is used to reflect the distance between each position on the target user in the depth map and the terminal device.
[0015] The embodiments of the present application bring the following beneficial effects: An image data processing method and device provided in an embodiment of the present application can determine the current interval distance representing the screen distance between the target user and the terminal device according to the key point interval, and the key point interval is determined based on an infrared ranging unit, thereby improving the calculation accuracy of the current interval distance and avoiding the problem of low calculation accuracy of the screen distance caused by the monocular camera ranging method. At the same time, the panoramic distance is obtained by correcting the depth map by using the pixel values in the depth map and the current interval interval. It does not simply rely on the face image to calculate the distance between the user and the electronic device, and also improves the accuracy of the screen posture calculation. Compared with the image data processing method in the prior art, the problem of low calculation accuracy of the screen distance and the screen posture between the user and the electronic device is solved.
[0016] In order to make the above-mentioned objects, features and advantages of the present application more obvious and easy to understand, preferred embodiments are specifically cited below and described in detail with reference to the attached drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0018] Figure 1 A flowchart showing a method for processing image data provided by an embodiment of the present application is shown; Figure 2 A flow chart of a depth map correction method provided in an embodiment of the present application is shown; Figure 3 A schematic diagram showing the structure of an image data processing device provided in an embodiment of the present application is shown; Figure 4 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application is shown. DETAILED DESCRIPTION
[0019] To make the purpose, technical scheme and advantages of the embodiments of the present application clearer, the technical scheme in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all of the embodiments. The components of the embodiments of the present application usually described and shown in the drawings here can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present application provided in the drawings is not intended to limit the scope of the application claimed for protection, but merely represents the selected embodiments of the present application. Based on the embodiments of the present application, each other embodiment obtained by those skilled in the art without making creative work belongs to the scope of protection of the present application.
[0020] It is worth noting that before this application was filed, with the rapid development of digital technology, people have been using electronic devices for more and more times and in more and more scenarios. For example, smart phones, tablets, computer monitors, televisions and other electronic devices have become part of daily life. This trend not only affects people's vision health, but may also have adverse effects on posture, sleep quality and even physical health.
[0021] For example, long-term close viewing of electronic screens is one of the main causes of myopia and dry eye syndrome. By monitoring and reminding users to maintain an appropriate viewing distance, the burden on the eyes can be effectively reduced, and these vision problems can be prevented or alleviated.
[0022] At the same time, incorrect screen posture, such as looking down at the phone or leaning forward too much to look at the computer, will not only cause neck and back pain, but may also affect spinal health. Monitoring the screen distance can help users realize their posture problems and prompt them to adjust to a healthier sitting or standing posture. The appropriate screen distance can help reduce visual fatigue, allowing users to maintain attention and concentration for longer, thereby improving work and study efficiency.
[0023] Another example: For parents, monitoring the distance and time of their children's screen use can help control their children's dependence on electronic devices, encourage more parent-child interaction and outdoor activities, and promote their children's all-round development. Through the monitoring and feedback mechanism, users can more intuitively understand their screen usage habits, thereby enhancing their awareness of a healthy lifestyle. This increased awareness may prompt users to adopt more positive health behaviors, such as regular eye exercises and increased outdoor activities.
[0024] At the same time, as the market demand for health monitoring increases, the technology for monitoring screen distance will continue to develop and improve. This will promote the innovation of related hardware and software and provide users with more convenient and accurate health management services.
[0025] Therefore, it is crucial to accurately monitor the user's screen distance and screen posture. At present, a monocular camera is usually used to obtain a facial image of the target user when viewing a terminal device, and distance measurement is performed based on the acquired facial image to determine the distance between the target user and the electronic device and the posture of the user using the electronic device. This method of relying on a monocular camera for distance measurement has the advantages of low cost and simple implementation, but the measurement error is large, resulting in low calculation accuracy of the screen distance and screen posture between the user and the electronic device.
[0026] Based on this, an embodiment of the present application provides a method for processing image data to improve the accuracy of calculating the screen distance and screen posture between a user and an electronic device.
[0027] See also Figure 1 , Figure 1 This is a flow chart of a method for processing image data provided by an embodiment of the present application. Figure 1 As shown, the method for processing image data provided in the embodiment of the present application provides an image acquisition unit and an infrared ranging unit through a terminal device, and the method includes: Step S101, using an image acquisition unit to acquire a current face image of a target user, and determining a current facial parameter and a depth map of the target user based on the current face image; Step S102, obtaining a key point distance corresponding to the current facial feature and used to characterize the actual distance between two preset facial key points of the target user, and determining a current interval distance between the target user and the terminal device according to the key point distance and the current facial parameters; Step S103, for each preset facial key point, obtaining the pixel value of the target pixel point corresponding to the preset facial key point on the depth map; Step S104, the depth map is corrected using the pixel value and the current interval distance to obtain the panoramic distance at the current moment, so as to determine the current posture of the target user using the panoramic distance.
[0028] Through the above method, the present application can determine the current interval distance that characterizes the screen distance between the target user and the terminal device according to the key point spacing, and the key point spacing is determined based on the infrared ranging unit, which improves the calculation accuracy of the current interval distance and avoids the problem of low calculation accuracy of the screen distance caused by the monocular camera ranging method. At the same time, the panoramic distance is obtained by correcting the depth map by the pixel value in the depth map and the current interval spacing. It does not rely solely on the face image to calculate the distance between the user and the electronic device, but also improves the accuracy of the screen posture calculation, solving the problem of low calculation accuracy of the screen distance and screen posture between the user and the electronic device.
[0029] Below Figure 1Each step is described in detail.
[0030] In step S101, an image acquisition unit is used to acquire a current face image of a target user, and current facial parameters and a depth map of the target user are determined based on the current face image.
[0031] The image acquisition unit may refer to an image acquisition device. Exemplarily, the image acquisition unit may be a monocular camera or a binocular camera.
[0032] The target user may refer to a user who is currently using the terminal device.
[0033] The current facial parameters may refer to the parameters used to characterize the facial position and features of the target user. The facial parameters include the current facial features, the current facial rotation angle, and the current pixel distance between two preset facial key points on the current facial image. Among them, the current facial features are used to uniquely identify the facial features of a user. The current facial features include but are not limited to facial contour features and facial features. The current facial rotation angle may refer to the rotation angle of the target user's face relative to the plane where the terminal device is located. The current pixel distance may refer to the pixel distance between two preset facial key points on the facial image. The unit of the current pixel distance is pixel.
[0034] The preset facial key points are key points selected in advance on the user's face, and the two preset facial key points are symmetrical about the middle line of the target user's face. For example, the two preset facial key points can be two inner eye corners, that is, two eye corners located in the center of the face; the two preset facial key points can also be two outer eye corners. Those skilled in the art can select the specific positions of the preset facial key points according to actual conditions, but the requirement that the two preset facial key points are symmetrical about the middle line of the face must be met to further improve the calculation accuracy.
[0035] A depth map may refer to an image used to characterize the distance between each position on the target user corresponding to the depth map and the image acquisition unit (terminal device), that is, the size of the pixel value of each pixel on the depth map represents the relative distance between the position and the image acquisition unit (terminal device). The range of pixel values is 0~255. If the pixel value corresponding to the pixel point is larger and the color is darker, it means that the position corresponding to the pixel point is closer to the image acquisition unit; if the pixel value corresponding to the pixel point is smaller and the color is lighter, it means that the position corresponding to the pixel point is farther from the image acquisition unit.
[0036] In an embodiment of the present application, when the target user watches the terminal device, the image acquisition unit on the terminal device will acquire the current face image of the target user in real time, and use the face key point detection algorithm to detect the key points in the current face image to determine the current facial parameters. Here, the key points include multiple, and the multiple key points include two inner corners of the eyes, that is, two preset facial key points. In addition, the depth map of the target user can also be determined by a deep learning model, for example: the current face image is input into the deep learning model to obtain a depth map, and the deep learning model can be depth-anything, fcrn-depth prediction, dense depth, etc.
[0037] In addition, before using the image acquisition unit to capture the current facial image of the target user, it is necessary to determine the key point spacing of the target user when the target user performs facial recognition registration, and save the key point spacing so that when the target user subsequently uses the terminal device, the saved key point spacing can be directly called to determine the current interval distance.
[0038] When the target user performs face recognition registration for the terminal device, the image acquisition unit can be used to obtain the initial face image of the target user, and the initial face parameters can be obtained based on the initial face image. When performing face recognition registration, the face recognition algorithm is also used to obtain the initial face parameters, and the initial face parameters include initial face features, initial face rotation angles, and initial pixel distances. The initial face features may refer to the face features obtained during face recognition registration, the initial face rotation angles may refer to the face rotation angles obtained during face recognition registration, and the initial pixel distance may refer to the pixel distance between two preset face key points on the face image obtained during face recognition registration.
[0039] While obtaining the initial facial parameters, the infrared ranging unit can be used to determine the initial interval distance between the target user and the terminal device. The initial interval distance can refer to the actual distance between the target user and the terminal device obtained during face recognition registration. At this time, the infrared ranging unit on the terminal device will emit an infrared signal at a specific frequency in a fixed direction, and calculate the distance between the target user and the infrared ranging unit based on the time difference between the received reflected signal and the emitted infrared signal. This distance is the initial interval distance. To this end, after the image acquisition unit acquires the current face image, it will also detect whether the face position is within the specified area. If it is not within the specified area, the target user is prompted to move to the specified area so that the target user's face can be irradiated by the infrared ray emitted by the infrared ranging unit. For example: ensure that the emitted infrared ray is irradiated on the forehead of the target user to accurately measure the initial interval distance from the target user to the terminal device during face recognition registration.
[0040] After determining the initial spacing distance, the initial spacing distance, the initial facial rotation angle, and the device parameters of the image acquisition unit can be used to correct the initial pixel distance to obtain the key point spacing. Here, the spacing distance equation can be constructed based on the pinhole imaging principle, and then the initial pixel distance, the initial spacing distance, the initial facial rotation angle, and the device parameters are substituted into the spacing distance equation to determine the key point spacing. Among them, the spacing distance equation includes the key point spacing, the facial rotation angle is denoted as: α, and the pixel distance is denoted as: , the interval distance is recorded as: H, the equipment parameters include the focal length and internal parameters of the image acquisition unit, the internal parameters include the distortion coefficient, the focal length is recorded as: F, the internal parameters are recorded as: A, the key point spacing is recorded as: .
[0041] When constructing the interval distance expression, you can use the pixel distance The ratio of the cosine value cosα of the facial rotation angle determines the first expression, that is, the first expression is At the same time, according to the internal reference A and the key point spacing The second expression is determined by the ratio of the product of the three, namely, the focal length F and the spacing distance H, which is: In this way, the interval distance expression can be established based on the equation relationship between the first expression and the second expression. The interval distance expression is: Here, the pixel distance The value of is the initial pixel distance, the value of the facial rotation angle α is the initial facial rotation angle, the value of the interval distance H is the initial interval distance, and the internal parameters A and focal length F are also known. Therefore, the key point spacing during face recognition registration can be calculated. The key point spacing is an inherent parameter of the target user, which is fixed. Therefore, the key point spacing can be directly saved and directly retrieved when the target user uses the terminal device in the future. In addition, since the current interval distance H is measured based on the infrared ranging unit, it has a high accuracy, which also improves the calculation accuracy of the key point spacing.
[0042] In order to improve the accuracy and speed of subsequent interval distance calculations, after determining the key point distance, the correspondence between the initial facial features and the key point distance is established and saved, and stored in the terminal device, so that the corresponding relationship can be used to obtain the key point distance corresponding to the target user at a future time (for example, the current time is the future time after face recognition registration). In this way, each user who uses the terminal device only needs to register once, and when using the terminal device again in the future, the key point distance corresponding to the user can be obtained by matching the user's facial features.
[0043] In step S102, the key point distance corresponding to the current facial feature and used to characterize the actual distance between two preset facial key points of the target user is obtained, and the current interval distance between the target user and the terminal device is determined according to the key point distance and the current facial parameters. The key point distance is determined based on the infrared ranging unit.
[0044] The infrared distance measuring unit may refer to a device that uses infrared rays to measure distance. Exemplarily, the infrared distance measuring unit may be an infrared rangefinder.
[0045] The key point distance may refer to the actual distance between the two inner corners of the target user's eyes. The unit of the key point distance may be centimeters or meters.
[0046] In the embodiment of the present application, when the target user uses the terminal device again at the current moment, it is only necessary to obtain the current face image of the target user, and use the current face image to determine the current facial parameters of the target user. Then, using the established correspondence between the initial face feature and the key point spacing, the initial face feature matching the current face feature is selected from the database, and the key point spacing corresponding to the initial face feature is used as the key point spacing corresponding to the acquired current face feature.
[0047] After obtaining the key point spacing of the target user, the key point spacing, the current pixel distance, the current facial rotation angle and the current device parameters of the image acquisition unit can be substituted into the above distance equation to determine the current distance between the target user and the terminal device. In this way, no matter when the target user uses the terminal device, the actual distance between the target user and the terminal device at this time can be quickly calculated based on the key point spacing of the target user stored in the database. And because the key point spacing is obtained based on the measurement result of the infrared ranging unit, it has high accuracy, thus also improving the accuracy of the calculated actual distance.
[0048] It should be noted that although the measurement result of the infrared distance measuring unit has the advantage of high measurement accuracy, since the infrared distance measuring unit measures the distance through an infrared ray, it can only measure the distance between the point on the path passed by the infrared ray and the infrared distance measuring unit. However, when the target user is watching the terminal device, if he is not on the path of the infrared ray emitted by the infrared distance measuring unit, the distance between the target user and the terminal device cannot be measured, and this situation is a common phenomenon. For this reason, when the target user uses the terminal device daily, the infrared distance measuring unit cannot be relied on to measure the distance between the target user and the terminal device.
[0049] In step S103, for each preset facial key point, the pixel value of the target pixel point corresponding to the preset facial key point on the depth map is obtained.
[0050] In the embodiment of the present application, when obtaining the pixel value of the target pixel corresponding to each preset facial key point, the position information of the preset facial key point in the current face image can be obtained first. Then, the target pixel corresponding to the position information is selected in the depth map, and the pixel value of the target pixel corresponding to the position information is obtained.
[0051] Taking the above example, first obtain the position coordinates of the two inner corners of the eye in the current face image, select the pixel points corresponding to the position coordinates of the two inner corners of the eye in the depth map as the target pixel points, and the pixel value of the target pixel point is the pixel value of the two inner corners of the eye in the depth map.
[0052] The target pixel includes a first target pixel and a second target pixel, and the pixel value includes a first pixel value and a second pixel value, wherein the first pixel value is the pixel value of the first target pixel, and the second pixel value is the pixel value of the second target pixel. Taking the left and right inner corners of the eye as an example, the first pixel value may represent the pixel value of the left inner corner of the eye, and the second pixel value may represent the pixel value of the right inner corner of the eye.
[0053] The depth map is represented by a depth map matrix, which is denoted as: B. The pixel value of each pixel in the depth map matrix represents the distance between the position and the image acquisition unit.
[0054] In step S104, the depth map is corrected using the pixel value and the current interval distance to obtain the panoramic distance at the current moment, so as to determine the current posture of the target user using the panoramic distance.
[0055] The panoramic distance is used to reflect the distance between each position on the target user in the depth map and the terminal device. The panoramic distance is represented by a panoramic distance matrix, which is denoted as: C.
[0056] Refer to the following Figure 2 Let's introduce the process of correcting the depth map using pixel values and key point spacing.
[0057] Figure 2 A flow chart of a depth map correction method provided in an embodiment of the present application is shown. Figure 2 As shown, the depth map correction method includes: Step S201 , normalizing the first pixel value and the second pixel value to obtain a normalized distance.
[0058] Here, the first pixel value is recorded as: , the second pixel value is recorded as: , the normalized distance is recorded as: . It can be normalized by the following formula: ; Among them, the normalized distance It is a value ranging from 0 to 1, which is obtained by normalizing the mean of the pixel values corresponding to the two preset facial key points of the target user.
[0059] Step S202, determining a distance correction value according to the normalized distance and the current interval distance.
[0060] Here, the distance correction value can be determined according to the ratio of the current interval distance to the normalized distance. For example, the distance correction value is recorded as: param, and the current interval distance is recorded as: H, then .
[0061] Step S203: Correct the depth map matrix corresponding to the depth map by using the distance correction value to determine the panoramic distance corresponding to the target user at the current moment.
[0062] Here, the panoramic distance can be calculated by the following formula: .
[0063] In this way, the actual distance between each position on the target user and the terminal device in the depth map can be represented by the panoramic matrix C, and then the current posture of the target user can be calculated based on the actual distance between each position on the target user and the terminal device. For example, the current posture of the target user can be calculated through a neural network model or based on a geometric relationship. The specific method for calculating the current posture is not described here.
[0064] At the same time, according to the current posture of the target user, it can be determined whether the current posture meets the warning prompt requirements. For example, if the head-down angle in the current posture is less than the first set angle threshold, or the body forward leaning angle in the current posture is greater than the second set angle threshold, it is determined that the warning prompt requirements are met. If the warning prompt requirements are met, a posture error prompt message is sent to the target user to promptly remind the user to view the electronic device in the correct posture and improve usage habits.
[0065] Based on the same inventive concept, an image data processing device corresponding to the image data processing method is also provided in the embodiment of the present application. Since the principle of solving the problem by the device in the embodiment of the present application is similar to the above-mentioned image data processing method in the embodiment of the present application, the implementation of the device can refer to the implementation of the method, and the repeated parts will not be repeated.
[0066] See also Figure 3 , Figure 3 This is a schematic diagram of the structure of an image data processing device provided in an embodiment of the present application. Figure 3 As shown in , an image acquisition unit and an infrared ranging unit are provided by a terminal device, and the image data processing device 300 includes: The parameter and image acquisition module 301 is used to acquire the current face image of the target user by using the image acquisition unit, and determine the face parameters and depth map of the target user based on the current face image, wherein the current face parameters include the current face features; The distance determination module 302 is used to obtain the key point distance between two preset facial key points corresponding to the current facial feature and used to characterize the actual distance between the target user and the terminal device, and determine the current interval distance between the target user and the terminal device according to the key point distance and the current facial parameters, wherein the key point distance is determined based on the infrared ranging unit; The pixel value acquisition module 303 is used to acquire the pixel value of the target pixel point corresponding to the preset facial key point on the depth map for each preset facial key point; The panoramic distance determination module 304 is used to correct the depth map using pixel values and the current interval distance to obtain the panoramic distance at the current moment, so as to determine the current posture of the target user using the panoramic distance. The panoramic distance is used to reflect the distance between each position on the target user in the depth map and the terminal device.
[0067] See also Figure 4 , Figure 4 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. Figure 4 As shown in , the electronic device 400 includes a processor 410 , a memory 420 and a bus 430 .
[0068] The memory 420 stores machine-readable instructions executable by the processor 410. When the electronic device 400 is running, the processor 410 communicates with the memory 420 via the bus 430. When the machine-readable instructions are executed by the processor 410, the above-mentioned Figure 1 The steps of the method for processing image data in the method embodiment shown and the specific implementation manner can be found in the method embodiment, which will not be described in detail here.
[0069] The present application also provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the computer program can execute the above-mentioned Figure 1 The steps of the method for processing image data in the method embodiment shown and the specific implementation manner can be found in the method embodiment, which will not be described in detail here.
[0070] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0071] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. The device embodiments described above are merely schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some communication interfaces, and the indirect coupling or communication connection of devices or units can be electrical, mechanical or other forms.
[0072] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0073] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0074] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a non-volatile computer-readable storage medium that is executable by a processor. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk, and other media that can store program codes.
[0075] Finally, it should be noted that the above-described embodiments are only specific implementation methods of the present application, which are used to illustrate the technical solutions of the present application, rather than to limit them. The protection scope of the present application is not limited thereto. Although the present application is described in detail with reference to the above-mentioned embodiments, ordinary technicians in the field should understand that any technician familiar with the technical field can still modify the technical solutions recorded in the above-mentioned embodiments within the technical scope disclosed in the present application, or can easily think of changes, or make equivalent replacements for some of the technical features therein; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application, and should be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be based on the protection scope of the claims.
Claims
1. A method for processing image data, characterized in that: Providing an image acquisition unit and an infrared ranging unit through a terminal device, the method includes: Using the image acquisition unit to acquire a current face image of the target user, and determining current facial parameters and a depth map of the target user based on the current face image, wherein the current facial parameters include current facial features; Obtaining a key point distance corresponding to the current facial feature and used to characterize the actual distance between two preset facial key points of the target user, and determining a current interval distance between the target user and the terminal device according to the key point distance and the current facial parameter, wherein the key point distance is determined based on an infrared ranging unit; For each preset facial key point, obtaining a pixel value of a target pixel point corresponding to the preset facial key point on the depth map; The depth map is corrected using the pixel value and the current interval distance to obtain a panoramic distance at the current moment, so as to determine the current posture of the target user using the panoramic distance, and the panoramic distance is used to reflect the distance between each position on the target user in the depth map and the terminal device.
2. The method according to claim 1, characterized in that The pixel value includes a first pixel value and a second pixel value, and the correcting the depth map by using the pixel value and the key point distance includes: Normalizing the first pixel value and the second pixel value to obtain a normalized distance; Determining a distance correction value according to the normalized distance and the current interval distance; The depth map matrix corresponding to the depth map is corrected using the distance correction value to determine the panoramic distance corresponding to the target user at the current moment.
3. The method according to claim 1, characterized in that An infrared ranging unit is provided by the terminal device, and before the image acquisition unit is used to acquire the current face image of the target user, the method further includes: When the target user performs face recognition registration for the terminal device, the image acquisition unit is used to obtain an initial face image of the target user, and initial face parameters are obtained based on the initial face image, wherein the initial face parameters include an initial face rotation angle and an initial pixel distance corresponding to the two preset face key points; Determine the initial distance between the target user and the terminal device by using the infrared distance measuring unit; The initial pixel distance is corrected using the initial interval distance, the initial facial rotation angle and the device parameters of the image acquisition unit to obtain the key point spacing.
4. The method according to claim 3, characterized in that The method of correcting the initial pixel distance by using the initial interval distance, the initial facial rotation angle and the device parameters of the image acquisition unit includes: Based on the pinhole imaging principle, a spacing distance equation is constructed, wherein the spacing distance equation includes the key point spacing; The initial pixel distance, the initial spacing distance, the initial facial rotation angle, and the device parameters are substituted into the spacing distance equation to determine the keypoint spacing.
5. The method according to claim 4, characterized in that The current facial parameters also include a current facial rotation angle and a current pixel distance between the two preset facial key points on the current face image. The current interval distance between the target user and the terminal device is determined based on the key point spacing and the current facial parameters, including: The key point spacing, the current pixel distance, the current facial rotation angle and the device parameters of the image acquisition unit are substituted into the interval distance equation to determine the current interval distance.
6. The method according to claim 4, characterized in that The device parameters include the focal length and internal parameters of the image acquisition unit. The spacing distance expression is constructed based on the pinhole imaging principle, including: Determine a first expression based on a ratio of a pixel distance to a cosine value of a facial rotation angle; Determine a second expression according to the ratio of the product of the internal parameter, the key point spacing and the focal length to the spacing distance; An interval distance expression is established based on the equation relationship between the first expression and the second expression.
7. The method according to claim 4, characterized in that The initial facial parameters also include initial facial features. After substituting the initial pixel distance, the initial spacing distance, the initial facial rotation angle, and the device parameters into the spacing distance equation to determine the key point spacing, the method further includes: A correspondence between the initial facial features and the key point distances is established and saved, so as to obtain the key point distances corresponding to the target user by using the correspondence at the current moment.
8. The method according to claim 2, characterized in that: The determining of a distance correction parameter according to the normalized distance and the current interval distance includes: A distance correction parameter is determined according to a ratio of the current interval distance to the normalized distance.
9. The method according to claim 1, characterized in that: The step of obtaining the pixel value of the target pixel corresponding to the preset facial key point on the depth map includes: Obtaining position information of the preset facial key points in the current face image; A target pixel point corresponding to the position information is selected in the depth map, and a pixel value of the target pixel point corresponding to the position information is obtained.
10. An image data processing device, characterized in that: The terminal device provides an image acquisition unit and an infrared ranging unit, and the device includes: A parameter and image acquisition module, used to acquire a current face image of a target user using the image acquisition unit, and determine current face parameters and a depth map of the target user based on the current face image, wherein the current face parameters include current face features; A distance determination module, used to obtain a key point distance corresponding to the current facial feature and used to characterize the actual distance between two preset facial key points of the target user, and determine the current interval distance between the target user and the terminal device according to the key point distance and the current facial parameter, wherein the key point distance is determined based on an infrared ranging unit; A pixel value acquisition module, used for acquiring, for each preset facial key point, a pixel value of a target pixel point corresponding to the preset facial key point on the depth map; A panoramic distance determination module is used to correct the depth map using the pixel value and the current interval distance to obtain the panoramic distance at the current moment, so as to determine the current posture of the target user using the panoramic distance, and the panoramic distance is used to reflect the distance between each position on the target user in the depth map and the terminal device.
Citation Information
Patent Citations
Method and device for determining face depth map
CN111080689A
Eye-screen distance prompt myopia prevention system based on machine vision
CN113012407A
Image processing method and electronic equipment
CN115272453A
Face deformation compensation method of face depth image, imaging device and storage medium
CN115482182A
Distance obtaining method, device and system and storage medium
CN116086396A