Image edge optimization processing method, device and equipment

Through edge detection and Gaussian blur processing, the edges of the image after cutout are optimized, the problem of jagged and harsh edges of the image after cutout is solved, the image edges are smoothed and soft, and the cutout quality and efficiency are improved.

CN120672789AActive Publication Date: 2025-09-19WANGXU TECH CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202510766091.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-10
Publication Date
2025-09-19
Estimated Expiration
2045-06-10

AI Technical Summary

Technical Problem

In the prior art, the edges of images after cutout are jagged or hard, which affects the image quality.

Method used

Through edge detection and Gaussian blur processing, the edges of the image after cutout are optimized. The OpenCV edge detection algorithm is used to detect the edge curve, and the Gaussian kernel is used for blur processing to generate a soft transition area.

Benefits of technology

The image edges after cutout are smooth and soft, which reduces the complexity of the cutout operation. Users can obtain professional cutout effects without professional knowledge, thus improving the efficiency and quality of cutout.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120672789A_ABST
    Figure CN120672789A_ABST
Patent Text Reader

Abstract

The invention provides an image edge optimization processing method, device and equipment, and relates to the technical field of image processing, and the method comprises the steps: obtaining a to-be-processed image obtained after matting and a coordinate track drawn by a user on the to-be-processed image; processing pixel points located at different coordinate points of the coordinate track in the to-be-processed image to obtain a first image; performing edge detection on the coordinate track in the first image to obtain a target edge curve; determining a target edge region based on the target edge curve and the configured expansion radius; for any first pixel point in the target edge area, performing fuzzy processing on the first pixel point according to configured fuzzy processing parameters to obtain a second pixel point; determining a second image based on each second pixel point; and fusing the first image and the second image to obtain an image after edge optimization processing. According to the invention, the edge of the image after matting is smooth and soft.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of image processing technology, and in particular to a method, device and equipment for optimizing image edge processing. Background Art

[0002] In today's era of digital image processing, mobile image editing applications have become essential tools for everyday image processing. Manual cutout features allow users to separate specific subjects from the background by smearing or erasing, paving the way for subsequent operations like creative image synthesis and background replacement. However, current manual cutout tools often produce jagged or harsh edges, compromising overall image quality when the cutout is superimposed on a background or used directly. Summary of the Invention

[0003] The purpose of the embodiments of the present application is to provide an image edge optimization processing method, device and equipment to solve the problems of jagged edges and lack of softness after cutout transformation in the prior art, and to obtain a cutout image with soft edges.

[0004] In a first aspect, the present invention provides an image edge optimization processing method, which is applied to a controller of an image edge optimization processing system, the method comprising:

[0005] Obtaining the image to be processed obtained after the cutout and the coordinate trajectory drawn by the user on the image to be processed;

[0006] Processing pixels at different coordinate points of the coordinate track in the image to be processed according to the configured image processing mode to obtain a first image containing the coordinate track;

[0007] Performing edge detection on the coordinate trajectory in the first image to obtain a plurality of edge curves;

[0008] selecting a target edge curve from a plurality of edge curves according to the image processing mode;

[0009] Determining a target edge area based on the target edge curve and the configured expansion radius; the target edge area includes a plurality of first pixel points;

[0010] For any first pixel point in the target edge area, blur the first pixel point according to the configured blur processing parameters to obtain a second pixel point;

[0011] Determine a second image based on each second pixel point;

[0012] The first image and the second image are fused to obtain an image after edge optimization processing.

[0013] In an optional embodiment, the image processing mode includes a clear mode and a restore mode.

[0014] In an optional embodiment, when the image processing mode is a clear mode, processing pixel points at different coordinate points of the coordinate trajectory in the image to be processed according to the configured image processing mode includes:

[0015] Clearing the pixels located at different coordinate points of the coordinate track in the image to be processed to obtain a first image;

[0016] When the image processing mode is the restoration mode, processing the pixel points at different coordinate points of the coordinate track in the image to be processed according to the configured image processing mode includes:

[0017] Get the original image to be cut out;

[0018] For any coordinate point in the coordinate trajectory, obtaining an initial pixel point of the original image at the coordinate point and a third pixel point of the image to be processed at the coordinate point;

