Image processing method, medium and electronic device
By obtaining the coordinates of key points in the target image and mapping them to the target scene coordinate system using device parameters and fitting methods, the problem of inaccurate judgment of the positional relationship between the target object and the region in the existing technology is solved, and efficient and accurate positional relationship judgment and attention statistics are achieved.
Patent Information
- Application Number
- CN202210087984.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-01-25
- Publication Date
- 2025-10-21
- Estimated Expiration
- 2042-01-25
AI Technical Summary
Existing technologies have difficulty in accurately determining the relative positional relationship between a target object and a target area, especially in complex application scenarios and with changing user demands, and the accuracy is insufficient.
By obtaining the coordinates of key points in the target image, the first mapping parameter is used to map them to the second coordinate system. Combined with the parameters of the image acquisition device, such as height, field of view, and tilt angle, the coordinates are further mapped to the third coordinate system to obtain the relative positional relationship between the target object and the target area. The second mapping parameter is obtained by using a fitting method.
It achieves high accuracy in determining the relative positional relationship between the target object and the target area, reduces manual intervention, improves engineering deployment efficiency, and lowers maintenance costs.
Smart Images

Figure CN114494688B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image processing, and in particular to an image processing method, medium and electronic equipment. Background Art
[0002] In practical applications, it is often necessary to determine the degree of attention a target object pays to a target area. Accurately determining the relative positional relationship between the target object and the target area is a prerequisite for achieving this goal. However, due to factors such as complex application scenarios and changing user needs, existing technologies have difficulty accurately determining the relative positional relationship between the target object and the target area. Summary of the Invention
[0003] In view of the above-mentioned shortcomings of the prior art, an object of the present invention is to provide an image processing method, a medium and an electronic device for solving the above-mentioned problems in the prior art.
[0004] To achieve the above-mentioned purpose and other related purposes, the first aspect of the present invention provides an image processing method, which includes: obtaining a target image, which contains image points of key points of a target object; obtaining the coordinates of the image points of the key points in a first coordinate system as first coordinates, and the first coordinate system is a coordinate system established based on the target image; mapping the first coordinates to a second coordinate system to obtain the coordinates of the key points in the second coordinate system as second coordinates, and the second coordinate system is a coordinate system established based on a target scene; and obtaining the relative position relationship between the target object and the target area in the target scene according to the second coordinates.
[0005] In an embodiment of the first aspect, the method for mapping the first coordinate to a second coordinate system includes: mapping the first coordinate to the second coordinate system using a first mapping parameter, wherein the first mapping parameter includes the height of the image acquisition device used to acquire the target image, the horizontal field of view angle of the image acquisition device, the tilt angle of the image acquisition device, and the resolution of the target image.
[0006] In an embodiment of the first aspect, a method for mapping the first coordinate to a second coordinate system to obtain the coordinates of the key point in the second coordinate system as the second coordinate includes: obtaining a first distance and a second distance based on the first coordinate and the coordinates of the center point of the target image, the first distance refers to the lateral distance between the image point of the key point and the center point of the target image, and the second distance refers to the longitudinal distance between the image point of the key point and the center point; obtaining a first offset angle based on the first distance, the second distance, the resolution of the target image, and the horizontal field of view of the image acquisition device; obtaining a second offset angle based on the first offset angle, the first distance, and the second distance; obtaining a third distance and a fourth distance based on the height of the image acquisition device, the first offset angle, the second offset angle, and the horizontal field of view of the image acquisition device, the third distance refers to the lateral distance between the key point and the origin of the second coordinate system, and the fourth distance refers to the longitudinal distance between the key point and the origin of the second coordinate system; obtaining the second coordinate based on the third distance and the fourth distance.
[0007] In an embodiment of the first aspect, the method for obtaining the relative position relationship between the target object and the target area in the target scene based on the second coordinates includes: mapping the second coordinates to a third coordinate system to obtain the mapping point coordinates corresponding to the key point as the third coordinates; and obtaining the relative position relationship between the target object and the target area based on the mapping point coordinates corresponding to the feature points of the target area in the third coordinate system and the third coordinates.
[0008] In an embodiment of the first aspect, the third coordinate system is a coordinate system established based on a drawing of the target scene.
[0009] In an embodiment of the first aspect, a method for mapping the second coordinate to a third coordinate system includes: mapping the second coordinate to the third coordinate system using second mapping parameters, wherein the second mapping parameters are obtained by fitting.
[0010] In an embodiment of the first aspect, the image processing method further includes: acquiring the attention level of the target area according to a relative positional relationship between the target object and the target area.
[0011] In an embodiment of the first aspect, the image processing method further includes: processing the target image to obtain the image points of the key points contained therein; and filtering the image points of the key points according to the confidence level of each image point.
[0012] A second aspect of the present invention provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the image processing method described in any one of the first aspects of the present invention.
[0013] A third aspect of the present invention provides an electronic device, comprising: a memory storing a computer program; and a processor communicatively connected to the memory, for executing the image processing method described in any one of the first aspects of the present invention when calling the computer program.
[0014] As described above, the image processing method described in one or more embodiments of the present invention has the following beneficial effects:
[0015] The image processing method can obtain the actual position of the key point in the target scene based on the image point position of the key point in the target image, and then judge the relative position relationship between the target object and the target area based on the actual position of the key point in the target scene. This method has the advantages of high accuracy and basically no need for human intervention. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] Figure 1 Shown is a flowchart of an image processing method according to a specific embodiment of the present invention.
[0017] Figure 2A FIG. 1 is a detailed flow chart of step S13 of the image processing method according to an embodiment of the present invention.
[0018] Figure 2B Shown is an example diagram of a target image in a specific embodiment of the image processing method of the present invention.
[0019] Figure 2C Shown is an example diagram of the positional relationship of relevant points in a specific embodiment of the image processing method of the present invention.
[0020] Figure 3A FIG. 1 is a detailed flow chart of step S14 of the image processing method according to an embodiment of the present invention.
[0021] Figure 3B FIG. 1 is a detailed flowchart of step S142 of the image processing method according to an embodiment of the present invention.
[0022] Figure 4 Shown is a flowchart of key steps in a specific embodiment of the image processing method of the present invention.
[0023] Figure 5A Shown is a flowchart of the deployment phase of the image processing method according to one embodiment of the present invention.
[0024] Figure 5BShown is an example diagram of a target scene in a specific embodiment of the image processing method of the present invention.
[0025] Figure 5C Shown is a drawing example of a target scene in a specific embodiment of the image processing method of the present invention.
[0026] Figure 5D FIG. 1 is a flow chart showing the calculation stage of the image processing method according to one embodiment of the present invention.
[0027] Figure 6 Shown is a schematic structural diagram of the electronic device according to a specific embodiment of the present invention.
[0028] Component number description
[0029] 600 Electronic Equipment
[0030] 610 Memory
[0031] 620 processor
[0032] 630 Display
[0033] Steps S11 to S14
[0034] Steps S131 to S135
[0035] Steps S141-S142
[0036] Steps S1421 to S1423
[0037] Steps S41-S42
[0038] Steps S511 to S517
[0039] Steps S521 to S529 DETAILED DESCRIPTION
[0040] The following describes the embodiments of the present invention through specific examples. Those skilled in the art can easily understand other advantages and effects of the present invention from the content disclosed in this specification. The present invention can also be implemented or applied through other different specific embodiments. The details in this specification can also be modified or changed based on different viewpoints and applications without departing from the spirit of the present invention. It should be noted that the following embodiments and features in the embodiments can be combined with each other unless they conflict.
[0041] It should be noted that the diagrams provided in the following embodiments are merely schematic illustrations of the basic concept of the present invention. The diagrams only show components relevant to the present invention and are not drawn according to the number, shape, and size of components in actual implementation. In actual implementation, the type, quantity, and proportion of each component may be arbitrarily varied, and the component layout may also be more complex. Furthermore, in this document, relational terms such as "first," "second," and the like are used solely to distinguish one entity or operation from another, and do not necessarily require or imply any actual relationship or order between these entities or operations.
[0042] In one embodiment of the present invention, an image processing method is provided. Figure 1 , which is a flow chart of the image processing method described in this embodiment. Figure 1 As shown, the image processing method includes steps S11 to S14.
[0043] Step S11: Acquire a target image. The target image may be, for example, an image captured by an image acquisition device such as a surveillance camera. The target image includes image points of key points of the target object, i.e., corresponding points of the key points in the target image. The target object may be, for example, a human body, but the present invention is not limited thereto. The key points of the target object are points that can indicate the location of the target object. In this embodiment, the detection of these key points can be achieved using methods such as deep learning.
[0044] Optionally, when the target object is a human body, the key points may be nodes at human joints, such as nose, left eye, right eye, left ear, right ear, neck, left shoulder, right shoulder, left hip, right hip, left knee, left ankle, right knee, right ankle, left elbow, left wrist, right elbow and / or right wrist, etc.
[0045] Step S12: Obtain coordinates of the image point of the key point in a first coordinate system as first coordinates. The first coordinate system is a coordinate system established based on the target image, and the first coordinates are used to represent the position of the image point of the key point in the target image. The first coordinate system can be, for example, a two-dimensional coordinate system established with a corner point or center point of the target image as its origin, but the present invention is not limited thereto.
[0046] Step S13: Mapping the first coordinates to a second coordinate system to obtain the coordinates of the key point in the second coordinate system as second coordinates. The second coordinate system is a coordinate system established based on the target scene, and the second coordinates are used to represent the actual position of the key point in the target scene. The second coordinate system can be a three-dimensional coordinate system established with any point in the target scene as the origin. In this embodiment, the second coordinate system is preferably a three-dimensional coordinate system established with the vertical projection point of the image acquisition device on a reference plane as the origin, and the reference plane is, for example, the ground.
[0047] Step S14, obtaining the relative positional relationship between the target object and the target area based on the second coordinate, wherein the target area is located in a target scene, and the target scene is, for example, a retail store. The relative positional relationship between the target object and the target area may include: the target object is located inside the target area or the target object is located outside the target area. Specifically, the second coordinate can represent the actual position of the target object in the target scene, and the target area is one or more areas in the target scene, and its range can be configured or adjusted according to actual needs. Therefore, in this embodiment, the relative positional relationship between the target object and the target area can be obtained based on the second coordinate and the range of the target area.
[0048] In one embodiment of the present invention, a method for mapping the first coordinates to a second coordinate system includes mapping the first coordinates to the second coordinate system using first mapping parameters, wherein the first mapping parameters include the height of an image acquisition device used to acquire the target image, the horizontal field of view angle of the image acquisition device, the tilt angle of the image acquisition device, and the resolution of the target image. The first mapping parameters can be obtained through actual measurement, for example, by using a ranging device such as a laser rangefinder to obtain the height of the image acquisition device from a reference plane, or by using an angle measuring instrument to obtain the tilt angle of the image acquisition device.
[0049] Optionally, in this embodiment, the first mapping parameters may be acquired during installation or deployment of the image acquisition device. Furthermore, when the first mapping parameters change, for example, when the height and / or tilt angle of the image acquisition device is adjusted, this embodiment requires reacquiring the changed first mapping parameters.
[0050] Optionally, the image acquisition device in this embodiment may be a fixed-focus camera, and in this case, there is no need to obtain the internal parameters of the image acquisition device.
[0051] Optionally, see Figure 2A, which shows a method for implementing the mapping of the first coordinate to the second coordinate system in this embodiment to obtain the coordinates of the key point as the second coordinate. Figure 2A As shown, in this embodiment, the method includes the following steps S131 to S135.
[0052] Step S131, obtaining a first distance and a second distance based on the first coordinates and the coordinates of the center point of the target image, wherein the first distance refers to the horizontal distance between the image point of the key point and the center point of the target image, and the second distance refers to the vertical distance between the image point of the key point and the center point.
[0053] Step S132: Obtain a first offset angle based on the first distance, the second distance, the resolution of the target image, and the horizontal field of view of the image acquisition device. The first offset angle is the offset angle of the key point relative to a central projection point in the direction of a line connecting the key point and the image acquisition device. The central projection point is the projection point of the center point of the target image on a reference plane, where the projection center is the image acquisition device.
[0054] Step S133: Obtain a second offset angle according to the first offset angle, the first distance, and the second distance. The second offset angle refers to the offset angle of the key point relative to the central projection point in the vertical direction (Y-axis direction).
[0055] Step S134: Acquire a third distance and a fourth distance based on the height of the image acquisition device, the first offset angle, the second offset angle, and the horizontal field of view angle of the image acquisition device. The third distance refers to the lateral distance between the key point and the origin of the second coordinate system, and the fourth distance refers to the longitudinal distance between the key point and the origin of the second coordinate system.
[0056] Step S135: Acquire the second coordinate according to the third distance and the fourth distance.
[0057] The following will explain the above steps in detail through a specific example. Figure 2B and Figure 2C, where B' is the image point of the key point B in the target image, O' is the center point of the target image, C' is the projection point of point B' in the vertical direction (i.e., the Y-axis direction) of the center point O', px is the first distance, and py is the second distance, both of which can be obtained based on the target image. D represents the position of the image acquisition device in the target scene, for example, it can be the center point of the lens of the image acquisition device. G represents the vertical projection point of D on the reference plane, and the length of DG is the height of the image acquisition device. O represents the projection point of point O' on the reference plane, and its projection center is point D, which is used to represent the position of point O' on the reference plane. C represents the projection point of point C' on the reference plane, and its projection center is point D, which is used to represent the position of point C' on the reference plane. The horizontal field of view angle α of the image acquisition device corresponds to ∠GDO in the figure, the first offset angle γ corresponds to ∠ODB in the figure, and the second offset angle β corresponds to ∠ODC in the figure. Furthermore, points D, G, and O lie on the same plane, BC is perpendicular to the plane, and point A is the intersection of the extended line of OD and the perpendicular projection of C. That is, AC is perpendicular to AD. The third distance is the length of GC, and the fourth distance is the length of BC.
[0058] based on Figure 2B and Figure 2C In this embodiment, step S132 can obtain the first offset angle γ by the following formula: in Image w Indicates the width of the target image, and HFOV indicates the horizontal field of view of the image acquisition device. For example, if the resolution of the decoded target image is 1920×1080 and HFOV=52°, then the pixel at this resolution is scale In this embodiment, step S133 can obtain the second offset angle β by the following formula: In this embodiment, step S134 can obtain the third distance |GC| by the following formula: |GC|=|DG|×tan(α+β), where |DG| represents the height of the image acquisition device relative to the reference plane. In this embodiment, step S134 can obtain the fourth distance |BC| by the following formula: in, |OC|=|GC|-|OG|, |OG|=|DG|×tan(α), |AB|=|DA|×tan(γ), |DA|=|OA|+|DO|.
[0059] In the above manner, this embodiment can obtain the third distance |GC| and the fourth distance |BC|. When point G is used as the origin of the second coordinate system, the third distance |GC| and the fourth distance |BC| are the horizontal coordinate (x coordinate) and the vertical coordinate (y coordinate) of the key point B. When the second coordinate system is a three-dimensional coordinate system, the vertical coordinate (z coordinate) of the key point B can be obtained according to the category of the key point B. For example, if the key point B is the middle point between the left and right ankles, its vertical coordinate is configured as the first value. If the key point B is the middle point between the left and right hips, its vertical coordinate is configured as the second value, and so on. The first value and the second value can be preset values, but the present invention is not limited to this.
[0060] See also Figure 3A In one embodiment of the present invention, the method for obtaining the relative position relationship between the target object and the target area in the target scene according to the second coordinate includes the following steps S141 and S142.
[0061] Step S141 : Mapping the second coordinates to a third coordinate system to obtain mapping point coordinates corresponding to the key point as third coordinates.
[0062] Optionally, the third coordinate system is a coordinate system established based on a drawing of the target scene, but the present invention is not limited thereto.
[0063] Step S142, obtaining the relative positional relationship between the target object and the target area based on the mapping point coordinates corresponding to the feature points of the target area in the third coordinate system and the third coordinates. The feature points of the target area are used to define the scope of the target area. For example, when the target area is a quadrilateral, the feature points of the target area can be the four vertices of the rectangle. For another example, when the target area is a circle, the feature points of the target area can be the center of the circle and any one or more points on the circumference. For any feature point of the target area, the mapping point coordinates corresponding to the feature point can be obtained by mapping the coordinates of the feature point to the third coordinate system. Based on the mapping point coordinates corresponding to the feature points of the target area, the scope of the target area in the third coordinate system can be obtained, and based on the third coordinates, the corresponding position of the key point in the third coordinate system can be obtained. Therefore, based on the third coordinates and the mapping point coordinates corresponding to the feature points of the target area, the relative positional relationship between the key point and the target area can be determined.
[0064] Optionally, a method for mapping the second coordinate to the third coordinate system is: mapping the second coordinate to the third coordinate system using second mapping parameters, wherein the second mapping parameters are obtained by fitting.
[0065] See also Figure 3B In this embodiment, a method for obtaining the second mapping parameters by fitting includes the following steps S1421 to S1423.
[0066] Step S1421: Obtain the distance between the mapping point corresponding to the image acquisition device and the mapping point corresponding to each of the feature points in the third coordinate system, thereby obtaining a first matrix. Each element in the first matrix is the distance between the mapping point corresponding to the image acquisition device and the mapping point corresponding to one of the feature points. In particular, when the third coordinate system is a coordinate system established based on a drawing of the target scene, the distance between the mapping point corresponding to the image acquisition device and the mapping point corresponding to each of the feature points can be obtained based on the drawing of the target scene.
[0067] Step S1422: Obtain the distance between the image acquisition device and each of the feature points on the reference plane, thereby obtaining a second matrix. Each element in the second matrix is the distance between the image acquisition device and a feature point on the reference plane, that is, the projected length of the line connecting the image acquisition device and a feature point on the reference plane.
[0068] S1423: Perform parameter fitting according to the first matrix and the second matrix to obtain the second mapping parameters.
[0069] Optionally, in step S1423, the least squares method may be used to implement the parameter fitting. Specifically, the least squares method may be used to fit the coefficients of the following binomial to obtain the second mapping parameters a0, a1, and a2 from the second matrix to the first matrix: f(x)=a0+a1×x+a2×x 2 .
[0070] It should be noted that the process of obtaining the second mapping parameters and / or obtaining the mapping point coordinates corresponding to the feature points of the target area can be completed during the calibration process of the image acquisition device, but the present invention is not limited thereto.
[0071] In an embodiment of the present invention, the image processing method further includes: obtaining the attention level of the target area according to the relative position relationship between the target object and the target area.
[0072] Specifically, in this embodiment, the image acquisition device can be used to obtain multiple frames of target images, and the relative position relationship between the target object and the target area can be obtained based on the target images of each frame. If the target object is located within the target area according to a certain frame of target image, and the target object is located outside the target area according to the previous frame of target image, the state of the target object is updated to be located within the target area, and the degree of attention of the target area is increased by one. If the target object is located outside the target area according to a certain frame of target image, and the target object is located within the target area according to the previous frame of target image, the state of the target object is updated to be located outside the target area. In this way, the total degree of attention of the target area over a period of time (for example, one day) can be obtained.
[0073] See also Figure 4 In one embodiment of the present invention, the image processing method further includes the following steps S41 and S42.
[0074] Step S41 : Process the target image to obtain image points of all key points contained therein, where the image points of each key point form an image point set.
[0075] Step S42: Filter the image points of the key points based on the confidence level of each image point. For example, a confidence threshold may be set, and the image points in the image point set may be filtered based on the confidence threshold to retain image points with a confidence level higher than the confidence threshold and delete image points with a confidence level lower than the confidence threshold.
[0076] In one embodiment of the present invention, the image processing method includes a deployment phase and a calculation phase. The deployment phase is used to calibrate the image acquisition device, the target area, the first mapping parameters, and the second mapping parameters. The calculation phase is used to process the target image captured by the image acquisition device to detect a human body in the target image, calculate the relative position of the human body and the target area, and obtain the degree of attention of the target area.
[0077] Specifically, see Figure 5A In this embodiment, the deployment phase includes the following steps S511 to S517.
[0078] Step S511: Obtain first mapping parameters, which include the height of the image acquisition device used to acquire the target image, the horizontal field of view angle of the image acquisition device, the tilt angle of the image acquisition device, and the resolution of the target image. Based on the first mapping parameters, the number of pixels per unit angle can be obtained.scale .
[0079] Step S512: Acquire a calibration image, wherein the calibration image includes the target area in the target scene, and the target area includes a plurality of feature points. For example, Figure 5B An example image of the calibration image is shown, which includes a counter S and a target area I. The feature points of the target area I include vertices e1, e2, b1, and b2, and may also include vertices t1 and t2 adjacent to the counter S and the target area I.
[0080] Step S513: Obtain the coordinates of the image point of the feature point in the calibration image in the first coordinate system as the fourth coordinates. Figure 5B In step S513, the coordinates of e1, e2, b1, b2, t1 and t2 can be obtained. When t1 and b1 are not both visible, the coordinates of only one of the two can be obtained. When t2 and b2 are not both visible, the coordinates of only one of the two can be obtained.
[0081] In step S514, the fourth coordinate is mapped to the second coordinate system using the first mapping parameter to obtain a fifth coordinate, where the fifth coordinate is the coordinate of the feature point in the second coordinate system. This mapping process is similar to step S13 above and will not be described in detail here.
[0082] Step S515: Obtain the distance between the image acquisition device and each of the feature points on the reference plane based on the fifth coordinate, and obtain a second matrix. For example, the lengths of the projections of the lines connecting the image acquisition device and the feature points b1, b2, e1, and e2 on the reference plane may be obtained as the distances between the image acquisition device and the feature points b1, b2, e1, and e2, respectively. A 1×4 matrix is generated based on these four distances as the second matrix.
[0083] Step S516, obtaining the distance between the mapping point corresponding to the image acquisition device and the mapping point corresponding to each of the feature points according to the drawing of the target scene, and obtaining a first matrix. Specifically, the mapping point corresponding to the image acquisition device can be a point in the drawing indicating the position of the image acquisition device. The mapping point corresponding to the feature point can be a point in the drawing indicating the position of the feature point. For example, refer to Figure 5C , which is an example image of the target scene. At this time, the distances from the mapping point C_G corresponding to the image acquisition device in the drawing to the mapping points C_g_b1, C_g_b2, C_g_e1 and C_g_e2 corresponding to each of the feature points can be obtained, and a 1×4 matrix is generated based on these four distances as the first matrix.
[0084] Step S517: Fitting is performed based on the first matrix and the second matrix to obtain the second mapping parameters. For example, the least square method can be used to implement the fitting.
[0085] As can be seen from the above description, the above steps S511 to S517 can complete the deployment of the device. If the installation angle, height and other parameters of the image acquisition device change during the application process, some or all of the above steps S511 to S517 can be re-executed.
[0086] See also Figure 5D , the calculation stage described in this embodiment includes the following steps S521 to S529.
[0087] Step S521: Acquire a target image, where the target image includes the target area.
[0088] Step S522: perform key point detection on the target image to obtain image points of all key points of the human body in the target image.
[0089] Step S523 , filtering the image points of the key points of the human body according to the confidence score of each image point.
[0090] Step S524: Select target key points for calculation and their corresponding heights from the image points of the human body key points based on preset rules. The preset rules are, for example: if the target image contains image points of the left and right ankles, the middle point of the left and right ankles is used as the target key point, and the corresponding height is a third value, such as 0; otherwise, if the target image contains image points of the left and right buttocks, the middle point of the left and right buttocks is used as the target key point, and the corresponding height is a fourth value, such as 1; otherwise, if the target image contains the nose, left and right eyes, or left and right ears, the middle point of the nose, left and right eyes, or left and right ears is selected as the target key point, and the corresponding height is a fifth value, such as 1.7; otherwise, the intersection of the central axis and the top edge of the detection frame is used as the target key point, and the corresponding height is a sixth value, such as 1.7.
[0091] Step S525 : Acquire the coordinates of the image point of the target key point in the target image as the sixth coordinates.
[0092] Step S526: Map the sixth coordinate to the second coordinate system using the first mapping parameter to obtain the coordinate of the target key point in the second coordinate system as the seventh coordinate.
[0093] Step S527: Map the seventh coordinate to a third coordinate system using the second mapping parameter to obtain mapping point coordinates corresponding to the target key point.
[0094] Step S528 : Acquire the relative positional relationship between the target object and the target area according to the mapping point coordinates corresponding to the feature points of the target area and the mapping point coordinates corresponding to the target key points in the third coordinate system.
[0095] Step S529: Acquire the attention level of the target area according to the relative position relationship between the target object and the target area.
[0096] Based on the above description of the image processing method, the present invention further provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the image processing method of the present invention is implemented.
[0097] The present invention also provides an electronic device. Figure 6 In one embodiment of the present invention, an electronic device 600 includes a memory 610 and a processor 620. The memory 610 stores a computer program, and the processor 620 is in communication with the memory 610 and executes the image processing method of the present invention when calling the computer program.
[0098] Optionally, the electronic device 600 may further include a display 630. The display 630 is communicatively connected to the memory 610 and the processor 620, and is configured to display a GUI interaction interface related to the image processing method.
[0099] The protection scope of the image processing method described in the present invention is not limited to the execution order of the steps listed in this embodiment. All solutions implemented by adding, reducing, or replacing steps in the prior art based on the principles of the present invention are included in the protection scope of the present invention.
[0100] In summary, the image processing method described in this invention can accurately and rapidly determine the relative positional relationship between a target object and a target area, and thus, the level of attention received by the target area. Furthermore, this image processing method defines a comprehensive deployment and calculation method, effectively improving project deployment efficiency, enabling customer attention statistics, and reducing subsequent maintenance costs. Therefore, this invention effectively overcomes the shortcomings of existing technologies and possesses high industrial value.
[0101] The above embodiments are merely illustrative of the principles and effects of the present invention and are not intended to limit the present invention. Anyone skilled in the art may modify or alter the above embodiments without departing from the spirit and scope of the present invention. Therefore, all equivalent modifications or alterations made by one of ordinary skill in the art without departing from the spirit and technical principles disclosed herein are intended to be covered by the claims of the present invention.
Claims
1. An image processing method, characterized in that: The image processing method comprises: Acquire a target image, wherein the target image contains image points of key points of the target object; Acquire coordinates of an image point of the key point in a first coordinate system as first coordinates, where the first coordinate system is a coordinate system established based on the target image; Mapping the first coordinates to a second coordinate system to obtain coordinates of the key point in the second coordinate system as second coordinates, where the second coordinate system is a coordinate system established based on the target scene; Acquire a relative positional relationship between the target object and a target area in the target scene according to the second coordinate; Wherein, acquiring the relative positional relationship between the target object and the target area in the target scene according to the second coordinate includes: Obtaining, in a third coordinate system, a distance between a mapping point corresponding to an image acquisition device and a mapping point corresponding to each feature point of the target area, thereby obtaining a first matrix, wherein each element in the first matrix is a distance between a mapping point corresponding to the image acquisition device and a mapping point corresponding to one of the feature points, wherein the feature points of the target area are used to define a range of the target area; Obtaining the distance between the image acquisition device and each of the feature points on the reference plane, and then obtaining a second matrix, wherein each element in the second matrix is the distance between the image acquisition device and one of the feature points on the reference plane; performing parameter fitting according to the first matrix and the second matrix to obtain the second mapping parameters; Mapping the second coordinates to the third coordinate system using the second mapping parameters to obtain mapping point coordinates corresponding to the key point as third coordinates, wherein the third coordinate system is a coordinate system established based on a drawing of the target scene; The relative positional relationship between the target object and the target area is acquired according to the mapping point coordinates corresponding to the feature points of the target area in the third coordinate system and the third coordinates.
2. The image processing method according to claim 1, wherein: The implementation method of mapping the first coordinate to the second coordinate system includes: mapping the first coordinate to the second coordinate system using first mapping parameters, wherein the first mapping parameters include the height of the image acquisition device used to acquire the target image, the horizontal field of view angle of the image acquisition device, the tilt angle of the image acquisition device, and the resolution of the target image.
3. The image processing method according to claim 2, wherein: The method for mapping the first coordinates to a second coordinate system to obtain the coordinates of the key point in the second coordinate system as the second coordinates includes: Acquire a first distance and a second distance according to the first coordinates and the coordinates of the center point of the target image, wherein the first distance refers to the horizontal distance between the image point of the key point and the center point of the target image, and the second distance refers to the vertical distance between the image point of the key point and the center point; Acquire a first offset angle according to the first distance, the second distance, the resolution of the target image, and the horizontal field of view angle of the image acquisition device; Acquire a second offset angle according to the first offset angle, the first distance, and the second distance; Acquire a third distance and a fourth distance based on the height of the image acquisition device, the first offset angle, the second offset angle, and the horizontal field of view of the image acquisition device, wherein the third distance refers to the lateral distance between the key point and the origin of the second coordinate system, and the fourth distance refers to the longitudinal distance between the key point and the origin of the second coordinate system; The second coordinate is acquired according to the third distance and the fourth distance.
4. The image processing method according to claim 1, wherein: The image processing method further includes: obtaining the attention level of the target area according to the relative position relationship between the target object and the target area.
5. The image processing method according to claim 1, wherein: The image processing method further includes: Processing the target image to obtain image points of the key points contained therein; The image points of the key points are filtered according to the confidence level of each image point.
6. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the image processing method according to any one of claims 1 to 5 is implemented.
7. An electronic device, characterized in that: The electronic device comprises: a memory storing a computer program; A processor is communicatively connected to the memory, and executes the image processing method according to any one of claims 1 to 5 when calling the computer program.
Citation Information
Patent Citations
Image coordinate system conversion method and device, equipment and storage medium
CN110458895A
Method for acquiring coordinate transformation matrix and positioning target in monitoring picture
CN111461994A
Image processing method and device, electronic equipment and computer readable storage medium
CN113706609A