Method for unifying picture styles, data processing device, and storage medium

By calculating the edge distance and length proportion values ​​of the reference picture and the target picture, the scale of the target picture is automatically adjusted, which solves the problem of inefficient unified picture style in the prior art, and improves the effectiveness of picture display and visual experience.

CN114519664BActive Publication Date: 2025-05-09SHENZHEN TECH UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210064177.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-01-20
Publication Date
2025-05-09
Estimated Expiration
2042-01-20

AI Technical Summary

Technical Problem

The prior art is difficult to automatically unify the style of multiple pictures, especially in the foreground position and proportion, resulting in poor appearance when displayed on the same page.

Method used

By obtaining the reference picture with the reference foreground box and the target picture with the target foreground box, the distance and edge length ratio between the two is calculated, and the scale adjustment distance of the target picture is determined, thereby unifying the picture style.

Benefits of technology

The edges of the target image are automatically adjusted to ensure that it is consistent with the foreground position and proportion of the reference image, thereby improving the effectiveness and visual experience of image display.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114519664B_ABST
    Figure CN114519664B_ABST
Patent Text Reader

Abstract

The present invention discloses a method for unifying the style of pictures, a data processing device, and a storage medium, comprising obtaining a reference picture with a reference foreground frame; obtaining a target picture with a target foreground frame; obtaining a first distance between a first edge and a second edge; obtaining a third distance between a third edge and a fourth edge before scale adjustment; obtaining the length of a fifth edge and obtaining the length of a sixth edge; obtaining a first ratio value according to the length of the fifth edge and the first distance; obtaining a second ratio value according to the length of the sixth edge and the third distance; determining a second distance according to the first ratio value and the second ratio value, wherein the first edge, the second edge, the third edge, and the fourth edge are all located on the same side, the fifth edge intersects with the first edge, and the sixth edge intersects with the third edge; obtaining the scale-adjusted target picture according to the second distance, so as to unify the style of the pictures and achieve the purpose of improving the effectiveness of picture display.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of image processing technology, and in particular to a method for unifying picture styles, a data processing device, and a storage medium. Background Art

[0002] With the rapid development of information technology, the number of images on the Internet has exploded. In many scenarios, a series of images need to be displayed in a unified style, such as product images displayed on various shopping websites and employee images displayed on the websites of various organizations. When these images are displayed on the same page, the target object or person in each image can be displayed in a unified style to give users a better viewing experience. The style here refers to the position of the foreground in the image and the proportion of the foreground to the entire image. However, manual resizing of images is inefficient. How to provide a method to automatically unify the style of images is a technical problem that needs to be solved urgently. Summary of the invention

[0003] The purpose of the present invention is to solve at least one of the technical problems existing in the prior art and to provide a method for unifying picture styles, which can improve the effectiveness of picture display.

[0004] In a first aspect, an embodiment of the present invention provides a method for unifying picture styles, including:

[0005] Get a reference image with a reference foreground frame;

[0006] Get the target image with the target foreground frame;

[0007] Obtaining a first distance between a first edge of the reference foreground frame and a second edge of the reference picture;

[0008] Acquire a third distance between a third edge of the target foreground frame and a fourth edge of the target image before scale adjustment;

[0009] Obtaining the length of the fifth edge of the reference foreground frame, and obtaining the length of the sixth edge of the target foreground frame;

[0010] Obtaining a first ratio value according to the length of the fifth edge and the first distance;

[0011] Obtaining a second ratio value according to the length of the sixth edge and the third distance;

[0012] Determining a second distance between a third edge of the target foreground frame after the scale adjustment and a fourth edge of the target image according to the first ratio value and the second ratio value, wherein the first edge, the second edge, the third edge and the fourth edge are all located on the same side, the fifth edge intersects with the first edge, and the sixth edge intersects with the third edge;

[0013] The scale-adjusted target image is obtained according to the second distance.

[0014] According to the method for unifying the style of a picture according to an embodiment of the present invention, there are at least the following beneficial effects: obtaining a reference picture with a reference foreground frame; obtaining a target picture with a target foreground frame; obtaining a first distance between a first edge of the reference foreground frame and a second edge of the reference picture; obtaining a third distance between a third edge of the target foreground frame and a fourth edge of the target picture before scale adjustment; obtaining the length of a fifth edge of the reference foreground frame, and obtaining the length of a sixth edge of the target foreground frame; obtaining a first ratio value according to the length of the fifth edge and the first distance; obtaining a second ratio value according to the length of the sixth edge and the third distance; determining a second distance between the third edge of the target foreground frame after scale adjustment and the fourth edge of the target picture according to the first ratio value and the second ratio value, wherein the first edge, the second edge, the third edge and the fourth edge are all located on the same side, the fifth edge intersects with the first edge, and the sixth edge intersects with the third edge; obtaining the scale-adjusted target picture according to the second distance. According to the scheme of the embodiment of the present invention, the edge of the target picture is adjusted, the ratio value of the length or width between the reference picture and the reference foreground frame is determined, the ratio value of the length or width between the target picture and the target foreground frame is determined, and the style of the picture is unified, thereby achieving the purpose of improving the effectiveness of picture display.