[0019] The third pixel point of the image to be processed at the coordinate point is restored to the corresponding initial pixel point to obtain a first image.

[0020] In an optional embodiment, the edge curve includes a first edge curve and a second edge curve; the first edge curve is an edge curve close to the first image; the second edge curve is an edge curve away from the first image;

[0021] When the image processing mode is the clear mode, selecting a target edge curve from a plurality of edge curves according to the image processing mode includes:

[0022] determining the first edge curve as the target edge curve;

[0023] When the image processing mode is the restoration mode, selecting a target edge curve from a plurality of edge curves according to the image processing mode includes:

[0024] The second edge curve is determined as the target edge curve.

[0025] In an optional embodiment, the target edge curve includes a plurality of pixel coordinates;

[0026] Determining a target edge area based on the target edge curve and the configured expansion radius includes:

[0027] For any pixel coordinate, all pixels whose distance from the pixel coordinate in the configured neighborhood direction is no greater than the expansion radius are regarded as the neighboring pixels of the pixel coordinate;

[0028] The target edge area is determined based on the adjacent pixels of different pixel coordinates.

[0029] In an optional embodiment, the blur processing parameters include: Gaussian kernel size and standard deviation;

[0030] Performing blur processing on the first pixel according to configured blur processing parameters to obtain a second pixel, including:

[0031] generating a two-dimensional Gaussian kernel according to the Gaussian kernel size and standard deviation;

[0032] A convolution operation is performed on the first pixel point using the two-dimensional Gaussian kernel to obtain a second pixel point.

[0033] In an optional embodiment, the target edge area includes a first boundary line; the first boundary line is a boundary line close to the first image;

[0034] The step of fusing the first image and the second image includes:

[0035] clearing the coordinate track contained in the first image to obtain a third image;

[0036] For any coordinate point in the target edge area, calculating the distance between the coordinate point and the first boundary line;

[0037] Matching the first weight and the second weight corresponding to the distance from a configured comparison table of different distances, different first weights, and different second weights;

[0038] Using the first weight and the second weight, weighted sum the pixel point of the third image at the coordinate point and the second pixel point of the second image at the coordinate point to obtain a fused pixel point;

[0039] The pixel points of the third image at the coordinate point are updated to the fused pixel points to obtain an image after edge optimization processing.

[0040] In a second aspect, the present invention provides an image edge optimization processing device, the device comprising:

[0041] An acquisition unit, configured to acquire the image to be processed obtained after the cutout and a coordinate track drawn by the user on the image to be processed;

[0042] a first processing unit, configured to process pixel points at different coordinate points of the coordinate track in the image to be processed according to a configured image processing mode, to obtain a first image containing the coordinate track;

[0043] a detection unit, configured to perform edge detection on the coordinate trajectory in the first image to obtain a plurality of edge curves;

[0044] a selection unit, configured to select a target edge curve from a plurality of edge curves according to the image processing mode;

[0045] A first determining unit is configured to determine a target edge region based on the target edge curve and a configured expansion radius; the target edge region includes a plurality of first pixel points;

[0046] a second processing unit, configured to perform blur processing on any first pixel point within the target edge area according to a configured blur processing parameter to obtain a second pixel point;

[0047] A second determining unit, configured to determine a second image based on each second pixel point;

[0048] A fusion unit is used to fuse the first image and the second image to obtain an image after edge optimization processing.

[0049] In a third aspect, the present invention provides an electronic device, comprising a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other via the communication bus;

[0050] Memory for storing computer programs;

[0051] The processor is configured to implement any of the methods described in the foregoing embodiments when executing the program stored in the memory.

[0052] In a fourth aspect, the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method described in any one of the aforementioned embodiments is implemented.

[0053] This application performs edge detection on the coordinate trajectory of the cutout image, expands the pixels of the relatively harsh edge parts, and then performs fuzzy feathering processing on the edge pixels to make the edges of the cutout image smooth and soft; this application greatly reduces the complexity of the cutout operation, and users do not need to learn professional image processing knowledge to achieve refined cutouts; through automated edge detection and Gaussian blur processing, the naturalness of the cutout results is greatly improved. At the same time, users can obtain nearly professional cutout effects on mobile devices without relying on traditional cumbersome PC tools and complex operations. On the basis of low maintenance and implementation costs, this application significantly improves the efficiency and quality of cutouts.

