Image processing method and device

By conducting linear detection of the target boundaries in the scene image and generating transformed areas, we realize the automatic replacement of the targets in the scene image, solving the problem of time-consuming and labor-consuming manual labeling, and meeting the personalized needs of users.

CN113763439BActive Publication Date: 2025-03-18BEIJING WODONG TIANJUN INFORMATION TECH CO LTD +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202110175113.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-02-07
Publication Date
2025-03-18
Estimated Expiration
2041-02-07

AI Technical Summary

Technical Problem

In the prior art, the replacement of the target in the scene image by manual labeling is huge, time-consuming and labor cost, and cannot meet the personalized needs of users.

Method used

An image processing method is provided, by performing linear detection of the target boundary in the scene image, generating a minimum external rectangle and a transformed area, converting a preset image into the transformed area, generating a transformed image and overwriting the target to update the scene image.

Benefits of technology

It realizes the automatic replacement of the target in the scene image with a sample image, reducing labor costs and time, and meeting the personalized needs of users.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113763439B_ABST
    Figure CN113763439B_ABST
Patent Text Reader

Abstract

The present disclosure provides an image processing method and device. The image processing method includes: performing straight line detection on the boundary of a target in a scene image to obtain multiple candidate straight lines; among the multiple candidate straight lines, taking the candidate straight line with the largest number of overlapping pixels with the boundary as the first reference straight line; generating a minimum circumscribed rectangle of the target in the scene image; generating a transformation area, wherein the four vertices of the minimum circumscribed rectangle are located on the four sides of the transformation area, the slopes of the first side and the corresponding second side of the transformation area are associated with the slopes of the first reference straight line, and the slopes of the third side and the corresponding fourth side of the transformation area are associated with the slopes of the external angle bisectors of the first side and the second side; transforming a preset image into the transformation area to generate a transformation image; and covering the target with the transformation image to update the scene image.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of information processing, and in particular to an image processing method and device. Background Art

[0002] At present, image display has been widely used as a means of promotion. For example, by displaying items such as floors and carpets in different decoration scenes, the user experience can be effectively improved. Summary of the invention

[0003] The inventors have noticed that in the related art, objects such as the floor in the scene image are replaced by manual annotation, which is labor-intensive, time-consuming and labor-intensive, and cannot meet the personalized needs of users.

[0004] Accordingly, the present disclosure provides an image processing solution that can directly replace the target of a scene image with a sample image, thereby effectively meeting the personalized needs of users.

[0005] According to a first aspect of an embodiment of the present disclosure, there is provided an image processing method, comprising: performing straight line detection on a target boundary in a scene image to obtain a plurality of candidate straight lines; among the plurality of candidate straight lines, taking the candidate straight line with the largest number of overlapping pixels with the boundary as a first reference straight line; generating a minimum circumscribed rectangle of the target in the scene image; generating a transformation region, wherein four vertices of the minimum circumscribed rectangle are located on four sides of the transformation region, the slopes of a first side and a corresponding second side of the transformation region are associated with the slopes of the first reference straight line, and the slopes of a third side and a corresponding fourth side of the transformation region are associated with the slopes of the external angle bisectors of the first side and the second side; transforming a preset image into the transformation region to generate a transformed image; and covering the target with the transformed image so as to update the scene image.

[0006] In some embodiments, generating a transformation area includes: generating a first side line passing through a first vertex of the minimum circumscribed rectangle and a second side line passing through a second vertex of the minimum circumscribed rectangle, the angle where the first vertex is located and the angle where the second vertex is located are opposite angles, and the difference between the slopes of the first side line and the second side line and the slope of the first reference straight line is within a first preset range; generating a second reference straight line passing through a center point of the minimum circumscribed rectangle, wherein the slope of the second reference straight line is the slope of the outer angle bisector of the first side line and the second side line; generating a third side line passing through a third vertex of the minimum circumscribed rectangle and a fourth side line passing through a fourth vertex of the minimum circumscribed rectangle, the angle where the third vertex is located and the angle where the fourth vertex is located are opposite angles, and the difference between the slopes of the third side line and the fourth side line and the slope of the second reference straight line is within a second preset range; and generating a transformation area using the first side line, the second side line, the third side line, and the fourth side line.

