Image Cropping Method, Device, Computer Equipment and Storage Medium

By calculating the face coordinates and width and height of the spokesperson image and dynamically cropping the image, the problems of low image cropping efficiency and poor effect in the prior art are solved, and the cropping quality and conference efficiency of the spokesperson image in video conference are improved.

CN114842031BActive Publication Date: 2025-07-01SHENZHEN KTC COMMERCIAL DISPLAY TECHNOLOGY CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210517477.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-05-12
Publication Date
2025-07-01
Estimated Expiration
2042-05-12

AI Technical Summary

Technical Problem

The existing image cropping technology is inefficient and poor, resulting in improper cropping of the spokesperson's image in video conferences and inappropriate face proportion, which affects the efficiency of the conference and the experience of participants.

Method used

By obtaining the face coordinates and width and height of the spokesperson image, using the preset cropping screen formula to calculate the cropping screen coordinates and width and height, and using the cropping screen movement feature value formula to determine whether the cropping screen movement feature value is within the preset threshold range. If so, call the cropping interface for dynamic cropping.

Benefits of technology

It improves the efficiency and effect of image cropping, ensures that the cropped face proportion of the spokesperson image is appropriate, and improves the communication efficiency of video conferences and the experience of participants.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114842031B_ABST
    Figure CN114842031B_ABST
Patent Text Reader

Abstract

The present invention relates to the technical field of image processing, and discloses an image cropping method, device, computer device and storage medium. The method includes: obtaining the face coordinates and face width and height of a speaker image; calculating the cropping screen coordinates and cropping screen width and height according to the face coordinates and face width and height; obtaining the previous cropping screen coordinates and cropping screen width and height as reference cropping screen coordinates and reference cropping screen width and height, and calculating a cropping screen movement feature value according to the cropping screen coordinates, cropping screen width and height, reference cropping screen coordinates and reference cropping screen width and height; if the cropping screen movement feature value is greater than a first threshold and less than a second threshold, calling a cropping interface to crop the speaker image according to the cropping screen coordinates, cropping screen width and height, reference cropping screen coordinates, reference cropping screen width and height and a preset cropping change value. Embodiments of the present invention can improve the image cropping efficiency and image cropping effect.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] Embodiments of the present invention relate to the field of image processing technologies, and in particular, to an image cropping method, apparatus, computer device, and storage medium. Background Art

[0002] In video conferencing software, after the speaker is located, the captured image of the speaker by the camera is cropped through image cropping, and the cropped image of the speaker is sent to the magnification module for magnification and output to the video conferencing screen. However, the existing image cropping has the following two disadvantages. On the one hand, since the image of the speaker is not magnified in a fitting ratio, the proportion of the face in the overall picture may be too large or too small. On the other hand, slow cropping is used for the image of the speaker, which takes a long time for cropping, has low cropping efficiency, is not conducive to good communication in the meeting process, results in low meeting efficiency, and poor experience for the participants. Summary of the Invention

[0003] Embodiments of the present invention provide an image cropping method, apparatus, computer device, and storage medium, aiming to solve the problems of low existing image cropping efficiency and poor cropping effect.

[0004] In a first aspect, embodiments of the present invention provide an image cropping method, which includes:

[0005] Obtain the face coordinates and face width and height of the speaker image;

[0006] Calculate the cropping screen coordinates and cropping screen width and height according to the face coordinates and the face width and height through a preset cropping screen formula;

[0007] Obtain the previous cropping screen coordinates and cropping screen width and height as the reference cropping screen coordinates and reference cropping screen width and height, and calculate the cropping screen movement eigenvalue according to the cropping screen coordinates, the cropping screen width and height, the reference cropping screen coordinates, and the reference cropping screen width and height through a cropping screen movement eigenvalue formula;

[0008] If the cropping screen movement eigenvalue is greater than a first threshold and less than a second threshold, call a cropping interface to crop the speaker image according to the cropping screen coordinates, the cropping screen width and height, the reference cropping screen coordinates, the reference cropping screen width and height, and a preset cropping change value.

[0009] In a second aspect, embodiments of the present invention further provide an image cropping apparatus, which includes:

[0010] A first acquisition unit, configured to obtain the face coordinates and face width and height of the speaker image;

[0011] A first calculation unit, configured to calculate the coordinates and width / height of a cropped image according to the face coordinates and the face width / height through a preset cropped image formula;

[0012] A second calculation unit, configured to obtain the coordinates and width / height of the previous cropped image as the reference cropped image coordinates and reference cropped image width / height, and calculate a cropped image movement feature value according to the cropped image coordinates, the cropped image width / height, the reference cropped image coordinates, and the reference cropped image width / height through a cropped image movement feature value formula;

[0013] A first cropping unit, configured to, if the cropped image movement feature value is greater than a first threshold and less than a second threshold, call a cropping interface to crop the speaker image according to the cropped image coordinates, the cropped image width / height, the reference cropped image coordinates, the reference cropped image width / height, and a preset cropping change value.