[0015] According to some embodiments of the present invention, determining the second distance based on the first ratio value and the second ratio value includes at least one of the following scenarios: when the first ratio value is not equal to the second ratio value, determining that the second distance is equal to the first ratio value multiplied by the length of the sixth edge; when the first ratio value is equal to the second ratio value, determining that the second distance is equal to the third distance.

[0016] According to some embodiments of the present invention, determining the second distance based on the first ratio value and the second ratio value further includes: when a difference between the first ratio value and the second ratio value is less than a preset error value, determining that the second distance is equal to the third distance.

[0017] According to some embodiments of the present invention, determining the second distance according to the first ratio value and the second ratio value further includes: when the third distance is less than a preset distance threshold, determining that the second distance is equal to the third distance.

[0018] According to some embodiments of the present invention, obtaining the scale-adjusted target image according to the second distance includes at least one of the following scenarios: when the third distance is not equal to the second distance, the target image is scaled according to the second distance to obtain the scale-adjusted target image; when the third distance is equal to the second distance, determining that the third distance of the target image remains unchanged.

[0019] According to some embodiments of the present invention, before obtaining a reference picture with a reference foreground frame, the steps include: obtaining a reference picture; obtaining a first foreground of the reference picture based on the reference picture; determining a reference foreground frame based on the first foreground; and obtaining a reference picture with a reference foreground frame based on the reference foreground frame.

[0020] According to some embodiments of the present invention, before obtaining the target image with the target foreground frame, the steps include: obtaining the target image; obtaining a second foreground of the target image based on the target image; determining a target foreground frame based on the second foreground; and obtaining the target image with the target foreground frame based on the target foreground frame.

[0021] In a second aspect, an embodiment of the present invention further provides a data processing device, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the method for unifying picture styles as described in the first aspect is implemented.

[0022] In a third aspect, an embodiment of the present invention further provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions, and the computer-executable instructions are used to enable a computer to execute the method for unifying picture styles as described in the first aspect.

[0023] Other features and advantages of the present invention will be described in the following description, and partly become apparent from the description, or understood by practicing the present invention. The purpose and other advantages of the present invention can be realized and obtained by the structures particularly pointed out in the description, claims and drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0024] The accompanying drawings are used to provide a further understanding of the technical solution of the present invention and constitute a part of the specification. Together with the embodiments of the present invention, they are used to explain the technical solution of the present invention and do not constitute a limitation on the technical solution of the present invention.

[0025] The present invention is further described below in conjunction with the accompanying drawings and embodiments;

[0026] Figure 1 is a flowchart of the steps of a method for unifying picture styles provided by an embodiment of the present invention;

[0027] Figure 2 yes Figure 1 Flow chart of the specific method of step S180;

[0028] Figure 3 yes Figure 1 A flowchart of another embodiment of the specific method of step S180;

[0029] Figure 4 yes Figure 1 A flowchart of another embodiment of the specific method of step S180;

[0030] Figure 5 yes Figure 1 A flowchart of a specific scenario of step S190;

[0031] Figure 6 yes Figure 1 Flow chart of the specific method of step S110;

[0032] Figure 7 yes Figure 1 Flow chart of the specific method of step S120;

[0033] Figure 8 is a structural schematic diagram of a data processing device provided by another embodiment of the present invention;

[0034] Fig. 9 This is a diagram showing the effect of a method for unifying picture styles provided by another embodiment of the present invention. DETAILED DESCRIPTION

[0035] This section will describe in detail the specific embodiments of the present invention. The preferred embodiments of the present invention are shown in the accompanying drawings. The purpose of the accompanying drawings is to supplement the description of the text part of the specification with graphics, so that people can intuitively and vividly understand each technical feature and the overall technical solution of the present invention, but it cannot be understood as a limitation on the scope of protection of the present invention.

[0036] In the description of the present invention, if there is a description of first and second, it is only for the purpose of distinguishing the technical features, and cannot be understood as indicating or implying the relative importance or implicitly indicating the number of the indicated technical features or implicitly indicating the order of the indicated technical features.

[0037] In the description of the present invention, unless otherwise clearly defined, terms such as setting, installing, connecting, etc. should be understood in a broad sense, and technicians in the relevant technical field can reasonably determine the specific meanings of the above terms in the present invention based on the specific content of the technical solution.