[0054] This application enables users to erase or restore specified areas of the image to be processed directly by touching the screen with their fingers; after the finger leaves the screen, the edges of the erased or restored images are automatically identified and feathered, making the cutout boundaries smoother and more natural. It closely combines user interaction with automated image processing algorithms (OpenCV edge detection and Gaussian blur), thereby achieving the purpose of simplifying the operation process and improving the cutout quality. BRIEF DESCRIPTION OF THE DRAWINGS

[0055] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the following is a brief introduction to the drawings required for use in the embodiments of the present application. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other relevant drawings can be obtained based on these drawings without creative work.

[0056] Figure 1 A schematic diagram of a flow chart of an image edge optimization processing method provided in an embodiment of the present application;

[0057] Figure 2 A schematic diagram of an image processed without using the edge optimization processing method provided in an embodiment of the present application;

[0058] Figure 3 A schematic diagram of an image processing method using an edge optimization processing method provided in an embodiment of the present application;

[0059] Figure 4 A schematic diagram of the structure of an image edge optimization processing device provided in an embodiment of the present application;

[0060] Figure 5 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0061] The following will be combined with the drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are only part of the embodiments of this application, not all of the embodiments. Based on the embodiments of this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.

[0062] The image edge optimization processing method provided in the embodiment of the present application is applied to a controller of an image edge optimization processing system, wherein the controller is a mobile device terminal; the mobile device terminal also includes a touch display screen; the touch display screen includes a first touch display area and a second touch display area;

[0063] The first touch display area includes a processing mode selection control, a fusion mode selection control, and a parameter configuration control, which are used by the user to select and configure the image processing mode, fusion mode, and processing parameters; the processing mode selection control is used to select the image processing mode as clear mode or restore mode; the fusion mode selection control is used to select the fusion mode of the first image and the second image; the fusion mode includes Alpha gradient fusion; the parameter configuration control is used to configure the expansion radius, blur processing parameters, neighborhood direction, and fusion parameters;

[0064] The second touch display area is used to display the image to be processed and the coordinate track drawn by the user on the image to be processed through the touch display screen;

[0065] Specifically, in response to a user selecting an image to be processed, the image to be processed is displayed in the second touch display area; in response to a user selecting an image processing mode in a processing mode selection control, a coordinate trajectory drawn by the user on the image to be processed in the second touch display area is obtained; according to the image processing mode selected by the user, pixels in the image to be processed located at different coordinate points of the coordinate trajectory are processed accordingly to obtain a first image including the coordinate trajectory; edge detection is performed on the coordinate trajectory in the first image to obtain multiple edge curves; according to the image processing mode selected by the user, a target edge curve is selected from the multiple edge curves; in response to a user configuring an expansion radius and a neighborhood direction in a parameter configuration control, a target edge area is determined based on the target edge curve and the configured expansion radius; in response to a user configuring a blur processing parameter in the parameter configuration control, for any first pixel in the target edge area, the first pixel is blurred according to the configured blur processing parameter to obtain a second pixel; and a second image is determined based on each second pixel; in response to a user selecting a fusion mode in a fusion mode selection control, the first image and the second image are fused according to the user selected fusion mode and the configured fusion parameters to obtain an image after edge optimization processing.

[0066] The preferred embodiments of the present application are described below in conjunction with the drawings in the specification. It should be understood that the preferred embodiments described herein are only used to illustrate and explain the present application and are not used to limit the present application. In addition, the embodiments and features in the embodiments of the present application can be combined with each other if there is no conflict.

[0067] Figure 1 This is a flow chart of an image edge optimization processing method provided in an embodiment of the present application. Figure 1 As shown, the method may include:

[0068] Step S110: Obtain the image to be processed after the cutout and the coordinate track drawn by the user on the image to be processed; process the pixel points at different coordinate points of the coordinate track in the image to be processed according to the configured image processing mode to obtain a first image containing the coordinate track.