[0007] In some embodiments, when the slope of the first reference straight line is less than 0, the slope of the first edge line is greater than the slope of the first reference straight line, and the slope of the second edge line is less than the slope of the first reference straight line.

[0008] In some embodiments, when the slope of the first reference straight line is greater than 0, the slope of the first sideline is smaller than the slope of the first reference straight line, and the slope of the second sideline is greater than the slope of the first reference straight line.

[0009] In some embodiments, the difference between the slope of the first edge line and the slope of the first reference line is the ratio of the distance from the first vertex to the first reference line and a first preset parameter; the difference between the slope of the second edge line and the slope of the first reference line is the ratio of the distance from the second vertex to the first reference line and a second preset parameter.

[0010] In some embodiments, when the slope of the second reference straight line is greater than 0, the slope of the third sideline is smaller than the slope of the second reference straight line, and the slope of the fourth sideline is greater than the slope of the second reference straight line.

[0011] In some embodiments, when the slope of the second reference straight line is less than 0, the slope of the third sideline is greater than the slope of the second reference straight line, and the slope of the fourth sideline is less than the slope of the second reference straight line.

[0012] In some embodiments, the difference between the slope of the third edge line and the slope of the second reference line is the ratio of the distance from the third vertex to the second reference line and a third preset parameter; the difference between the slope of the fourth edge line and the slope of the second reference line is the ratio of the distance from the fourth vertex to the second reference line and a fourth preset parameter.

[0013] In some embodiments, transforming a preset image mapping into the transformation area to generate a transformation image includes: generating a minimum bounding rectangle of the transformation area; repeatedly splicing the preset image in the minimum bounding rectangle of the transformation area to generate a sample image; and transforming the sample image into the transformation area through an affine transformation to generate a transformation image.

[0014] In some embodiments, after the target is covered with the transformed image, the portion of the transformed image that exceeds the scene image is deleted.

[0015] According to a second aspect of an embodiment of the present disclosure, there is provided an image processing device, comprising: a first processing module, configured to perform straight line detection on a target boundary in a scene image to obtain a plurality of candidate straight lines, wherein the candidate straight line having the largest number of overlapping pixels with the boundary is used as a first reference straight line; a second processing module, configured to generate a minimum circumscribed rectangle of the target in the scene image; a transformation region generation module, configured to generate a transformation region, wherein four vertices of the minimum circumscribed rectangle are located on four sides of the transformation region, the slopes of a first side and a corresponding second side of the transformation region are associated with the slope of the first reference straight line, and the slopes of a third side and a corresponding fourth side of the transformation region are associated with the slopes of the external angle bisectors of the first side and the second side; and an image processing module, configured to transform a preset image into the transformation region to generate a transformation image, and cover the target with the transformation image so as to update the scene image.

[0016] According to a third aspect of an embodiment of the present disclosure, there is provided an image processing device, comprising: a memory configured to store instructions; a processor coupled to the memory, the processor being configured to execute a method as described in any of the above embodiments based on the instructions stored in the memory.

[0017] According to a fourth aspect of an embodiment of the present disclosure, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer instructions, and when the instructions are executed by a processor, the method involved in any of the above embodiments is implemented.

[0018] Other features and advantages of the present disclosure will become apparent from the following detailed description of exemplary embodiments of the present disclosure with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] In order to more clearly illustrate the embodiments of the present disclosure or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present disclosure. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.

[0020] Figure 1 A schematic diagram of a flow chart of an image processing method according to an embodiment of the present disclosure;

[0021] Figure 2A-2C A schematic diagram of target boundary extraction in some embodiments of the present disclosure;