[0038] The embodiment of the present invention provides a method, a data processing device, and a storage medium for unifying the style of an image, including obtaining a reference image with a reference foreground frame; obtaining a target image with a target foreground frame; determining a second distance between a third edge of a scale-adjusted target foreground frame and a fourth edge of the target image based on a first distance between a first edge of the reference foreground frame and a second edge of the reference image, wherein the first edge, the second edge, the third edge, and the fourth edge are all located on the same side, and obtaining the scale-adjusted target image based on the second distance. According to the solution of the embodiment of the present invention, the edge of the target image is adjusted, the position of the foreground in the target image is set according to the position of the foreground in the reference image, and the style of the image is unified, thereby achieving the purpose of improving the effectiveness of image display.

[0039] like Fig. 9 As shown, Fig. 9 The original image is the target image, the outer frame is the frame of the target image, and the inner frame is the target foreground frame, which is used to frame the foreground part of the image. The target image determines the second distance after the scale adjustment according to the first distance. After adjusting the scales of the four edges, the target image is obtained as shown in Fig. 9 As shown in the effect diagram in , according to the technical solution of the present invention, the style of the picture can be unified, thereby achieving the purpose of improving the effectiveness of picture display.

[0040] The embodiments of the present invention are further described below in conjunction with the accompanying drawings.

[0041] like Figure 1 As shown, Figure 1 It is a flowchart of a method for unifying picture styles provided by an embodiment of the present invention. The method for unifying picture styles may include but is not limited to step S110, step S120, step S130, step S140, step S150, step S160, step S170, step S180 and step S190.

[0042] Step S110: Obtain a reference image with a reference foreground frame.

[0043] In this step, the reference image refers to a sample image whose image style has been determined. The reference image can be an existing image or a manually processed image edge. The reference foreground frame refers to a frame centered on the foreground. In an optional implementation, the foreground can be identified by foreground cutout or machine learning algorithm recognition. A reference foreground frame can be drawn based on the found foreground, or a reference foreground frame can be manually drawn on the foreground image. The center position of the reference foreground frame is taken as the position of the foreground, and the size of the reference foreground frame is the size of the foreground.

[0044] It is understandable that obtaining the reference image with the reference foreground frame is to facilitate unifying the style of the image in subsequent steps.

[0045] Step S120: Obtain a target image with a target foreground frame.

[0046] In this step, the target image refers to the image whose foreground position needs to be adjusted, that is, the image to be processed. The target image can be an existing image, or a image with foreground obtained after preprocessing in any manner in the relevant technology. The target foreground frame refers to a frame centered on the foreground. In an optional embodiment, the target image has the same type of foreground, such as apples, people, mobile phones, etc. The foreground can be obtained by identifying the target image by means of foreground cutout or machine learning algorithm recognition. The foreground frame can be drawn based on the found foreground, or a foreground frame can be drawn manually on the foreground image. The center position of the foreground frame is taken as the position of the foreground, and the size of the foreground frame is the size of the foreground.

[0047] It is understandable that obtaining the target image with the foreground frame is to facilitate unifying the style of the image in subsequent steps.

[0048] Step S130: Obtain a first distance between a first edge of the reference foreground frame and a second edge of the reference picture.

[0049] In this step, the first edge and the second edge are correspondingly set edges. In an optional implementation, the first edge refers to the upper edge of the reference foreground frame, and the second edge refers to the upper edge of the reference image.

[0050] It can be understood that the first distance refers to the distance between the first edge and the second edge, and the first distance is obtained in order to facilitate obtaining the second distance in subsequent steps.

[0051] Step S140: obtaining a third distance between a third edge of the target foreground frame and a fourth edge of the target image before scale adjustment.

[0052] In this step, the third distance refers to the distance between the third edge of the target foreground frame and the fourth edge of the target image before scale adjustment. The third distance may be greater than, less than or equal to the second distance, and is not specifically limited here.

[0053] It can be understood that the third distance is obtained to facilitate the determination of the second distance and the scale adjustment of the target image in the subsequent steps. The scale adjustment refers to the scale adjustment of the target image according to the second distance, including enlarging, reducing or keeping the distance between the third edge of the target image and the fourth edge of the target foreground frame unchanged.

[0054] Step S150: obtaining the length of the fifth edge of the reference foreground frame, and obtaining the length of the sixth edge of the target foreground frame, wherein the fifth edge intersects with the first edge, and the sixth edge intersects with the third edge.

[0055] In this step, the length of the fifth edge and the length of the sixth edge are obtained in order to facilitate the acquisition of the first ratio value and the second ratio value in the subsequent steps.

[0056] Step S160: obtaining a first ratio value according to the length of the fifth edge and the first distance.

