Image processing method, image processing device, and electronic device

By acquiring the target subject of an image in an electronic device and performing translation and cropping based on the rule of thirds composition guidelines, the problem of ordinary users having difficulty utilizing the rule of thirds grid lines is solved, improving image quality and enhancing visual impact.

CN114092455BActive Publication Date: 2025-10-28VIVO MOBILE COMM CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111422076.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-11-26
Publication Date
2025-10-28
Estimated Expiration
2041-11-26

AI Technical Summary

Technical Problem

Ordinary users often lack the skills to effectively utilize the rule of thirds grid lines on electronic devices, resulting in poor image quality.

Method used

By acquiring the target subject in the image, determining the target position based on the position of the target subject and the target composition auxiliary lines, and performing translation and cropping on the image, automatic cropping processing is achieved.

Benefits of technology

It improves image quality, makes the location of the subject visually impactful, and reduces the skill requirements for users when shooting.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114092455B_ABST
    Figure CN114092455B_ABST
Patent Text Reader

Abstract

This application discloses an image processing method, an image processing apparatus, and an electronic device, belonging to the field of image processing technology. The image processing method provided in this application includes: acquiring a target subject in an image to be processed; determining a target position based on the position of the target subject and target compositional auxiliary lines; translating the image to be processed, such that the target subject is located at the target position after translation; and cropping the translated image to obtain a target image.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application belongs to the field of image processing technology, specifically relating to an image processing method, an image processing device, and an electronic device. Background Technology

[0002] The rule of thirds is a guiding principle for composing images or videos, which can make them look more aesthetically pleasing. Therefore, professional photographers, cinematographers, and visual artists have long used the rule of thirds in their creative work.

[0003] In related technologies, the viewfinder of electronic devices displays grid lines for the rule of thirds composition. Since ordinary users usually have relatively low shooting skills, they do not know how to compose a shot based on the grid lines, resulting in poor image quality. Summary of the Invention

[0004] The purpose of this application is to provide an image processing method, image processing apparatus, and electronic device that can solve the problem of poor image quality.

[0005] In a first aspect, embodiments of this application provide an image processing method, the method comprising:

[0006] Obtain the target subject from the image to be processed;

[0007] The target location is determined based on the position of the target subject and the target composition auxiliary lines;

[0008] The image to be processed is translated, and after the translation, the target subject is located at the target position;

[0009] The translated image to be processed is cropped to obtain the target image.

[0010] Secondly, embodiments of this application provide an image processing apparatus, the apparatus comprising:

[0011] The acquisition module is used to acquire the target subject in the image to be processed;

[0012] The determination module is used to determine the target position based on the position of the target subject and the target composition auxiliary lines;

[0013] The translation module is used to translate the image to be processed, and after translation, the target subject is located at the target position;

[0014] The cropping module is used to crop the translated image to obtain the target image.

[0015] Thirdly, embodiments of this application provide an electronic device including a processor, a memory, and a program or instructions stored in the memory and executable on the processor, wherein the program or instructions, when executed by the processor, implement the steps of the method described in the first aspect.

[0016] Fourthly, embodiments of this application provide a readable storage medium on which a program or instructions are stored, which, when executed by a processor, implement the steps of the method described in the first aspect.

[0017] Fifthly, embodiments of this application provide a chip, the chip including a processor and a communication interface, the communication interface being coupled to the processor, the processor being used to run programs or instructions to implement the method as described in the first aspect.

[0018] In a sixth aspect, embodiments of this application provide a computer program product stored in a storage medium, which is executed by at least one processor to implement the method described in the first aspect.

[0019] In this embodiment, the target subject of the image to be processed is translated to the target position and then cropped, realizing automatic cropping of the image based on the target composition guideline. This makes the position of the target subject after cropping visually impactful, improves image quality, and requires less shooting skills from the user. Attached Figure Description

[0020] Figure 1 This is a schematic flowchart of the image processing method provided in the embodiments of this application;

[0021] Figure 2 This is one of the scene diagrams of the image processing method provided in the embodiments of this application;

[0022] Figure 3 This is a second scene diagram of the image processing method provided in the embodiments of this application;

[0023] Figure 4 This is the third scene diagram of the image processing method provided in the embodiments of this application;

[0024] Figure 5 This is the fourth scene diagram of the image processing method provided in the embodiments of this application;

[0025] Figure 6 This is the fifth scene diagram of the image processing method provided in the embodiments of this application;

[0026] Figure 7 This is the sixth scene diagram of the image processing method provided in the embodiments of this application;

[0027] Figure 8This is the seventh scene diagram of the image processing method provided in the embodiments of this application;

[0028] Figure 9 This is the eighth scene diagram of the image processing method provided in the embodiments of this application;