[0014] In a third aspect, an embodiment of the present invention further provides an electronic device, which includes a memory and a processor. A computer program is stored on the memory, and when the processor executes the computer program, the above method is implemented.

[0015] In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium, where the storage medium stores a computer program, and when the computer program is executed by a processor, the above method can be implemented.

[0016] An embodiment of the present invention provides an image cropping method, device, computer device, and storage medium. The method includes: obtaining the face coordinates and face width / height of a speaker image; calculating the coordinates and width / height of a cropped image according to the face coordinates and the face width / height through a preset cropped image formula; obtaining the coordinates and width / height of the previous cropped image as the reference cropped image coordinates and reference cropped image width / height, and calculating a cropped image movement feature value according to the cropped image coordinates, the cropped image width / height, the reference cropped image coordinates, and the reference cropped image width / height through a cropped image movement feature value formula; if the cropped image movement feature value is greater than a first threshold and less than a second threshold, calling a cropping interface to crop the speaker image according to the cropped image coordinates, the cropped image width / height, the reference cropped image coordinates, the reference cropped image width / height, and a preset cropping change value. The technical solution of the embodiment of the present invention first calculates the coordinates and width / height of the cropped image according to the face coordinates and the face width / height, and then, by judging the cropped image movement feature value with the first threshold and the second threshold, can dynamically crop the speaker image with different cropping strategies according to the speaker's position, so as to improve the image cropping efficiency and the image cropping effect. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] To more clearly illustrate the technical solutions of the embodiments of the present invention, the following will briefly introduce the drawings required for the description of the embodiments. Obviously, the drawings in the following description are some embodiments of the present invention. For those of ordinary skill in the art, without creative efforts, other drawings can also be obtained based on these drawings.

[0018] Figure 1 It is a schematic flowchart of an image cropping method provided by an embodiment of the present invention;

[0019] Figure 2 It is a diagram showing the sound source angle of an image cropping method provided by an embodiment of the present invention;

[0020] Figure 3 It is a schematic sub - flowchart of an image cropping method provided by an embodiment of the present invention;

[0021] Figure 4 It is a diagram showing the face width - height, face coordinates, cropped image width - height, and cropped image coordinates of an image cropping method provided by an embodiment of the present invention;

[0022] Figure 5 It is a schematic sub - flowchart of an image cropping method provided by an embodiment of the present invention;

[0023] Figure 6 It is a schematic sub - flowchart of an image cropping method provided by an embodiment of the present invention;

[0024] Figure 7 It is a schematic flowchart of an image cropping method provided by another embodiment of the present invention;

[0025] Figure 8 It is a schematic block diagram of an image cropping device provided by an embodiment of the present invention;

[0026] And

[0027] Figure 9 It is a schematic block diagram of an electronic device provided by an embodiment of the present invention. Detailed Embodiments

[0028] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are some, but not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts fall within the scope of protection of the present invention.

[0029] It should be understood that when used in this specification and the appended claims, the terms "comprising" and "including" indicate the presence of the described features, wholes, steps, operations, elements and / or components, but do not preclude the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or their combinations.

[0030] It should also be understood that the terminology used in this specification of the present invention is for the purpose of describing particular embodiments only and is not intended to limit the present invention. As used in this specification of the present invention and the appended claims, unless the context clearly dictates otherwise, the singular forms "a", "an" and "the" are intended to include the plural forms.

[0031] It should be further understood that the term "and / or" used in this specification of the present invention and the appended claims refers to any combination and all possible combinations of one or more of the associated listed items, and includes these combinations.

[0032] As used in this specification and the appended claims, the term "if" can be interpreted, depending on the context, as "when", "once", "in response to determining" or "in response to detecting". Similarly, the phrase "if determined" or "if [the described condition or event] is detected" can be interpreted, depending on the context, as meaning "once determined", "in response to determining", "once [the described condition or event] is detected" or "in response to detecting [the described condition or event]".

[0033] Please refer to Figure 1 , Figure 1 which is a schematic flow chart of the image cropping method provided by an embodiment of the present invention. The image cropping method will be described in detail below. As Figure 1 shown, the method includes the following steps S100 - S130.

[0034] S100. Obtain the face coordinates and face width and height of the speaker image.

[0035] In an embodiment of the present invention, before obtaining the face coordinates and face width and height of the speaker through a preset face localization algorithm, it is also necessary to obtain the voice of the speaker through an array microphone, obtain the sound source angle through an existing sound processing algorithm, and determine whether the sound source angle is within a preset angle range; if the sound source angle is within the preset angle range, increment the acquisition count by 1, and determine whether the acquisition count is 1. Understandably, the initial value of the acquisition count is 0; if the acquisition count is 1, use the sound source angle as the reference sound source angle, and return to execute the step of obtaining the sound source angle and determining whether the sound source angle is within the preset angle range; if the acquisition count is not 1, determine whether the sound source angle is equal to the reference sound source angle; if the sound source angle is equal to the reference sound source angle, return to execute the step of obtaining the sound source angle and determining whether the sound source angle is within the preset angle range until the preset acquisition count is reached. In practical applications, as Figure 2 shown, the sound source angle is θ, the preset angle range is greater than θ1 and less than θ2, and the preset number of times can be set according to the actual situation. Understandably, if the sound source angle is within the preset angle range within the preset number of acquisitions and the sound source angle values are the same each time, it indicates that a speaker is detected speaking, and then execute the step of obtaining the face coordinates and face width and height of the speaker. It should be noted that in an embodiment of the present invention, the preset face localization algorithm includes existing sound pickup and localization algorithms based on face detection and array microphones and lip movement detection algorithms.