[0057] In this step, the first ratio value may be a ratio of the length of the fifth edge to the first distance. The first ratio value is obtained according to the length of the fifth edge and the first distance in order to facilitate obtaining the second distance in the subsequent step.

[0058] It can be understood that the fifth edge intersects with the first edge. In an optional embodiment, the length of the fifth edge is the height of the reference foreground frame, the first distance is the difference between the upper edge of the reference foreground frame and the upper edge of the reference image, and the first ratio value is equal to the first distance value divided by the length value of the fifth edge.

[0059] Step S170: obtaining a second ratio value according to the length of the sixth edge and the third distance.

[0060] In this step, the second ratio value may be a ratio of the length of the sixth edge to the third distance. The first ratio value is obtained according to the length of the sixth edge and the third distance in order to facilitate obtaining the second distance in the subsequent step.

[0061] It can be understood that the sixth edge intersects with the second edge. In an optional embodiment, the length of the sixth edge is the height of the target foreground frame, the third distance is the difference between the upper edge of the target foreground frame and the upper edge of the target image, and the second ratio value is equal to the third distance value divided by the length value of the sixth edge.

[0062] Step S180: Determine a second distance between a third edge of the scale-adjusted target foreground frame and a fourth edge of the target image according to the first ratio value and the second ratio value, wherein the first edge, the second edge, the third edge and the fourth edge are all located on the same side, the fifth edge intersects with the first edge, and the sixth edge intersects with the third edge.

[0063] In this step, the second distance refers to the distance between the third edge of the target foreground frame after scale adjustment and the fourth edge of the target image. The second distance is determined according to the first ratio value and the second ratio value. The second ratio value can be compared with the first ratio value to determine the second distance, so as to scale the target image according to the second distance.

[0064] It can be understood that when the size of the reference image is inconsistent with that of the target image, or the size of the reference foreground frame is inconsistent with that of the target foreground frame, the method of determining the second distance according to the first ratio value and the second ratio value in this embodiment can reduce the situation where target images of different sizes obtain images of different styles, thereby achieving the purpose of improving the effectiveness of image display.

[0065] It should be noted that the first edge, the second edge, the third edge and the fourth edge are all located on the same side, which means that the first edge refers to the upper edge of the reference foreground frame, the second edge refers to the upper edge of the reference image, the third edge refers to the upper edge of the target foreground frame, and the fourth edge refers to the upper edge of the target image. The same also applies to the left edge, right edge and bottom edge, which are not listed one by one here.

[0066] It should also be noted that the fifth edge intersects with the first edge, and the sixth edge intersects with the third edge. In an optional embodiment, the reference foreground frame and the target foreground frame are both rectangular frames, the fifth edge is perpendicular to the first edge, and the sixth edge is perpendicular to the third edge.

[0067] Step S190: obtaining a target image after scale adjustment according to the second distance.

[0068] In this step, the second distance refers to the distance between each edge of the target foreground frame after scale adjustment and each corresponding edge of the target image, for example: the distance between the upper edge of the target foreground frame and the upper edge of the target image, the distance between the lower edge of the target foreground frame and the lower edge of the target image, the distance between the left edge of the target foreground frame and the left edge of the target image, and the distance between the right edge of the target foreground frame and the right edge of the target image. The target image after scale adjustment is obtained according to the second distance. In an optional embodiment, when the distance of the corresponding position of the target image before scale adjustment is the same as the second distance, the target image does not need to be scaled. When the distance of the corresponding position of the target image before scale adjustment is different from the second distance, the target image is scaled to unify the style of the image. This scale adjustment method does not require manual operation, which improves the convenience of operation. Moreover, this standardized scale adjustment method can unify the style of the image and achieve the purpose of improving the effectiveness of image display.

[0069] It can be understood that after obtaining the target image after the scale is adjusted, the target image can be output, or the target image can be exhibited according to any method in the relevant technology. In an optional implementation, the target image is used as an exhibition of goods, and the target image is scaled using the method of unifying the image style of this embodiment to obtain a picture with a unified style for exhibition, thereby achieving the purpose of improving the effectiveness of the display.

[0070] In this embodiment, by adopting the method of unifying picture style including the above steps S110 to S190, a reference picture with a reference foreground frame is obtained; a target picture with a target foreground frame is obtained; a first distance between a first edge of the reference foreground frame and a second edge of the reference picture is obtained; a third distance between a third edge of the target foreground frame and a fourth edge of the target picture before scale adjustment is obtained; a length of a fifth edge of the reference foreground frame is obtained, and a length of a sixth edge of the target foreground frame is obtained; a first ratio value is obtained according to the length of the fifth edge and the first distance; a second ratio value is obtained according to the length of the sixth edge and the third distance; a second distance between the third edge of the target foreground frame after scale adjustment and the fourth edge of the target picture is determined according to the first ratio value and the second ratio value, wherein the first edge, the second edge, the third edge and the fourth edge are all located on the same side, the fifth edge intersects with the first edge, and the sixth edge intersects with the third edge; and a scale-adjusted target picture is obtained according to the second distance. According to the scheme of the embodiment of the present invention, the edge of the target picture is adjusted, the ratio value of the length or width between the reference picture and the reference foreground frame is determined, the ratio value of the length or width between the target picture and the target foreground frame is determined, and the style of the picture is unified, thereby achieving the purpose of improving the effectiveness of picture display.