[0029] Figure 10 This is the ninth scene diagram of the image processing method provided in the embodiments of this application;

[0030] Figure 11 This is the tenth scene diagram of the image processing method provided in the embodiments of this application;

[0031] Figure 12 This is a schematic diagram of the structure of the image processing apparatus provided in the embodiments of this application;

[0032] Figure 13 This is a schematic diagram of the structure of the electronic device provided in the embodiments of this application;

[0033] Figure 14 A schematic diagram of the hardware structure of the electronic device used to implement the embodiments of this application. Detailed Implementation

[0034] The technical solutions of the embodiments of this application will be clearly described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this application. All other embodiments obtained by those skilled in the art based on the embodiments of this application are within the scope of protection of this application.

[0035] The terms "first," "second," etc., used in the specification and claims of this application are used to distinguish similar objects and not to describe a specific order or sequence. It should be understood that such use of data can be interchanged where appropriate so that embodiments of this application can be implemented in orders other than those illustrated or described herein, and the objects distinguished by "first," "second," etc., are generally of the same class and the number of objects is not limited; for example, a first object can be one or more. Furthermore, in the specification and claims, "and / or" indicates at least one of the connected objects, and the character " / " generally indicates that the preceding and following objects are in an "or" relationship.

[0036] The image processing method, image processing apparatus, electronic device, and readable storage medium provided in this application will be described in detail below with reference to the accompanying drawings and through specific embodiments and application scenarios.

[0037] The image processing method provided in this application embodiment can be executed by an electronic device or a functional module or entity in an electronic device that can implement the image processing method. The electronic devices mentioned in this application embodiment include, but are not limited to, mobile phones, tablets, computers, cameras, wearable devices, etc. The image processing method provided in this application embodiment is described below using an electronic device as the execution subject as an example.

[0038] Figure 1 This is a schematic flowchart of the image processing method provided in the embodiments of this application, as shown below. Figure 1 As shown, the image processing method includes steps 101, 102, 103, and 104.

[0039] Step 101: Obtain the target subject in the image to be processed.

[0040] In one embodiment, when a user needs to process an image, they can open the photo album and perform a selection operation on the image to be processed. Upon receiving the user's selection operation, the electronic device displays the image indicated by the selection operation as the image to be processed. After displaying the image to be processed, the target subject can be obtained from the image to be processed based on the user's input, or the target subject in the image to be processed can be obtained based on image recognition technology.

[0041] The image processing method of this application embodiment can be applied to shooting scenarios where users capture subjects such as buildings, people, animals, and landscapes. In such scenarios, the target subject in the image to be processed can be the area where the subject such as buildings, people, animals, and landscapes is located.

[0042] It should be noted that after displaying the image to be processed, the electronic device also displays an automatic composition control. When the user selects the automatic composition control, the target subject in the image to be processed is obtained.

[0043] Step 102: Determine the target position based on the position of the target subject and the target composition auxiliary lines.

[0044] Among them, the target composition guide lines are the guide lines used when composing the target.

[0045] In one embodiment, the target composition includes the rule of thirds, which is a guiding principle used when composing an image or video. The most important compositional elements in the image are placed along the guide lines or at the intersections of these guide lines. Following this principle can make the image or video look more aesthetically pleasing. When the target composition is a rule of thirds composition, the target composition guide lines include two horizontal guide lines and two vertical guide lines. The intersections formed by the two horizontal guide lines and the two vertical guide lines include four points, that is, N equals 4.

[0046] Figure 2 This is one of the scene diagrams of the image processing method provided in the embodiments of this application, such as... Figure 2 As shown, the rule of thirds is constructed based on the first horizontal auxiliary line IJ, the second horizontal auxiliary line KL, the first vertical auxiliary line MO, and the second vertical auxiliary line NQ, dividing the area occupied by the image to be processed into nine sub-regions of the same size, forming a 3*3 grid.

[0047] The four intersection points of the target composition auxiliary lines are: the first intersection point A where the first horizontal auxiliary line IJ intersects with the first vertical auxiliary line MO; the second intersection point B where the first horizontal auxiliary line IJ intersects with the second vertical auxiliary line NQ; the third intersection point C where the second horizontal auxiliary line KL intersects with the first vertical auxiliary line MO; and the fourth intersection point D where the second horizontal auxiliary line KL intersects with the second vertical auxiliary line NQ. The target position can be the position of the first horizontal auxiliary line, the position of the second horizontal auxiliary line, or the position of any one of the four intersection points of the target composition auxiliary lines.