[0022] Figure 3 A schematic diagram of a minimum bounding rectangle of a target according to an embodiment of the present disclosure;

[0023] Figure 4 A flowchart of an image processing method according to another embodiment of the present disclosure;

[0024] Figure 5-Figure 8 A schematic diagram for generating a transformation region edge line for some embodiments of the present disclosure;

[0025] Fig. 9 A schematic diagram of a transformation area according to an embodiment of the present disclosure;

[0026] Figure 10A-10C A schematic diagram of image transformation in some embodiments of the present disclosure;

[0027] Figure 11A-11B A schematic diagram is presented for the purpose of some embodiments of the present disclosure;

[0028] Fig.12 A schematic diagram of the structure of an image processing device according to an embodiment of the present disclosure;

[0029] Fig.13 The figure is a schematic diagram of the structure of an image processing device according to another embodiment of the present disclosure. DETAILED DESCRIPTION

[0030] The following will be combined with the drawings in the embodiments of the present disclosure to clearly and completely describe the technical solutions in the embodiments of the present disclosure. Obviously, the described embodiments are only part of the embodiments of the present disclosure, rather than all of the embodiments. The following description of at least one exemplary embodiment is actually only illustrative and is by no means intended to limit the present disclosure and its application or use. Based on the embodiments in the present disclosure, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present disclosure.

[0031] The relative arrangement of components and steps, the numerical expressions and numerical values ​​set forth in these embodiments do not limit the scope of the present disclosure unless specifically stated otherwise.

[0032] At the same time, it should be understood that for the convenience of description, the sizes of the various parts shown in the drawings are not drawn according to the actual proportional relationship.

[0033] Technologies, methods, and apparatus known to ordinary technicians in the relevant field may not be discussed in detail, but where appropriate, such technologies, methods, and apparatus should be considered part of the authorization specification.

[0034] In all examples shown and discussed herein, any specific values ​​should be interpreted as merely exemplary and not as limiting. Therefore, other examples of the exemplary embodiments may have different values.

[0035] It should be noted that like reference numerals and letters refer to similar items in the following figures, and therefore, once an item is defined in one figure, it need not be further discussed in subsequent figures.

[0036] Figure 1 The following is a flow chart of an image processing method according to an embodiment of the present disclosure. In some embodiments, the following steps of the image processing method are performed by an image processing device.

[0037] In step 101, straight line detection is performed on the boundary of an object in a scene image to obtain a plurality of candidate straight lines.

[0038] For example, in order to Figure 2A The floor area in the image shown in the figure is processed. First, the floor area in the scene image is extracted using the foreground mask of the floor area, and the pixel values ​​of the non-floor area are set to 0, as shown in Figure 2B Next, the Canny operator is used to extract the boundary of the floor area, as shown in Figure 2C shown.

[0039] Then, Hough line detection is performed on the extracted boundaries to obtain multiple candidate lines.

[0040] In step 102 , among a plurality of candidate straight lines, a candidate straight line having the largest number of overlapping pixels with the boundary is used as a first reference straight line.

[0041] In step 103, a minimum bounding rectangle of the object is generated in the scene image.

[0042] For example, in Figure 2A In the image shown in , the minimum bounding rectangle of the floor is Figure 3 As shown in the black box in .

[0043] In step 104, a transformation region is generated.

[0044] It should be noted here that the four vertices of the minimum circumscribed rectangle are located on the four sides of the transformation area, the slopes of the first side line and the relative second side line of the transformation area are associated with the slope of the first reference straight line, and the slopes of the third side line and the relative fourth side line of the transformation area are associated with the slopes of the exterior angle bisectors of the first side line and the second side line.

[0045] Figure 4 FIG. 1 is a flow chart of an image processing method according to another embodiment of the present disclosure. This embodiment describes the steps of generating a transformation region. In some embodiments, the following steps of the image processing method are performed by an image processing device.