[0036] S110. Calculate the cropped screen coordinates and cropped screen width and height according to the face coordinates and the face width and height through a preset cropped screen formula.

[0037] In an embodiment of the present invention, after obtaining the face coordinates and face width and height of the speaker image, calculate the cropped screen coordinates and cropped screen width and height according to the face coordinates and the face width and height through a preset cropped screen formula, where the preset cropped screen formula includes a cropped screen width and height formula and a cropped screen coordinate formula. Understandably, the cropped screen width and height can be calculated according to the cropped screen width and height formula; the cropped screen coordinates can be calculated according to the cropped screen coordinate formula.

[0038] Please refer to Figure 3 , in an embodiment, for example, in an embodiment of the present invention, the step S110 includes the following steps S111 - S112.

[0039] S111. Calculate the cropped screen width and height according to the face width and height through the cropped screen width and height formula;

[0040] S112. Calculate the cropped screen coordinates according to the cropped screen width and height, the face coordinates, and the face width and height through the cropped screen coordinate formula.

[0041] In an embodiment of the present invention, as Figure 4 shown, the width and height of the human face are w and h, the coordinates of the human face are (x, y), the width and height of the cropped screen are W and H, and the coordinates of the cropped screen are (X, Y). Then the formula for the width and height of the cropped screen is H = (w * h * 4) / 16; W = (w * h * 4) / 9; the formula for the coordinates of the cropped screen is X = x + (w - W) / 2; Y = y + (h - H) / 2; Understandably, the 16:9 ratio in the formula for the width and height of the cropped screen is set according to the video conferencing tablet and the UVC (USB Video Class) video format. It should be noted that in an embodiment of the present invention, when the coordinates (X, Y) of the cropped screen are less than 0 or (X + W), (Y + H) exceed the screen edge, it is necessary to move the speaker image as a whole up, down, left, and right.

[0042] S120. Obtain the coordinates of the previous cropped screen and the width and height of the cropped screen as the reference cropped screen coordinates and the reference cropped screen width and height, and calculate the cropped screen movement eigenvalue according to the cropped screen coordinates, the cropped screen width and height, the reference cropped screen coordinates, and the reference cropped screen width and height through the cropped screen movement eigenvalue formula.

[0043] In an embodiment of the present invention, if it is the first time to obtain the coordinates and width and height of the human face of the speaker image, obtain the preset cropped screen coordinates and the preset cropped screen width and height from the memory as the reference cropped screen coordinates and the reference cropped screen width and height. If it is not the first time to obtain the coordinates and width and height of the human face of the speaker image, obtain the coordinates of the previous cropped screen and the width and height of the cropped screen from the memory as the reference cropped screen coordinates and the reference cropped screen width and height. Understandably, the coordinates of the previous cropped screen and the width and height of the cropped screen are the cropped screen coordinates and the cropped screen width and height calculated according to the previous human face coordinates and the human face width and height through the preset cropped screen formula. Calculate the cropped screen movement eigenvalue through the cropped screen movement eigenvalue formula, where the cropped screen movement eigenvalue formula is T = d + t * |m|. It should be noted that T is the cropped screen movement eigenvalue, d is the square value of the distance between the center of the current cropped screen and the center of the previous cropped screen, m is the area difference between the area of the current cropped screen and the area of the previous cropped screen, and t is the weight coefficient. It can be seen from the cropped screen movement eigenvalue formula that the cropped screen movement eigenvalue is related to the size of the cropped screen and the position of the speaker.

[0044] Please refer to Figure 5 , in an embodiment, for example, in an embodiment of the present invention, the step S120 includes the following steps S121 - S123.

[0045] S121. Calculate the squared distance value between the center of the current cropped screen and the center of the previous cropped screen based on the cropped screen coordinates, the width and height of the cropped screen, the reference cropped screen coordinates, and the width and height of the reference cropped screen;

[0046] S122. Calculate the area difference between the area of the current cropped screen and the area of the previous cropped screen based on the width and height of the cropped screen and the width and height of the reference cropped screen;

[0047] S123. Calculate the cropped screen movement eigenvalue through the cropped screen movement eigenvalue formula based on the squared distance value and the area difference.

[0048] In an embodiment of the present invention, based on the cropped screen coordinates (X, Y), the width and height of the cropped screen (W, H), the reference cropped screen coordinates (X1, Y1), and the width and height of the reference cropped screen (W1, H1), calculate the squared distance value d between the center of the current cropped screen and the center of the previous cropped screen, where the squared distance value d = (X + W / 2 - (X1) - (W1) / 2)^2 + (Y + H / 2 - (Y1) - (H1) / 2)^2; calculate the area difference m between the area of the current cropped screen and the area of the previous cropped screen based on the width and height of the cropped screen (W, H) and the width and height of the reference cropped screen (W1, H1), where the area difference m = (W * H - (W1) * (H1)); calculate the cropped screen movement eigenvalue T according to the cropped screen movement eigenvalue formula d + t * |m|.