[0048] In one embodiment, when determining the target subject in the image to be processed, the target subject can be translated to the position of the first horizontal auxiliary line or the position of the second horizontal auxiliary line; alternatively, a target point of the target subject can be determined, which can be the center point of the area where the target subject is located, or a point in the area where the target subject is located at a preset distance from the center point; the target position is determined based on the distance between the target point and the first intersection point, the distance between the target point and the second intersection point, the distance between the target point and the third intersection point, and the distance between the target point and the fourth intersection point.

[0049] Step 103: Translate the image to be processed, and after translation, the target subject is located at the target position.

[0050] Where the target subject includes a target point, the target point is located at the target position after translation.

[0051] Optionally, the image to be processed is translated along the direction of the target position, so that the translated target subject is located at the target position.

[0052] In one embodiment, Figure 3 This is a second scene diagram of the image processing method provided in the embodiments of this application, such as... Figure 3As shown, based on the resolution of the image to be processed, a two-axis quadrant coordinate system is used to represent the size of the target area occupied by the image to be processed; where the X-axis of the two-axis quadrant coordinate system represents the width of the image to be processed, and the Y-axis of the two-axis quadrant coordinate system represents the height of the image to be processed. The value corresponding to the width is the number of pixels in the width direction, and the value corresponding to the height is the number of pixels in the height direction. Then, the target area occupied by the image to be processed is divided into a 3*3 grid using the rule of thirds. The four intersection points are represented by A, B, C, and D, respectively, and the target point of the main object is represented by P.

[0053] Once the target location is determined, the image to be processed is translated along the direction of the target location until the target object is located at the target location, at which point the translation stops.

[0054] Figure 4 This is the third scene diagram of the image processing method provided in the embodiments of this application, such as... Figure 4 As shown, when the target position is one of the four intersections of the target composition auxiliary lines, this target position is the target location point. Assuming the target location point is the third intersection point C, after translating the image to be processed, the target point P coincides with the third intersection point C. At this point, the image to be processed includes images within the two quadrants and images outside the two quadrants, such as... Figure 4 As shown, the area of ​​the image outside the two quadrants of the number axis is the area filled with diagonal lines.

[0055] Step 104: Crop the translated image to obtain the target image.

[0056] Optional, Figure 5 This is the fourth scene diagram of the image processing method provided in the embodiments of this application, such as... Figure 5 As shown, the image outside the two quadrants of the number axis is cropped to obtain the cropped target image, as shown. Figure 5 As shown, the target image is a region filled with white.

[0057] Taking animal photography as an example, when taking the picture, the user doesn't need to worry too much about the animal's position in the overall image; they can simply take the picture and save it to their album. If the user needs to improve the quality of the animal image later, they need to select the animal image in the album and click the automatic composition control. This will enter the automatic composition mode. During the automatic composition process, the user circles the target subject (the area where the animal is located) in the animal image. The electronic device determines the target point based on the area circled by the user and shifts the target point in the animal's area to the intersection point closest to the target point in the rule of thirds composition. Finally, the shifted animal image is cropped so that the position of the target point in the cropped animal image has visual impact, thereby improving the quality of the cropped animal image.

[0058] It should be noted that the above image processing method also applies to the video to be processed. In practical applications, steps 101 to 104 above need to be performed on each frame of the video to be processed in order to complete the image processing of each frame.

[0059] The image processing method provided in this application translates the target subject of the image to be processed to the target position and then performs cropping. It realizes automatic cropping of the image based on the target composition guideline, making the position of the target subject after cropping visually impactful, improving image quality, and requiring less shooting skills from the user.

[0060] Optionally, the target entity includes a target point; Figure 1 The implementation of step 102 may include: determining a target intersection point among the N intersection points of the target mapping auxiliary line based on the position of the target point; and determining the target intersection point as the target position.

[0061] Wherein, N is a positive integer.

[0062] In one embodiment, based on the positional relationship between the target point and the first intersection point, the positional relationship between the target point and the second intersection point, the positional relationship between the target point and the third intersection point, and the positional relationship between the target point and the fourth intersection point, the target intersection point is determined from the first intersection point, the second intersection point, the third intersection point, and the fourth intersection point according to the target rule, and the target intersection point is determined as the target location.

[0063] The target rule is a pre-defined rule. The target rule could be to determine the intersection farthest from the target point as the target intersection point, or to determine the intersection second closest to the target point as the target intersection point, etc. The specific target rule can be set according to user needs, and this application does not limit it. For example, if the target rule is to determine the intersection second closest to the target point as the target intersection point, from... Figure 3 It can be seen that the first intersection point A is the second closest intersection point to the target point P, so the first intersection point A is determined as the target intersection point.

[0064] The image processing method provided in this application determines the target intersection point among N intersection points as the target location, eliminating the need to calculate other points in the target area occupied by the image to be processed, thereby simplifying the image processing steps.