[0046] In step 401, a first sideline passing through a first vertex of a minimum circumscribed rectangle and a second sideline passing through a second vertex of the minimum circumscribed rectangle are generated, the angle where the first vertex is located and the angle where the second vertex is located are opposite angles, and the difference between the slopes of the first sideline and the second sideline and the slope of the first reference straight line is within a first preset range.

[0047] In some embodiments, when the slope of the first reference straight line is less than 0, the slope of the first sideline is greater than the slope of the first reference straight line, and the slope of the second sideline is less than the slope of the first reference straight line.

[0048] In some embodiments, Figure 5 As shown, rectangle ABCD is the generated minimum circumscribed rectangle, straight line L00 is the first reference straight line, and the slope k* of straight line L00 is <0. Considering the visual effect, the slopes of the first side line L1 passing through vertex A and the second side line L2 passing through vertex D will not be completely consistent with the slope of straight line L00, but will have a certain deviation. For example, Figure 5 As shown, the slope of the first sideline L1 is greater than the slope of the straight line L00, and the slope of the second sideline L2 is less than the slope of the straight line L00.

[0049] For example, Figure 5 As shown, the distance from vertex A to straight line L00 is d1, and the distance from vertex D to straight line L00 is d2. Then the slope k1 of the first side line L1 is as shown in formula (1), and the slope k2 of the second side line L2 is as shown in formula (2), where parameters N1 and N2 are preset parameters.

[0050] k1=k* + d1 / N1 (1)

[0051] k2=k* - d2 / N2 (2)

[0052] In some embodiments, Figure 6As shown, the slope k* of the first reference straight line L00 is greater than 0. Considering the visual effect, the slopes of the first side line L1 passing through vertex B and the second side line L2 passing through vertex C will not be completely consistent with the slope of the straight line L00, but will have a certain deviation. Figure 6 As shown, the slope of the first side line L1 is smaller than the slope of the straight line L00, and the slope of the second side line L2 is larger than the slope of the straight line L00.

[0053] For example, Figure 6 As shown, the distance from vertex B to straight line L00 is d3, and the distance from vertex C to straight line L00 is d4. Then the slope k1 of the first side line L1 is as shown in formula (3), and the slope k2 of the second side line L2 is as shown in formula (4), where parameters N1 and N2 are preset parameters.

[0054] k1=k* - d3 / N1 (3)

[0055] k2=k* + d4 / N2 (4)

[0056] In step 402, a second reference straight line passing through the center point of the minimum circumscribed rectangle is generated, wherein the slope of the second reference straight line is the slope of the outer angle bisector of the first sideline and the second sideline.

[0057] In step 403, a third sideline passing through the third vertex of the minimum circumscribed rectangle and a fourth sideline passing through the fourth vertex of the minimum circumscribed rectangle are generated, the angle where the third vertex is located and the angle where the fourth vertex is located are opposite angles, and the difference between the slopes of the third sideline and the fourth sideline and the slope of the second reference straight line is within a second preset range.

[0058] In some embodiments, when the slope of the second reference straight line is greater than 0, the slope of the third sideline is smaller than the slope of the second reference straight line, and the slope of the fourth sideline is greater than the slope of the second reference straight line.

[0059] In some embodiments, Figure 7 As shown, the second reference straight line L01 passes through the center point O of the rectangle ABCD, and the slope k** of the second reference straight line L01 is greater than 0. Considering the visual effect, the slopes of the third side line L3 passing through the vertex B and the fourth side line L4 passing through the vertex C will not be completely consistent with the slope of the straight line L01, but will have a certain deviation. For example, Figure 7 As shown, the slope of the third side line L3 is smaller than the slope of the straight line L01, and the slope of the fourth side line L4 is larger than the slope of the straight line L01.

[0060] For example, Figure 7As shown, the distance from vertex B to straight line L01 and the distance from vertex C to straight line L01 are both d5, then the slope k3 of the third side line L3 is as shown in formula (5), and the slope k4 of the fourth side line L4 is as shown in formula (6), where parameters N3 and N4 are preset parameters.