[0071] In one embodiment, if Figure 2 As shown, step S180 is further explained, and step S180 may also include at least but not limited to the following two scenarios.

[0072] Scenario 1: When the first ratio value is not equal to the second ratio value, the second distance is determined to be equal to the first ratio value multiplied by the length value of the sixth edge.

[0073] In this step, the first ratio value refers to the ratio value of the length of the foreground in the reference image to the first distance, and the second ratio value refers to the ratio value of the length of the foreground in the target image to the third distance. When the first ratio value is greater than the second ratio value, the third distance needs to be increased to obtain the second distance, and the second distance is determined to be equal to the first ratio value multiplied by the length value of the sixth edge. In an optional embodiment, the third distance value may be less than the first distance value, the first ratio value may be equal to the first distance divided by the length value of the fifth edge, and the second ratio value may be equal to the third distance divided by the length value of the sixth edge. When the first ratio value is greater than the second ratio value, if the size of the reference foreground frame is equal to the size of the target foreground frame, that is, the length value of the fifth edge is equal to the length value of the sixth edge, the second distance may be equal to the first distance; if the size of the reference foreground frame is not equal to the size of the target foreground frame, the second distance may be equal to the first ratio value multiplied by the length value of the sixth edge.

[0074] It can be understood that when the first ratio value is smaller than the second ratio value, the third distance needs to be reduced to obtain the second distance, that is, one end of the fourth edge of the target image needs to be cropped. In an optional embodiment, the second distance is equal to the first ratio value multiplied by the length value of the sixth edge, and the distance to be cropped is equal to the third distance minus the first ratio value multiplied by the length value of the sixth edge, that is, the third distance minus the second distance.

[0075] Scenario 2: When the first ratio value is equal to the second ratio value, it is determined that the second distance is equal to the third distance.

[0076] In this step, the first ratio value refers to the ratio value of the length of the foreground in the reference image to the first distance, and the second ratio value refers to the ratio value of the length of the foreground in the target image to the third distance. When the first ratio value is equal to the second ratio value, the ratio between the target foreground frame and the fourth edge in the target image is the same as the ratio between the reference foreground frame and the second edge of the reference image, and the second distance is determined to be equal to the third distance, that is, the distance value between the fourth edge of the target image and the third edge of the target foreground frame remains unchanged.

[0077] In this embodiment, by adopting a method for unifying the picture style including at least one of the above two scenarios, when the first ratio value is not equal to the second ratio value, the second distance is determined to be equal to the first ratio value multiplied by the length value of the sixth edge; or, when the first ratio value is equal to the second ratio value, the second distance is determined to be equal to the third distance. According to the scheme of the embodiment of the present invention, by comparing the first ratio value with the second ratio value, the value of the second distance of the target picture after scale adjustment is obtained to unify the style of the picture, thereby achieving the purpose of improving the effectiveness of picture display.

[0078] In one embodiment, if Figure 3 As shown, step S180 is further explained, and step S180 may also include but is not limited to step S310.

[0079] Step S310: When the difference between the first ratio value and the second ratio value is less than a preset error value, determine that the second distance is equal to the third distance.

[0080] In this step, the preset error value may be any error value set manually. In an optional embodiment, the preset error value is equal to the minimum error value that can be visually perceived in the relevant technology. The difference between the first ratio value and the second ratio value may be the absolute value of the value obtained by subtracting the two. When the difference between the first ratio value and the second ratio value is less than the preset error value, it is determined that the second distance value is equal to the third distance value.

[0081] In this embodiment, by adopting the method of unifying the picture style including the above step S310, when the difference between the first ratio value and the second ratio value is less than the preset error value, the second distance value is determined to be equal to the third distance value. According to the scheme of the embodiment of the present invention, by the preset error value, the first ratio value is determined to be equal to the second ratio value within the range of the preset error value, thereby achieving the purpose of reducing the amount of calculation for the scale adjustment processing of the picture.

[0082] It is worth noting that the first edge, the second edge, the third edge, and the fourth edge can all be the upper edge, the lower edge, the left edge, or the right edge. After processing the edges of the image, the style of the image can be unified, thereby achieving the purpose of improving the effectiveness of image display.