[0065] Optional, Figure 1 The implementation of step 102 may include: based on the position of the target point, determining the target intersection point among the N intersection points of the target mapping auxiliary line, and determining the point at the target distance from the target intersection point as the target position.

[0066] The target distance is a pre-set distance.

[0067] In one embodiment, after determining the target intersection point based on the positional relationships between the target point and the first intersection point, the target point and the second intersection point, the target point and the third intersection point, and the target point and the fourth intersection point, any point at a target distance from the target intersection point can also be determined as the target location. For example, a point at a distance of two pixels from the target intersection point can be determined as the target location.

[0068] Optionally, determining the target intersection point among the N intersection points of the target mapping auxiliary line based on the position of the target point includes: determining the intersection point among the N intersection points that is closest to the target point as the target intersection point.

[0069] In one embodiment, a first distance between the target point and a first intersection point, a second distance between the target point and a second intersection point, a third distance between the target point and a third intersection point, and a fourth distance between the target point and a fourth intersection point are determined. Based on the first, second, third, and fourth distances, the intersection point closest to the target point among the four intersection points is determined, and this closest intersection point is identified as the target intersection point. Figure 3 It can be seen that the third intersection point C is the intersection point closest to the target point P, so the third intersection point C is determined as the target intersection point.

[0070] The image processing method provided in this application determines the intersection point closest to the target point among N intersection points as the target intersection point. On the one hand, it eliminates the need to calculate other points in the target area occupied by the image to be processed, simplifying the image processing steps. On the other hand, shifting the target point to the intersection point closest to itself can reduce the area that needs to be cropped, reduce the loss of resolution in the image to be processed, and at the same time ensure that the target image contains as much of the image details as possible in the image to be processed.

[0071] Optionally, where N equals 4, the method for determining the target intersection point as the intersection point among the N intersection points that is closest to the target point includes:

[0072] Based on the first and second auxiliary lines passing through the target point, the target area occupied by the image to be processed is divided into four reference areas; the target reference area with the smallest area is determined among the four reference areas; the target vertices of the target area contained in the target reference area are determined, and the target intersection points are determined based on the target list and the target vertices.

[0073] The first auxiliary line is perpendicular to the second auxiliary line, and the target list stores the mapping relationship between the four intersection points and the four vertices of the target region.

[0074] In one embodiment, Figure 6 This is the fifth scene diagram of the image processing method provided in the embodiments of this application, such as... Figure 6 As shown, in the 2-quadrant coordinate system, rectangle EFGH represents the target area occupied by the image to be processed. IJ represents the first horizontal auxiliary line, KL represents the second horizontal auxiliary line, MO represents the first vertical auxiliary line, NQ represents the second vertical auxiliary line, SU represents the first auxiliary line passing through the target point P, and RT represents the second auxiliary line passing through the target point P. The first auxiliary line SU and the second auxiliary line RT divide the target area EFGH occupied by the image to be processed into four reference areas, namely the first reference area ESPR, the second reference area FSPT, the third reference area HUPR, and the fourth reference area GUPT.

[0075] For Figure 6 The target list stores the correspondence between vertex E and the first intersection point A, vertex F and the second intersection point B, vertex H and the third intersection point C, and vertex W and the fourth intersection point D.

[0076] The specific method for calculating the intersection point closest to the target point is as follows: Calculate the first area of ​​the first reference region ESPR, the second area of ​​the second reference region FSPT, the third area of ​​the third reference region HUPR, and the fourth area of ​​the fourth reference region GUPT. Then, determine the minimum area from the first, second, third, and fourth areas, and determine the reference region corresponding to the minimum area as the target reference region. Next, determine the target vertices of the target region occupied by the image to be processed included in the target reference region, and determine the intersection points corresponding to the target vertices found in the target list as the target intersection points.

[0077] from Figure 6 It can be seen that the area of ​​the third reference region HUPR is the smallest, so the third reference region HUPR is determined as the target reference region. At this time, the target vertex of the target region EFGH of the image to be processed is determined to be H in the third reference region HUPR. Then, the intersection point corresponding to H is found in the target list as the third intersection point C, so the third intersection point C is determined as the target intersection point. After translating the image to be processed, the target point P coincides with the third intersection point C.

[0078] Figure 7 This is the sixth scene diagram of the image processing method provided in the embodiments of this application. The final target image obtained after cropping is as follows: Figure 7As shown, the area occupied by the target image is the rectangular region VZWH. Therefore, the resolution of the obtained target image is HW*HV.

[0079] Optionally, when the target point is located within the central area formed by N intersections, the method of determining the intersection closest to the target point among the N intersections as the target intersection point includes:

[0080] Based on the target point, add a first auxiliary line and a second auxiliary line that are perpendicular to each other, and divide the target area of ​​the image to be processed into four reference areas; determine the target reference area with the smallest area among the four reference areas; and determine the intersection points contained in the target reference area as target intersection points.

[0081] In one embodiment, such as Figure 6 As shown, the first intersection point A is located within the first reference region ESPR, the second intersection point B is located within the second reference region FSPT, the third intersection point C is located within the third reference region HUPR, and the fourth intersection point D is located within the fourth reference region GUPT. The areas of the first reference region ESPR, the second reference region FSPT, the third reference region HUPR, and the fourth reference region GUPT are calculated respectively. It is found that the area of ​​the third reference region HUPR is the smallest, which means that the distance from the target point P to the third intersection point C contained within the third reference region HUPR is the shortest. Therefore, the third reference region HUPR is determined as the target reference region, and the third intersection point C contained within the third reference region HUPR is determined as the target intersection point.

[0082] The image processing method provided in this application determines the nearest intersection point to the target point based on calculating the area of ​​each reference region. It is known that the area of ​​each reference region is equal to the product of the length and width of the reference region. Compared with calculating the distance between the target point and each intersection point, the calculation method is simpler, thereby further simplifying the image processing steps and reducing the processing burden of electronic devices.

[0083] Optionally, determining the intersection point closest to the target point among the N intersection points as the target intersection point includes: determining the position of the target point and the position of each intersection point; determining the distance between the target point and each intersection point based on the position of each intersection point and the position of the target point; and determining the intersection point closest to the target point as the target intersection point.

[0084] In one embodiment, a first distance between the first intersection point and the target point is calculated based on the positions of the first intersection point and the target point; a second distance between the second intersection point and the target point is calculated based on the positions of the second intersection point and the target point; a third distance between the third intersection point and the target point is calculated based on the positions of the third intersection point and the target point; and a fourth distance between the fourth intersection point and the target point is calculated based on the positions of the fourth intersection point and the target point. The intersection point corresponding to the minimum distance among the first, second, third, and fourth distances is determined as the target intersection point. For example, if the third distance is the minimum, then the third intersection point C corresponding to the third distance is determined as the target intersection point.

[0085] Optional, Figure 1 The implementation of step 101 may include: receiving a first input from a user to the image to be processed; and in response to the first input, determining a target subject in the image to be processed.

[0086] In one embodiment, after displaying the image to be processed, text information instructing the user to select a subject area in the image to be processed can be displayed, or voice information instructing the user to select a subject area in the image to be processed can be played via voice. This facilitates the user to perform a first input on the image to be processed according to their own needs when they receive the prompt text or voice information. When the electronic device receives the user's first input, it takes the object indicated by the first input as the feature information of the target subject, and identifies the target subject in the image to be processed based on image recognition technology and the feature information of the target subject, thus determining the target subject. Furthermore, a point in the target subject can be determined based on the area occupied by the target subject, which is the target point. The target point can be the center point of the area occupied by the target subject or a point at a preset distance from the center point.

[0087] The user's first input can be represented by the user's sliding trajectory on the image to be processed, and the main area in the image to be processed can be circled based on the sliding trajectory; the sliding trajectory can be the trajectory of the user's finger on the touch screen, or it can be the trajectory drawn by the user with a mouse.

[0088] The image processing method provided in this application determines the target subject based on the user's first input to the image to be processed, and realizes image processing based on the subject that the user wants to highlight, making the image processing more in line with the user's wishes.

[0089] The following is based on Figures 8 to 11 The steps of the image processing method provided in this application are described as follows:

[0090] like Figure 8 As shown, after displaying the image to be processed, the user clicks the automatic composition control to trigger the image processing steps 101 to 104 of this application.

[0091] like Figure 9 As shown, after the user clicks the automatic composition control, the user performs the first input on the image to be processed, circling the target subject in the image.

[0092] like Figure 10 As shown, upon receiving the user's first input, the target point of the target subject is determined based on the first input, and the target position is determined by combining the rule of thirds composition; the image to be processed is translated so that the target point coincides with the target position, and the translated image is cropped.

[0093] like Figure 11 As shown, the final target image is saved to the photo album.

[0094] Optionally, after cropping the translated image to obtain the target image, the image processing method further includes: determining the target ratio of the target image; and, if the target ratio of the target image is not the same as the original ratio of the image to be processed, cropping the target image based on the original ratio of the image to be processed to obtain the final image.

[0095] In one embodiment, the aspect ratio of the image is set as the ratio of the image width to the image height. If the target aspect ratio of the target image is different from the original aspect ratio of the image to be processed, the target aspect ratio of the target image is compared with the original aspect ratio of the image to be processed. If the target aspect ratio of the target image is greater than the original aspect ratio of the image to be processed, the edge indicating the width in the target image is cropped based on the original aspect ratio of the image to be processed.