[0069] Among them, the image to be processed includes two parts: the image body and the background area; the pixel value of each pixel in the background area is 0; the initial image to be processed obtained by cutting out the original image is displayed in the second touch display area of ​​the touch display screen; according to the user's touch operation on the touch display screen, the initial image to be processed is zoomed and translated to change the display position and display size of the initial image to be processed in the second touch display area; the coordinate trajectory drawn by the user in the second touch display area is obtained; wherein, the original image can be obtained by taking a photo of the mobile device terminal, or it can be an image stored in the memory of the mobile device; the cutting method can be any one or more of AI cutting, manual cutting or automatic cutting; the image to be processed is a bitmap, and the image to be processed can be displayed in the center of the touch display screen or the second touch display area through matrix transformation; the matrix is ​​changed according to the gesture to allow the image to be processed to perform operations such as zooming and translating, thereby improving the efficiency and convenience of user image processing.

[0070] Specifically, the coordinate trajectory is generated based on the different coordinate points touched by the user's finger in the second touch display area; the coordinate trajectory includes multiple coordinate points; when the user touches the image displayed on the touch display screen with his finger, the coordinate position of the finger touching the touch display screen can be obtained, and then the coordinate position of the screen coordinate mapped to the image, that is, the coordinate point, is obtained through the inverse matrix of the image transformation matrix; in the second touch display area, the user's drawing action from finger touching to finger lifting is a complete set of coordinate trajectory drawing actions. When the user completes a continuous drawing operation, that is, when the finger is lifted from the screen, it indicates that the trajectory drawing operation is completed; at this time, the pixel points at each coordinate point of the coordinate trajectory in the image to be processed are processed accordingly according to the processing mode selected by the user.

[0071] Furthermore, the image processing modes include: clear mode and restore mode;

[0072] When the image processing mode is the clearing mode, the pixel points at different coordinate points of the coordinate track in the image to be processed are processed according to the configured image processing mode, including: clearing the pixel points at different coordinate points of the coordinate track in the image to be processed to obtain a first image; wherein, clearing the pixel points includes: setting the transparency of the pixel points to a configured threshold so that the pixel points cannot be displayed in the current layer, or directly clearing the corresponding pixel points.

[0073] When the image processing mode is the restoration mode, the pixel points at different coordinate points in the coordinate trajectory in the image to be processed are processed according to the configured image processing mode, including: obtaining the original image to be cutout; for any coordinate point in the coordinate trajectory, obtaining the initial pixel point of the original image at the coordinate point and the third pixel point of the image to be processed at the coordinate point; restoring the third pixel point of the image to be processed at the coordinate point to the corresponding initial pixel point to obtain the first image.

[0074] Step S120: performing edge detection on the coordinate trajectory in the first image to obtain multiple edge curves; selecting a target edge curve from the multiple edge curves according to the image processing mode; and determining a target edge area based on the target edge curve and the configured expansion radius.

[0075] In an embodiment of the present application, an edge detection algorithm of OpenCV (such as a Canny operator, a Sobel operator, or other edge detection algorithms) is used to perform edge detection on the coordinate trajectory in the first image to obtain at least two edge curves: a first edge curve and a second edge curve; wherein the first edge curve is an edge curve close to the first image; and the second edge curve is an edge curve away from the first image.

[0076] In an embodiment of the present application, selecting a target edge curve from a plurality of edge curves according to an image processing mode includes:

[0077] When the image processing mode is the clear mode, determining the first edge curve as the target edge curve;

[0078] When the image processing mode is the restoration mode, the second edge curve is determined as the target edge curve;

[0079] The target edge curve includes a plurality of first pixel points.

[0080] In the embodiment of the present application, the expansion radius may also be referred to as the feathering radius or feathering band width. Its purpose is to determine the range of the target edge region. The user can configure the desired expansion radius in the parameter configuration control of the first touch display area according to actual needs. The target edge region is obtained by expanding the pixel coordinates by r pixels in each configured neighborhood direction. The expansion radius in different neighborhood directions can be configured to be the same or different to flexibly control the range of the transition region. The resulting transition region can be regarded as a "band-like" area, referred to as a "feather region".