[0049] S130. If the cropped screen movement eigenvalue is greater than the first threshold and less than the second threshold, then call the cropping interface to crop the speaker image based on the cropped screen coordinates, the width and height of the cropped screen, the reference cropped screen coordinates, the width and height of the reference cropped screen, and a preset cropping change value.

[0050] In an embodiment of the present invention, compare the cropped screen movement eigenvalue T with the first threshold Q1 and the second threshold. If the cropped screen movement eigenvalue T is greater than the first threshold Q1 and less than the second threshold Q2, that is, when Q1 < T < Q2, it indicates that when the current cropped screen and the previous cropped screen are of the same speaker, the movement amplitude of the speaker is relatively large. Then, obtain the cropping change value through the cropping change value formula based on the cropped screen coordinates, the width and height of the cropped screen, the reference cropped screen coordinates, the width and height of the reference cropped screen, and a preset cropping change value; call the cropping interface to crop the speaker image based on the cropping change value, the cropped screen coordinates, and the width and height of the cropped screen.

[0051] Please refer to Figure 6, in one embodiment, for example, in the embodiment of the present invention, step S130 includes the following steps S131 - S134.

[0052] S131. Obtain the number of cropping times through the cropping times formula according to the cropped screen coordinates, the width and height of the cropped screen, the reference cropped screen coordinates, the width and height of the reference cropped screen, and a preset cropping change value;

[0053] S132. Calculate the coordinate difference and width - height difference between the cropped screen coordinates and the reference cropped screen coordinates, and between the width and height of the cropped screen and the width and height of the reference cropped screen;

[0054] S133. Determine the cropping change value according to the coordinate difference, the width - height difference, and the number of cropping times;

[0055] S134. After adding / subtracting the cropping change value to / from the reference cropped screen coordinates and the width and height of the reference cropped screen, call the cropping interface until the reference cropped screen coordinates and the width and height of the reference cropped screen are the same as the cropped screen coordinates and the width and height of the cropped screen, so as to crop the speaker image.

[0056] In an embodiment of the present invention, according to the cropped screen coordinates (X, Y), the width and height of the cropped screen (W, H), the reference cropped screen coordinates (X1, Y1), the width and height of the reference cropped screen (W1, H1), and preset cropping change values (a, b, c, and d), the number of cropping times v is obtained through the cropping times formula, where the number of cropping times v = max((|X - X1|) / a, (|Y - Y1|) / b, (|W - W1|) / c, (|H - H1|) / d). In the formula, a is the preset cropping coordinate X change value, b is the preset cropping coordinate Y change value, c is the preset cropping width change value, and d is the preset cropping height change value. After obtaining the number of cropping change times, according to the formulas A = (X - X1) / v; B = (Y - Y1) / v; C = (W - W1) / v; D = (H - H1) / v, the cropping coordinate X change value A, the cropping coordinate Y change value B, the cropping width change value C, and the cropping height change value D are calculated, and A, B, C, and D are used as the cropping change values. If the reference cropped screen coordinates and the width and height of the reference cropped screen are smaller than the cropped screen coordinates and the width and height of the cropped screen, then the reference cropped screen coordinates and the width and height of the reference cropped screen are added with the cropping change values and then the cropping interface is called, and the loop is repeated until the reference cropped screen coordinates and the width and height of the reference cropped screen are the same as the cropped screen coordinates and the width and height of the cropped screen, so as to perform dynamic cropping on the speaker image. Understandably, if the reference cropped screen coordinates and the width and height of the reference cropped screen are larger than the cropped screen coordinates and the width and height of the cropped screen, then the reference cropped screen coordinates and the width and height of the reference cropped screen are subtracted by the cropping change values and then the cropping interface is called, and the loop is repeated until the reference cropped screen coordinates and the width and height of the reference cropped screen are the same as the cropped screen coordinates and the width and height of the cropped screen, so as to perform dynamic cropping on the speaker image. It should be noted that in an embodiment of the present invention, the cropping parameters are transmitted to the cropping module through the cropping interface, and the speaker image is cropped by the cropping module.

[0057] Figure 7 is a schematic flowchart of an image cropping method provided by another embodiment of the present invention. As Figure 7 shown, in this embodiment, the method includes steps S100 - S150. That is, in this embodiment, after step S130 of the above embodiment, the method further includes steps S140 - S150.

[0058] S140. If the cropped screen movement feature value is less than the first threshold, then the cropping interface is called according to the reference cropped screen coordinates and the width and height of the reference cropped screen to crop the speaker image;

[0059] S150. If the cropping screen movement eigenvalue is greater than the second threshold, call the cropping interface to crop the speaker image according to the cropping screen coordinates and the cropping screen width and height.