[0096] If the target image has a smaller scale than the original scale of the image to be processed, crop the edges indicating the height in the target image based on the original scale of the image to be processed.

[0097] It should be noted that when the target aspect ratio of the target image is different from the original aspect ratio of the image to be processed, the width-indicating edge and the height-indicating edge of the target image can be cropped simultaneously, as long as the aspect ratio of the final cropped image is the same as that of the image to be processed.

[0098] The image processing method provided in this application translates the target subject of the image to be processed to the target position and then performs cropping, realizing automatic cropping of the image based on the target composition guideline, thereby improving the visual effect of the target image obtained after cropping. In this way, the user can focus on shooting during the shooting process without having to pay too much attention to the composition, which requires less shooting skills from the user. The user only needs to recompose the captured image based on the image processing method of this application.

[0099] It should be noted that the image processing method provided in this application embodiment can be executed by an image processing device or a control module within that image processing device for executing the image processing method. This application embodiment uses an image processing device executing the image processing method as an example to illustrate the image processing device provided in this application embodiment.

[0100] This application also provides an image processing apparatus. Figure 12 This is a schematic diagram of the structure of the image processing apparatus provided in the embodiments of this application, as shown below. Figure 12 As shown, the device includes: an acquisition module 1201, a determination module 1202, a translation module 1203, and a cutting module 1204; wherein,

[0101] The acquisition module 1201 is used to acquire the target subject in the image to be processed;

[0102] The determination module 1202 is used to determine the target position based on the position of the target subject and the target composition auxiliary lines;

[0103] The translation module 1203 is used to translate the image to be processed, and after translation, the target subject is located at the target position;

[0104] The cropping module 1204 is used to crop the translated image to obtain the target image.

[0105] The image processing apparatus provided in this application translates the target subject of the image to be processed to the target position and then performs cropping, realizing automatic cropping of the image based on the target composition guideline, making the position of the target subject after cropping visually impactful, improving image quality, and requiring less shooting skills from the user.

[0106] Optionally, the target entity includes a target point; after translation, the target point is located at the target position; the determining module 1202 is further configured to:

[0107] Based on the location of the target point, the target intersection point is determined from the N intersection points of the target mapping auxiliary lines; where N is a positive integer;

[0108] The target intersection point is determined as the target location.

[0109] Optionally, the determining module 1202 is further configured to:

[0110] The intersection point that is closest to the target point among the N intersection points is determined as the target intersection point.

[0111] Optionally, N equals 4;

[0112] The determining module 1202 is further configured to:

[0113] Based on the first and second auxiliary lines passing through the target point, the target area occupied by the image to be processed is divided into four reference areas;

[0114] The target reference region with the smallest area is determined from the four reference regions;

[0115] Determine the target vertices of the target region contained within the target reference region;

[0116] The target intersection point is determined based on the target list and the target vertices;

[0117] The first auxiliary line is perpendicular to the second auxiliary line, and the target list stores the mapping relationship between the four intersection points and the four vertices of the target region.

[0118] Optionally, the acquisition module 1201 is further configured to:

[0119] Receive the user's first input on the image to be processed;

[0120] In response to the first input, the target subject in the image to be processed is determined.

[0121] The image processing device in this application embodiment can be a device, or a component, integrated circuit, or chip in a terminal. The device can be a mobile electronic device or a non-mobile electronic device. For example, mobile electronic devices can be mobile phones, tablets, laptops, PDAs, in-vehicle electronic devices, wearable devices, ultra-mobile personal computers (UMPCs), netbooks, or personal digital assistants (PDAs), etc., while non-mobile electronic devices can be servers, network-attached storage (NAS), personal computers (PCs), televisions (TVs), ATMs, or self-service machines, etc. This application embodiment does not impose specific limitations.

[0122] The image processing device in this application embodiment can be a device with an operating system. This operating system can be Android, iOS, or other possible operating systems; this application embodiment does not specifically limit the specific operating system used.

[0123] The image processing apparatus provided in this application embodiment can achieve... Figures 1 to 11 The various processes implemented in the method implementation examples will not be described again here to avoid repetition.

[0124] Optionally, such as Figure 13 As shown, this application embodiment also provides an electronic device 1300, including a processor 1301, a memory 1302, and a program or instructions stored in the memory 1302 and executable on the processor 1301. When the program or instructions are executed by the processor 1301, they implement the various processes of the above-described image processing method embodiments and achieve the same technical effects. To avoid repetition, they will not be described again here.

[0125] It should be noted that the electronic devices in the embodiments of this application include the mobile electronic devices and non-mobile electronic devices described above.