[0081] Specifically, based on the target edge curve and the configured expansion radius, the target edge area is determined, including:

[0082] For any pixel coordinate, all pixels whose distance from the pixel coordinate in the configured neighborhood direction is no greater than the expansion radius are regarded as the adjacent pixels of the pixel coordinate; based on the adjacent pixels of different pixel coordinates, the target edge area is determined;

[0083] The expansion radius and neighborhood direction are configured by the user through the parameter configuration control; the neighborhood directions include two neighbors, four neighbors, and eight neighbors;

[0084] If the user selects two neighborhoods, for any pixel coordinate, all pixels in the two neighborhood directions (left and right) that are no more than the extension radius away from the pixel coordinate are considered as the neighboring pixels of the pixel coordinate;

[0085] If the user selects four neighborhoods, for any pixel coordinate, all pixels in the four neighborhood directions (up, down, left, and right) that are no more than the extension radius away from the pixel coordinate are considered as the neighboring pixels of the pixel coordinate;

[0086] If the user selects the eight-neighborhood area, for any pixel coordinate, all pixels in the eight-neighborhood directions (up, down, left, right, upper left, upper right, lower left, and lower right) whose distance to the pixel coordinate is no greater than the expansion radius will be regarded as the adjacent pixel points of the pixel coordinate.

[0087] The target edge area includes a first boundary line and a second boundary line; the first boundary line is a boundary line close to the first image; and the second boundary line is a boundary line far from the first image.

[0088] Step S130 : For any first pixel point in the target edge area, blur the first pixel point according to the configured blur processing parameters to obtain a second pixel point; and determine a second image based on each second pixel point.

[0089] In the embodiment of the present application, blurring the first pixel according to the configured blurring parameters includes:

[0090] Blurring the first pixel according to configured blur parameters to obtain a second pixel includes: generating a two-dimensional Gaussian kernel based on the Gaussian kernel size and standard deviation; performing a convolution operation on the first pixel using the two-dimensional Gaussian kernel to obtain the second pixel; wherein the blur parameters are configured by the user in the parameter configuration control of the first touch display area; the blur parameters include: Gaussian kernel size and standard deviation; limiting the Gaussian blur to the feathering band (i.e., blurring only the area within r pixels from the edge line) without affecting other parts of the image to avoid unnecessary blur loss in areas that should be sharp. First, a mask image of the same size as the original image is generated, whose value is only valid within the feathering band (e.g., 1 or a higher value) and is 0 outside the band. Then, a global Gaussian blur is performed on the original image, and the result is multiplied or mixed with the mask to retain only the blur effect of the feathering band.

[0091] In actual applications, when performing feather blur, an appropriate Gaussian filter kernel size (such as kSize) is selected and the corresponding standard deviation is set; users can dynamically adjust parameters such as the Gaussian blur kernel size and standard deviation on the touch display area to strike a balance between the degree of blur (smoothness) and loss of image detail.

[0092] In practical applications, for mobile devices, hardware performance limitations must be considered. Usually, adjusting the Gaussian kernel size within the range of 3\times 3 to 15\times 15 can meet most requirements.

[0093] Step S140: Fusing the first image and the second image to obtain an image after edge optimization processing.

[0094] Specifically, in response to the user selecting Alpha gradient fusion in the fusion mode selection control, the fusion parameters input by the user in the first touch display area are obtained; the coordinate trajectory contained in the first image is cleared to obtain a third image; for any coordinate point in the target edge area, the distance between the coordinate point and the first boundary line is calculated; from a comparison table of configured different distances, different first weights and different second weights, the first weight and second weight corresponding to the distance are matched; using the first weight and the second weight, the pixel point of the third image at the coordinate point and the second pixel point of the second image at the coordinate point are weightedly summed to obtain the fused pixel point; the pixel point of the third image at the coordinate point is updated to the fused pixel point to obtain the image after edge optimization processing.