[0060] In an embodiment of the present invention, if T < Q1, it indicates that the current cropping screen is not much different from the previous cropping screen, and there is no need to change the cropping parameters. In practical applications, when the current cropping screen and the previous cropping screen are of the same speaker and the speaker moves slightly, the reference cropping screen coordinates (X1, Y1) and the reference cropping screen width and height (W1, H1) are used as the parameters of the cropping interface to call the cropping interface to crop the speaker image; if T > Q2, it indicates that the current cropping screen is quite different from the previous cropping screen and the cropping parameters need to be changed. In practical applications, when the current cropping screen and the previous cropping screen are not of the same speaker, the cropping screen coordinates (X, Y) and the cropping screen width and height (W, H) are directly used as the parameters of the cropping interface to call the cropping interface to quickly crop the speaker image.

[0061] Figure 8 is a schematic block diagram of an image cropping device 200 provided by an embodiment of the present invention. As Figure 8 shown, corresponding to the above image cropping method, the present invention also provides an image cropping device 200. The image cropping device 200 includes units for executing the above image cropping method, and the device can be configured in an electronic device. Specifically, please refer to Figure 8 and the image cropping device 200 includes a first acquisition unit 201, a first calculation unit 202, a second calculation unit 203, and a first cropping unit 204.

[0062] Among them, the first acquisition unit 201 is used to acquire the face coordinates and face width and height of the speaker image; the first calculation unit 202 is used to calculate the cropping screen coordinates and the cropping screen width and height according to the face coordinates and the face width and height through a preset cropping screen formula; the second calculation unit 203 is used to acquire the previous cropping screen coordinates and the cropping screen width and height as the reference cropping screen coordinates and the reference cropping screen width and height, and calculate the cropping screen movement eigenvalue according to the cropping screen coordinates, the cropping screen width and height, the reference cropping screen coordinates, and the reference cropping screen width and height through a cropping screen movement eigenvalue formula; the first cropping unit 204 is used to, if the cropping screen movement eigenvalue is greater than the first threshold and less than the second threshold, call the cropping interface to crop the speaker image according to the cropping screen coordinates, the cropping screen width and height, the reference cropping screen coordinates, the reference cropping screen width and height, and a preset cropping change value.

[0063] In some embodiments, such as this embodiment, the first computing unit 202 includes a first computing subunit and a second computing subunit.

[0064] Wherein, the first computing subunit is configured to calculate the cropped screen width and height according to the face width and height through a cropped screen width and height formula; the second computing subunit is configured to calculate the cropped screen coordinates according to the cropped screen width and height, the face coordinates, and the face width and height through a cropped screen coordinate formula.

[0065] In some embodiments, such as this embodiment, the second computing unit 203 includes a third computing subunit, a fourth computing subunit, and a fifth computing subunit.

[0066] Wherein, the third computing subunit is configured to calculate the squared value of the distance between the center of the current cropped screen and the center of the previous cropped screen according to the cropped screen coordinates, the cropped screen width and height, the reference cropped screen coordinates, and the reference cropped screen width and height; the fourth computing subunit is configured to calculate the area difference between the area of the current cropped screen and the area of the previous cropped screen according to the cropped screen width and height and the reference cropped screen width and height; the fifth computing subunit is configured to calculate the cropped screen movement feature value according to the squared distance value and the area difference through a cropped screen movement feature value formula.

[0067] In some embodiments, such as this embodiment, the first cropping unit 204 includes a sixth computing subunit, a seventh computing subunit, an eighth computing subunit, and a cropping subunit.

[0068] Wherein, the sixth computing subunit is configured to obtain the number of cropping times through a cropping times formula according to the cropped screen coordinates, the cropped screen width and height, the reference cropped screen coordinates, the reference cropped screen width and height, and a preset cropping change value; the seventh computing subunit is configured to calculate the coordinate difference and the width and height difference between the cropped screen coordinates and the reference cropped screen coordinates, and between the cropped screen width and height and the reference cropped screen width and height; the eighth computing subunit is configured to determine the cropping change value according to the coordinate difference, the width and height difference, and the number of cropping times; the cropping subunit is configured to call a cropping interface after adding / subtracting the cropping change value to the reference cropped screen coordinates and the reference cropped screen width and height until the reference cropped screen coordinates and the reference cropped screen width and height are the cropped screen coordinates and the cropped screen width and height, so as to crop the speaker image.

[0069] In some embodiments, such as this embodiment, the image cropping device 200 further includes a second cropping unit, a third cropping unit, a second obtaining unit, a first judging unit, a first returning and executing unit, a second judging unit, and a second returning and executing unit.