[0126] Figure 14 A schematic diagram of the hardware structure of an electronic device to implement an embodiment of this application.

[0127] The electronic device 1400 includes, but is not limited to, components such as: radio frequency unit 1401, network module 1402, audio output unit 1403, input unit 1404, sensor 1405, display unit 1406, user input unit 1407, interface unit 1408, memory 1409, and processor 1410.

[0128] Those skilled in the art will understand that the electronic device 1400 may also include a power supply (such as a battery) for supplying power to various components. The power supply may be logically connected to the processor 1410 through a power management system, thereby enabling functions such as managing charging, discharging, and power consumption through the power management system. Figure 14 The electronic device structure shown does not constitute a limitation on the electronic device. The electronic device may include more or fewer components than shown, or combine certain components, or have different component arrangements, which will not be elaborated here.

[0129] The processor 1410 is used to acquire the target subject in the image to be processed;

[0130] The processor 1410 is also configured to determine the target position based on the position of the target subject and the target composition auxiliary lines;

[0131] The processor 1410 is also configured to translate the image to be processed, and after translation, the target subject is located at the target position;

[0132] The processor 1410 is also used to crop the translated image to obtain the target image.

[0133] According to the electronic device provided in the embodiments of this application, the target subject of the image to be processed is translated to the target position and then cropped, realizing automatic cropping processing of the image based on the target composition auxiliary lines, making the position of the target subject after cropping visually impactful, improving image quality, and requiring less shooting skills from the user.

[0134] Optionally, the target body includes a target point; after translation, the target point is located at the target position; the processor 1410 is further configured to determine a target intersection point among N intersection points of the target mapping auxiliary lines based on the position of the target point; wherein, N is a positive integer;

[0135] The target intersection point is determined as the target location.

[0136] The electronic device provided in this application embodiment determines the target intersection point among N intersection points as the target location, eliminating the need to calculate other points in the target area occupied by the image to be processed, thereby simplifying the image processing steps.

[0137] Optionally, the processor 1410 is further configured to determine the intersection point among the N intersection points that is closest to the target point as the target intersection point.

[0138] The electronic device provided in this application determines the intersection point closest to the target point among N intersection points as the target intersection point. On the one hand, it eliminates the need to calculate other points in the target area occupied by the image to be processed, simplifying the image processing steps. On the other hand, shifting the target point to the intersection point closest to itself can reduce the area that needs to be cropped, reduce the loss of resolution in the image to be processed, and at the same time ensure that the target image contains as much of the image details as possible in the image to be processed.

[0139] Optionally, N equals 4; the processor 1410 is further configured to divide the target region occupied by the image to be processed into four reference regions based on the first auxiliary line and the second auxiliary line passing through the position of the target point;

[0140] The target reference region with the smallest area is determined from the four reference regions;

[0141] Determine the target vertices of the target region contained within the target reference region;

[0142] The target intersection point is determined based on the target list and the target vertices;

[0143] The first auxiliary line is perpendicular to the second auxiliary line, and the target list stores the mapping relationship between the four intersection points and the four vertices of the target region.

[0144] The electronic device provided in this application determines the nearest intersection point to the target point based on calculating the area of ​​each reference region. It is known that the area of ​​each reference region is equal to the product of the length and width of the reference region. Compared with calculating the distance between the target point and each intersection point, the calculation method is simple, thereby further simplifying the image processing steps and reducing the processing burden of the electronic device.

[0145] Optionally, the processor 1410 is also configured to receive a first input from a user on the image to be processed;

[0146] In response to the first input, the target subject in the image to be processed is determined.

[0147] The electronic device provided in this application determines the target subject based on the user's first input to the image to be processed, and realizes image processing based on the subject that the user wants to highlight, making the image processing more in line with the user's wishes.

[0148] It should be understood that, in this embodiment, the input unit 1404 may include a graphics processing unit (GPU) 14041 and a microphone 14042. The GPU 14041 processes image data of still images or videos obtained by an image capture device (such as a camera) in video capture mode or image capture mode. The display unit 1406 may include a display panel 14061, which may be configured in the form of a liquid crystal display, an organic light-emitting diode, etc. The user input unit 1407 includes a touch panel 14071 and other input devices 14072. The touch panel 14071 is also called a touch screen. The touch panel 14071 may include a touch detection device and a touch controller. Other input devices 14072 may include, but are not limited to, physical keyboards, function keys (such as volume control buttons, power buttons, etc.), trackballs, mice, joysticks, etc., which will not be described in detail here. The memory 1409 can be used to store software programs and various data, including but not limited to applications and operating systems. Processor 1410 may integrate an application processor and a modem processor. The application processor mainly handles the operating system, user interface, and applications, while the modem processor mainly handles wireless communication. It is understood that the modem processor may also not be integrated into processor 1410.