[0095] Among them, in the comparison table of different configured distances, different first weights and different second weights, the sum of the first weight and the second weight corresponding to any distance is 1; the smaller the distance (that is, the closer to the third image), the greater the first weight and the smaller the second weight, the higher the pixel value of the pixel point after the coordinate point is fused, and the lower the transparency; the greater the distance (that is, the farther from the third image), the smaller the first weight and the greater the second weight, the lower the pixel value of the pixel point after the coordinate point is fused, and the higher the transparency, thereby forming a soft transition effect.

[0096] Specifically, after completing the Gaussian blur, the blurred area is synthesized with the image to be processed that does not contain the coordinate trajectory (alpha blend); if Alpha gradient interpolation is used, the corresponding fusion weight needs to be calculated for the distance of each pixel in the feathering band, so that the pixels closer to the erased area have higher transparency, and the pixels closer to the retained area (image body) have lower transparency, forming a soft transition effect; the synthesized image is updated and displayed on the interface so that the user can view the effect in real time; if the effect is not ideal, the feathering parameters can be modified again or re-apply.

[0097] In practice, users can dynamically adjust the feathering intensity using a progress bar. Users can perform multiple erase operations, triggering the "edge detection + feathering" process after each application. This process increases the transparency of pixels closer to the erased area, while increasing the opacity of pixels closer to the retained area, creating a smooth alpha gradient that gradually refines the edge effect. Once the user confirms the final effect, the processed result can be exported as an image format that supports an alpha channel.

[0098] like Figure 2 As shown, the image obtained without using the edge optimization processing method of the image provided by the embodiment of the present application has a relatively hard edge and a poor display effect; Figure 3 As shown, the image obtained by the edge optimization processing method of the image provided by the embodiment of the present application has softer edges and high image quality.

[0099] In one embodiment of the present application, a method for optimizing image edges includes:

[0100] Acquire images from the photo album or camera, and choose to use AI cutout processing on the image; users can directly erase and restore the image on the touch screen; after the user lifts their finger, use OpenCV to perform edge detection and Gaussian blur feathering on the current image; the processed image is displayed in real time on the interface, and the user is allowed to compare and fine-tune the blur radius and parameters to obtain a satisfactory cutout effect; finally, the natural and smooth cutout result image is saved as an image that supports Alpha transparency.

[0101] In actual applications, taking into account the performance impact, edge detection processing will be performed when the user lifts his finger (in theory, real-time edge detection and processing are better when the user is smearing) - to be expanded; after the feathering processing is completed, the user can view the cutout effect in real time on the interface: the transition between the erased area and the retained area will become soft, with no obvious hard edges; the user can adjust the feathering radius, Gaussian blur parameters (such as kernel size) or repeat the smearing operation according to actual needs until a satisfactory cutout effect is obtained.

[0102] Corresponding to the above method, the embodiment of the present application also provides an image edge optimization processing device, such as Figure 4 As shown, the edge optimization processing device of the image includes:

[0103] An acquisition unit 410 is configured to acquire the image to be processed obtained after the cutout and the coordinate track drawn by the user on the image to be processed;

[0104] A first processing unit 420 is configured to process pixels at different coordinate points of the coordinate track in the image to be processed according to a configured image processing mode to obtain a first image including the coordinate track;

[0105] a detection unit 430, configured to perform edge detection on the coordinate trajectory in the first image to obtain a plurality of edge curves;

[0106] A selection unit 440 is configured to select a target edge curve from the plurality of edge curves according to an image processing mode;

[0107] A first determining unit 450 is configured to determine a target edge region based on the target edge curve and the configured expansion radius; the target edge region includes a plurality of first pixel points;

[0108] The second processing unit 460 is configured to perform blur processing on any first pixel point within the target edge area according to the configured blur processing parameters to obtain a second pixel point;

[0109] A second determining unit 470 is configured to determine a second image based on each second pixel point;

[0110] The fusion unit 480 is configured to fuse the first image and the second image to obtain an image after edge optimization processing.

[0111] The functions of each functional unit of the image edge optimization processing device provided in the above embodiments of the present application can be realized through the above method steps. Therefore, the specific working process and beneficial effects of each unit in the image edge optimization processing device provided in the embodiments of the present application will not be repeated here.

[0112] The present application also provides an electronic device, such as Figure 5As shown, it includes a processor 510 , a communication interface 520 , a memory 530 and a communication bus 540 , wherein the processor 510 , the communication interface 520 , and the memory 530 communicate with each other via the communication bus 540 .