[0070] Wherein, the second cropping unit is configured to crop the speaker image by invoking the cropping interface according to the reference cropping screen coordinates and the reference cropping screen width and height if the cropping screen movement eigenvalue is less than the first threshold; the third cropping unit is configured to crop the speaker image by invoking the cropping interface according to the cropping screen coordinates and the cropping screen width and height if the cropping screen movement eigenvalue is greater than the second threshold; the second obtaining unit is configured to obtain the sound source angle and determine whether the sound source angle is within a preset angle range; the first judging unit is configured to increment the obtaining times by 1 and determine whether the obtaining times is 1 if the sound source angle is within the preset angle range; the first returning and executing unit is configured to use the sound source angle as the reference sound source angle and return to execute the step of obtaining the sound source angle and determining whether the sound source angle is within the preset angle range if the obtaining times is 1; the second judging unit is configured to determine whether the sound source angle is equal to the reference sound source angle if the obtaining times is not 1; the second returning and executing unit is configured to return to execute the step of obtaining the sound source angle and determining whether the sound source angle is within the preset angle range until a preset obtaining times is reached if the sound source angle is equal to the reference sound source angle.

[0071] The above image cropping device can be implemented in the form of a computer program, and the computer program can run on an electronic device as shown in Figure 9 shown.

[0072] Please refer to Figure 9 , Figure 9 which is a schematic block diagram of an electronic device provided by an embodiment of the present invention. The electronic device 300 is a display device with an image cropping function.

[0073] Referring to Figure 9 , the electronic device 300 includes a processor 302, a memory, and a network interface 305 connected through a system bus 301. Among them, the memory may include a non-volatile storage medium 303 and an internal memory 304.

[0074] The non-volatile storage medium 303 can store an operating system 3031 and a computer program 3032. When the computer program 3032 is executed, the processor 302 can be caused to execute an image cropping method.

[0075] The processor 302 is configured to provide computing and control capabilities to support the operation of the entire electronic device 300.

[0076] The internal memory 304 provides an environment for the operation of the computer program 3032 in the non-volatile storage medium 303. When the computer program 3032 is executed by the processor 302, the processor 302 can be caused to execute an image cropping method.

[0077] The network interface 305 is used for network communication with other devices. Those skilled in the art can understand that Figure 9 the structure shown in is only a block diagram of some structures related to the solution of the present invention, and does not constitute a limitation on the electronic device 300 to which the solution of the present invention is applied. The specific electronic device 300 may include more or fewer components than those shown in the figure, or combine some components, or have different component arrangements.

[0078] Among them, the processor 302 is used to run the computer program 3032 stored in the memory to implement the following steps: obtaining the face coordinates and face width and height of the speaker image; calculating the cropping screen coordinates and cropping screen width and height according to the face coordinates and the face width and height through a preset cropping screen formula; obtaining the previous cropping screen coordinates and cropping screen width and height as the reference cropping screen coordinates and reference cropping screen width and height, and calculating the cropping screen movement eigenvalue according to the cropping screen coordinates, the cropping screen width and height, the reference cropping screen coordinates, and the reference cropping screen width and height through a cropping screen movement eigenvalue formula; if the cropping screen movement eigenvalue is greater than the first threshold and less than the second threshold, then calling a cropping interface to crop the speaker image according to the cropping screen coordinates, the cropping screen width and height, the reference cropping screen coordinates, the reference cropping screen width and height, and a preset cropping change value.

[0079] In some embodiments, such as this embodiment, when the processor 302 implements the step of calculating the cropping screen coordinates and cropping screen width and height according to the face coordinates and the face width and height through a preset cropping screen formula, the following steps are specifically implemented: calculating the cropping screen width and height according to the face width and height through a cropping screen width and height formula; calculating the cropping screen coordinates according to the cropping screen width and height, the face coordinates, and the face width and height through a cropping screen coordinate formula.

[0080] In some embodiments, such as this embodiment, when the processor 302 implements the step of calculating the cropped screen movement eigenvalue according to the cropped screen coordinates, the cropped screen width and height, the reference cropped screen coordinates, and the reference cropped screen width and height through the cropped screen movement eigenvalue formula, the specific implementation is as follows: Calculate the squared value of the distance between the center of the current cropped screen and the center of the previous cropped screen according to the cropped screen coordinates, the cropped screen width and height, the reference cropped screen coordinates, and the reference cropped screen width and height; Calculate the area difference between the area of the current cropped screen and the area of the previous cropped screen according to the cropped screen width and height and the reference cropped screen width and height; Calculate the cropped screen movement eigenvalue through the cropped screen movement eigenvalue formula according to the squared value of the distance and the area difference.

[0081] In some embodiments, such as this embodiment, when the processor 302 implements the step of cropping the speaker image by calling the cropping interface according to the cropped screen coordinates, the cropped screen width and height, the reference cropped screen coordinates, the reference cropped screen width and height, and the preset cropping change value, the specific implementation is as follows: Obtain the number of cropping times through the cropping times formula according to the cropped screen coordinates, the cropped screen width and height, the reference cropped screen coordinates, the reference cropped screen width and height, and the preset cropping change value; Calculate the coordinate difference and width-height difference between the cropped screen coordinates and the reference cropped screen coordinates, and between the cropped screen width and height and the reference cropped screen width and height; Determine the cropping change value according to the coordinate difference, the width-height difference, and the number of cropping times; Call the cropping interface after adding / subtracting the cropping change value to the reference cropped screen coordinates and the reference cropped screen width and height until the reference cropped screen coordinates and the reference cropped screen width and height are the cropped screen coordinates and the cropped screen width and height, so as to crop the speaker image.

