Image processing method, device, equipment and medium
The image processing method addresses the limitation of flat images by using main subject recognition and polygonal region fusion to achieve three-dimensional display, enhancing user experience.
Patent Information
- Application Number
- JP2024574664
- Authority / Receiving Office
- JP · JP
- Patent Type
- Patents
- Current Assignee / Owner
- Priority Date
- 2022-09-28
- Filing Date
- 2023-09-22
- Publication Date
- 2026-01-15
- Estimated Expiration
- 2043-09-22
AI Technical Summary
Conventional image editing software produces flat images and videos that cannot meet users' requirements for three-dimensional display, resulting in a poor user experience.
An image processing method that involves main subject recognition, generation of a target polygonal region, and fusion with additional image material to create a fused image with a three-dimensional effect, using image segmentation and polygonal region adjustment techniques.
Enhances the display of images with a three-dimensional effect, improving user experience by creating stereoscopic images and videos.
Smart Images

Figure 0007799865000038 
Figure 0007799865000039 
Figure 0007799865000040
Abstract
Description
[Technical Field]
[0001] [CROSS-REFERENCE TO RELATED APPLICATIONS] This application claims priority to Chinese Patent Application No. 202211193567.6, filed on September 28, 2022, the entire contents of which are incorporated herein by reference.
[0002] The present disclosure relates to an image processing method, apparatus, device, and medium. [Background technology]
[0003] As users' requirements for the exhibition (display, presentation) of pictures or videos become increasingly higher, many users wish to be able to display some or all of the image content displayed in the pictures or videos in a three-dimensional manner. However, the pictures or videos obtained by editing the image or video content using conventional image editing software or video editing software are all flat pictures or videos, which cannot meet users' requirements for the three-dimensional display of pictures or videos, resulting in a poor user experience. Summary of the Invention [Means for solving the problem]
[0004] To solve the above technical problems, the present disclosure provides an image processing method, apparatus, device, and medium.
[0005] In a first aspect, the present disclosure provides a method for manufacturing a semiconductor device comprising: obtaining an image to be processed; performing main subject recognition on the image to be processed to obtain an image main subject object; generating a target polygonal region corresponding to an image subject object, a portion of the image subject object being located within the target polygonal region and a remaining portion of the image subject object being located outside the target polygonal region; and fusing the image to be processed with additional image material according to a target polygonal region to obtain a fused image, wherein the fused image is consistent with image content in a first image region of the image to be processed, and image content in a second image region of the fused image represents the additional image material, the first image region being a union of the target polygonal region and the image region occupied by the image main subject object, and the second image region being an image region other than the first image region.
[0006] In a second aspect, the present disclosure provides a method for manufacturing a semiconductor device comprising: an image acquisition module configured to acquire an image to be processed; a main subject recognition module configured to perform main subject recognition on the image to be processed to obtain an image main subject object; a region generation module configured to generate a target polygonal region corresponding to an image subject object, a portion of the image subject object being located within the target polygonal region and a remainder of the image subject object being located outside the target polygonal region; and an image fusion module configured to fuse an image to be processed with additional image material according to a target polygonal region to obtain a fused image, wherein the fused image corresponds to image content in a first image region of the image to be processed and image content in a second image region of the fused image represents the additional image material, the first image region being a merged region of the target polygonal region and an image region occupied by an image main subject object, and the second image region being an image region other than the first image region.
[0007] In a third aspect, the present disclosure provides a method for manufacturing a semiconductor device comprising: a processor; a memory for storing executable instructions; The processor provides an image processing device that is used to read the executable instructions from the memory and execute the executable instructions to implement the image processing method of the first aspect.
[0008] In a fourth aspect, the present disclosure provides a computer-readable medium having stored thereon a computer program that, when executed by a processor, causes the processor to implement the image processing method of the first aspect.
[0009] These and other features, advantages, and aspects of each embodiment of the present disclosure will become more apparent with reference to the following specific embodiments in conjunction with the drawings. Throughout the drawings, identical or similar reference numerals refer to identical or similar elements. It should be understood that the drawings are illustrative and that elements and components are not necessarily drawn to scale. [Brief explanation of the drawings]
[0010] [Figure 1] 1 is a flowchart of an image processing method according to an embodiment of the present disclosure. [Figure 2] FIG. 2 is a schematic diagram of an image to be processed according to an embodiment of the present disclosure. [Figure 3] FIG. 2 is a schematic diagram of a target polygon area according to an embodiment of the present disclosure. [Figure 4] FIG. 1 is a schematic diagram of a fusion image according to an embodiment of the present disclosure. [Figure 5] 1 is a schematic diagram of a mask image of a main subject object in an image according to an embodiment of the present disclosure. FIG. [Figure 6] FIG. 1 is a schematic diagram of a minimum bounding rectangle area according to an embodiment of the present disclosure. [Figure 7] 10 is a flowchart for obtaining a target polygon region according to an embodiment of the present disclosure. [Figure 8] 10 is another flowchart for obtaining a target polygon region according to an embodiment of the present disclosure. [Figure 9] 10 is yet another flowchart for obtaining a target polygon region according to an embodiment of the present disclosure. [Figure 10] FIG. 10 is a schematic diagram of a mask image of a target polygonal region according to an embodiment of the present disclosure. [Figure 11] FIG. 10 is a schematic diagram of a mask image of a first background image according to an embodiment of the present disclosure. [Figure 12]FIG. 10 is a schematic diagram of a second background image according to an embodiment of the present disclosure. [Figure 13] 1 is a structural schematic diagram of an image processing device according to an embodiment of the present disclosure. [Figure 14] 1 is a structural schematic diagram of an image processing device according to an embodiment of the present disclosure. DETAILED DESCRIPTION OF THE INVENTION
[0011] Hereinafter, embodiments of the present disclosure will be described in more detail with reference to the drawings. Although the drawings show some specific embodiments of the present disclosure, it should be understood that the present disclosure can be realized in various forms and should not be construed as being limited to the embodiments described herein, but rather these embodiments are provided to enable a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are for illustrative purposes only and are not intended to limit the scope of protection of the present disclosure.
[0012] It should be understood that the steps described in the method embodiments of the present disclosure may be performed in a different order and / or in parallel, and that the method embodiments may include additional steps and / or omit performing steps as shown, and the scope of the present disclosure is not limited in this respect.
[0013] As used herein, the term "comprises" and variations thereof are intended to be openly inclusive, i.e., "including but not limited to." The term "based on" means "based at least in part on." The term "in one embodiment" means "at least one embodiment," the term "in another embodiment" means "at least one other embodiment," and the term "in some embodiments" means "at least some embodiments." Relevant definitions of other terms are provided in the description below.
[0014] It should be noted that the concepts of "first," "second," etc. referred to in this disclosure are intended only to distinguish between different devices, modules, or units, and are not intended to limit the order or interdependence of the functions performed by these devices, modules, or units.
[0015] It should be understood that the modifications "one" and "multiple" referred to in this disclosure are exemplary and not limiting, and that one of ordinary skill in the art should understand "one or more" unless the context clearly dictates otherwise.
[0016] The names of messages or information exchanged between devices in embodiments of the present disclosure are for illustrative purposes only and are not intended to limit the scope of these messages or information.
[0017] Most users edit pictures or videos using image editing software or video editing software, but the images or videos edited by the image editing software or video editing software are flat images or videos and cannot meet the users' requirements for three-dimensional display of images or videos.
[0018] Take adding a photo frame to a picture as an example. When a user uses image editing software to add a photo frame to a picture, the photo frame that is added is a flat photo frame, and the picture with the photo frame lacks a three-dimensional feel, resulting in a poor user experience.
[0019] There are several methods for generating stereoscopic pictures that can be fitted with stereoscopic photo frames. However, conventional methods for generating stereoscopic images require the use of depth estimation algorithms and three-dimensional (3D) image affine transformation algorithms. However, these algorithms have relatively high computational complexity and their effectiveness depends on the accuracy of the depth estimation algorithm. An inaccurate depth estimation algorithm may cause distortion of the picture.
[0020] Furthermore, some film and television productions allow for the addition of stereoscopic photo frames to videos through editing, but the attached photo frames only create a pseudo-3D effect by utilizing the occlusion relationship between the video image and the photo frame.
[0021] To address the above-mentioned problems, the embodiments of the present disclosure provide an image processing method, apparatus, device, and medium. The image processing method will be described below with reference to specific embodiments.
[0022] FIG. 1 is a flowchart of an image processing method according to an embodiment of the present disclosure.
[0023] In an embodiment of the present disclosure, the image processing method may be performed by an image processing device. The image processing device may be an electronic device or a server. The electronic device may include, but is not limited to, mobile devices such as mobile phones, laptops, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet PCs), PMPs (portable multimedia players), in-vehicle devices (e.g., in-vehicle navigation devices), and wearable devices, as well as fixed devices such as digital TVs, desktop computers, and smart home devices. The server may be an independent server or a cluster of multiple servers, including locally built servers and cloud-based servers.
[0024] As shown in FIG. 1, the image processing method mainly includes the following steps:
[0025] S110: An image to be processed is obtained.
[0026] In the embodiment of the present disclosure, the image processing device can acquire an image to be processed and perform stereoscopic image processing on the image to be processed.
[0027] Here, the image to be processed may be an image that requires stereoscopic image processing, or may be a single picture or a single image frame in a video.
[0028] When the image processing device is an electronic device, the image to be processed may be a picture or an image frame of a video uploaded or taken by a user, a picture or an image frame of a video downloaded from a server, or a picture or an image frame of a video sent to it by another device.
[0029] If the image processing device is a server, the image to be processed may be a picture or an image frame of a video carried in an image processing request sent to it by another device.
[0030] S120: Main subject recognition is performed on the image to be processed to obtain an image main subject object.
[0031] Usually, when taking pictures or videos, photographers generally design elements such as main object, secondary object, foreground, background, and white space within the image, and when users edit images, they often want to edit the main object in the image.
[0032] For example, when adding a photo frame to an image to be processed, a user usually wants to add a photo frame to the main object of the image, so in the embodiment of the present disclosure, after acquiring the image to be processed, the image processing device first needs to recognize the main object of the image in the image to be processed.
[0033] The main image object may be an object that is primarily depicted in the image to be processed, and may be a person, an object, or a single person, a single object, or multiple people, a single object, or multiple objects.
[0034] In some embodiments, an image segmentation algorithm can perform subject recognition on the image to be processed to obtain image subject objects.
[0035] Specifically, the image segmentation algorithm divides the image to be processed into a number of specific regions with unique characteristics, and finds the region where the main subject object of the image is located from the plurality of regions.
[0036] In general, the area where the main object of the image is located is the foreground element, and the other areas are the background elements, so all content included in the foreground element is considered to be the main object of the image. Image segmentation algorithms include threshold-based segmentation algorithms, region-based segmentation methods, etc., and the embodiments of the present disclosure do not limit the specific image segmentation algorithm.
[0037] For example, as shown in FIG. 2, the picture shown in FIG. 2 is the image to be processed, and an image segmentation algorithm can be used to recognize the area where image elements such as people, mountains, and the sun are located, and the area where the people are located is the foreground element, so the people in the image to be processed are the image main subject object.
[0038] In some other embodiments, the image to be processed is input into a pre-trained main subject recognition model for recognizing the main subject of the image, and the main subject object of the image to be processed is directly recognized by the main subject recognition model, and the main subject object of the image to be processed is obtained as an output of the main subject recognition model.
[0039] S130: Generate a target polygonal region corresponding to the image main subject object, where a part of the image main subject object is located within the target polygonal region and the remaining part of the image main subject object is located outside the target polygonal region.
[0040] In an embodiment of the present disclosure, after obtaining the image main subject object, the image processing device can generate a target polygon region corresponding to the image main subject object.
[0041] The target polygonal region can be used to blend with the image to be processed to achieve the effect of a photo frame, and the position and size of the target polygonal region can be determined according to the image main subject object, so that a part of the image main subject object is located within the target polygonal region and the remaining part of the image main subject object is located outside the target polygonal region, thereby achieving the effect of a stereoscopic display of the image main subject object in the photo frame.
[0042] Furthermore, the target polygonal region may be a polygonal region of any shape, such as a square region, a circular region, or the like.
[0043] Specifically, the image processing device generates one material image of the same size as the image to be processed, and generates a target polygonal region in the material image according to the relative position and relative size of the image main subject object in the image to be processed. The relative position of the target polygonal region in the material image is appropriate to the relative position of the image region object in the image to be processed, and the relative size of the target polygonal region in the material image is adapted to the relative size of the image main subject object in the image to be processed, so that a part of the image main subject object is located within the target polygonal region and the remaining part of the image main subject object is located outside the target polygonal region.
[0044] For example, if the target polygonal region is a quadrilateral region, the target polygonal region generated according to the image main subject object is shown in FIG.
[0045] S140: According to the target polygonal region, the image to be processed is fused with additional image material to obtain a fused image, the fused image is consistent with the image content in the first image region of the image to be processed, and the image content in the second image region of the fused image presents the additional image material, the first image region is a merged region of the target polygonal region and the image region occupied by the image main subject object, and the second image region is an image region other than the first image region.
[0046] In the embodiment of the present disclosure, after generating the target polygonal region, the image processing device can fuse the image to be processed with additional image material according to the target polygonal region to obtain a fused image, as shown in FIG. 4 .
[0047] The fused image is consistent with the image content within the first image region of the image to be processed, and the first image region is the merged region of the target polygon region and the image region occupied by the image main subject object, thereby displaying the target polygon region and the background image content and the image main subject object located within the target polygon region in the image to be processed to achieve a photo frame effect in the fused image, with a part of the image main subject object and the background image content located within the target polygon region and the remaining part of the image main subject object located outside the target polygon region, thereby achieving the effect of a three-dimensional photo frame.
[0048] Furthermore, the additional image material can be a preset background material or a background material selected by the user. The image content in the second image area of the fusion image presents the additional image material, and the second image area is an image area other than the first image area, so that the image content other than the first image area of the background material can be used as the photo frame background of the three-dimensional photo frame, further improving the aesthetics of the three-dimensional photo frame effect.
[0049] If the image processing device is an electronic device, the resulting fused image can be displayed directly on the electronic device.
[0050] When the image processing device is a server, the server can transmit the obtained fused image to another device, which can receive and display the image transmitted from the server.
[0051] In the embodiments of the present disclosure, an image main subject object in the image to be processed is recognized, and a target polygonal region within which a part of the image main subject object can be positioned and the remaining part can be positioned outside is generated. Then, the image to be processed can be fused with additional image material according to the target polygonal region to obtain a fused image, so that the image content of the fused image and the target polygonal region of the image to be processed is consistent with the image content in the first image region occupied by the image main subject object, and the image content in the second image region other than the first image region of the fused image presents additional image material, and further presents the effect of the three-dimensional display of the image main subject object relative to the target polygonal region, so as to meet the user's requirements for three-dimensional display of the image and improve the user experience.
[0052] In another embodiment of the present disclosure, S130 may specifically include the steps of determining a minimum circumscribing rectangular area corresponding to the image main subject object, and performing area adjustment on a preset polygonal area based on the minimum circumscribing rectangular area to obtain a target polygonal area, where the area adjustment includes size adjustment and position adjustment.
[0053] In some embodiments of the present disclosure, the image processing device can first perform mask processing on the image main subject object to obtain a mask image of the image main subject object, and then calculate a minimum bounding rectangle frame according to the mask image of the image main subject object to obtain a minimum bounding rectangle area.
[0054] For example, the image processing device sets each pixel value of the image main subject object in the image to be processed to 255, and sets the mask value corresponding to each pixel value to 1, so that the image main subject object in the image to be processed is displayed in white in the image to be processed; sets each pixel value of the non-image main subject object in the image to be processed to 255, and sets the mask value corresponding to each pixel value to 0, so that the non-image main subject object in the image to be processed is displayed in black in the image to be processed, and a mask image of the image main subject object can be obtained through this step.
[0055] Selectively performing mask processing on the image main subject object may also be setting the mask value to another value, and the embodiments of the present disclosure are not limited thereto.
[0056] For example, the mask image obtained by processing the image main subject object shown in FIG. 2 is shown in FIG.
[0057] Next, the step of calculating the minimum bounding rectangle frame according to the mask value of the image main subject object specifically includes a step in which the image processing device calculates the sum of the pixel values of each column and the sum of the pixel values of each row of the mask image, and respectively obtains an array A consisting of the sum of the pixel values of each column and an array B consisting of the sum of the pixel values of each row.
[0058] After obtaining array A and array B, the image processor traverses array A from the first element backward to find the position of the first non-zero element, and then finds the horizontal coordinate P of the left boundary point of the main subject object in the image. l Traversing from the last element of array A forward, we find the position of the first non-zero element, and then find the abscissa P of the right boundary point of the main subject object in the image. r Traversing from the first element of array B backward, we find the position of the first non-zero element, and then find the ordinate P of the upper boundary point of the main subject object in the image. t Traversing from the last element of array B forward, we find the position of the first non-zero element, and then find the ordinate P of the bottom boundary point of the main subject object in the image.b The upper left corner of the image to be processed is set as the coordinate origin, and the horizontal coordinate of the left boundary point P l and the abscissa of the right boundary point P r The left and right boundary lines are obtained by drawing parallel lines on the Y axis according to the t and the ordinate of the lower boundary point P b A parallel line on the X axis is created according to the above equation to obtain the upper and lower boundary lines. The rectangular frame consisting of the left boundary line, right boundary line, upper boundary line, and lower boundary line is defined as the minimum bounding rectangular frame, and the area formed by this minimum bounding rectangular frame is the minimum bounding rectangular area.
[0059] For example, the minimum circumscribing rectangular area calculated according to the mask image of the main subject object shown in FIG. 5 is shown in FIG.
[0060] In some other embodiments of the present disclosure, after obtaining the minimum bounding rectangle area, the image processing device may further perform area adjustment on a preset polygonal area based on the minimum bounding rectangle area to obtain a target polygonal area.
[0061] The preset polygonal region may be a polygonal region with a 3D effect, for example, a square region with a 3D effect or a circular region with a 3D effect.
[0062] The image processing device adjusts a predetermined polygonal area in a predetermined material image according to the obtained minimum circumscribing rectangular area, and further obtains a polygonal area that matches the minimum circumscribing rectangular area.The image processing device can obtain a material image having the target polygonal area by using the polygonal area that matches the minimum circumscribing rectangular area as a target polygonal area.
[0063] Specifically, after acquiring a preset material image, the image processing device first trims the preset material image in accordance with the image size of the image to be processed, thereby making the preset material image the same size as the image to be processed.
[0064] Next, the image processing device adjusts a preset polygonal area in a preset material image according to the minimum circumscribing rectangular area, thereby matching the adjusted target polygonal area to the minimum circumscribing rectangular area.
[0065] The region adjustment includes size adjustment and position adjustment, that is, performing material adjustment on a preset polygonal region includes adjusting the size and position of the preset polygonal region.
[0066] For example, the preset polygonal area may be located at the center of the preset material image by default, and the image processing device adjusts the size and position of the preset polygonal area in the preset material image according to the size and position of the minimum circumscribing rectangular area in the image to be processed.
[0067] For example, the preset polygonal region is a quadrangular region such as an isosceles trapezoid, and after adjusting the size and position of the preset polygonal region, a quadrangular region with a 3D effect matching the image main subject object, which is the minimum circumscribing rectangular region, is obtained; or for example, the preset polygonal region is a circular region such as an ellipse, and after adjusting the size and position of the preset polygonal region, a circular region with a 3D effect matching the image main subject object, which is the minimum circumscribing rectangular region, is obtained.
[0068] In still other embodiments of the present disclosure, when the preset polygonal region is a rectangular region, FIG. 7 shows a flowchart of a processing process for performing region adjustment on the preset polygonal region according to a minimum circumscribed rectangular region according to an embodiment of the present disclosure to obtain a target polygonal region.
[0069] As shown in FIG. 7, the processing process may include the following steps:
[0070] S710: The coordinates of the corner points of each rectangular area of the minimum circumscribing rectangular area are obtained.
[0071] The rectangular area corner points are the area vertices of the minimum bounding rectangular area.
[0072] In an embodiment of the present disclosure, the upper left corner of the image to be processed is set as the coordinate origin, and after the image processing device obtains the minimum bounding rectangular area, it can determine the coordinates of each rectangular area corner point of the minimum bounding rectangular area according to each boundary point of the minimum bounding rectangular area.
[0073] Taking FIG. 6 as an example, the horizontal coordinate of the left boundary point P1 and the horizontal coordinate of the right boundary point P r , the ordinate of the upper boundary point P t , and the ordinate of the lower boundary point P b The coordinates of the four corner points of the minimum bounding rectangular area in FIG. 6 can be obtained according to the above. The coordinates of the upper left vertex are (P l ,P t ), and the coordinate of the upper right vertex is (P r ,P t ), and the coordinate of the bottom left vertex is (P l ,P b ), and the coordinate of the bottom right vertex is (P r ,P b )
[0074] S720: Calculate the corner coordinates of each polygonal area corner point according to the corner coordinates of each rectangular area corner point.
[0075] In an embodiment of the present disclosure, the image processing device obtains the corner point coordinates of each rectangular area corner point of the minimum circumscribing rectangular area, and then calculates the corner point coordinates of each polygonal area corner point according to the corner point coordinates of each rectangular area corner point.
[0076] Specifically, the image processing device has a predefined functional relationship between the coordinates of each rectangular corner point of the minimum circumscribing rectangular area and the coordinates of each polygonal corner point of the polygonal area, and the image processing device obtains the coordinates of each polygonal corner point of the polygonal area by substituting the coordinates of each rectangular corner point of the minimum circumscribing rectangular area into the functional relationship.
[0077] S730: Perform area adjustment on a preset polygon area according to the corner point coordinates of each polygon area corner point to obtain a target polygon area.
[0078] In an embodiment of the present disclosure, the image processing device calculates a vector including a moving direction and a moving distance along which each of the preset corner points of the preset polygonal region needs to move according to the corner point coordinates of each of the corner points of the preset polygonal region and the corner point coordinates of each of the preset corner points of the preset polygonal region, and then moves each of the preset corner points of the preset polygonal region according to the vector, thereby adjusting the size and position of the preset polygonal region, and further obtaining a target polygonal region.
[0079] As can be seen from the above, the embodiments of the present disclosure obtain the corner coordinates of each corner point of a polygonal region according to the functional relationship between the corner coordinates of each corner point of a rectangular region of a minimum circumscribed rectangular region and the corner coordinates of each corner point of a polygonal region of a polygonal region, calculate the vectors that each predetermined corner point of a predetermined polygonal region needs to move, and perform area adjustment on the predetermined polygonal region based on the vectors to obtain a target polygonal region, thereby allowing the target polygonal region to be obtained with just simple calculations and improving calculation efficiency.
[0080] In still further embodiments of the present disclosure, when the preset polygonal region is a circular region, FIG. 8 shows a flowchart of another processing process for performing region adjustment on the preset polygonal region according to the minimum circumscribed rectangular region according to an embodiment of the present disclosure to obtain a target polygonal region.
[0081] As shown in FIG. 8, the processing process may include the following steps:
[0082] S810: The coordinates of the corner points of each rectangular area of the minimum circumscribing rectangular area and the coordinates of the center of the rectangular area are obtained.
[0083] The rectangular area corner points are the area vertices of the minimum circumscribing rectangular area, and the rectangular area center is the area center point of the minimum circumscribing rectangular area.
[0084] In an embodiment of the present disclosure, the upper left corner of the image to be processed is set as the coordinate origin, and after obtaining the minimum circumscribing rectangular area, the image processing device can determine the coordinates of each corner point of the minimum circumscribing rectangular area and the central coordinate of the rectangular area center according to each boundary point of the minimum circumscribing rectangular area.
[0085] Continuing with the example of Figure 6, the horizontal coordinate of the left boundary point P1 and the horizontal coordinate of the right boundary point P r , the ordinate of the upper boundary point P t , and the ordinate of the lower boundary point P b According to the above, the coordinates of the four corner points of the smallest circumscribed rectangular area in 6 and the center coordinate of the rectangular area center can be obtained. The coordinates of the upper left vertex are (P l ,P t ), and the coordinate of the upper right vertex is (P r ,P t ), and the coordinate of the bottom left vertex is (P l ,P b ), and the coordinate of the bottom right vertex is (P r ,P b ) and the center coordinates are
number
[0086] S820: The maximum distance from the center of the rectangular area to each boundary of the minimum circumscribing rectangular area is calculated according to the corner coordinates of each rectangular area corner and the center coordinate of the rectangular area center.
[0087] In an embodiment of the present disclosure, the image processing device connects adjacent rectangular area corner points of the minimum bounding rectangular area to obtain each area boundary of the minimum bounding rectangular area.
[0088] Furthermore, the image processing device calculates the distance from the center of the rectangular area to each boundary of the minimum circumscribing rectangular area according to the central coordinates of the center of the rectangular area and each boundary of the minimum circumscribing rectangular area, and selects the maximum distance from the calculated distances.
[0089] S830: The maximum distance is set as the boundary distance from the center of the polygon area to each polygon area boundary.
[0090] In an embodiment of the present disclosure, the image processing device can determine the maximum distance from the rectangular area center to each rectangular area boundary of the minimum circumscribing rectangular area, and then use the maximum distance as the boundary distance from the polygonal area center to each polygonal area boundary.
[0091] S840: According to the central coordinates of the rectangular area center and the boundary distance, area adjustment is performed on the preset polygonal area to obtain a target polygonal area.
[0092] In an embodiment of the present disclosure, the image processing device calculates a vector including a moving direction and a moving distance along which the polygon center point of the preset polygonal area needs to move according to the central coordinate of the rectangular area center, then moves the preset polygonal area according to the vector to realize the position adjustment of the preset polygonal area, and then adjusts the polygon boundary of the preset polygonal area according to the maximum distance to realize the size adjustment of the preset polygonal area, and further obtains a target polygonal area.
[0093] Specifically, the image processing device has a preset functional relationship between the central coordinates of the rectangular area center of the minimum circumscribing rectangular area and the central coordinates of the polygon center point of the polygonal area, and the image processing device obtains the central coordinates of the polygon center point of the polygonal area by substituting the central coordinates of the rectangular area center of the minimum circumscribing rectangular area into the functional relationship.
[0094] Furthermore, the image processing device presets a functional relationship between the boundary distance and the adjustment distance of the polygon boundary of the polygonal region, and the image processing device obtains the adjustment distance of the polygon boundary of the polygonal region by substituting the boundary distance into the functional relationship, and then enlarges or reduces the polygon boundary of the polygonal region according to the adjustment distance, thereby enlarging or reducing the preset polygonal region and achieving the size adjustment of the preset polygonal region.
[0095] As can be seen from the above, the embodiments of the present disclosure obtain the central coordinates of the polygon center point of a polygonal region according to the functional relationship between the central coordinates of the rectangular region center of the minimum circumscribed rectangular region and the central coordinates of the polygon center point of the polygonal region, calculate the vector that the polygon center point of the preset polygonal region needs to move, and obtain the adjustment distance of the polygon boundary of the polygonal region according to the functional relationship between the boundary distance and the adjustment distance of the polygon boundary of the polygonal region, and perform area adjustment on the preset polygonal region based on the vector and adjustment distance to obtain a target polygonal region, thereby allowing the target polygonal region to be obtained with just simple calculations and improving calculation efficiency.
[0096] In yet another embodiment of the present disclosure, when the generated target polygonal region is a quadrilateral region such as an isosceles trapezoid region, FIG. 9 shows a flowchart of a processing process for generating a target polygonal region according to a minimum circumscribing rectangular region and a preset corner point mapping relationship according to an embodiment of the present disclosure.
[0097] As shown in FIG. 9, the processing process may include the following steps:
[0098] S910: The minimum circumscribing rectangular area corresponding to the image main subject object is determined.
[0099] In some embodiments of the present disclosure, the image processing device can first perform mask processing on the image main subject object to obtain a mask image of the image main subject object, and then calculate a minimum circumscribing rectangle frame according to the mask image of the image main subject object to obtain a minimum circumscribing rectangle area, and redundant explanations will be omitted here.
[0100] S920: The coordinates of the corner points of each rectangular area corner point of the minimum circumscribing rectangular area are obtained.
[0101] In some embodiments of the present disclosure, the upper left corner of the image to be processed is set as the coordinate origin, and after the image processing device obtains the minimum bounding rectangular area, it can determine the coordinates of each rectangular area corner point of the minimum bounding rectangular area according to each boundary point of the minimum bounding rectangular area, and redundant explanations will be omitted here.
[0102] S930: Calculate the corner coordinates of the polygonal area corner points corresponding to the corner coordinates of the rectangular area corner points according to the preset corner point mapping relationship.
[0103] In some embodiments of the present disclosure, the image processing device is configured with a preset corner point mapping relationship, which includes a correspondence relationship between each rectangular area corner point of the minimum bounding rectangular area and each polygonal area corner point.
[0104] Specifically, the predetermined corner point mapping relationship may be a functional relationship between the corner point coordinates of each rectangular area corner point of the predetermined minimum circumscribing rectangular area and the corner point coordinates of each corresponding polygonal area corner point.
[0105] The image processing device substitutes the corner coordinates of each rectangular area corner point of the minimum circumscribing rectangular area into the above functional relationship to obtain the corner coordinates of the polygonal area corner points corresponding to the corner coordinates of each rectangular area corner point.
[0106] S940: A target polygon area is generated according to the corner point coordinates of the polygon area corner points.
[0107] In an embodiment of the present disclosure, the image processing device can generate a material image having a target polygonal region according to the corner point coordinates of the polygonal region corner points.
[0108] The image processing device first generates a canvas of the same size as the image to be processed, generates corner points at corresponding positions in the canvas according to the corner point coordinates of the polygonal area corner points, and performs interior filling on the polygonal area based on the generated corner points to obtain a target polygonal area.
[0109] In an embodiment of the present disclosure, the image processing device obtains the corner point coordinates of the polygon area corner points, then connects the polygon area corner points, and fills the interior of the connected area formed by connecting adjacent corner points to obtain a target polygon area.
[0110] Filling may be filling pixels in connected regions with the same pixel value.
[0111] Optionally, the pixel value filling the connected region may be 255, ie the target polygon region is displayed in white.
[0112] As can be seen from the above, the embodiments of the present disclosure can directly generate a target polygon area according to the corner point coordinates of each rectangular area corner point of the minimum circumscribed rectangular area and the preset corner point mapping relationship, thereby enabling the target polygon area to be obtained with only simple calculations, thereby improving calculation efficiency.
[0113] In an embodiment of the present disclosure, the method further includes, selectably, determining an area display direction of the target polygonal area relative to the image main subject object before calculating the corner point coordinates of the polygonal area corner points corresponding to the corner point coordinates of each rectangular area corner point according to a preset corner point mapping relationship, and obtaining a preset corner point mapping relationship corresponding to the area display direction.
[0114] The region display direction may be the position of the target polygonal region relative to the image main subject object. The target polygonal region may be positioned in any direction above, below, left, or right of the image main subject object.
[0115] In some embodiments, the formula for the preset salient point mapping relationship may be as follows:
[0116] The abscissa of the upper left corner point of the polygon
number
number
number
number
number
number
number
number
[0117] The above-mentioned preset corner point mapping relationship calculation formula realizes that the target polygon area is located below the image main subject object, thereby creating a three-dimensional effect in which the image main subject object protrudes upward relative to the photo frame.
[0118] In some other embodiments, the formula for the preset salient point mapping relationship may be as follows:
[0119] The abscissa of the upper left corner point of the polygon
number
number
number
number
number
number
number
number
[0120] The above-mentioned preset corner point mapping relationship calculation formula realizes that the target polygon area is located to the left of the image main subject object, thereby creating a three-dimensional effect in which the image main subject object protrudes to the right relative to the photo frame.
[0121] In some other embodiments, the formula for the preset salient point mapping relationship may be as follows:
[0122] The abscissa of the upper left corner point of the polygon
number
number
number
number
number
number
number
number
[0123] The above-mentioned preset corner point mapping relationship calculation formula realizes that the target polygon area is located to the right of the image main subject object, thereby creating a three-dimensional effect in which the image main subject object protrudes to the left relative to the photo frame.
[0124] Therefore, in the embodiment of the present disclosure, different stereoscopic effects can be realized based on different region display directions, improving the diversity of image processing effects.
[0125] In another embodiment of the present disclosure, S140 may specifically include the steps of creating additional image material of the same size as the image to be processed, extracting first image content located outside the target polygonal area from the additional image material to obtain a first background image, filling second image content located inside the target polygonal area in the image to be processed into the first background image to obtain a second background image, and filling the image main subject object into the second background image to obtain a fused image.
[0126] In an embodiment of the present disclosure, the image processing device first generates additional image material of the same size as the image to be processed. Specifically, the generating method may be to generate additional image material of the same size as the image to be processed according to a preset color or a color specified by a user and an image generating method such as a preset single color, a preset gradation color, etc. Alternatively, the generating method may be to obtain a preset background image, and perform image cropping around the preset background image with the preset background image as the center to obtain additional image material of the same size as the image to be processed.
[0127] The image processing device further extracts first image content located outside the target polygonal area from the additional image material and fills it into an image area located outside the target polygonal area of the material image having the target polygonal area to obtain a first background image, i.e., maps the first image content located outside the target polygonal area in the additional image material to the material image having the target polygonal area to obtain a first background image.
[0128] In some examples, the step of extracting first image content located outside the target polygonal area from the additional image material to obtain a first background image may specifically include the steps of obtaining an area boundary position of the target polygonal area, extracting first image content located outside the area boundary position from the additional image material, and filling the first image content into a corresponding position in a material image having the target polygonal area to obtain a first background image.
[0129] Specifically, the step of acquiring the area boundary position of the target polygonal area may include the step of performing a mask process on the target polygonal area to obtain a mask image of the target polygonal area.
[0130] For example, the image processing device sets each pixel value in the target polygonal region in the material image having the target polygonal region to 255, and sets the mask value corresponding to each pixel value to 1, so that the target polygonal region is displayed in white; and sets each pixel value in the non-target polygonal region corresponding to the material image of the target polygonal region to 0, and sets the mask value corresponding to each pixel value to 0, so that the non-target polygonal region corresponding to the material image having the target polygonal region is displayed in black, and a mask image of the target polygonal region can be obtained by this step, thereby obtaining a mask image of the first background image.
[0131] For example, FIG. 10 shows how mask processing is performed on the target polygonal region shown in FIG. 3 to obtain a mask image of the target polygonal region.
[0132] In some embodiments, a morphological dilation operation may be performed on the mask image of the target polygonal region to allow for a more stereoscopic display of the image's main subject content. The morphological dilation operation may extend the boundary of the target polygonal region.
[0133] Specifically, the specific implementation method for the image processing device to add the first image content to the mask image of the target polygonal region is as follows:
number
number
number
number
[0134] For example, the mask image of the first background image obtained by performing morphological dilation processing on the mask image of the target polygonal region shown in FIG. 10 is shown in FIG.
[0135] Furthermore, the image processing device then fills the first background image with the second image content located inside the target polygonal area in the image to be processed to obtain a second background image, i.e., maps the second image content located inside the target polygonal area in the image to be processed onto the first background image to obtain a second background image.
[0136] In some examples, the step of filling the first background image with second image content located inside the target polygonal region in the image to be processed to obtain the second background image may specifically include the steps of obtaining the region boundary positions of the target polygonal region that has not been morphologically expanded, extracting the second image content located inside the region boundary positions from the image to be processed, and filling the second image content into the corresponding position in the first background image to obtain the second background image.
[0137] For example, the image processing device fills the second image content into the corresponding position in the mask image of the first background image to obtain a second background image.
[0138] Specifically, the specific implementation method for the image processing device to add the second image content to the mask image of the first background image is as follows:
number
number
number
number
[0139] For example, the second background image obtained by adding the second image content to the first background image shown in FIG. 11 is shown in FIG.
[0140] Furthermore, the image processing device subsequently fills the image main subject object into the second background image to obtain a fused image, that is, maps the image main subject object in the image to be processed onto the second background image to obtain a fused image.
[0141] In some examples, the step of filling the image main subject object into the second background image to obtain a fused image may specifically include the steps of obtaining an object boundary position of the image main subject object, extracting main subject object content located inside the object boundary position from the image to be processed, and filling the main subject object content into a corresponding position in the second background image to obtain a fused image.
[0142] For example, the image processing device fills the main subject object content into the corresponding position in the second background image to obtain a fused image.
[0143] Specifically, the image processing device attaches the main subject object content to the second background image in the following manner:
number
number
number
number
[0144] For example, the fusion image obtained by adding the main subject object content to the second background image shown in FIG. 12 is shown in FIG.
[0145] Therefore, in the embodiment of the present disclosure, the image to be processed and the additional image material can be quickly and accurately merged by the mask image of the target polygonal region, and a fused image with high image quality and fusion quality can be obtained.
[0146] 13 is a structural schematic diagram of an image processing device according to an embodiment of the present disclosure. The image processing device according to an embodiment of the present disclosure can perform a processing process according to an embodiment of the image processing method. As shown in FIG. 13, the image processing device 1300 includes an image acquisition module 1310, a main object recognition module 1320, a region generation module 1330, and an image fusion module 1340.
[0147] The image acquisition module 1310 can be configured to acquire an image to be processed.
[0148] The subject recognition module 1320 may be configured to perform subject recognition on the image to be processed to obtain an image subject object.
[0149] The region generation module 1330 can be configured to generate a target polygon region corresponding to an image main subject object, where a portion of the image main subject object is located within the target polygon region and a remaining portion of the image main subject object is located outside the target polygon region.
[0150] The image fusion module 1340 can be configured to fuse the image to be processed with additional image material according to the target polygon region to obtain a fused image, where the fused image matches image content in a first image region of the image to be processed, and image content in a second image region of the fused image presents the additional image material, the first image region being a union region of the target polygon region and the image region occupied by the image main subject object, and the second image region being an image region other than the first image region.
[0151] In the embodiments of the present disclosure, an image main subject object in the image to be processed is recognized, and a target polygonal region within which a part of the image main subject object can be positioned and the remaining part can be positioned outside is generated. Then, the image to be processed can be fused with additional image material according to the target polygonal region to obtain a fused image, so that the image content of the fused image and the target polygonal region of the image to be processed is consistent with the image content in the first image region occupied by the image main subject object, and the image content in the second image region other than the first image region of the fused image presents additional image material, and further presents the effect of the three-dimensional display of the image main subject object relative to the target polygonal region, so as to meet the user's requirements for three-dimensional display of the image and improve the user experience.
[0152] In some embodiments of the present disclosure, the region generation module 1330 may include a region determination unit and a region adjustment unit.
[0153] The region determination unit may be configured to determine a minimum bounding rectangular region corresponding to the image main subject object.
[0154] The region adjustment unit may be configured to perform region adjustment on the preset polygon region based on the minimum circumscribing rectangular region to obtain the target polygon region, where the region adjustment includes size adjustment and position adjustment.
[0155] In some embodiments of the present disclosure, the area adjustment unit is further configured to obtain corner point coordinates of each rectangular area corner point of the minimum circumscribed rectangular area, calculate corner point coordinates of each polygonal area corner point according to the corner point coordinates of each rectangular area corner point, and perform area adjustment on the predetermined polygonal area according to the corner point coordinates of each polygonal area corner point to obtain a target polygonal area.
[0156] In some embodiments of the present disclosure, the area adjustment unit is further configured to obtain corner point coordinates of each rectangular area corner point of the minimum circumscribed rectangular area and the central coordinate of the rectangular area center, calculate the maximum distance from the rectangular area center to each rectangular area boundary of the minimum circumscribed rectangular area according to the corner point coordinates of each rectangular area corner point and the central coordinate of the rectangular area center, set the maximum distance as the boundary distance from the polygonal area center to each polygonal area boundary, and perform area adjustment on the predetermined polygonal area according to the central coordinate of the rectangular area center and the boundary distance to obtain a target polygonal area.
[0157] In some embodiments of the present disclosure, the region generation module 1330 may further include a region determination unit, a coordinate acquisition unit, a coordinate calculation unit, and a region generation unit.
[0158] The region determination unit may be configured to determine a minimum bounding rectangular region corresponding to the image main subject object.
[0159] The coordinate acquisition unit may be configured to acquire corner point coordinates of each rectangular area corner point of the minimum circumscribing rectangular area.
[0160] The coordinate calculation unit may be configured to calculate corner point coordinates of polygonal area corner points corresponding to the corner point coordinates of each rectangular area corner point according to a preset corner point mapping relationship; The region generating unit may be configured to generate the target polygon region according to the corner point coordinates of the polygon region corner points.
[0161] In some embodiments of the present disclosure, the region generating module 1330 may further include a direction determining unit and a relation obtaining unit.
[0162] The direction determining unit may be configured to determine a region display direction of the target polygonal region relative to the image subject object.
[0163] The relationship obtaining unit can be configured to obtain a preset salient point mapping relationship corresponding to the region display direction.
[0164] In some embodiments of the present disclosure, the image fusion module 1340 may include a material creation unit, a background extraction unit, a first filling unit, and a second filling unit.
[0165] The material creation unit can be configured to create additional image material of the same size as the image to be processed.
[0166] The background extraction unit may be configured to extract a first image content located outside the target polygonal region from the additional image material to obtain a first background image.
[0167] The first filling unit may be configured to fill the first background image with second image content located inside the target polygonal region in the image to be processed to obtain a second background image.
[0168] The second filling unit may be configured to fill the image main subject object into the second background image to obtain a fused image.
[0169] The image processing device 1300 shown in FIG. 13 can execute each step of the method embodiments shown in FIGS. 1 to 12 and realize each process and effect of the method embodiments shown in FIGS. 1 to 12, and redundant explanations will be omitted here.
[0170] An embodiment of the present disclosure further provides an image processing device, which may include a processor and a memory, the memory being operable to store executable instructions, and the processor being operable to read the executable instructions from the memory and execute the executable instructions to implement the image processing method in the embodiment.
[0171] 14 shows a structural schematic diagram of an image processing device according to an embodiment of the present disclosure. Hereinafter, with specific reference to FIG. 14, a structural schematic diagram suitable for realizing an image processing device 1400 according to an embodiment of the present disclosure will be shown.
[0172] The image processing device 1400 in the embodiment of the present disclosure may be an electronic device or a server. Here, the electronic device may include, but is not limited to, mobile terminals such as mobile phones, laptops, digital broadcast receivers, PDAs, PADs, PMPs, in-vehicle terminals (e.g., in-vehicle navigation terminals), and wearable devices, and fixed terminals such as digital TVs, desktop computers, and smart home devices. The server may be an independent server or a cluster of multiple servers, and may include locally built servers and cloud-based servers.
[0173] It should be noted that the image processing device 1400 shown in FIG. 14 is merely an example and does not impose any limitations on the functions and scope of use of the embodiments of the present disclosure.
[0174] 14, the image processing device 1400 may include a processing unit (e.g., a central processing unit, a graphics processor, etc.) 1401, which can perform various appropriate operations and processes according to programs stored in a read-only memory (ROM) 1402 or programs loaded from a storage device 1408 into a random access memory (RAM) 1403. The RAM 1403 further stores various programs and data necessary for the operation of the information processing device 1400. The processing unit 1601, the ROM 1402, and the RAM 1403 are connected to each other via a bus 1604. An input / output (I / O) interface 1405 is also connected to the bus 1404.
[0175] Typically, devices connected to the I / O interface 1405 include input devices 1406, such as a touch panel, touch pad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, etc.; output devices 1407, such as a liquid crystal display (LCD), speaker, vibrator, etc.; storage devices 1408, such as a tape or hard disk, etc.; and communication devices 1409. The communication devices 1409 enable the image processing device 1400 to communicate wirelessly or via wires with other devices to exchange data. While FIG. 14 illustrates the image processing device 1400 with various devices, it should be understood that it need not implement or include all of the devices shown. Instead, more or fewer devices may be implemented or included.
[0176] An embodiment of the present disclosure further provides a computer-readable medium, which stores a computer program, which, when executed by a processor, causes the processor to implement the image processing method in the above embodiment.
[0177] In particular, according to embodiments of the present disclosure, the processes described above with reference to the flowcharts may be implemented as a computer software program. For example, embodiments of the present disclosure include a computer program product including a computer program embodied in a non-transitory computer-readable medium, the computer program including program code for performing the methods illustrated in the flowcharts. In such embodiments, the computer program may be downloaded and installed from a network via the communication device 1409, installed from the storage device 1408, or installed from the ROM 1402. When the computer program is executed by the processing device 1401, the functions described above, which are limited to the image processing method of the embodiments of the present disclosure, are performed.
[0178] It should be noted that the computer-readable medium of the present disclosure may be a computer-readable signal medium, a computer-readable medium, or any combination thereof. The computer-readable medium may be, for example, but is not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of the computer-readable medium may include, but are not limited to, an electrical connection having one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In the present disclosure, the computer-readable medium may be any tangible medium that contains or stores a program, and the program can be used by or in combination with an instruction execution system, apparatus, or device. In the present disclosure, the computer-readable signal medium may include a propagated data signal, in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals may take a variety of forms, including, but not limited to, electromagnetic signals, optical signals, or any suitable combination thereof. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable medium that is capable of transmitting, propagating, or transmitting a program for use by or in connection with an instruction execution system, apparatus, or device. Program code contained in a computer-readable medium may be transmitted using any suitable medium, including, but not limited to, wire, optical cable, RF (radio frequency), etc., or any suitable combination thereof.
[0179] In some embodiments, clients and servers may communicate via any network protocol now known or later developed, such as HTTP, and may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), an internetwork (e.g., the Internet), and a peer-to-peer network (e.g., an ad hoc peer-to-peer network), and any network now known or later developed.
[0180] The computer-readable medium may be included in the image processing device, or may exist separately from the image processing device.
[0181] The computer-readable medium includes one or more programs that, when executed by the image processing device, cause the image processing device to: The method includes the steps of: acquiring an image to be processed; performing main subject recognition on the image to be processed to obtain an image main subject object; generating a target polygonal region corresponding to the image main subject object, wherein a part of the image main subject object is located within the target polygonal region and a remaining part of the image main subject object is located outside the target polygonal region; and fusing the image to be processed with additional image material according to the target polygonal region to obtain a fused image, wherein the fused image matches image content in a first image region of the image to be processed and image content in a second image region of the fused image represents the additional image material, the first image region being a union region of the target polygonal region and the image region occupied by the image main subject object, and the second image region being an image region other than the first image region.
[0182] In embodiments of the present disclosure, computer program code for performing the operations of the present disclosure may be programmed in one or more programming languages, or a combination thereof. Such programming languages include, but are not limited to, object-oriented programming languages such as Java, Smalltalk, and C++, as well as traditional procedural programming languages such as "C" and similar programming languages. The program code may run entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. When remote computers are involved, the remote computers may be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet Service Provider).
[0183] The flowcharts and block diagrams in the figures illustrate the architecture, functions, and operations possible for implementation by systems, methods, and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowcharts or block diagrams may represent a module, program segment, or portion of code, each of which includes one or more executable instructions for implementing a given logical function. It should be noted that, in some alternative implementations, the functions illustrated in the blocks may occur in an order different from that shown in the figures. For example, two successively shown blocks may, in fact, be executed substantially in parallel, or may even be executed in the reverse order, depending on the functionality involved. It should be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, may be implemented by a dedicated hardware-based system that performs a given function or operation, or by a combination of dedicated hardware and computer instructions.
[0184] The units described in the embodiments of the present disclosure may be implemented in the form of software or hardware, and in some cases, the names of the units do not limit the units themselves.
[0185] The functions described herein may be performed at least in part by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), etc.
[0186] In the context of this disclosure, a computer-readable medium may be a tangible medium that contains or stores a program usable by or in combination with an instruction execution system, apparatus, or device. The computer-readable medium may be a computer-readable signal medium or a computer-readable storage medium. The computer-readable medium may be, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination thereof. More specific examples of a computer-readable medium may include an electrical connection based on one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof.
[0187] The above description merely explains the preferred embodiments of the present disclosure and the technical principles used. It should be understood by those skilled in the art that the scope of the present disclosure is not limited to the technical solution based on the specific combination of the above technical features, but also includes other technical solutions based on any combination of the above technical features or their equivalent features within the scope of the present disclosure. For example, a technical solution formed by replacing the above features with technical features having similar functions (but not limited to) disclosed in the present disclosure.
[0188] Also, although operations are shown in a particular order, this should not be understood as requiring that these operations be performed in the particular order or sequence shown. In certain environments, multitasking and parallel processing may be advantageous. Similarly, although several specific implementation details are included in the above description, these should not be construed as limiting the scope of the present disclosure. Some features described in the context of individual embodiments may also be implemented in combination in a single embodiment. Rather, various features described in the context of a single embodiment may be implemented in multiple embodiments alone or in any suitable subcombination.
[0189] Although the present invention has been described in language specific to structural features and / or methodological operations, it should be understood that the subject matter defined in the claims is not necessarily limited to the specific features or operations described above. Rather, the specific features and operations described above are merely example forms for implementing the claims.
Claims
1. 1. An image processing method, comprising: obtaining an image to be processed; performing main subject recognition on the image to be processed to obtain an image main subject object; generating a target polygonal region corresponding to the image main subject object, a portion of the image main subject object being located within the target polygonal region and a remaining portion of the image main subject object being located outside the target polygonal region; and fusing the image to be processed with additional image material according to the target polygonal region to obtain a fused image, wherein the fused image matches image content in a first image region of the image to be processed, and image content in a second image region of the fused image represents the additional image material, the first image region being a combined region of the target polygonal region and an image region occupied by the image main subject object, and the second image region being an image region other than the first image region.
2. The step of generating a target polygonal region corresponding to the image main subject object includes: determining a minimum bounding rectangular area corresponding to the image subject object; 2. The method of claim 1, further comprising: performing area adjustment on a preset polygonal area based on the minimum bounding rectangular area to obtain the target polygonal area, wherein the area adjustment includes size adjustment and position adjustment.
3. The step of adjusting a predetermined polygonal area based on the minimum circumscribing rectangular area to obtain the target polygonal area includes: obtaining corner point coordinates of each corner point of the minimum circumscribing rectangular area; calculating corner coordinates of each polygonal area corner point according to the corner coordinates of each rectangular area corner point; 3. The method according to claim 2, further comprising: performing area adjustment on the preset polygon area according to corner point coordinates of each of the polygon area corner points to obtain the target polygon area.
4. The step of adjusting a predetermined polygonal area based on the minimum circumscribing rectangular area to obtain the target polygonal area includes: acquiring the corner coordinates of each corner point of the minimum circumscribing rectangular area and the center coordinates of the rectangular area center; calculating a maximum distance from the center of the rectangular area to each boundary of the minimum circumscribing rectangular area according to the corner coordinates of each rectangular area corner and the center coordinate of the rectangular area center; a step of setting the maximum distance as a boundary distance from the center of the polygonal region to each polygonal region boundary; The method of claim 2 , further comprising: performing area adjustment on the preset polygonal area according to the central coordinates of the rectangular area center and the boundary distance to obtain the target polygonal area.
5. The step of generating a target polygonal region corresponding to the image main subject object includes: determining a minimum bounding rectangular area corresponding to the image subject object; obtaining corner point coordinates of each corner point of the minimum circumscribing rectangular area; calculating corner coordinates of polygonal area corner points corresponding to the corner coordinates of each of the rectangular area corner points according to a preset corner point mapping relationship; and generating the target polygonal region according to corner point coordinates of the polygonal region corner points.
6. before the step of calculating the corner coordinates of the polygonal area corner points corresponding to the corner coordinates of each of the rectangular area corner points according to the preset corner point mapping relationship, determining a region display direction of the target polygonal region relative to the image subject object; The method of claim 5 , further comprising: obtaining the preset salient point mapping relationship corresponding to the region display direction.
7. The step of fusing the image to be processed with additional image material according to the target polygon region to obtain a fused image includes: creating said additional image material of the same size as the image to be processed; extracting a first image content located outside the target polygonal area from the additional image material to obtain a first background image; filling the first background image with second image content located inside the target polygonal region in the image to be processed to obtain a second background image; and filling the image subject object into the second background image to obtain the fused image.
8. An image processing device, an image acquisition module configured to acquire an image to be processed; a main subject recognition module configured to perform main subject recognition on the image to be processed to obtain an image main subject object; a region generation module configured to generate a target polygonal region corresponding to the image main subject object, wherein a portion of the image main subject object is located within the target polygonal region and a remaining portion of the image main subject object is located outside the target polygonal region; An image processing device comprising: an image fusion module configured to fuse the image to be processed with additional image material according to the target polygonal region to obtain a fused image, wherein the fused image matches image content in a first image region of the image to be processed, and image content in a second image region of the fused image represents the additional image material, the first image region being a union of the target polygonal region and an image region occupied by the image main subject object, and the second image region being an image region other than the first image region.
9. The area generation module: a region determination unit configured to determine a minimum bounding rectangular region corresponding to the image main subject object; 9. The image processing apparatus according to claim 8, further comprising: a region adjustment unit configured to perform region adjustment on a preset polygonal region based on the minimum circumscribing rectangular region to obtain a target polygonal region.
10. The area adjustment unit further comprises: obtain the corner point coordinates of each rectangular area corner point of the minimum circumscribing rectangular area; Calculate the corner point coordinates of each polygonal area corner point according to the corner point coordinates of each rectangular area corner point; 10. The image processing apparatus according to claim 9, wherein area adjustment is performed on a preset polygonal area in accordance with the coordinates of corner points of each polygonal area to obtain a target polygonal area.
11. The area adjustment unit further comprises: The corner point coordinates of each rectangular area corner point of the minimum circumscribed rectangular area and the center coordinates of the rectangular area center are obtained. Calculate the maximum distance from the center of the rectangular area to each boundary of the minimum circumscribed rectangular area according to the corner point coordinates of each rectangular area corner point and the center coordinate of the rectangular area center; The maximum distance is the boundary distance from the center of the polygonal region to each polygonal region boundary, 10. The image processing apparatus according to claim 9, wherein the target polygonal area is obtained by performing area adjustment on a preset polygonal area in accordance with the central coordinates of the center of the rectangular area and the boundary distance.
12. The area generation module: a region determination unit configured to determine a minimum bounding rectangular region corresponding to the image main subject object; a coordinate acquisition unit configured to acquire corner point coordinates of each rectangular area corner point of the minimum circumscribing rectangular area; a coordinate calculation unit configured to calculate corner coordinates of polygonal area corner points corresponding to the corner coordinates of each rectangular area corner point according to a preset corner point mapping relationship; and a region generating unit configured to generate the target polygon region according to corner point coordinates of the polygon region corner points.
13. The area generation module: an orientation determining unit configured to determine an area exposure orientation of the target polygonal area relative to the image subject object; The image processing apparatus according to claim 9 , further comprising: a relationship obtaining unit configured to obtain a preset corner point mapping relationship corresponding to the region display direction.
14. An image processing device, a processor; a memory for storing executable instructions; The image processing device is adapted to implement the image processing method of claim 1 , wherein the processor reads the executable instructions from the memory and executes the executable instructions.
15. A computer-readable medium having a computer program stored thereon, the computer program causing a processor to implement the image processing method according to claim 1 when the computer program is executed by the processor.
Citation Information
Patent Citations
Image processing method and device based on target object posture and electronic equipment
CN110084204A
Image processing method and device, electronic equipment and computer-readable medium
CN111783777A
Image special effect processing method and device
CN113315924A
Improving depth perception by integrating monocular visual cues
JP2000512833A
Video processing apparatus, video processing method and computer program
JP2011119926A