[0061] k3=k** - d5 / N3 (5)

[0062] k4=k** + d5 / N4 (6)

[0063] In some embodiments, when the slope of the second reference straight line is less than 0, the slope of the third sideline is greater than the slope of the second reference straight line, and the slope of the fourth sideline is less than the slope of the second reference straight line.

[0064] In some embodiments, Figure 8 As shown, the second reference straight line L01 passes through the center point O of the rectangle ABCD, and the slope k** of the second reference straight line L01 is less than 0. Considering the visual effect, the slopes of the third side line L3 passing through the vertex A and the fourth side line L4 passing through the vertex D will not be completely consistent with the slope of the straight line L01, but will have a certain deviation. For example, Figure 8 As shown, the slope of the third side line L3 is greater than the slope of the straight line L01, and the slope of the fourth side line L4 is less than the slope of the straight line L01.

[0065] For example, Figure 8 As shown, the distance from vertex A to straight line L01 and the distance from vertex D to straight line L01 are both d6, then the slope k3 of the third side line L3 is as shown in formula (7), and the slope k4 of the fourth side line L4 is as shown in formula (8), where parameters N3 and N4 are preset parameters.

[0066] k3=k** + d6 / N3 (7)

[0067] k4=k** - d6 / N4 (8)

[0068] In step 404, a transformation region is generated using the first edge line, the second edge line, the third edge line, and the fourth edge line.

[0069] For example, in Figure 8 Based on this, the obtained transformation area is as follows Fig. 9 As shown in the white box in the figure.

[0070] return Figure 1 In step 105, the preset image is transformed into the transformation area to generate a transformed image.

[0071] In some embodiments, by generating a minimum bounding rectangle of a transformation area, the preset image is repeatedly spliced ​​in the minimum bounding rectangle of the transformation area to generate a sample image, and the sample image is transformed into the transformation area through affine transformation to generate a transformed image.

[0072] For example, the preset floor pattern is Fig. 10A As shown. The sample image is generated by repeatedly splicing the preset floor sample image in the minimum bounding rectangle of the transformation area, as shown in Fig. 10B Next, the sample image is transformed into the transformation region by affine transformation to generate a transformed image, as shown in Fig. 10C shown.

[0073] At step 106, the object is overlaid with the transformed image so as to update the scene image.

[0074] In some embodiments, after the target is covered with the transformed image, the portion of the transformed image that exceeds the scene image is deleted.

[0075] For example, Fig.11A The original scene image is overlaid with the transformed image by the solution described in the above embodiment, thereby changing the floor pattern in the original scene image, such as Fig. 11B shown.

[0076] In the image processing device provided by the above-mentioned embodiment of the present disclosure, the target of the scene image can be directly replaced with a sample image, thereby effectively meeting the personalized needs of users.

[0077] Fig.12 FIG. 1 is a schematic diagram of the structure of an image processing device according to an embodiment of the present disclosure. Fig.12 As shown, the image processing apparatus includes a first processing module 1201 , a second processing module 1202 , a transformation region generating module 1203 and an image processing module 1204 .

[0078] The first processing module 1201 is configured to perform straight line detection on the target boundary in the scene image to obtain multiple candidate straight lines, and among the multiple candidate straight lines, the candidate straight line with the largest number of overlapping pixels with the boundary is used as the first reference straight line.

[0079] For example, in order to Figure 2A The floor area in the image shown in the figure is processed. First, the floor area in the scene image is extracted using the foreground mask of the floor area, and the pixel values ​​of the non-floor area are set to 0, as shown in Figure 2B Next, the Canny operator is used to extract the boundary of the floor area, as shown in Figure 2C Then, Hough line detection is performed on the extracted boundary to obtain multiple candidate lines.

[0080] The second processing module 1202 is configured to generate a minimum bounding rectangle of the object in the scene image.

