Customized cutout method, device, system and medium based on B-spline curve
By using B-spline curves to customize the cutout in image processing, the problem of insufficient flexibility and smoothness of cutout in the prior art is solved, and flexible and smooth cutout operations on any terminal device are achieved.
Patent Information
- Application Number
- CN202110121104.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-01-28
- Publication Date
- 2025-02-18
- Estimated Expiration
- 2041-01-28
AI Technical Summary
In the prior art, custom cutouts have poor flexibility and fluency, especially because the calculation volume of the Bezier curve is large, resulting in lag and crash.
Using a custom cutout method based on B-spline curve, a closed B-spline curve is drawn on the target diagram through detection cutout operations. The curve includes multiple segments of sequentially spliced interval curves, allowing users to adjust the curve shape through interactive operations.
It realizes flexible and smooth custom cutouts by adjusting the B-spline on any terminal device, avoiding lags and crashes, and improving the flexibility and operation experience of cutouts.
Smart Images

Figure CN112819839B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image processing technology, and in particular to a custom cutout method, device, system and medium based on a B-spline curve. Background Art
[0002] Currently, cutout technology is often needed in image processing. Most of the current cutout technologies are developed based on third-order Bezier curves. There are certain disadvantages in using Bezier curves. For example, once the feature polygon is determined, the order of the curve is determined. Local modifications will cause the entire curve to change, making the selection area not flexible enough during custom cutouts. In addition, due to the large amount of calculation of Bezier curves, it often causes freezes or even crashes.
[0003] Therefore, the prior art still needs to be improved and developed. Summary of the invention
[0004] In view of the above-mentioned deficiencies in the prior art, an object of the present invention is to provide a custom cutout method, device, system and medium based on B-spline curves, aiming to solve the problem of poor flexibility and fluency of custom cutouts in the prior art.
[0005] The technical solution of the present invention is as follows:
[0006] A custom cutout method based on B-spline curve comprises the following steps:
[0007] When a cutout operation is detected, a closed B-spline curve is drawn on the target image according to the cutout operation, wherein the B-spline curve includes a plurality of interval curves that are sequentially spliced;
[0008] When the shape of the B-spline curve is a target shape, determining a B-spline curve region currently having the target shape as a cutout region;
[0009] Obtain corresponding cutout pixels in the target image according to the cutout area, and generate a cutout image according to the cutout pixels.
[0010] In the custom cutout method based on B-spline curve, when a cutout operation is detected, a closed B-spline curve is drawn on the target image according to the cutout operation, and the B-spline curve includes multiple interval curves spliced in sequence, including:
[0011] Detect the user's movement trajectory on the cutout layer;
[0012] Collecting a set of coordinate points corresponding to the moving trajectory;
[0013] A B-spline data model is established, and after the coordinate point set is input into the B-spline data model, a closed B-spline curve is generated on the cutout layer.
[0014] In the custom cutout method based on a B-spline curve, when the shape of the B-spline curve is a target shape, determining the B-spline curve region currently having the target shape as the cutout region includes:
[0015] Adjusting the shape of the closed B-spline curve according to an interactive operation input by a user;
[0016] When the shape of the B-spline curve is a target shape, a B-spline curve region currently having the target shape is determined as a cutout region.
[0017] In the custom cutout method based on B-spline curve, the step of adjusting the shape of the closed B-spline curve according to the interactive operation input by the user includes:
[0018] Detect user input interactions;
[0019] Dynamically modifying the parameters of the coordinate point set according to the interactive operation;
[0020] The shape of the closed B-spline curve is adjusted according to the dynamically modified set of coordinate points.
[0021] In the custom cutout method based on B-spline curve, the dynamically modifying the parameters of the coordinate point set according to the interactive operation specifically includes:
[0022] According to the dynamic trajectory of the interactive operation, the number of coordinate points in the coordinate point set and the coordinate value of each coordinate point are modified accordingly.
[0023] In the custom cutout method based on B-spline curve, the interactive operation includes curve dragging and / or curve squeezing and / or curve zooming in and / or curve shrinking.
[0024] In the custom cutout method based on B-spline curve, before drawing a closed B-spline curve on the target image according to the cutout operation when the cutout operation is detected, the method further includes:
[0025] Create a new cutout layer on the target image to draw the cutout curve.
[0026] Another embodiment of the present invention further provides a custom cutout device based on a B-spline curve, the device comprising:
[0027] A drawing module, used for drawing a closed B-spline curve on a target image according to the cutout operation when a cutout operation is detected, wherein the B-spline curve includes a plurality of interval curves spliced together;
[0028] A selection module, used for determining the B-spline curve region having the target shape as a cutout region when the shape of the B-spline curve is the target shape;
[0029] The cutout module is used to obtain corresponding cutout pixels in the target image according to the cutout area, and generate a cutout image according to the cutout pixels.
[0030] Another embodiment of the present invention further provides a custom cutout system based on a B-spline curve, the system comprising at least one processor; and
[0031] a memory communicatively connected to the at least one processor; wherein,
[0032] The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the above-mentioned custom cutout method based on B-spline curve.
[0033] Another embodiment of the present invention further provides a non-volatile computer-readable storage medium, which stores computer-executable instructions. When the computer-executable instructions are executed by one or more processors, the one or more processors can execute the above-mentioned custom cutout method based on B-spline curve.
[0034] Another embodiment of the present invention further provides a computer program product, which includes a computer program stored on a non-volatile computer-readable storage medium, and the computer program includes program instructions. When the program instructions are executed by a processor, the processor executes the above-mentioned custom cutout method based on B-spline curves.
[0035] Beneficial effects: The present invention discloses a custom cutout method, device, system and medium based on a B-spline curve. Compared with the prior art, the embodiments of the present invention perform cutout by establishing an adjustable closed B-spline curve on a target image according to a detected cutout operation. Flexible and smooth custom cutout can be achieved on any terminal device by adjusting the B-spline curve. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] The present invention will be further described below with reference to the accompanying drawings and embodiments, in which:
[0037] Figure 1 A flowchart of a preferred embodiment of a custom cutout method based on a B-spline curve provided by the present invention;
[0038] Figure 2 It is a schematic diagram of the structure of a third-order Bezier curve;
[0039] Figure 3It is a schematic diagram of the closing process of the B-spline curve;
[0040] Figure 4 A flowchart of a first application embodiment of a custom cutout method based on a B-spline curve provided by the present invention;
[0041] Figure 5 A flowchart of a second application embodiment of the custom cutout method based on B-spline curve provided by the present invention;
[0042] Figure 6 A schematic diagram of functional modules of a preferred embodiment of a custom cutout device based on a B-spline curve provided by the present invention;
[0043] Figure 7 A schematic diagram of the hardware structure of a preferred embodiment of the custom cutout system based on B-spline curves provided by the present invention. DETAILED DESCRIPTION
[0044] In order to make the purpose, technical solution and effect of the present invention clearer and more specific, the present invention is further described in detail below. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention. The embodiments of the present invention are described below in conjunction with the accompanying drawings.
[0045] See also Figure 1 , Figure 1 The flowchart of the preferred embodiment of the custom cutout method based on B-spline curve provided by the present invention. Figure 1 As shown, it includes the following steps:
[0046] S100, when a cutout operation is detected, drawing a closed B-spline curve on the target image according to the cutout operation, wherein the B-spline curve includes a plurality of interval curves that are sequentially spliced;
[0047] S200, when the shape of the B-spline curve is a target shape, determining a B-spline curve region currently having the target shape as a cutout region;
[0048] S300, obtaining corresponding cutout pixels in the target image according to the cutout area, and generating a cutout image according to the cutout pixels.
[0049] In this embodiment, when performing a cutout operation, the cutout operation input on the target image is first detected, and a closed B-spline curve is drawn according to the cutout operation. Specifically, the cutout operation can be manually input by the user or automatically detected by the system when the automatic identification cutout function is triggered. Compared with the conventional Bezier curve, the B-spline curve has the advantages of reduced calculation amount and smoother curve, which can ensure the smoothness of drawing the cutout curve. Specifically, the B-spline curve includes a plurality of interval curves spliced in sequence, that is, the entire curve is connected by interval curves one by one, and is generated by piecewise continuous multi-segment. The calculation amount of the B-spline curve is less than that of the Bezier curve because the basic function table of the B-spline curve is an array, which is only calculated once. When processing closure, it is only necessary to process the connection relationship between the points near the head and the tail, thereby reducing a lot of calculation workload. Therefore, it is determined from the algorithm principle that under the condition of ensuring the smooth connection of the closed curve, the B-spline curve has more advantages than the third-order Bezier curve.
[0050] Specifically, if Figure 2 As shown, it is a structural diagram of a third-order Bezier curve. The formula of the third-order Bezier curve is as follows:
[0051] B(t)=P0(1-t) 3 +3P1t(1-t) 2 +3P2t 2 (1-t)+P3t 3 , t∈[0,1]
[0052] The four points P0, P1, P2, and P3 define a third-order square Bezier curve, and t is the percentage of the line from the starting point to the end point, such as Figure 2 As shown, the bottom curve is the final Bezier curve B(t).
[0053] In the coordinate point set, it is necessary to ensure that all connection points can be smoothly connected. For example, there are four points A, B, C, and D. When connecting point A and point B, you can substitute the formula, P0=A, P3=B, where control points P1 and P2 need to be calculated. These two control points need to ensure the connection between A to B to C. The general calculation logic is relatively complicated and varies depending on the specific usage scenario. Then substitute B and C into the formula, continue to calculate the control points, and finally substitute C and D into the formula to calculate, and finally get the Bezier curve that can connect the four points A, B, C, and D.
[0054] The B-spline curve used in this embodiment does not need to consider how to ensure the continuity of the connection line. It is a generalization of the Bezier curve. Figure 3 As shown in Figure 2, when dealing with closure, the B-spline curve only needs to deal with the connection relationship between the points near the beginning and the end, that is, Figure 3(a) in the figure finds the closest point near the end (the two points in the rectangular box), and closes these two points to get Figure 3 The points in the circle (b) are then Figure 3 (b) in the figure continues to find the closest point near the end (the two points in the rectangular box), close it and then Figure 3 In (c) of the figure, a closed point is added inside the circle, and then Figure 3 (c) in the figure continues to find the closest point near the end (the two points in the rectangular box), and then closes it to get Figure 3 (d) in the figure is to achieve curve closure, without considering how to ensure the continuity of the connection, thus reducing a lot of calculation workload. Under the same condition of ensuring the smooth connection of the closed curve, the drawing efficiency and flexibility of the B-spline curve are higher.
[0055] Then, when the shape of the B-spline curve is the target shape, the B-spline curve currently having the target shape is determined as the cutout area, that is, the shape of the B-spline curve can be flexibly changed until its shape meets the current cutout requirement, and the current B-spline curve area is determined as the cutout area to complete the selection process. Since the B-spline curve adopts a multi-segment splicing method, the overall shape of the curve will not be affected when the local shape is flexibly changed, which is more conducive to the accuracy and flexibility of the cutout selection; then, according to the cutout area, the corresponding cutout pixels can be obtained from the target image and a cutout image can be generated, so as to realize a flexible custom cutout process, that is, the B-spline curve drawn in this embodiment is a closed curve that can be deformed dynamically. Based on the calculation characteristics of the B-spline curve, a smooth operation experience is also provided when the shape is adjusted, thus avoiding the occurrence of freezes or even flashbacks.
[0056] Furthermore, before drawing a closed B-spline curve on the target graph according to the cutout operation when the cutout operation is detected, the method further includes:
[0057] Create a new cutout layer on the target image to draw the cutout curve.
[0058] In this embodiment, the cutout curve, i.e., the closed B-spline curve mentioned above, is drawn on a newly created cutout layer. When using an overlay layer for cutout, after adjusting the B-spline curve to obtain the cutout area, the cutout image can be output by overlapping the layers, cutting out the union of the opaque pixels in the two layers and retaining the background pixels, thereby avoiding irreversible damage to the target image due to operational errors when drawing the cutout directly on the target image.
[0059] Furthermore, when a cutout operation is detected, a closed B-spline curve is drawn on the target image according to the cutout operation, and the B-spline curve includes a plurality of interval curves that are sequentially spliced, including:
[0060] Detect the user's movement trajectory on the cutout layer;
[0061] Collecting a set of coordinate points corresponding to the moving trajectory;
[0062] A B-spline data model is established, and after the coordinate point set is input into the B-spline data model, a closed B-spline curve is generated on the cutout layer.
[0063] In this embodiment, the cutout operation can be a moving trajectory input by the user on the newly created cutout layer, such as a moving trajectory input by clicking and sliding a mouse, or a moving trajectory input by directly touching and sliding a finger on the touch screen; or the cutout operation can also be a moving trajectory automatically input by the system on the cutout layer when automatic cutout is turned on according to automatic recognition results, such as face recognition results, and a corresponding set of coordinate points is collected according to control points such as touch points or click positions contained in the moving trajectory, and then a closed B-spline curve is generated on the cutout layer after processing the control points contained in the coordinate point set through the established B-spline data model, so as to achieve smooth and fluent cutout curve drawing and enhance the experience of the cutout operation.
[0064] In specific implementation, the B-spline data model includes the basic functions and curve calculation formula of the B-spline curve, wherein the basic function expression is:
[0065]
[0066] Where knot is the node table, knot i represents the i-th node in the node table, B i,deg (t) represents the element of the basic function table. The basic function table is an array. The parameters i and deg represent the i-th element and order respectively.
[0067] This is a recursive function, so there is also a base value:
[0068]
[0069] The calculation formula of the B-spline curve is:
[0070]
[0071] Where P i is the control point, n is the number of control points, i is the i-th control point, B i,deg (t) is the basic function.
[0072] Further, when the shape of the B-spline curve is a target shape, determining a B-spline curve region currently having the target shape as a cutout region comprises:
[0073] Adjusting the shape of the closed B-spline curve according to an interactive operation input by a user;
[0074] When the shape of the B-spline curve is a target shape, a B-spline curve region currently having the target shape is determined as a cutout region.
[0075] In this embodiment, after drawing a closed B-spline curve, the user can input corresponding interactive operations as needed to arbitrarily adjust the shape of the curve until the shape of the B-spline curve meets the cutout requirements, that is, a B-spline curve with a target shape is obtained, and the current B-spline curve area with the target shape is determined as the cutout area to implement the cutout selection process. Since the B-spline curve has a small amount of calculation and can be adjusted locally, a smooth and burr-free effect can always be maintained during the process of adjusting the curve shape, thereby ensuring the accuracy and smoothness of the cutout selection.
[0076] In a specific implementation, the interactive operation includes curve dragging and / or curve squeezing and / or curve enlargement and / or curve reduction, that is, the user can perform one or more interactive operations of dragging, squeezing, enlarging, and reducing on the closed B-spline curve to adjust the shape of the curve. Of course, other interactive operations can be added as needed, such as copying, flipping, mirroring, etc., and the present invention is not limited to this.
[0077] Further, adjusting the shape of the closed B-spline curve according to the interactive operation input by the user includes:
[0078] Detect user input interactions;
[0079] Dynamically modifying the parameters of the coordinate point set according to the interactive operation;
[0080] The shape of the closed B-spline curve is adjusted according to the dynamically modified set of coordinate points.
[0081] In this embodiment, when adjusting the shape of the curve, the interactive operation input by the user is first detected, and the parameters of the coordinate point set are dynamically modified according to the interactive operation. That is, the coordinate point set in this embodiment is dynamically changeable. Since the B-spline curve is generated according to the coordinate point set, the parameters of the coordinate point set can be dynamically modified to achieve real-time curve shape adjustment, and a dynamically deformable B-spline curve is obtained. This dynamically changing optimization logic can greatly improve the operating smoothness and clipping flexibility, and enhance the clipping product experience.
[0082] Furthermore, dynamically modifying the parameters of the coordinate point set according to the interactive operation specifically includes:
[0083] According to the dynamic trajectory of the interactive operation, the number of coordinate points in the coordinate point set and the coordinate value of each coordinate point are modified accordingly.
[0084] In this embodiment, the dynamic modification of the coordinate point set is performed according to the dynamic trajectory of the interactive operation. The dynamic change of the point set can be achieved by correspondingly modifying the number of coordinate points in the coordinate point set and the coordinate value of each coordinate point according to the dynamic trajectory. For example, when the user inputs a curve dragging operation, the coordinate value of each coordinate point is modified according to its touch point and dragging direction, so as to obtain a curve that moves synchronously with the curve dragging operation; when the user inputs a curve zoom-in operation, it is necessary to stretch outward at this time, and the number of coordinate points in the coordinate point set is synchronously increased according to the zoom-in ratio; when the user inputs a curve zoom-out operation, it is necessary to accumulate inward at this time, and the number of coordinate points in the coordinate point set is synchronously reduced according to the zoom-out ratio. Therefore, by continuously and dynamically updating the coordinate point set of the curve, a smooth and smooth curve deformation effect is achieved, ensuring that the user can accurately and smoothly adjust the cutout curve when customizing the cutout, thereby realizing a flexible and non-stuttering custom cutout process.
[0085] To better understand the custom cutout process in the present invention, the following Figure 4 and Figure 5 , the implementation process of the custom cutout method provided by the present invention is described by taking a specific application example:
[0086] like Figure 4 As shown, in the first application embodiment, first, a cutout layer is placed, and a closed curve with a smooth curve is drawn on the layer; then, an interactive operation is input to adjust the cutout range. Specifically, the curve can be deformed by squeezing and dragging the curve, the curve edge can be dragged to stretch the curve, the curve edge can be squeezed to shrink the curve, the curve can be enlarged to reduce the curve deformation granularity, and the curve can be reduced to increase the curve deformation granularity, and during the deformation process, the curve is ensured to be always smooth and without burrs; then, after the curve shape becomes the target shape, a picture of the curve shape is cut out from the background picture, that is, a cutout picture is generated.
[0087] like Figure 5As shown, in the second application embodiment, when adjusting the curve, the smooth change of the curve is achieved by the dynamic change of the B-spline curve coordinate point set. First, the set of touch points on the cutout layer is collected, and then the B-spline data model is established to draw a closed B-spline curve. The granularity factor of the operation curve can be zoomed in and out and modified according to the interactive operation. Specifically, when one of the coordinate points is touched and dragged, if it is stretched out of the circle, the coordinate points are proportionally added to the set. If it is squeezed inward, the coordinate points in the set are proportionally reduced. In this way, a new coordinate point set is formed, and a new curve is obtained after the new coordinate point set is re-established with the data model. The shape adjustment of the B-spline curve is completed by dynamically adjusting the coordinate point set. When it is adjusted to the target shape, the layer overlaps, the union pixels of the opaque pixels in the two images are cut out, and the pixels of the background image are retained. The pixels of the curve are discarded and the cutout image is output.
[0088] It can be seen from the above method embodiments that the custom cutout method based on B-spline curve provided by the present invention performs cutout by establishing an adjustable closed B-spline curve on the target image according to the detected cutout operation, and flexible and smooth custom cutout can be achieved on any terminal device by adjusting the B-spline curve.
[0089] It should be noted that there is not necessarily a certain order between the above-mentioned steps. A person skilled in the art can understand, based on the description of the embodiments of the present invention, that in different embodiments, the above-mentioned steps may have different execution orders, that is, they may be executed in parallel, may be executed interchangeably, and so on.
[0090] Another embodiment of the present invention provides a custom cutout device based on a B-spline curve, such as Figure 6 As shown, the device 1 comprises:
[0091] A drawing module 11, used for drawing a closed B-spline curve on a target image according to the cutout operation when a cutout operation is detected, wherein the B-spline curve includes a plurality of interval curves that are sequentially spliced;
[0092] A selection module 12, configured to determine a B-spline curve region having a target shape as a cutout region when the shape of the B-spline curve is a target shape;
[0093] The cutout module 13 is used to obtain corresponding cutout pixels in the target image according to the cutout area, and generate a cutout image according to the cutout pixels.
[0094] The drawing module 11, the area selection module 12 and the cutout module 13 are connected in sequence. For specific implementation methods, please refer to the corresponding method embodiments above, which will not be described in detail here.
[0095] Furthermore, the drawing module 11 includes:
[0096] A detection unit, used for detecting the moving track on the cutout layer;
[0097] A collection unit, used for collecting a set of coordinate points corresponding to the movement trajectory;
[0098] The drawing unit is used to establish a B-spline data model, and generate a closed B-spline curve on the cutout layer after inputting the coordinate point set into the B-spline data model.
[0099] Furthermore, the area selection module 12 includes:
[0100] An adjusting unit, configured to adjust the shape of the closed B-spline curve according to an interactive operation input by a user;
[0101] The area selection unit is used to determine the B-spline curve area currently having the target shape as the cutout area when the shape of the B-spline curve is the target shape.
[0102] Furthermore, the adjustment unit includes:
[0103] A detection subunit, used to detect interactive operations input by a user;
[0104] A dynamic modification subunit, used for dynamically modifying the parameters of the coordinate point set according to the interactive operation;
[0105] The shape adjustment subunit is used to adjust the shape of the closed B-spline curve according to the dynamically modified coordinate point set.
[0106] Furthermore, the dynamic modification subunit is specifically used to modify the number of coordinate points in the coordinate point set and the coordinate value of each coordinate point according to the dynamic trajectory of the interactive operation.
[0107] Furthermore, the custom cutout device based on B-spline curve also includes:
[0108] The layer creation module is used to create a new cutout layer on the target image for drawing the cutout curve.
[0109] Another embodiment of the present invention provides a custom cutout system based on B-spline curves, such as Figure 7 As shown, the system 10 includes:
[0110] One or more processors 110 and memory 120, Figure 7 A processor 110 is used as an example for description. The processor 110 and the memory 120 may be connected via a bus or other means. Figure 7 The example of connecting through bus is taken in the following.
[0111] The processor 110 is used to complete various control logics of the system 10, and it can be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA), a single-chip microcomputer, an ARM (Acorn RISC Machine) or other programmable logic device, a discrete gate or transistor logic, a discrete hardware component, or any combination of these components. In addition, the processor 110 can also be any traditional processor, microprocessor or state machine. The processor 110 can also be implemented as a combination of computing devices, for example, a combination of a DSP and a microprocessor, a plurality of microprocessors, one or more microprocessors combined with a DSP and / or any other such configuration.
[0112] The memory 120, as a non-volatile computer-readable storage medium, can be used to store non-volatile software programs, non-volatile computer executable programs and modules, such as program instructions corresponding to the custom cutout method based on B-spline curves in the embodiment of the present invention. The processor 110 executes various functional applications and data processing of the system 10 by running the non-volatile software programs, instructions and units stored in the memory 120, that is, implementing the custom cutout method based on B-spline curves in the above method embodiment.
[0113] The memory 120 may include a program storage area and a data storage area, wherein the program storage area may store an operating system and an application required by at least one function; the data storage area may store data created according to the use of the system 10, etc. In addition, the memory 120 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other non-volatile solid-state storage device. In some embodiments, the memory 120 may optionally include a memory remotely arranged relative to the processor 110, and these remote memories may be connected to the system 10 via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0114] One or more units are stored in the memory 120, and when executed by one or more processors 110, the custom cutout method based on the B-spline curve in any of the above method embodiments is executed, for example, the above described Figure 1 The method comprises steps S100 to S300.
[0115] An embodiment of the present invention provides a non-volatile computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions, and the computer-executable instructions are executed by one or more processors, for example, to execute the above-described Figure 1 The method comprises steps S100 to S300.
[0116] As an example, the non-volatile storage medium can include a read-only memory (ROM), a programmable ROM (PROM), an electrically programmable ROM (EPROM), an electrically erasable ROM (EEPROM), or a flash memory. Volatile memory can include a random access memory (RAM) as an external cache memory. By way of illustration and not limitation, RAM can be obtained in many forms such as synchronous RAM (SRAM), dynamic RAM, (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), Synchlink DRAM (SLDRAM), and direct Rambus RAM (DRRAM). The disclosed memory components or memories of the operating environment described herein are intended to include one or more of these and / or any other suitable types of memory.
[0117] Another embodiment of the present invention provides a computer program product, which includes a computer program stored on a non-volatile computer-readable storage medium, and the computer program includes program instructions. When the program instructions are executed by a processor, the processor executes the custom cutout method based on B-spline curves of the above method embodiment. For example, the above described Figure 1 The method comprises steps S100 to S300.
[0118] In summary, in the B-spline curve-based custom cutout method, device, system and medium disclosed in the present invention, the method detects the cutout operation input by the user, draws a closed B-spline curve on the target image according to the cutout operation; after adjusting the shape of the B-spline curve to the target shape, the current curve area is determined as the cutout area; and pixels corresponding to the cutout area are cut out from the target image to generate a cutout image. The embodiment of the present invention establishes an adjustable closed B-spline curve on the target image according to the detected cutout operation for cutout, and can realize flexible and smooth custom cutout by adjusting the B-spline curve on any terminal device.
[0119] The embodiments described above are merely illustrative, in which the units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0120] Through the description of the above embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus a general hardware platform, and of course can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the relevant technology can be embodied in the form of a software product, and the computer software product can exist in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer electronic device (which can be a personal computer, a server, or a network electronic device, etc.) to execute the methods of each embodiment or some parts of the embodiment.
[0121] Conditional language such as "can," "can," "might," or "may," among other things, unless specifically stated otherwise or otherwise understood within the context as used, is generally intended to convey that a particular embodiment can include (while other embodiments do not) a particular feature, element, and / or operation. Thus, such conditional language is also generally intended to imply that a feature, element, and / or operation is required for one or more embodiments anyway or that one or more embodiments must include logic for determining whether such features, elements, and / or operations are included or will be performed in any particular embodiment, with or without input or prompting.
[0122] What has been described herein in this specification and the accompanying drawings includes examples of custom cutout methods, devices, systems and media that can provide B-spline curves. Of course, it is not possible to describe every conceivable combination of elements and / or methods for the purpose of describing the various features of the present disclosure, but it can be recognized that many other combinations and permutations of the disclosed features are possible. Therefore, it is obvious that various modifications can be made to the present disclosure without departing from the scope or spirit of the present disclosure. In addition, or in an alternative, other embodiments of the present disclosure may be obvious from consideration of this specification and the accompanying drawings and from the practice of the present disclosure as presented herein. It is intended that the examples proposed in this specification and the accompanying drawings are considered to be illustrative and not restrictive in all respects. Although specific terms are used herein, they are used in a general and descriptive sense and are not used for limiting purposes.
Claims
1. A custom cutout method based on B-spline curve, characterized in that: The steps include: When a cutout operation is detected, a closed B-spline curve is drawn on the target image according to the cutout operation, wherein the B-spline curve includes a plurality of interval curves that are sequentially spliced; When the shape of the B-spline curve is a target shape, determining a B-spline curve region currently having the target shape as a cutout region; Acquire corresponding cutout pixels in the target image according to the cutout area, and generate a cutout image according to the cutout pixels; When a cutout operation is detected, a closed B-spline curve is drawn on the target image according to the cutout operation, wherein the B-spline curve includes a plurality of interval curves that are sequentially spliced, including: Detect movement tracks on the cutout layer; Collecting a set of coordinate points corresponding to the moving trajectory; A B-spline data model is established, and after the coordinate point set is input into the B-spline data model, a closed B-spline curve is generated on the cutout layer.
2. The custom cutout method based on B-spline curve according to claim 1, characterized in that: When the shape of the B-spline curve is a target shape, determining a B-spline curve region currently having the target shape as a cutout region comprises: Adjusting the shape of the closed B-spline curve according to an interactive operation input by a user; When the shape of the B-spline curve is a target shape, a B-spline curve region currently having the target shape is determined as a cutout region.
3. The custom cutout method based on B-spline curve according to claim 2, characterized in that: The step of adjusting the shape of the closed B-spline curve according to the interactive operation input by the user comprises: Detect user input interactions; Dynamically modifying the parameters of the coordinate point set according to the interactive operation; The shape of the closed B-spline curve is adjusted according to the dynamically modified set of coordinate points.
4. The custom cutout method based on B-spline curve according to claim 3, characterized in that: The dynamically modifying the parameters of the coordinate point set according to the interactive operation specifically includes: According to the dynamic trajectory of the interactive operation, the number of coordinate points in the coordinate point set and the coordinate value of each coordinate point are modified accordingly.
5. The custom cutout method based on B-spline curve according to any one of claims 2 to 4, characterized in that: The interactive operation includes curve dragging and / or curve squeezing and / or curve zooming in and / or curve zooming out.
6. The custom cutout method based on B-spline curve according to any one of claims 1-2, characterized in that: Before drawing a closed B-spline curve on the target graph according to the cutout operation when the cutout operation is detected, the method further includes: Create a new cutout layer on the target image to draw the cutout curve.
7. A custom cutout device based on B-spline curve, characterized in that: The device comprises: A drawing module, used for drawing a closed B-spline curve on a target image according to the cutout operation when a cutout operation is detected, wherein the B-spline curve includes a plurality of interval curves spliced together; A selection module, used for determining the B-spline curve region having the target shape as a cutout region when the shape of the B-spline curve is the target shape; A cutout module, used for acquiring corresponding cutout pixels in the target image according to the cutout area, and generating a cutout image according to the cutout pixels; The drawing module comprises: A detection unit, used for detecting the moving track on the cutout layer; A collection unit, used for collecting a set of coordinate points corresponding to the movement trajectory; The drawing unit is used to establish a B-spline data model, and generate a closed B-spline curve on the cutout layer after inputting the coordinate point set into the B-spline data model.
8. A custom cutout system based on B-spline curve, characterized in that: The system includes at least one processor; and, a memory communicatively connected to the at least one processor; wherein, The memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the custom cutout method based on B-spline curves as described in any one of claims 1-6.
9. A non-volatile computer-readable storage medium, characterized in that: The non-volatile computer-readable storage medium stores computer-executable instructions, which, when executed by one or more processors, enable the one or more processors to execute the custom cutout method based on B-spline curves as described in any one of claims 1-6.
Citation Information
Patent Citations
Picture matting method and device
CN110097560A
Pattern edge track intelligent extraction method and application thereof
CN110136155A