[0082] In some embodiments, such as this embodiment, before the processor 302 implements the step of obtaining the face coordinates and face width and height of the speaker image, the specific implementation further includes the following steps: Obtain the sound source angle and determine whether the sound source angle is within the preset angle range; If the sound source angle is within the preset angle range, increment the acquisition count by 1 and determine whether the acquisition count is 1; If the acquisition count is 1, use the sound source angle as the reference sound source angle and return to execute the step of obtaining the sound source angle and determining whether the sound source angle is within the preset angle range; If the acquisition count is not 1, determine whether the sound source angle is equal to the reference sound source angle; If the sound source angle is equal to the reference sound source angle, return to execute the step of obtaining the sound source angle and determining whether the sound source angle is within the preset angle range until the preset acquisition count is reached.

[0083] In some embodiments, such as this embodiment, when the processor 302 implements the method for cropping the image, the specific implementation further includes the following steps: If the cropping screen movement eigenvalue is less than the first threshold, the cropping interface is called to crop the speaker image according to the reference cropping screen coordinates and the reference cropping screen width and height; if the cropping screen movement eigenvalue is greater than the second threshold, the cropping interface is called to crop the speaker image according to the cropping screen coordinates and the cropping screen width and height.

[0084] It should be understood that in the embodiments of the present invention, the processor 302 may be a central processing unit (CPU), and the processor 302 may also be other general-purpose processors, digital signal processors (DSPs), application specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. Among them, the general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.

[0085] Those of ordinary skill in the art can understand that all or part of the processes in the methods of the above embodiments can be completed by instructing relevant hardware through a computer program. The computer program can be stored in a storage medium, and the storage medium is a computer-readable storage medium. The computer program is executed by at least one processor in the computer system to implement the process steps of the embodiments of the above method.

[0086] Therefore, the present invention also provides a storage medium. The storage medium may be a computer-readable storage medium. The storage medium stores a computer program. When the computer program is executed by a processor, the processor executes any embodiment of the above image cropping method.

[0087] The storage medium may be a USB flash drive, a mobile hard disk, a read-only memory (ROM), a magnetic disk, or an optical disc, etc., which are all computer-readable storage media that can store program codes.

[0088] Those of ordinary skill in the art can realize that the units and algorithm steps of each example described in combination with the embodiments disclosed herein can be implemented by electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described according to functions in the above description. Whether these functions are executed in a hardware or software manner depends on the specific application and design constraints of the technical solution. Professional technicians can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the present invention.

[0089] In several embodiments provided by the present invention, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of each unit is only a logical function division, and there may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed.

[0090] The steps in the method embodiments of the present invention can be adjusted, combined, and deleted according to actual needs. The units in the device embodiments of the present invention can be combined, divided, and deleted according to actual needs. In addition, the functional units in each embodiment of the present invention can be integrated into a processing unit, or each unit can exist physically alone, or two or more units can be integrated into one unit.

[0091] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or 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 and includes several instructions to enable an electronic device (which can be a personal computer, a terminal, or a network device, etc.) to execute all or part of the steps of the methods described in each embodiment of the present invention.

[0092] In the above embodiments, the descriptions of each embodiment have their own emphases. For the parts not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0093] Obviously, those skilled in the art can make various changes and modifications to the present invention without departing from the spirit and scope of the present invention. Thus, if these modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalent technologies, the present invention also intends to include these changes and modifications.

[0094] As described above, it is only the specific implementation manner of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art within the technical scope disclosed by the present invention can easily think of various equivalent modifications or substitutions, and these modifications or substitutions should be covered within the protection scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.

Claims

1. An image cropping method, characterized in that, Including: Obtaining the face coordinates and face width and height of the speaker image; Calculating the cropped image coordinates and cropped image width and height according to the face coordinates and the face width and height through a preset cropped image formula; Obtaining the previous cropped image coordinates and cropped image width and height as the reference cropped image coordinates and reference cropped image width and height, and calculating the cropped image movement eigenvalue according to the cropped image coordinates, the cropped image width and height, the reference cropped image coordinates, and the reference cropped image width and height through the cropped image movement eigenvalue formula; If the cropped image movement eigenvalue is greater than the first threshold and less than the second threshold, then call the cropping interface to crop the speaker image according to the cropped image coordinates, the cropped image width and height, the reference cropped image coordinates, the reference cropped image width and height, and a preset cropping change value; The calculating the cropped image movement eigenvalue according to the cropped image coordinates, the cropped image width and height, the reference cropped image coordinates, and the reference cropped image width and height through the cropped image movement eigenvalue formula includes: Calculating the squared value of the distance between the center of the current cropped image and the center of the previous cropped image according to the cropped image coordinates, the cropped image width and height, the reference cropped image coordinates, and the reference cropped image width and height; Calculating the area difference between the area of the current cropped image and the area of the previous cropped image according to the cropped image width and height and the reference cropped image width and height; Calculating the cropped image movement eigenvalue according to the squared value of the distance and the area difference through the cropped image movement eigenvalue formula.