[0113] Memory 530, for storing computer programs;

[0114] The processor 510 is configured to execute the program stored in the memory 530 by performing the following steps:

[0115] Obtain the image to be processed after the cutout and the coordinate trajectory drawn by the user on the image to be processed;

[0116] According to the configured image processing mode, pixel points at different coordinate points of the coordinate track in the image to be processed are processed to obtain a first image containing the coordinate track;

[0117] Performing edge detection on the coordinate trajectory in the first image to obtain a plurality of edge curves;

[0118] According to the image processing mode, a target edge curve is selected from multiple edge curves;

[0119] Determining a target edge region based on a target edge curve and a configured expansion radius; the target edge region includes a plurality of first pixel points;

[0120] For any first pixel point in the target edge area, blur the first pixel point according to the configured blur processing parameters to obtain a second pixel point;

[0121] Determine a second image based on each second pixel point;

[0122] The first image and the second image are fused to obtain an image after edge optimization processing.

[0123] The communication bus mentioned above can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus. This communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is used in the figure, but this does not mean that there is only one bus or only one type of bus.

[0124] The communication interface is used for communication between the above electronic device and other devices.

[0125] The memory may include random access memory (RAM) or non-volatile memory (NVM), such as at least one disk storage. Alternatively, the memory may be at least one storage device located away from the processor.

[0126] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be 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, and discrete hardware components.

[0127] The implementation methods and beneficial effects of the various components of the electronic device in the above embodiments to solve the problems can be found in Figure 1 The various steps in the embodiment shown are implemented, therefore, the specific working process and beneficial effects of the electronic device provided by the embodiment of the present application are not repeated here.

[0128] In another embodiment provided in the present application, a computer-readable storage medium is also provided, in which instructions are stored. When the computer-readable storage medium is run on a computer, the computer executes any one of the image edge optimization processing methods in the above embodiments.

[0129] In another embodiment provided by the present application, a computer program product including instructions is also provided, which, when executed on a computer, enables the computer to execute any one of the image edge optimization processing methods in the above embodiments.

[0130] Those skilled in the art will appreciate that the embodiments of the present application can be provided as methods, systems, or computer program products. Therefore, the embodiments of the present application can be implemented in the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Furthermore, the embodiments of the present application can be implemented in the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0131] The embodiments of the present application are described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the steps in the process. Figure 1 a process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0132] These computer program instructions may also be stored in a computer readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 a process or multiple processes and / or boxes Figure 1 The function specified in one or more boxes.

[0133] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing the instructions executed on the computer or other programmable device for implementing the process. Figure 1 a process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.

[0134] Although preferred embodiments of the present invention have been described, those skilled in the art may make additional changes and modifications to these embodiments once they become aware of the basic creative concepts. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the embodiments of the present invention.

[0135] Obviously, those skilled in the art can make various changes and modifications to the embodiments of the present application without departing from the spirit and scope of the embodiments of the present application. Thus, if these modifications and variations of the embodiments of the present application fall within the scope of the claims and their equivalents, the embodiments of the present application are also intended to include these modifications and variations.

Claims

1. A method for edge optimization processing of an image, characterized in that: The method comprises: Obtaining the image to be processed obtained after the cutout and the coordinate trajectory drawn by the user on the image to be processed; Processing pixels at different coordinate points of the coordinate track in the image to be processed according to the configured image processing mode to obtain a first image containing the coordinate track; Performing edge detection on the coordinate trajectory in the first image to obtain a plurality of edge curves; selecting a target edge curve from a plurality of edge curves according to the image processing mode; Determining a target edge area based on the target edge curve and the configured expansion radius; the target edge area includes a plurality of first pixel points; For any first pixel point in the target edge area, blur the first pixel point according to the configured blur processing parameters to obtain a second pixel point; Determine a second image based on each second pixel point; The first image and the second image are fused to obtain an image after edge optimization processing.

2. The method according to claim 1, wherein The image processing modes include a clear mode and a restore mode.