[0083] In one embodiment, if Figure 4 As shown, step S180 is further explained, and step S130 may also include but is not limited to step S410.

[0084] Step S410: When the third distance is less than a preset distance threshold, determine that the second distance is equal to the third distance.

[0085] In this step, the preset distance threshold may be preset manually. When the third distance is less than the preset distance threshold, the third distance is too small. If the target image is scaled, it may affect the target foreground frame, thereby destroying the content displayed in the foreground area. The second distance is determined to be equal to the third distance.

[0086] In this embodiment, by adopting the method of unifying the picture style including the above step S410, when the third distance is less than the preset distance threshold, it is determined that the second distance is equal to the third distance. According to the scheme of the embodiment of the present invention, by presetting the distance threshold, if the third distance value is too small, it is determined that the second distance value is equal to the third distance value, thereby reducing the situation where the target foreground frame is damaged and reducing the amount of calculation, unifying the style of the picture, and achieving the purpose of improving the effectiveness of the picture display.

[0087] In one embodiment, if Figure 5 As shown, step S190 is further explained, and step S190 may also include at least but not limited to the following two scenarios.

[0088] Scenario 1: When the third distance is not equal to the second distance, the target image is resized according to the second distance to obtain a resized target image.

[0089] In this step, the third distance is the distance between the third edge and the fourth edge of the target image before the scale adjustment, and the second distance is the distance after the scale adjustment of the target image. When the third distance is not equal to the second distance, it is necessary to scale the distance between the fourth edge of the target image and the third edge of the target foreground frame. Therefore, the target image is scaled according to the second distance to obtain the scale-adjusted target image.

[0090] It can be understood that the second distance and the third distance refer to the distance between the same two edges, and scaling the target image according to the second distance refers to changing the original third distance to the second distance, and scaling includes increasing or decreasing the third distance to achieve the purpose of obtaining the target image through scaling.

[0091] Scenario 2: When the third distance is equal to the second distance, it is determined that the third distance of the target image remains unchanged.

[0092] In this step, when the third distance is equal to the second distance, that is, at the fourth edge of the target image, it is only necessary to keep the third distance unchanged to obtain the target image after the scale adjustment.

[0093] It can be understood that the second distance and the third distance refer to the distance between the same two edges. Since the third distance is equal to the second distance, the target image after scale adjustment can be directly obtained, thereby achieving the purpose of reducing the calculation amount of scale adjustment.

[0094] In this embodiment, by adopting a method for unifying the style of a picture including at least one of the above two scenarios, when the third distance is not equal to the second distance, the target picture is scaled according to the second distance to obtain the scaled target picture; or, when the third distance is equal to the second distance, the third distance of the target picture is determined to remain unchanged. According to the solution of the embodiment of the present invention, by determining whether the third distance and the second distance are equal to each other, it is determined whether the target picture needs to be scaled, thereby unifying the style of the picture and achieving the purpose of reducing the amount of calculation for scale adjustment.

[0095] In one embodiment, if Figure 6 As shown, the steps before step S110 are further explained, and the method for unifying the picture style may also include but is not limited to step S610, step S620, step S630 and step S640.

[0096] Step S610: Obtain a reference image.

[0097] In this step, the reference image refers to an image in which the foreground position is reasonable. The reference image is obtained to facilitate obtaining a reference image with a reference foreground frame in subsequent steps.

[0098] It is understandable that the foreground may be any foreground in the related art, such as a person, merchandise for exhibition, etc., and is not specifically limited here.

[0099] Step S620: Obtain a first foreground of the reference picture according to the reference picture.

[0100] In this step, the first foreground may be any foreground in the related art, such as a person, a commodity for exhibition, etc., which is not specifically limited here. The first foreground of the reference image is obtained according to the reference image, and the first foreground may be obtained by any means in the related art. In an optional implementation, the first foreground may be obtained by foreground cutout, or the first foreground may be obtained by manually processing the image using related software.

[0101] Step S630: determining a reference foreground frame according to the first foreground.

[0102] In this step, the reference foreground frame refers to the foreground frame that frames the first foreground. The reference foreground frame can be a reference foreground frame of the same shape as the reference image, such as a rectangle. The center of the reference foreground frame is the center position of the first foreground. The reference foreground frame is determined based on the first foreground to facilitate obtaining a reference image with a reference foreground frame in subsequent steps.

[0103] Step S640: obtaining a reference picture with a reference foreground frame according to the reference foreground frame.

[0104] In this step, the reference foreground frame refers to a frame that frames the first foreground. A reference image with a reference foreground frame is obtained based on the reference foreground frame. The reference foreground frame and the reference image may be merged to form a reference image with a reference foreground frame, so as to unify the style of the image based on the reference image with the reference foreground frame in subsequent steps.