2. The method according to claim 1, characterized in that, The calculating the cropped image coordinates and cropped image width and height according to the face coordinates and the face width and height through a preset cropped image formula includes: Calculating the cropped image width and height according to the face width and height through the cropped image width and height formula; Calculating the cropped image coordinates according to the cropped image width and height, the face coordinates, and the face width and height through the cropped image coordinates formula.

3. The method according to claim 1, characterized in that, The calling the cropping interface to crop the speaker image according to the cropped image coordinates, the cropped image width and height, the reference cropped image coordinates, the reference cropped image width and height, and a preset cropping change value includes: Obtaining the cropping change value according to the cropped image coordinates, the cropped image width and height, the reference cropped image coordinates, the reference cropped image width and height, and the preset cropping change value through the cropping change value formula; Calling the cropping interface after adding / subtracting the cropping change value to the reference cropped image coordinates and the reference cropped image width and height until the reference cropped image coordinates and the reference cropped image width and height are the cropped image coordinates and the cropped image width and height, so as to crop the speaker image.

4. The method according to claim 3, wherein The obtaining the cropping change value according to the cropped image coordinates, the cropped image width and height, the reference cropped image coordinates, the reference cropped image width and height, and the preset cropping change value through the cropping change value formula includes: Obtaining the number of cropping times according to the cropped image coordinates, the cropped image width and height, the reference cropped image coordinates, the reference cropped image width and height, and the preset cropping change value through the cropping times formula; Calculate the coordinate difference and width-height difference between the cropped screen coordinates and the reference cropped screen coordinates, and between the width and height of the cropped screen and the width and height of the reference cropped screen; Determine the cropping change value according to the coordinate difference, the width-height difference, and the number of cropping times.

5. The method according to claim 1, characterized in that, Before obtaining the face coordinates and face width-height of the speaker image, it further includes: Obtain the sound source angle and determine whether the sound source angle is within a preset angle range; If the sound source angle is within the preset angle range, increment the acquisition count by 1 and determine whether the acquisition count is 1; If the acquisition count is 1, use the sound source angle as the reference sound source angle, and return to execute the step of obtaining the sound source angle and determining whether the sound source angle is within the preset angle range; If the acquisition count is not 1, determine whether the sound source angle is equal to the reference sound source angle; If the sound source angle is equal to the reference sound source angle, return to execute the step of obtaining the sound source angle and determining whether the sound source angle is within the preset angle range until the preset acquisition count is reached; If the sound source angle is within the preset angle range within the preset acquisition count and the sound source angle values are the same each time, execute the step of obtaining the face coordinates and face width-height of the speaker image.

6. The method according to claim 1, wherein The method further includes: If the cropped screen movement feature value is less than the first threshold, call the cropping interface to crop the speaker image according to the reference cropped screen coordinates and the reference cropped screen width and height; If the cropped screen movement feature value is greater than the second threshold, call the cropping interface to crop the speaker image according to the cropped screen coordinates and the cropped screen width and height.

7. An image cropping device, characterized in that, It includes: A first acquisition unit for obtaining the face coordinates and face width-height of the speaker image; A first calculation unit for calculating the cropped screen coordinates and the cropped screen width and height according to the face coordinates and the face width-height through a preset cropped screen formula; A second calculation unit for obtaining the previous cropped screen coordinates and the cropped screen width and height as the reference cropped screen coordinates and the reference cropped screen width and height, and calculating the cropped screen movement feature value according to the cropped screen coordinates, the cropped screen width and height, the reference cropped screen coordinates, and the reference cropped screen width and height through a cropped screen movement feature value formula; A first cropping unit for, if the cropped screen movement feature value is greater than the first threshold and less than the second threshold, calling the cropping interface to crop the speaker image according to the cropped screen coordinates, the cropped screen width and height, the reference cropped screen coordinates, the reference cropped screen width and height, and a preset cropping change value; The second calculation unit includes: A third calculation subunit for calculating the squared value of the distance between the center of the current cropped screen and the center of the previous cropped screen according to the cropped screen coordinates, the cropped screen width and height, the reference cropped screen coordinates, and the reference cropped screen width and height; A fourth calculation subunit for calculating the area difference between the area of the current cropped screen and the area of the previous cropped screen according to the cropped screen width and height and the reference cropped screen width and height; A fifth calculation subunit, configured to calculate a cropped screen movement eigenvalue according to the squared distance value and the area difference through the cropped screen movement eigenvalue formula.

8. An electronic device, characterized in that, The electronic device includes a memory and a processor. A computer program is stored on the memory. When the processor executes the computer program, the method according to any one of claims 1-6 is implemented.

9. A computer-readable storage medium, characterized in that, The storage medium stores a computer program. When the computer program is executed by a processor, the method according to any one of claims 1-6 can be implemented.

Citation Information

Patent Citations

  • Image processing device and image processing program

    JP2022050099A

  • Method, device and program for cutting out moving image

    US20040175035A1