3. The method according to claim 2, wherein When the image processing mode is the clear mode, processing the pixel points at different coordinate points of the coordinate track in the image to be processed according to the configured image processing mode includes: Clearing the pixels located at different coordinate points of the coordinate track in the image to be processed to obtain a first image; When the image processing mode is the restoration mode, processing the pixel points at different coordinate points of the coordinate track in the image to be processed according to the configured image processing mode includes: Get the original image to be cut out; For any coordinate point in the coordinate trajectory, obtaining an initial pixel point of the original image at the coordinate point and a third pixel point of the image to be processed at the coordinate point; The third pixel point of the image to be processed at the coordinate point is restored to the corresponding initial pixel point to obtain a first image.

4. The method according to claim 2, wherein The edge curve includes a first edge curve and a second edge curve; the first edge curve is an edge curve close to the first image; the second edge curve is an edge curve away from the first image; When the image processing mode is the clear mode, selecting a target edge curve from a plurality of edge curves according to the image processing mode includes: determining the first edge curve as the target edge curve; When the image processing mode is the restoration mode, selecting a target edge curve from a plurality of edge curves according to the image processing mode includes: The second edge curve is determined as the target edge curve.

5. The method according to claim 1, wherein The target edge curve includes a plurality of pixel coordinates; Determining a target edge area based on the target edge curve and the configured expansion radius includes: For any pixel coordinate, all pixels whose distance from the pixel coordinate in the configured neighborhood direction is no greater than the expansion radius are regarded as the neighboring pixels of the pixel coordinate; The target edge area is determined based on the adjacent pixels of different pixel coordinates.

6. The method according to claim 1, wherein The blur processing parameters include: Gaussian kernel size and standard deviation; Performing blur processing on the first pixel according to configured blur processing parameters to obtain a second pixel, including: generating a two-dimensional Gaussian kernel according to the Gaussian kernel size and standard deviation; A convolution operation is performed on the first pixel point using the two-dimensional Gaussian kernel to obtain a second pixel point.

7. The method according to claim 6, wherein The target edge area includes a first boundary line; the first boundary line is a boundary line close to the first image; The step of fusing the first image and the second image includes: clearing the coordinate track contained in the first image to obtain a third image; For any coordinate point in the target edge area, calculating the distance between the coordinate point and the first boundary line; Matching the first weight and the second weight corresponding to the distance from a configured comparison table of different distances, different first weights, and different second weights; Using the first weight and the second weight, weighted sum the pixel point of the third image at the coordinate point and the second pixel point of the second image at the coordinate point to obtain a fused pixel point; The pixel points of the third image at the coordinate point are updated to the fused pixel points to obtain an image after edge optimization processing.

8. An image edge optimization processing device, characterized in that: The device comprises: An acquisition unit, configured to acquire the image to be processed obtained after the cutout and a coordinate track drawn by the user on the image to be processed; a first processing unit, configured to process pixel points at different coordinate points of the coordinate track in the image to be processed according to a configured image processing mode, to obtain a first image containing the coordinate track; a detection unit, configured to perform edge detection on the coordinate trajectory in the first image to obtain a plurality of edge curves; a selection unit, configured to select a target edge curve from a plurality of edge curves according to the image processing mode; A first determining unit is configured to determine a target edge region based on the target edge curve and a configured expansion radius; the target edge region includes a plurality of first pixel points; a second processing unit, configured to perform blur processing on any first pixel point within the target edge area according to a configured blur processing parameter to obtain a second pixel point; A second determining unit, configured to determine a second image based on each second pixel point; A fusion unit is used to fuse the first image and the second image to obtain an image after edge optimization processing.

9. An electronic device, characterized in that: The electronic device includes a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus; Memory for storing computer programs; A processor, configured to implement the method according to any one of claims 1 to 7 when executing a program stored in a memory.

10. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.

Citation Information

Patent Citations

  • Optimizing method of image border

    CN104331868A

  • Image processing method and device, terminal equipment and computer readable storage medium

    CN114841864A

  • Image processing method and device, electronic equipment, chip and storage medium

    CN117635634A

  • Image processing method and device and electronic equipment

    CN119850664A

  • Image processing method and electronic device

    WO2024093854A1