[0081] For example, in Figure 2A In the image shown in , the minimum bounding rectangle of the floor is Figure 3 As shown in the black box in .

[0082] The transformation area generation module 1203 is configured to generate a transformation area, wherein the four vertices of the minimum circumscribed rectangle are located on the four sides of the transformation area, the slopes of the first side line and the relative second side line of the transformation area are associated with the slope of the first reference straight line, and the slopes of the third side line and the relative fourth side line of the transformation area are associated with the slopes of the external angle bisectors of the first side line and the second side line.

[0083] In some embodiments, the transformation area generation module 1203 generates a first side line passing through the first vertex of the minimum circumscribed rectangle and a second side line passing through the second vertex of the minimum circumscribed rectangle, the angle where the first vertex is located and the angle where the second vertex is located are opposite angles, and the difference between the slopes of the first side line and the second side line and the slope of the first reference straight line is within a first preset range.

[0084] In some embodiments, when the slope of the first reference straight line is less than 0, the slope of the first sideline is greater than the slope of the first reference straight line, and the slope of the second sideline is less than the slope of the first reference straight line. For example, the slope of the first sideline can be calculated using the above formula (1), and the slope of the second sideline can be calculated using the above formula (2).

[0085] In some embodiments, when the slope of the first reference straight line is greater than 0, the slope of the first sideline is less than the slope of the first reference straight line, and the slope of the second sideline is greater than the slope of the first reference straight line. For example, the slope of the first sideline can be calculated using the above formula (3), and the slope of the second sideline can be calculated using the above formula (4).

[0086] Next, the transformation region generating module 1203 generates a second reference straight line passing through the center point of the minimum circumscribed rectangle, wherein the slope of the second reference straight line is the slope of the outer angle bisector of the first sideline and the second sideline.

[0087] Next, the transformation area generation module 1203 generates a third sideline passing through the third vertex of the minimum circumscribed rectangle and a fourth sideline passing through the fourth vertex of the minimum circumscribed rectangle, the angle where the third vertex is located and the angle where the fourth vertex is located are opposite angles, and the difference between the slopes of the third sideline and the fourth sideline and the slope of the second reference straight line is within a second preset range.

[0088] In some embodiments, when the slope of the second reference straight line is greater than 0, the slope of the third sideline is less than the slope of the second reference straight line, and the slope of the fourth sideline is greater than the slope of the second reference straight line. For example, the slope of the third sideline can be calculated using the above formula (5), and the slope of the fourth sideline can be calculated using the above formula (6).

[0089] In some embodiments, when the slope of the second reference straight line is less than 0, the slope of the third sideline is greater than the slope of the second reference straight line, and the slope of the fourth sideline is less than the slope of the second reference straight line. For example, the slope of the third sideline can be calculated using the above formula (7), and the slope of the fourth sideline can be calculated using the above formula (8).

[0090] Then, the transformation region generating module 1203 generates a transformation region using the first sideline, the second sideline, the third sideline and the fourth sideline. Figure 8 Based on this, the obtained transformation area is as follows Fig. 9 As shown in the white box in the figure.

[0091] The image processing module 1204 is configured to transform the preset image into the transformation area to generate a transformation image, and cover the target with the transformation image to update the scene image.

[0092] In some embodiments, the image processing module 1204 generates a minimum bounding rectangle of a transformation area, repeatedly splices a preset image in the minimum bounding rectangle of the transformation area to generate a sample image, and transforms the sample image into the transformation area through an affine transformation to generate a transformed image.

[0093] Fig.13 FIG. 1 is a schematic diagram of the structure of an image processing device according to another embodiment of the present disclosure. Fig.13 As shown, the image processing apparatus includes a memory 1301 and a processor 1302 .

[0094] The memory 1301 is used to store instructions. The processor 1302 is coupled to the memory 1301. The processor 1302 is configured to execute the instructions stored in the memory to implement the following. Figure 1 or Figure 4 The method of any one of the embodiments.