[0105] In this embodiment, by adopting the method of unifying picture styles including the above steps S610 to S640, a reference picture is obtained, a first foreground of the reference picture is obtained according to the reference picture, a reference foreground frame is determined according to the first foreground, and a reference picture with a reference foreground frame is obtained according to the reference foreground frame. According to the scheme of the embodiment of the present invention, by adjusting the edge of the target picture, the position of the foreground in the target picture is set according to the position of the foreground in the reference picture, and the style of the picture is unified, thereby achieving the purpose of improving the effectiveness of picture display.

[0106] In one embodiment, if Figure 7 As shown, the steps before step S120 are further explained, and the method for unifying the picture style may also include but is not limited to step S710, step S720, step S730 and step S740.

[0107] Step S710: Acquire the target image.

[0108] In this step, the target image refers to the image whose foreground position needs to be adjusted, that is, the image to be processed. The target image is obtained to facilitate obtaining the target image with the target foreground frame in the subsequent steps.

[0109] It can be understood that the foreground may be any type of foreground in the related art, such as a person, merchandise for exhibition, etc., and is not specifically limited here.

[0110] Step S720: obtaining a second foreground of the target image according to the target image.

[0111] In this step, the second foreground may be any type of foreground in the related art, such as a person, a commodity for exhibition, etc., which is not specifically limited here. The second foreground of the target image is obtained according to the target image, and the second foreground may be obtained by any means in the related art. In an optional implementation, the second foreground may be obtained by foreground cutout, or the second foreground may be obtained by manually processing the image using related software.

[0112] Step S730: determining a target foreground frame according to the second foreground.

[0113] In this step, the target foreground frame refers to the foreground frame that frames the second foreground. The target foreground frame can be a target foreground frame with the same shape as the target image, such as a rectangle. The center of the target foreground frame is the center position of the second foreground. The target foreground frame is determined based on the second foreground to facilitate obtaining the target image with the target foreground frame in the subsequent steps.

[0114] Step S740: obtaining a target image with a target foreground frame according to the target foreground frame.

[0115] In this step, the target foreground frame refers to a frame that frames the second foreground. A target image with the target foreground frame is obtained based on the target foreground frame. The target foreground frame and the target image may be merged to form a target image with the target foreground frame, so as to facilitate processing of the target image with the target foreground frame in subsequent steps.

[0116] In this embodiment, by adopting the method of unifying the picture style including the above steps S710 to S740, a target picture is obtained, a second foreground of the target picture is obtained according to the target picture, a target foreground frame is determined according to the second foreground, and a target picture with a target foreground frame is obtained according to the target foreground frame. According to the scheme of the embodiment of the present invention, by adjusting the edge of the target picture, the position of the foreground in the target picture is set according to the position of the foreground in the target picture, and the style of the picture is unified, so as to achieve the purpose of improving the effectiveness of picture display.

[0117] In addition, if Figure 8As shown, an embodiment of the present invention further provides a data processing device, which includes: a memory 820, a processor 810, and a computer program stored in the memory 820 and executable on the processor 810.

[0118] The processor 810 and the memory 820 may be connected via a bus or other means.

[0119] The memory 820, as a non-transitory computer-readable storage medium, can be used to store non-transitory software programs and non-transitory computer executable programs. In addition, the memory 820 may include a high-speed random access memory 820, and may also include a non-transitory memory, such as at least one disk storage device, a flash memory device, or other non-transitory solid-state storage device. In some embodiments, the memory 820 optionally includes a memory 820 remotely arranged relative to the processor 810, and these remote memories can be connected to the processor 810 via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0120] The non-transient software program and instructions required to implement the data processing method of the above embodiment are stored in the memory 820. When executed by the processor 810, the method of unifying the picture style in the above embodiment is executed, for example, the above described method is executed. Figure 1 Steps S110 to S190 of the method, Figure 2 At least one of the two scenarios, Figure 3 Step S310 of the method, Figure 4 In the method step S410, Figure 5 At least one of the two scenarios, Figure 6 Steps S610 to S640 of the method, Figure 7 Method steps S710 to S740 in.

[0121] In addition, an embodiment of the present invention further provides a computer-readable storage medium, which stores computer-executable instructions. The computer-executable instructions are executed by a processor 810 or a controller, for example, by a processor 810 in the above-mentioned device embodiment, so that the above-mentioned processor 810 can execute the method of unifying the picture style in the above-mentioned embodiment, for example, executing the above-mentioned Figure 1 Steps S110 to S190 of the method, Figure 2 At least one of the two scenarios, Figure 3 Step S310 of the method, Figure 4 In the method step S410, Figure 5 At least one of the two scenarios, Figure 6 Steps S610 to S640 of the method, Figure 7Method steps S710 to S740 in.

