Disclosure of Invention
The invention provides a method for identifying attention based on human eyes and a multimedia terminal, which aim to solve the technical problem.
The technical scheme adopted by the invention is as follows: the method for identifying the attention based on the human eyes comprises the following steps:
creating a camera callback interface, realizing help classes in the camera, and exposing preview data and related exceptions when the camera is executed;
the method comprises the steps of creating a camera instance in a multimedia terminal, calling a camera callback interface, and monitoring a video preview stream returned by a camera;
drawing a face frame, acquiring eyeball data parameters through a face acquisition SDK, and monitoring the rotation range, the interpupillary distance and the corrected interpupillary distance data of the face;
and judging the attention degree in the multimedia terminal, and recording data when a user watches a screen.
As a preferred mode of the method for identifying attention based on human eyes, the method for drawing a human face frame, acquiring eyeball data parameters through a human face acquisition SDK, and monitoring the rotation range, the interpupillary distance and the corrected interpupillary distance data of the human face comprises the following steps:
setting a face detection parameter when the attention equipment is initialized;
the camera stream acquires a face and then compares the face with the database, and after the comparison is finished, the face information is scanned and uploaded;
after various parameters of the eyeballs are obtained, angle filtering is carried out, and finally face data recognized by the camera are returned;
after the face data are obtained, firstly, the interpupillary distance of eyeballs is calculated, and the interpupillary distance of the face is calculated by using the x coordinate and the y coordinate of the center points of the left eye and the right eye through an interpupillary distance formula sqrt ((x2-x1). pow (2) + (y2-y1). pow (2)); where x1 is the x coordinate of the left eye midpoint, x 2: x-coordinate of right eye midpoint, y 1: y-coordinate of left-eye midpoint, y 2: the y-coordinate of the right eye midpoint; pow (2) represents the mathematical square, sqrt () represents the mathematical square;
then using a correction pupil distance formula (ipd/cos (abs (yaw)) Math. PI/180)), calculating the correction pupil distance of the eyeball according to the x coordinate, the y coordinate and the face offset of the midpoint of the left eye and the right eye; wherein, Ipd is the pupil distance of human eyes calculated according to the pupil distance formula, abs (yaw) is the absolute value of the human face rotational offset, yaw is the human face rotational offset, Math.PI is the angle of the circumferential ratio pi;
and matching the pupil distance with a database after the pupil distance is taken, finding out all the close pupil distance data, finding out the most matched data according to the nearest pupil distance, and finally judging whether the target data is in the range of the matched data.
As a preferable mode of the method for recognizing the attention based on the human eye, the performing of the filtering of the angle includes:
judging whether the left and right deflection angles of the face are within the initialization parameters, judging whether the head rotation angle in the parallel plane of the face exceeds the limit, judging whether the upper and lower deflection angles of the face exceed the limit, and filtering the exceeding part.
As a preferable mode of the method for recognizing the attention based on the human eye, the face detection parameters include: minimum face number, blur, occlusion, and illumination quality detection standard.
The invention also discloses a multimedia terminal which judges whether the user is watching the multimedia product terminal by the method for identifying the attention degree based on the human eyes.
The invention has the beneficial effects that: the invention can realize the purpose of capturing the sight range and angle of human eyes to judge whether a user watches the multimedia product terminal. A large database is established by acquiring the watching preference of a user, and accurate advertisement or video delivery is realized. The method can effectively solve the problem of the efficiency of face recognition by monitoring the real-time preview flow of the camera to capture the face frame, and does not need the user to stay in front of the camera for a long time. The method comprises the steps of acquiring the interpupillary distance of a user after capturing a face, correcting the interpupillary distance, and comparing data in a database to detect whether the user is watching, so that the monitoring of the user attention is realized.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention clearer, the present invention will be described in further detail below with reference to the accompanying drawings, but embodiments of the present invention are not limited thereto.
Abbreviations and key term definitions:
the multimedia terminal is developed based on an Android system.
Face recognition attention: on the basis of face recognition, whether the eyeball sight range is in the interval concerned by the equipment is detected.
The ladder inner screen: multimedia terminal equipment inside the elevator.
Attention device: face identification camera.
Example 1:
referring to fig. 1-2, the present embodiment discloses a method for identifying attention based on human eyes, which develops a human face identification attention and non-perception face identification technology for detecting an eyeball sight range based on a human face acquisition and living body detection technology. In the test stage of the project, the attention equipment collects eyeball data of a user watching the multimedia terminal at different angles through a large number of recognition tests, and then fine adjustment of data results is carried out through a dynamically distributed algorithm model. After actual pupil distance data of a user are obtained, finding out all close pupil distances in a database and then matching, finding out the most matched data according to the most matched pupil distance, and detecting whether the user is watching a product terminal in front of a camera by realizing methods such as camera angle, eyeball capture, eyeball watching range library and the like.
The method specifically comprises the following steps:
s1: and (3) creating a camera callback interface, realizing help classes in the camera, and exposing preview data and related exceptions when the camera is executed.
The attention device needs to adjust parameters internally, and the function needs to call a camera to realize a help class and perform deployment in mips of the multimedia terminal. Such as: whether a mirror image function is started or not, whether a front camera is started or not, preview size setting, terminal screen adaptation, focusing mode setting and the like.
S2: the method comprises the steps of creating a camera instance in the multimedia terminal, calling a camera callback interface, and monitoring a video preview stream returned by the camera.
The attention equipment cannot independently solve the problems of information collection, face drawing and the like, so that a multimedia terminal is required to participate, and a preview stream is processed in a camera callback interface. The multimedia terminal needs to acquire the camera instance to perform the next operation.
S3: drawing a face frame, acquiring eyeball data parameters through a face acquisition SDK, and monitoring data such as a face rotation range, an interpupillary distance, a correction interpupillary distance and the like.
After monitoring the camera preview callback, the terminal will start to judge the face frame logic, whether the face frame is displayed or not, and whether the position of human eyes is drawn or not. And carrying out code operation according to actual requirements.
S4: and judging the attention degree in the multimedia terminal, and recording data when a user watches a screen.
And finally, comparing information such as the detected positions of human eyes, the pupil distance and the corrected pupil distance with data in a database, judging whether the user is watching the screen or not, and recording the current time stamp or advertisement data if the user is watching the screen.
Further, referring to fig. 3, S3 specifically includes the following steps:
s301: setting face detection parameters when the attention device is initialized, wherein the face detection parameters comprise: and (5) quality detection standards such as minimum face number, blur, shielding, illumination and the like.
S302: and the camera stream acquires the face and then compares the face with the database, and after the comparison is finished, the face information is scanned and uploaded.
S303: after various parameters of the eyeballs are obtained, angle filtering is carried out, and finally face data recognized by the camera are returned.
Performing angular filtering includes: judging whether the left and right deflection angles of the face are within the initialization parameters, judging whether the head rotation angle in the parallel plane of the face exceeds the limit, judging whether the upper and lower deflection angles of the face exceed the limit, and filtering the exceeding part.
S304: after the face data is obtained, the interpupillary distance of the eyeball is firstly calculated, and the interpupillary distance of the face is calculated by using the x coordinate and the y coordinate of the center points of the left eye and the right eye through the interpupillary distance formula sqrt ((x2-x1). pow (2) + (y2-y1). pow (2)). Where x1 is the x coordinate of the left eye midpoint, x 2: x-coordinate of right eye midpoint, y 1: y-coordinate of left-eye midpoint, y 2: the y-coordinate of the right eye midpoint; pow (2) represents the mathematical square and sqrt () represents the mathematical square.
S305: then, using a correction pupil distance formula (ipd/cos (abs (raw)) math.pi/180)), the correction pupil distance of the eyeball is calculated by the x-coordinate, y-coordinate of the midpoint between the left and right eyes and the face offset. Wherein, Ipd is the pupil distance of human eyes calculated according to the pupil distance formula, abs (yaw) is the absolute value of the human face rotation offset, yaw is the human face rotation offset, and Math.PI is the angle of the circumferential ratio pi.
S306: and matching the pupil distance with a database after the pupil distance is taken, finding out all the close pupil distance data, finding out the most matched data according to the nearest pupil distance, and finally judging whether the target data is in the range of the matched data.
Example 2
The present embodiment discloses a multimedia terminal, which determines whether a user is watching a multimedia product terminal by the method of identifying attention based on human eyes as described in embodiment 1.
The application scenarios of the invention are as follows: the face attention device is carried on the inner screen of the elevator, so that the attention degree of a user to advertisement putting can be effectively detected, and an exclusive advertisement putting mechanism of each user is generated by combining a timestamp of playing advertisements on the screen, so that a foundation is laid for big data. The face attention device can judge whether the user is watching the multimedia product terminal by capturing the sight range and the angle of eyeballs on the face.
The above examples are only intended to illustrate the technical solution of the present invention, but not to limit it; although the invention has been described in detail with reference to the foregoing embodiments, it will be understood by those skilled in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions of the embodiments of the present invention.