[0095] like Fig.13 As shown, the image processing device further includes a communication interface 1303 for information exchange with other devices. At the same time, the image processing device further includes a bus 1304, through which the processor 1302, the communication interface 1303, and the memory 1301 communicate with each other.

[0096] The memory 1301 may include a high-speed RAM memory, and may also include a non-volatile memory, such as at least one disk memory. The memory 1301 may also be a memory array. The memory 1301 may also be divided into blocks, and the blocks may be combined into virtual volumes according to certain rules.

[0097] In addition, the processor 1302 may be a central processing unit (CPU), or may be an application specific integrated circuit (ASIC), or may be configured to implement one or more integrated circuits of the embodiments of the present disclosure.

[0098] The present disclosure also relates to a computer-readable storage medium, wherein the computer-readable storage medium stores computer instructions, and when the instructions are executed by a processor, the following are implemented: Figure 1 or Figure 4 The method of any one of the embodiments.

[0099] In some embodiments, the functional unit module described above can be implemented as a general-purpose processor, a programmable logic controller (PLC), a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components or any appropriate combination thereof for performing the functions described in the present disclosure.

[0100] A person skilled in the art will understand that all or part of the steps to implement the above embodiments may be accomplished by hardware or by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a disk or an optical disk, etc.

[0101] The description of the present disclosure is given for the purpose of illustration and description, and is not intended to be exhaustive or to limit the present disclosure to the disclosed form. Many modifications and variations will be apparent to those of ordinary skill in the art. The embodiments are selected and described in order to better illustrate the principles and practical applications of the present disclosure, and to enable those of ordinary skill in the art to understand the present disclosure and thereby design various embodiments with various modifications suitable for specific uses.

Claims

1. An image processing method, comprising: Perform straight line detection on the target boundary in the scene image to obtain multiple candidate straight lines; Among the plurality of candidate straight lines, the candidate straight line having the largest number of overlapping pixels with the boundary is used as a first reference straight line; Generating a minimum bounding rectangle of the target in the scene image; Generate a transformation region, wherein four vertices of the minimum circumscribed rectangle are located on four sides of the transformation region, the slopes of a first sideline and an opposite second sideline of the transformation region are associated with the slope of the first reference straight line, and the slopes of a third sideline and an opposite fourth sideline of the transformation region are associated with the slopes of the external angle bisectors of the first sideline and the second sideline; Transforming the preset image into the transformation area to generate a transformed image; Overlaying the target with the transformed image to update the scene image; Among them, generating the transformation area includes: Generate a first sideline passing through a first vertex of the minimum circumscribed rectangle and a second sideline passing through a second vertex of the minimum circumscribed rectangle, wherein the angle where the first vertex is located and the angle where the second vertex is located are opposite angles, and the difference between the slopes of the first sideline and the second sideline and the slope of the first reference straight line is within a first preset range; Generate a second reference straight line passing through the center point of the minimum circumscribed rectangle, wherein the slope of the second reference straight line is the slope of the exterior angle bisector of the first sideline and the second sideline; Generate a third sideline passing through a third vertex of the minimum circumscribed rectangle and a fourth sideline passing through a fourth vertex of the minimum circumscribed rectangle, wherein the angle where the third vertex is located and the angle where the fourth vertex is located are opposite angles, and the difference between the slopes of the third sideline and the fourth sideline and the slope of the second reference straight line is within a second preset range; A transformation region is generated using the first sideline, the second sideline, the third sideline and the fourth sideline.

2. The method according to claim 1, wherein: When the slope of the first reference straight line is less than 0, the slope of the first sideline is greater than the slope of the first reference straight line, and the slope of the second sideline is less than the slope of the first reference straight line.

3. The method according to claim 2, wherein: When the slope of the first reference straight line is greater than 0, the slope of the first sideline is smaller than the slope of the first reference straight line, and the slope of the second sideline is larger than the slope of the first reference straight line.