[0149] This application also provides a readable storage medium storing a program or instructions. When the program or instructions are executed by a processor, they implement the various processes of the above-described image processing method embodiments and achieve the same technical effects. To avoid repetition, they will not be described again here.

[0150] The processor is the processor in the electronic device described in the above embodiments. The readable storage medium includes computer-readable storage media, such as computer read-only memory (ROM), random access memory (RAM), magnetic disk, or optical disk.

[0151] This application embodiment also provides a chip, which includes a processor and a communication interface. The communication interface is coupled to the processor. The processor is used to run programs or instructions to implement the various processes of the above-described image processing method embodiments and can achieve the same technical effect. To avoid repetition, it will not be described again here.

[0152] It should be understood that the chip mentioned in the embodiments of this application may also be referred to as a system-on-a-chip, system chip, chip system, or system-on-a-chip, etc.

[0153] This application provides a computer program product, which is stored in a storage medium and executed by at least one processor to implement the various processes of the above-described image processing method embodiments, and can achieve the same technical effect. To avoid repetition, it will not be described again here.

[0154] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element. Furthermore, it should be noted that the scope of the methods and apparatuses in the embodiments of this application is not limited to performing functions in the order shown or discussed, but may also include performing functions substantially simultaneously or in the reverse order, depending on the functions involved. For example, the described methods may be performed in a different order than described, and various steps may be added, omitted, or combined. Additionally, features described with reference to certain examples may be combined in other examples.

[0155] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a computer software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods described in the various embodiments of this application.

[0156] The embodiments of this application have been described above with reference to the accompanying drawings. However, this application is not limited to the specific embodiments described above. The specific embodiments described above are merely illustrative and not restrictive. Those skilled in the art can make many other forms under the guidance of this application without departing from the spirit and scope of the claims, and all of these forms are within the protection scope of this application.

Claims

1. An image processing method, characterized in that, include: Obtain the target subject from the image to be processed; The target location is determined based on the position of the target subject and the target composition auxiliary lines; The image to be processed is translated, and after the translation, the target subject is located at the target position; The translated image to be processed is cropped to obtain the target image; The target entity includes the target point; After translation, the target point is located at the target position; Determining the target location based on the position of the target subject and the target composition auxiliary lines includes: Based on the first and second auxiliary lines passing through the target point, the target area occupied by the image to be processed is divided into four reference areas; The target reference region with the smallest area is determined from the four reference regions; Determine the target vertices of the target region contained within the target reference region; Target intersections are determined based on the target list and the target vertices; wherein the first auxiliary line is perpendicular to the second auxiliary line, and the target list stores the mapping relationship between the four intersections of the target mapping auxiliary lines and the four vertices of the target region; The target intersection point is determined as the target location.

2. The image processing method according to claim 1, characterized in that, The process of acquiring the target subject in the image to be processed includes: Receive the user's first input on the image to be processed; In response to the first input, the target subject in the image to be processed is determined.

3. An image processing apparatus, characterized in that, include: The acquisition module is used to acquire the target subject in the image to be processed; The determination module is used to determine the target position based on the position of the target subject and the target composition auxiliary lines; The translation module is used to translate the image to be processed, and after translation, the target subject is located at the target position; The cropping module is used to crop the translated image to obtain the target image; The target entity includes a target point; after translation, the target point is located at the target position; the determining module is further used for: Based on the first and second auxiliary lines passing through the target point, the target area occupied by the image to be processed is divided into four reference areas; The target reference region with the smallest area is determined from the four reference regions; Determine the target vertices of the target region contained within the target reference region; Determine the target intersection point based on the target list and the target vertices; Wherein, the first auxiliary line is perpendicular to the second auxiliary line, and the target list stores the mapping relationship between the four intersection points of the target mapping auxiliary lines and the four vertices of the target region; The target intersection point is determined as the target location.

4. The image processing apparatus according to claim 3, characterized in that, The acquisition module is also used for: Receive the user's first input on the image to be processed; In response to the first input, the target subject in the image to be processed is determined.

5. An electronic device, characterized in that, It includes a processor, a memory, and a program or instructions stored in the memory and executable on the processor, wherein the program or instructions, when executed by the processor, implement the steps of the image processing method as described in claim 1 or 2.

6. A readable storage medium, characterized in that, The readable storage medium stores a program or instructions that, when executed by a processor, implement the steps of the image processing method as described in claim 1 or 2.

Citation Information

Patent Citations

  • Picture processing method and terminal

    CN106919318A

  • Alignment method and mobile terminal

    CN108920053A