[0122] It will be appreciated by those skilled in the art that all or some of the steps and systems in the disclosed method above may be implemented as software, firmware, hardware and appropriate combinations thereof. Some physical components or all physical components may be implemented as software executed by a processor, such as a central processing unit, a digital signal processor or a microprocessor, or may be implemented as hardware, or may be implemented as an integrated circuit, such as an application specific integrated circuit. Such software may be distributed on a computer-readable medium, which may include a computer storage medium (or a non-transitory medium) and a communication medium (or a temporary medium). As known to those skilled in the art, the term computer storage medium includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information (such as computer-readable instructions, data structures, program modules or other data). Computer storage media include, but are not limited to, RAM, ROM, EEPROM, flash memory or other memory technologies, CD-ROM, digital versatile disks (DVD) or other optical disk storage, magnetic cassettes, magnetic tapes, disk storage or other magnetic storage devices, or any other medium that may be used to store desired information and may be accessed by a computer. Furthermore, it is well known to those skilled in the art that communication media typically embodies computer readable instructions, data structures, program modules, or other data in a modulated data signal such as a carrier wave or other transport mechanism, and may include any information delivery media.

[0123] The above is a specific description of the preferred implementation of the present invention, but the present invention is not limited to the above-mentioned implementation mode. Technical personnel familiar with the field can also make various equivalent deformations or substitutions without violating the spirit of the present invention. These equivalent deformations or substitutions are all included in the scope defined by the claims of the present invention.

Claims

1. A method for unifying picture styles, characterized in that: include: Get a reference image with a reference foreground frame; Get the target image with the target foreground frame; Obtaining a first distance between a first edge of the reference foreground frame and a second edge of the reference picture; Acquire a third distance between a third edge of the target foreground frame and a fourth edge of the target image before scale adjustment; Acquire the length of the fifth edge of the reference foreground frame, and acquire the length of the sixth edge of the target foreground frame; Obtaining a first ratio value according to the length of the fifth edge and the first distance; Obtaining a second ratio value according to the length of the sixth edge and the third distance; Determining a second distance between a third edge of the target foreground frame after the scale adjustment and a fourth edge of the target image according to the first ratio value and the second ratio value, wherein the first edge, the second edge, the third edge and the fourth edge are all located on the same side, the fifth edge intersects with the first edge, and the sixth edge intersects with the third edge; The scale-adjusted target image is obtained according to the second distance.

2. The method for unifying picture styles according to claim 1, characterized in that: The determining the second distance according to the first ratio value and the second ratio value includes at least one of the following scenarios: When the first ratio value is not equal to the second ratio value, determining that the second distance is equal to the first ratio value multiplied by the length value of the sixth edge; When the first ratio value is equal to the second ratio value, it is determined that the second distance is equal to the third distance.

3. The method for unifying picture styles according to claim 1, characterized in that: The determining the second distance according to the first ratio value and the second ratio value further includes: When the difference between the first ratio value and the second ratio value is less than a preset error value, it is determined that the second distance is equal to the third distance.

4. The method for unifying picture styles according to claim 1, characterized in that: The determining the second distance according to the first ratio value and the second ratio value further includes: When the third distance is less than a preset distance threshold, it is determined that the second distance is equal to the third distance.

5. The method for unifying picture styles according to claim 1, characterized in that: The step of obtaining the scale-adjusted target image according to the second distance includes at least one of the following scenarios: When the third distance is not equal to the second distance, resizing the target image according to the second distance to obtain the resizing target image; When the third distance is equal to the second distance, it is determined that the third distance of the target image remains unchanged.

6. The method for unifying picture styles according to claim 1, characterized in that: Before obtaining the reference picture with the reference foreground frame, the following steps are included: Get reference images; Obtaining a first foreground of a reference picture according to the reference picture; determining a reference foreground frame according to the first foreground; A reference picture with a reference foreground frame is obtained according to the reference foreground frame.

7. The method for unifying picture styles according to claim 1, characterized in that: Before obtaining the target image with the target foreground frame, the following steps are included: Get the target image; Obtaining a second foreground of the target image according to the target image; determining a target foreground frame according to the second foreground; A target image with a target foreground frame is obtained according to the target foreground frame.

8. A data processing device, comprising: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the method for unifying picture styles as described in any one of claims 1 to 7 when executing the computer program.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, and the computer-executable instructions are used to enable a computer to execute the method for unifying picture styles as described in any one of claims 1 to 7.

Citation Information

Patent Citations

  • Graph frame generation method and device, storage medium and electronic device

    CN109766530A

  • Picture adjusting method and device, equipment and storage medium

    CN112784543A