4. The method according to claim 3, wherein: The difference between the slope of the first edge line and the slope of the first reference straight line is the ratio of the distance from the first vertex to the first reference straight line to a first preset parameter; The difference between the slope of the second edge line and the slope of the first reference straight line is the ratio of the distance from the second vertex to the first reference straight line and a second preset parameter.

5. The method according to claim 4, wherein: When the slope of the second reference straight line is greater than 0, the slope of the third sideline is smaller than the slope of the second reference straight line, and the slope of the fourth sideline is larger than the slope of the second reference straight line.

6. The method according to claim 5, wherein: When the slope of the second reference straight line is less than 0, the slope of the third sideline is greater than the slope of the second reference straight line, and the slope of the fourth sideline is less than the slope of the second reference straight line.

7. The method according to claim 6, wherein: The difference between the slope of the third edge line and the slope of the second reference straight line is the ratio of the distance from the third vertex to the second reference straight line to a third preset parameter; The difference between the slope of the fourth edge line and the slope of the second reference straight line is the ratio of the distance from the fourth vertex to the second reference straight line and a fourth preset parameter.

8. The method according to claim 1, wherein: Mapping and transforming the preset image into the transformation area to generate a transformed image includes: Generate a minimum bounding rectangle of the transformation area; Repeatedly splicing the preset images in the minimum circumscribed rectangle of the transformation area to generate a sample image; The sample image is transformed into the transformation area by affine transformation to generate a transformation image.

9. The method according to any one of claims 1 to 8, further comprising: After the target is covered by the transformed image, the portion of the transformed image that exceeds the scene image is deleted.

10. An image processing device, comprising: A first processing module is configured to perform straight line detection on a target boundary in a scene image to obtain a plurality of candidate straight lines, wherein a candidate straight line having the largest number of overlapping pixels with the boundary is used as a first reference straight line among the plurality of candidate straight lines; A second processing module is configured to generate a minimum bounding rectangle of the target in the scene image; A transformation region generating module is configured to generate a transformation region, wherein four vertices of the minimum circumscribed rectangle are located on four sides of the transformation region, the slopes of a first sideline of the transformation region and an opposite second sideline are associated with the slope of the first reference straight line, the slopes of a third sideline of the transformation region and an opposite fourth sideline are associated with the slopes of the outer angle bisectors of the first sideline and the second sideline, wherein a first sideline passing through a first vertex of the minimum circumscribed rectangle and a second sideline passing through a second vertex of the minimum circumscribed rectangle are generated, the angle where the first vertex is located and the angle where the second vertex is located are opposite angles, and the first sideline and the second sideline are opposite angles. The difference between the slope and the slope of the first reference straight line is within a first preset range, a second reference straight line passing through the center point of the minimum circumscribed rectangle is generated, wherein the slope of the second reference straight line is the slope of the outer angle bisector of the first sideline and the second sideline, a third sideline passing through the third vertex of the minimum circumscribed rectangle and a fourth sideline passing through the fourth vertex of the minimum circumscribed rectangle are generated, the angle where the third vertex is located and the angle where the fourth vertex is located are opposite angles, the difference between the slopes of the third sideline and the fourth sideline and the slope of the second reference straight line is within a second preset range, and the transformation area is generated using the first sideline, the second sideline, the third sideline and the fourth sideline; The image processing module is configured to transform the preset image into the transformation area to generate a transformation image, and use the transformation image to cover the target so as to update the scene image.

11. An image processing device, comprising: a memory configured to store instructions; A processor is coupled to the memory, and the processor is configured to execute the method according to any one of claims 1 to 9 based on instructions stored in the memory.

12. A computer-readable storage medium, wherein: The computer-readable storage medium stores computer instructions, and when the instructions are executed by a processor, the method according to any one of claims 1 to 9 is implemented.

Citation Information

Patent Citations

  • Image processing apparatus, image processing method, and computer program

    CN102098476A

  • Image processing apparatus, image processing system, and non-transitory computer readable medium

    US20180137654A1