A method, device and storage medium for generating a curve representing image information
By dividing the curve of the image information into multiple curve segments, and calculating its actual expression separately, the problem of large transformation range of the Bessel curve when the anchor point is dragged, and the fine debugging of some pixel information of the image is realized. And flexible adjustment.
Patent Information
- Application Number
- CN202210152138.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-02-18
- Publication Date
- 2025-01-28
- Estimated Expiration
- 2042-02-18
AI Technical Summary
In the prior art, when the Bezier curve drags the anchor point, the deformation propagation range is large, making it difficult to finely debug the pixel information of the image part.
By obtaining the coordinate data of multiple anchor points, the actual expression of each curve segment is calculated according to the smooth curve drawing conditions and the general expression, and the curve of the image information of the characteristic image is generated. This method divides the curve into multiple curve segments, which only affects two adjacent curve segments when dragging one anchor point. Other curve segments are not affected.
A fine debugging of the pixel information of the image part is achieved, avoiding the inconvenience of deformation communication, and improving the flexibility and accuracy of image debugging.
Smart Images

Figure CN114581554B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of data processing technology, and in particular to a method, device and storage medium for generating a curve representing image information. Background Art
[0002] In image signal processing tuning (ISP tuning) tools, operations that require the use of curves to map image pixel information are often encountered. In order to make the changes in the image as natural as possible, smooth curves are an indispensable prerequisite. From the perspective of user interaction, in order to allow users to customize the shape of the curve, the shape of the curve is often controlled by multiple anchor points, and the anchor points can be dragged arbitrarily within the specified range. Existing solutions such as Bezier curves can obtain the shape of the curve based on the anchor points given by the user. However, the disadvantage of the Bezier curve is that when dragging an anchor point, the line segments adjacent to the anchor point will propagate the deformation, and the deformation propagation range is large, which is not convenient for debugging partial pixel information of the image. Summary of the invention
[0003] In view of this, embodiments of the present disclosure provide a method, device, and storage medium for generating a curve representing image information.
[0004] According to the first aspect of the present disclosure, an embodiment of the present disclosure provides a curve generation method for representing image information, including: obtaining coordinate data corresponding to multiple anchor points, wherein the first coordinate data in the coordinate data of each anchor point is used to represent the pixel information of the pixel point of the image, and the second coordinate data in the coordinate data of each anchor point is used to represent the correction parameter of the pixel information; according to the smooth curve drawing conditions, the general expressions corresponding to each curve segment, and the coordinate data corresponding to each anchor point, the actual expressions corresponding to each curve segment are obtained, wherein the curve segment is a curve between two adjacent anchor points; according to the actual expressions corresponding to each curve segment, a curve representing the image information is generated.
[0005] According to the second aspect of the present disclosure, an embodiment of the present disclosure provides a curve generating device for representing image information, including: an acquisition module, used to obtain coordinate data corresponding to multiple anchor points, wherein the first coordinate data in the coordinate data of each anchor point is used to represent the pixel information of the pixel point of the image, and the second coordinate data in the coordinate data of each anchor point is used to represent the correction parameter of the pixel information; a calculation module, used to obtain the actual expression corresponding to each curve segment according to the smooth curve drawing conditions, the general expression corresponding to each curve segment, and the coordinate data corresponding to each anchor point, wherein the curve segment is a curve between two adjacent anchor points; a drawing module, used to generate a curve representing the image information according to the actual expression corresponding to each curve segment.
[0006] According to the third aspect of the present disclosure, an embodiment of the present disclosure provides an electronic device, comprising: 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 executes a curve generation method for characterizing image information as in the first aspect or any embodiment of the first aspect.
[0007] According to the fourth aspect of the present disclosure, an embodiment of the present disclosure provides a computer-readable storage medium, which stores computer instructions, and the computer instructions are used to enable a computer to execute a curve generation method for characterizing image information as in the first aspect or any embodiment of the first aspect.
[0008] The curve generation method, device and storage medium for representing image information provided by the embodiments of the present disclosure obtain coordinate data corresponding to multiple anchor points respectively, wherein the first coordinate data in the coordinate data of each anchor point is used to represent the pixel information of the pixel point of the image, and the second coordinate data in the coordinate data of each anchor point is used to represent the correction parameter of the pixel information; according to the smooth curve drawing conditions, the general expressions corresponding to each curve segment respectively, and the coordinate data corresponding to each anchor point respectively, the actual expressions corresponding to each curve segment are obtained, wherein the curve segment is the curve between two adjacent anchor points; according to the actual expressions corresponding to each curve segment, the curve representing the image information is generated. In this way, the curve representing the image information is divided into multiple curve segments, and each curve segment is generated by calculating the actual expressions of each curve segment in the curve representing the image information respectively, so that the curve used to represent the image information can be generated based on the combination of each curve segment, so that when an anchor point is dragged arbitrarily, only the two adjacent curve segments corresponding to the anchor point are affected, while other curve segments are not affected, so that the debugging of part of the pixel information of the image can be realized.
[0009] The above description is only an overview of the technical solution of the present disclosure. In order to more clearly understand the technical means of the present disclosure, it can be implemented according to the contents of the specification. In order to make the above and other purposes, features and advantages of the present disclosure more obvious and easy to understand, the specific implementation methods of the present disclosure are listed below. BRIEF DESCRIPTION OF THE DRAWINGS
[0010] Figure 1 A schematic diagram showing a flow chart of a method for generating a curve representing image information in an embodiment of the present disclosure is shown;
[0011] Figure 2 A schematic diagram of the process of step S102 of the embodiment of the present disclosure is shown;
[0012] Figure 3 A schematic diagram showing the shape of a curve segment corresponding to two adjacent anchor points in an embodiment of the present disclosure is shown;
[0013] Figure 4 Another schematic diagram of the shape of the curve segment corresponding to two adjacent anchor points in the embodiment of the present disclosure is shown;
[0014] Figure 5 A schematic diagram showing a flow chart of another method for generating a curve representing image information in an embodiment of the present disclosure;
[0015] Figure 6 A schematic diagram of the shape of an unclosed curve in an embodiment of the present disclosure is shown;
[0016] Figure 7 A schematic diagram of the structure of a device for generating a curve representing image information in an embodiment of the present disclosure is shown;
[0017] Figure 8 A schematic diagram of the hardware structure of an electronic device in an embodiment of the present disclosure is shown. DETAILED DESCRIPTION
[0018] In order to make the purpose, technical solution and advantages of the embodiments of the present disclosure clearer, the technical solution in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are part of the embodiments of the present disclosure, rather than all the embodiments. Based on the embodiments in the present disclosure, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present disclosure.
[0019] The present disclosure provides a method for generating a curve representing image information, which can be applied to debug local or partial pixel information of an image, such as Figure 1 As shown, the specific steps of the curve generation method for representing image information include:
[0020] Step S101, obtaining coordinate data corresponding to a plurality of anchor points respectively, wherein the first coordinate data in the coordinate data of each anchor point is used to represent pixel information of a pixel point of the image, and the second coordinate data in the coordinate data of each anchor point is used to represent a correction parameter of the pixel information.
[0021] In this embodiment, the number of anchor points used to generate the curve representing the image signal is not limited. Multiple coordinate data can be input through an input device to obtain coordinate data corresponding to multiple anchor points. For example, multiple coordinate data [[x0, y0], [x1, y1], [x2, y2]…[x i ,y i ]], i = 0, 1…n, multiple coordinate data are the coordinate data corresponding to multiple anchor points selected in sequence according to the shape of the curve representing the image information, [x0, y0] is the coordinate data corresponding to the first anchor point selected, [x n ,y n] is the coordinate data corresponding to the last anchor point selected. i is the first coordinate data, y i The pixel information may be a pixel value of a pixel point of the image, and the correction parameter of the pixel information may be a correction value of the pixel value.
[0022] Step S102, obtaining actual expressions corresponding to each curve segment according to the smooth curve drawing conditions, the general expressions corresponding to each curve segment, and the coordinate data corresponding to each anchor point, wherein a curve segment is a curve between two adjacent anchor points.
[0023] In this embodiment, the general expressions corresponding to the various segments of the curve may be the same or different. For example, the general expressions corresponding to the various segments of the curve may be expressed as the cubic equation y=ax 3 +bx 2 +cx+d, the cubic equation can ensure the nonlinearity of the curve, but it is not limited to this. In other embodiments, it can also be expressed by a quadratic equation or other dimensional equations.
[0024] According to the smooth curve drawing conditions, two equations can be established for each anchor point. One is to establish an equation based on the anchor point satisfying the equality of the second coordinate data on the adjacent curve segments, and the other is to establish an equation based on the anchor point satisfying the equality of the slope on the adjacent curve segments. Then, by solving the equation group, the coefficients in the actual expression corresponding to each curve segment can be obtained, thereby obtaining the actual expression corresponding to each curve segment.
[0025] Step S103: generating a curve representing the image information according to the actual expression corresponding to each curve segment.
[0026] In this embodiment, two adjacent anchor points correspond to a curve segment. Based on the actual expressions corresponding to the curve segments, each curve segment can be generated. The curve formed by connecting the curve segments is the curve representing the image information.
[0027] The curve generation method for representing image information provided by the embodiment of the present disclosure obtains the coordinate data corresponding to a plurality of anchor points respectively, wherein the first coordinate data in the coordinate data of each anchor point is used to represent the pixel information of the pixel point of the image, and the second coordinate data in the coordinate data of each anchor point is used to represent the correction parameter of the pixel information; according to the smooth curve drawing conditions, the general expressions corresponding to each curve segment respectively, and the coordinate data corresponding to each anchor point respectively, the actual expressions corresponding to each curve segment respectively are obtained, wherein the curve segment is the curve between two adjacent anchor points; according to the actual expressions corresponding to each curve segment, the curve representing image information is generated. In this way, the curve representing image information is divided into a plurality of curve segments, and the actual expressions of each curve segment in the curve representing image information are calculated respectively to generate each curve segment, and then the curve representing image information is generated based on the combination of each curve segment, so that when an anchor point is dragged arbitrarily, only the two adjacent curve segments corresponding to the anchor point are affected, while other curve segments are not affected, so that the debugging of part of the pixel information of the image can be realized.
[0028] In an optional implementation, step S102, according to the smooth curve drawing conditions, the general expressions corresponding to the curve segments, and the coordinate data corresponding to the anchor points, the actual expressions corresponding to the curve segments are obtained, such as Figure 2 As shown, specifically including:
[0029] Step S102a, based on the smooth curve drawing conditions and the general expressions corresponding to the curve segments, obtain the equation group of each anchor point.
[0030] Step S102b, based on the coordinate data and equation groups corresponding to each anchor point, obtain the actual expressions corresponding to each curve segment.
[0031] In some embodiments, for step S102a, the smooth curve drawing condition includes: the second coordinate data of two adjacent curve segments corresponding to each anchor point at the anchor point are the same, and the slopes of the two adjacent curve segments at the anchor point are the same. This ensures that the curve drawn based on the anchor point is a smooth curve. According to the smooth curve drawing condition, for each anchor point, two equations can be established, one is to establish a curve segment equation based on the coordinate data of the anchor point, that is, to establish an equation based on the anchor point satisfying the equality of the second coordinate data on the adjacent curve segments, and the other is to establish a slope equation based on the coordinate data of the anchor point, that is, to establish an equation based on the anchor point satisfying the equality of the slopes on the adjacent curve segments.
[0032] In some embodiments, for step S102b, based on the coordinate data and equation groups corresponding to the anchor points, actual expressions corresponding to the curve segments are obtained, including:
[0033] Based on the coordinate data corresponding to multiple anchor points, the closure of the curve representing the image information is determined; based on the closure of the curve representing the image information and the coordinate data corresponding to each anchor point, the slope corresponding to each anchor point is obtained; based on the slope corresponding to each anchor point, the coordinate data corresponding to each anchor point, and the equation group, the coefficients in the general expression corresponding to each curve segment are obtained; based on the coefficients in the general expression corresponding to each curve segment, the actual expression corresponding to each curve segment is determined.
[0034] In a specific implementation, the slopes corresponding to the anchor points are obtained according to the closure of the curve representing the image information and the coordinate data corresponding to the anchor points, including: determining that the curve representing the image information is an open curve, and obtaining the slopes corresponding to the anchor points according to the coordinate data corresponding to the anchor points and a first calculation method; or determining that the curve representing the image information is a closed curve, and obtaining the slopes corresponding to the anchor points according to the coordinate data corresponding to the anchor points and a second calculation method.
[0035] In a specific implementation, the coordinate data list corresponding to all anchor points is [[x0, y0], [x1, y1], [x2, y2]…[x i ,y i ]], where i = 0, 1…n, and the coordinate data list is a coordinate data sequence corresponding to multiple anchor points selected in sequence according to the shape of the curve representing the image information. In order to ensure that the curve representing the image information does not jump significantly during the dragging process and to ensure that the shape of the curve is conducive to image debugging, a first calculation method and a second calculation method can be specified.
[0036] The curve representing the image information corresponding to the first calculation method is an open curve. The first calculation method can be divided into the following cases:
[0037] 1) When (x i ,y i ) that is (x0, y0), the slope of the point (x0, y0) is K0, and K0 should be the slope of the line connecting (x0, y0) and (x1, y1).
[0038] 2) When (x i ,y i ) That is (x n ,y n ), record (x n ,y n ) is K n , K n Should be (x n ,y n ) and (x n-1 ,y n-1 ) is the slope of the line connecting them.
[0039] 3) When y i-1 <y i And y i+1 <y i , or i-1 >y i And y i+1 >y i When (x i ,y i ) is K i , K i Should be 0, such as Figure 3 .
[0040] 4) When y i-1 <y i <y i+1 or i-1 >y i >y i+1 When Figure 4 , remember (x i ,y i ) is K i , point (x i-1 ,y i-1 ) and point (x i ,y i ) is K 01 , point (x i ,y i ) and point (x i+1 ,y i+1 ) is K 12 , point (x i-1 ,y i-1 ) and point (x i+1 ,y i+1 ) is K 02 , then K i The value of is divided into the following cases:
[0041] When the anchor point is in area 2 or area 3: K i =K 02 ;
[0042] When the anchor point is in region 1: K i =2*K 12 ;
[0043] When the anchor point is in region 4: K i =2*K 01 ;
[0044] Among them, the slopes of the three dividing lines of the four regions are all equal to K 02 , and two of the dividing lines intersect at the midpoint of the side of the rectangular frame.
[0045] Since the curve representing the image information corresponding to the second calculation method is a closed curve, the second calculation method can be divided into the following cases:
[0046] 1) When (x i , y i ) is (x0, y0), denote the slope of the point (x0, y0) as K0. If y n-1 < y0 and y1 < y0, or y n-1 > y0 and y1 > y0, then K0 = 0. If y n-1 < y0 < y1 or y n-1 > y0 > y1, convert the point (x n-1 , y n-1 ) to the point (x n-1 - x range , y n-1 ). Then the slope of the line connecting the point (x n-1 - x range , y n-1) ) and the point (x0, y0) is K 01 , the slope of the line connecting the point (x0, y0) and the point (x1, y1) is K 12 , the slope of the line connecting the point (x n-1 - x range , y n-1 ) and the point (x1, y1) is K 02 , x range = x n - x0. Then the value of K0 is as Figure 4 shown and can be divided into the following cases: When the anchor point is in region 2 or region 3: K0 = K 02 ; when the anchor point is in region 1: K0 = 2 * K 12 ; when the anchor point is in region 4: K0 = 2 * K 01 ; where the slopes of the three dividing lines of the 4 regions are all equal to K 02 , and two of the dividing lines intersect at the midpoint of the side length of the rectangular frame.
[0047] 2) When (x i , y i ) is (x n-1 , y n-1 ), denote the slope of the point (x n-1 , y n-1 ) as K n-1 . a) If y n-1 < y0 and y n-1 < y n-2 , or y n-1 > y0 and y n-1 > y n-2 , then K n-1= 0. b) If y n-2 <y n-1 <y0 or y n-2 >y n-1 >y0, convert the point (x0, y0) to the point (x0 + x range , y0). Then the slope of the line connecting the point (x0 + x range , y0) and the point (x n-1 , y n-1 ) is K 01 , the slope of the line connecting the point (x n-1 , y n-1 ) and the point (x n-2 , y n-2 ) is K 12 , and the slope of the line connecting the point (x0 + x range , y0) and the point (x n-2 , y n-2 ) is K 02 . Then the value of K n-1 is as shown in Figure 4 , and it is divided into the following cases: When the anchor point is in Region 2 or Region 3: K i = K 02 ; When the anchor point is in Region 1: K n-1 = 2 * K 12 ; When the anchor point is in Region 4: K n-1 = 2 * K 01 ; Among them, the slopes of the three dividing lines of the 4 regions are all equal to K 02 , and two of the dividing lines intersect at the midpoint of the side length of the rectangular frame.
[0048] 3) When (x i , y i ), that is, (x n , y n ), denote the slope of the point (x n , y n ) as K n , and K n should be the slope of the line connecting (x n , y n ) and (x n-1 , y n-1 ).
[0049] 4) When y i-1 <y i and y i+1 <y i , or y i-1 >y i and y i+1 >y i , denote the slope of the point (x i , y i ) as Ki , K i Should be 0, such as Figure 3 .
[0050] 5) When y i-1 <y i <y i+1 or i-1 >y i >y i+1 When Figure 4 , let (x i ,y i ) is K i , point (x i-1 ,y i-1 ) and point (x i ,y i ) is K 01 , point (x i ,y i ) and point (x i+1 ,y i+1 ) is K 12 , point (x i-1 ,y i-1 ) and point (x i+1 ,y i+1 ) is K 02 , then K i The value of is divided into the following cases:
[0051] When the anchor point is in area 2 or area 3: K i =K 02 ;
[0052] When the anchor point is in region 1: K i =2*K 12 ;
[0053] When the anchor point is in region 4: K i =2*K 01 ;
[0054] Among them, the slopes of the three dividing lines of the four regions are all equal to K 02 , and the two dividing lines intersect at the midpoint of the side of the rectangular frame. i ,y i ) That is (x n ,y n ), record (x i ,y i ) is K i , K i Should be (x n ,y n ) and (x n-1 ,y n-1) is the slope of the line connecting them.
[0055] Among them, the slopes of the three dividing lines of the four regions are all equal to K 02 , and two of the dividing lines intersect at the midpoint of the side of the rectangular frame.
[0056] According to the closure of the curve representing the image information, the first calculation method, the second calculation method and the coordinate data corresponding to each anchor point, the slope corresponding to each anchor point can be calculated. Therefore, the slope corresponding to each anchor point and the coordinate data corresponding to each anchor point can be substituted into the equation group of each anchor point, and the coefficients in the general expression corresponding to each curve segment can be obtained by solving the equation group, for example, the specific values of a, b, c, and d in the cubic equation, and then the coefficients in the general expression corresponding to each curve segment can be substituted into the general expression corresponding to each curve segment, and the actual expression corresponding to each curve segment can be obtained.
[0057] In the embodiment of the present disclosure, by obtaining the set of equations corresponding to each anchor point based on the smooth curve drawing conditions and the general expressions corresponding to each curve segment, and solving the set of equations based on the coordinate data and slope corresponding to each anchor point, the coefficients in the general expressions corresponding to each curve segment can be quickly obtained, thereby quickly determining the actual expressions corresponding to each curve segment.
[0058] In an optional embodiment, a curve generating method representing image information is as follows: Figure 5 As shown, it also includes:
[0059] Step S104, obtaining the coordinate data of the changed first anchor point.
[0060] Step S105, obtaining first actual expressions respectively corresponding to two adjacent curve segments corresponding to the first anchor point according to the smooth curve drawing condition, the general expressions respectively corresponding to two adjacent curve segments corresponding to the first anchor point, the coordinate data of the first anchor point, and the coordinate data of two anchor points adjacent to the first anchor point;
[0061] Step S106: regenerate two adjacent curve segments corresponding to the first anchor point according to the first actual expression.
[0062] In this embodiment, with respect to step S104, when the user adjusts the pixel information of a local pixel point of the image through a curve representing the image information, it can be achieved by arbitrarily dragging the first anchor point. When the first anchor point is dragged, the coordinate data of the first anchor point will change, and the changed coordinate data of the first anchor point can be recorded.
[0063] In some embodiments, for step S105, first actual expressions corresponding to the two adjacent curve segments corresponding to the first anchor point are obtained according to the smooth curve drawing condition, the general expressions corresponding to the two adjacent curve segments corresponding to the first anchor point, the coordinate data of the first anchor point, and the coordinate data of the two anchor points adjacent to the first anchor point, including: obtaining a first set of equations for the first anchor point and the two anchor points adjacent to the first anchor point based on the smooth curve drawing condition and the general expressions corresponding to the two adjacent curve segments corresponding to the first anchor point; obtaining first actual expressions corresponding to the two adjacent curve segments corresponding to the first anchor point based on the coordinate data of the first anchor point, the coordinate data corresponding to the two anchor points adjacent to the first anchor point, and the first set of equations.
[0064] Specifically, since the curve representing the image information is composed of various curve segments, and when the first anchor point is dragged, only the curves of the two adjacent curve segments corresponding to the first anchor point are affected. Therefore, it is only necessary to redraw the curves of the two adjacent curve segments corresponding to the first anchor point, thereby realizing the debugging of the local pixel information of the image.
[0065] When redrawing the curve of two adjacent curve segments corresponding to the first anchor point, it is necessary to recalculate the actual expressions of the two adjacent curve segments corresponding to the first anchor point. The specific calculation process can refer to the description in steps S101 to S103 of the above embodiment. However, in this step, only the first anchor point and the two anchor points adjacent to the first anchor point are calculated, and other anchor points do not need to be calculated repeatedly.
[0066] In the embodiment of the present disclosure, when the coordinate data of the first anchor point changes, the first actual expressions corresponding to the two adjacent curve segments corresponding to the first anchor point are calculated through the smooth curve drawing condition, the general expressions corresponding to the two adjacent curve segments corresponding to the first anchor point, the coordinate data of the first anchor point, and the coordinate data of the two anchor points adjacent to the first anchor point. Thus, only the actual expressions of the two adjacent curve segments corresponding to the first anchor point whose coordinate data has changed can be calculated, and the two adjacent curve segments corresponding to the first anchor point can be regenerated based on the first actual expressions. The shape changes of other curve segments of the curve representing the image information will not be changed, and the local pixel information of the image can be quickly debugged, which is interactive and friendly.
[0067] In order to further understand the present disclosure, a method for generating a curve representing image information provided by an embodiment of the present disclosure is described below using a specific implementation method.
[0068] The user enters a list of anchor points [[x0,y0], [x1,y1], [x2,y2] ... [x i ,y i]], i = 0, 1…n, the anchor point coordinate data list is a coordinate data sequence corresponding to multiple anchor points selected in sequence according to the shape of the curve representing the image information, [x0, y0] is the coordinate data corresponding to the first selected anchor point, [x n ,y n ] is the coordinate data corresponding to the last anchor point selected. The number of anchor points is unlimited, and the value range of the horizontal coordinate of the curve is also entered. range , assuming x range is [0, 255]. And each curve segment can be represented by a cubic equation y = ax 3 +bx 2 +cx+d, we need the four coefficients [a, b, c, d] of each curve segment. From the known conditions, we know that the ordinate values of the two curve segments at each anchor point are equal, and the slopes of the two curve segments at the anchor point are also equal, which ensures that the curve is smooth. We assume that the curve is not closed, so the first and last anchor points on the curve are fixed, such as Figure 6 As shown. Based on the above conditions, the equation group can be listed as follows:
[0069]
[0070]
[0071]
[0072]
[0073]
[0074]
[0075] …
[0076]
[0077]
[0078] Wherein, formula (1) represents the equation satisfied by the point (x0, y0) on the first curve segment, and formula (2) represents that the slope at the point (x0, y0) should be equal to K0. Formulas (3)-(6) describe the characteristics of the intermediate anchor points. Formulas (3) and (5) represent the equations satisfied by the point (x1, y1) on the left and right curve segments, respectively. Formulas (4) and (6) represent that the slopes of the point (x1, y1) on the left and right curve segments should be equal to K1, respectively. The formulas listed for each intermediate point are similar until the last anchor point. Formula (7) represents the equation of the point (x1, y1) on the left and right curve segments. n ,y n) satisfies the equation on the last curve segment. Equation (8) represents the equation of the point (x n ,y n ) should be equal to K n-1 .
[0079] In order to make the above equations easier to solve, the equations can be converted into matrix multiplication form:
[0080]
[0081] The above matrix multiplication can be written as:
[0082] q*M=p;
[0083] And M is the coefficient of each line segment of the curve we require, then M should be:
[0084] M=p*q -1 .
[0085] Then the next step is to set k0, k1...k n-1 , so that the curve does not jump significantly during the dragging process, and ensures that the curve shape is conducive to image debugging. The following are divided into several situations:
[0086] 1) When (x i ,y i ) is (x0,y0), record (x i ,y i ) is K i , K i Should be (x i ,y i ) and (x i+1 ,y i+1 ) is the slope of the line connecting them.
[0087] 2) When (x i ,y i ) that is (x n ,y n ), record (x i ,y i ) is K i , K i Should be (x n ,y n ) and (x n-1 ,y n-1 ) is the slope of the line connecting them.
[0088] 3) When y i-1 <y i And y i+1 <y i , or i-1 >y i And yi+1 >y i When (x i ,y i ) is K i , K i Should be 0, such as Figure 3 .
[0089] 4) When y i-1 <y i <y i+1 or i-1 >y i >y i+1 When Figure 4 , remember (x i ,y i ) is K i , point (x i-1 ,y i-1 ) and point (x i ,y i ) is K 01 , point (x i ,y i ) and point (x i+1 ,y i+1 ) is K 12 , point (x i-1 ,y i-1 ) and point (x i+1 ,y i+1 ) is K 02 , then K i The value of is divided into the following cases:
[0090] When the anchor point is in area 2 or area 3: K i =K 02 ;
[0091] When the anchor point is in region 1: K i =2*K 12 ;
[0092] When the anchor point is in region 4: K i =2*K 01 ;
[0093] Among them, the slopes of the three dividing lines of the four regions are all equal to K 02 , and two of the dividing lines intersect at the midpoint of the side of the rectangular frame.
[0094] Calculate k0, k1...k n-1, and the coordinate data of each anchor point is known, and then it can be solved to M, and the actual expression corresponding to each curve segment can be obtained. After obtaining the actual expression corresponding to each curve segment, each curve segment can be drawn, and then the curve representing the image information can be obtained. When the pixel value of a certain pixel point in the image is known to be x n , then the adjusted pixel value of this pixel value should be mapped to y n That is to say, the smooth curve forms a lookup table (LUT), which is convenient for users to operate and adjust the pixel values of each image. When the user drags a single anchor point, the shape of the curve will not jump during the process of dragging a single anchor point. Dragging a single anchor point only affects the shape of the curve on both sides of the anchor point, and has little effect on the curves of other segments. It is easy to adjust the local pixel values of the image and interactively friendly.
[0095] The disclosed embodiment also provides a curve generating device representing image information, such as Figure 7 As shown, including:
[0096] The acquisition module 41 is used to obtain the coordinate data corresponding to multiple anchor points respectively, the first coordinate data in the coordinate data of each anchor point is used to represent the pixel information of the pixel point of the image, and the second coordinate data in the coordinate data of each anchor point is used to represent the correction parameters of the pixel information; the specific implementation method is detailed in the description of step S101 of the above method embodiment, which will not be repeated here.
[0097] The calculation module 42 is used to obtain the actual expressions corresponding to each curve segment according to the smooth curve drawing conditions, the general expressions corresponding to each curve segment, and the coordinate data corresponding to each anchor point, wherein the curve segment is the curve between two adjacent anchor points; the specific implementation method is detailed in the description of step S102 of the above method embodiment, which will not be repeated here.
[0098] The drawing module 43 is used to generate a curve representing the image information according to the actual expression corresponding to each curve segment. The specific implementation method is described in the description of step S103 of the above method embodiment, which will not be repeated here.
[0099] The curve generating device for representing image information provided by the embodiment of the present disclosure obtains coordinate data corresponding to a plurality of anchor points respectively, wherein the first coordinate data in the coordinate data of each anchor point is used to represent the pixel information of the pixel point of the image, and the second coordinate data in the coordinate data of each anchor point is used to represent the correction parameter of the pixel information; according to the smooth curve drawing condition, the general expression corresponding to each curve segment respectively, and the coordinate data corresponding to each anchor point respectively, the actual expression corresponding to each curve segment is obtained, wherein the curve segment is the curve between two adjacent anchor points; according to the actual expression corresponding to each curve segment, a curve representing image information is generated, so that the curve representing image information is divided into a plurality of curve segments, and each curve segment is generated by respectively calculating the actual expression of each curve segment of the curve representing image information, so that the generated curve representing image information is a combination of each curve segment, so that when an anchor point is dragged arbitrarily, only the two adjacent curve segments corresponding to the anchor point are affected, while other curve segments are not affected, so that the debugging of part of the pixel information of the image can be realized.
[0100] In an optional embodiment, the calculation module 42 includes:
[0101] The first calculation submodule is used to obtain a set of equations for each anchor point based on the smooth curve drawing conditions and the general expressions corresponding to each curve segment.
[0102] The second calculation submodule is used to obtain actual expressions corresponding to each curve segment based on the coordinate data and equation groups corresponding to each anchor point.
[0103] In an optional embodiment, the smooth curve drawing condition includes: the second coordinate data of two adjacent curve segments corresponding to each anchor point at the anchor point are the same, and the slopes of the two adjacent curve segments at the anchor point are the same.
[0104] In an optional embodiment, the second calculation submodule is used to determine the closure of the curve representing the image information based on the coordinate data corresponding to multiple anchor points; obtain the slope corresponding to each anchor point according to the closure of the curve representing the image information and the coordinate data corresponding to each anchor point; obtain the coefficients in the general expression corresponding to each curve segment according to the slope corresponding to each anchor point, the coordinate data corresponding to each anchor point, and the set of equations; determine the actual expression corresponding to each curve segment according to the coefficients in the general expression corresponding to each curve segment.
[0105] In an optional embodiment, the slope corresponding to each anchor point is obtained according to the closure of the curve representing the image information and the coordinate data corresponding to each anchor point, including: determining that the curve representing the image information is an open curve, and obtaining the slope corresponding to each anchor point according to the coordinate data corresponding to each anchor point and a first calculation method; or; determining that the curve representing the image information is a closed curve, and obtaining the slope corresponding to each anchor point according to the coordinate data corresponding to each anchor point and a second calculation method.
[0106] In an optional embodiment, the curve generating device representing the image information further includes:
[0107] The second acquisition module is used to acquire the coordinate data of the changed first anchor point.
[0108] A second calculation module is used to obtain first actual expressions corresponding to two adjacent curve segments corresponding to the first anchor point according to the smooth curve drawing condition, the general expressions corresponding to two adjacent curve segments corresponding to the first anchor point, the coordinate data of the first anchor point, and the coordinate data of two anchor points adjacent to the first anchor point;
[0109] A generating module is used to regenerate two adjacent curve segments corresponding to the first anchor point according to the first actual expression.
[0110] In an optional embodiment, the second calculation module includes:
[0111] The third calculation submodule is used to obtain a first set of equations for the first anchor point and two anchor points adjacent to the first anchor point based on the smooth curve drawing condition and the general expressions corresponding to the two adjacent curve segments corresponding to the first anchor point.
[0112] The fourth calculation submodule is used to obtain first actual expressions corresponding to two adjacent curve segments corresponding to the first anchor point based on the coordinate data of the first anchor point, the coordinate data corresponding to two anchor points adjacent to the first anchor point, and the first equation group.
[0113] The embodiment of the present disclosure further provides an electronic device. The exemplary application of the electronic device provided by the embodiment of the present disclosure is described below. The electronic device provided by the embodiment of the present disclosure can be implemented as an electronic device, and the electronic device can be a server or a terminal device.
[0114] The server may be an independent physical server, a server cluster or a distributed system composed of multiple physical servers, or a cloud server providing cloud computing services. The terminal device may be a smart phone, a tablet computer, a laptop computer, a desktop computer, a smart speaker, a smart watch, etc., but is not limited thereto. The terminal device and the server may be directly or indirectly connected via wired or wireless communication, which is not limited in the embodiments of the present disclosure.
[0115] See also Figure 8 , Figure 8 is a schematic diagram of the structure of an electronic device 400 provided in an embodiment of the present disclosure, Figure 8 The electronic device 400 shown includes: at least one processor 410, a memory 450 and a bus 440; the various components in the electronic device 400 are coupled together through the bus 440. It is understood that the bus 440 is used to achieve connection and communication between these components. In addition to the data bus, the bus 440 also includes a power bus, a control bus and a status signal bus. However, for the sake of clarity, Figure 8 Various buses are labeled as bus 440.
[0116] Processor 410 can be an integrated circuit chip with signal processing capabilities, such as a general-purpose processor, a digital signal processor (DSP), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc., where the general-purpose processor can be a microprocessor or any conventional processor, etc.
[0117] The memory 450 stores executable instructions for implementing the curve generation method for representing image information provided by the embodiment of the present disclosure. The curve generation method for representing image information can be performed by Figure 8 The processor 410 in the electronic device shown is implemented; the memory 450 can be removable, non-removable, or a combination thereof. Exemplary hardware devices include solid-state memory, hard disk drives, optical disk drives, etc. The memory 450 optionally includes one or more storage devices that are physically located away from the processor 410.
[0118] In some embodiments, memory 450 is capable of storing data to support various operations, examples of which include programs, modules, and data structures, or a subset or superset thereof.
[0119] In some embodiments, the electronic device 400 may further include:
[0120] Operating system 451, including system programs for processing various basic system services and performing hardware-related tasks, such as a framework layer, a core library layer, a driver layer, etc., for implementing various basic services and processing hardware-based tasks;
[0121] The network communication module 452 is used to reach other computing devices via one or more (wired or wireless) network interfaces 420. Exemplary network interfaces 420 include: Bluetooth, Wireless Authentication (WiFi), and Universal Serial Bus (USB).
[0122] The present disclosure embodiment provides a computer-readable storage medium storing executable instructions, wherein the executable instructions are stored. When the executable instructions are executed by a processor, the processor will execute the curve generation method for representing image information provided by the present disclosure embodiment, for example, Figures 1 to 6 A method for generating a curve representing image information is shown.
[0123] In some embodiments, the computer-readable storage medium may be a memory such as FRAM, ROM, PROM, EPROM, EEPROM, flash memory, magnetic surface storage, optical disk, or CD-ROM; or it may be various devices including one or any combination of the above memories.
[0124] In some embodiments, executable instructions may be in the form of a program, software, software module, script or code, written in any form of programming language (including compiled or interpreted languages, or declarative or procedural languages), and may be deployed in any form, including as a stand-alone program or as a module, component, subroutine or other unit suitable for use in a computing environment.
[0125] By way of example, executable instructions may be deployed to be executed on one computing device, or on multiple computing devices located at one site, or on multiple computing devices distributed across multiple sites and interconnected by a communication network.
[0126] In addition to the above-mentioned method and device, an embodiment of the present disclosure provides a computer program product, including computer program instructions, which, when executed by a processor, enable the processor to execute the curve generation method for representing image information of the present disclosure.
[0127] The computer program product may be written in any combination of one or more programming languages to write program code for performing the operations of the disclosed embodiments, including object-oriented programming languages such as Java, C++, etc., and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user device, as a separate software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server.
[0128] The above are only embodiments of the present disclosure and are not intended to limit the protection scope of the present disclosure. Any modifications, equivalent substitutions and improvements made within the spirit and scope of the present disclosure are included in the protection scope of the present disclosure.
Claims
1. A method for generating a curve representing image information, comprising: Acquire coordinate data corresponding to a plurality of anchor points respectively, wherein first coordinate data in the coordinate data of each anchor point is used to represent pixel information of a pixel point of an image, and second coordinate data in the coordinate data of each anchor point is used to represent a correction parameter of the pixel information; According to the smooth curve drawing conditions, the general expressions corresponding to the curve segments, and the coordinate data corresponding to the anchor points, the actual expressions corresponding to the curve segments are obtained, wherein the curve segment is the curve between two adjacent anchor points; A curve representing the image information is generated according to the actual expressions corresponding to the curve segments.
2. The method according to claim 1, wherein the actual expressions corresponding to the curve segments are obtained according to the smooth curve drawing conditions, the general expressions corresponding to the curve segments, and the coordinate data corresponding to the anchor points, comprising: Based on the smooth curve drawing conditions and the general expressions corresponding to the curve segments, a set of equations for the anchor points is obtained; Based on the coordinate data corresponding to each of the anchor points and the set of equations, actual expressions corresponding to each of the curve segments are obtained.
3. The method according to claim 1 or 2, wherein the smooth curve drawing conditions include: The second coordinate data of two adjacent curve segments corresponding to each anchor point at the anchor point are the same, and the slopes of two adjacent curve segments at the anchor point are the same.
4. The method according to claim 2, based on the coordinate data corresponding to each anchor point and the equation group, obtaining the actual expression corresponding to each curve segment, comprising: Determining the closure of a curve representing the image information based on the coordinate data corresponding to each of the plurality of anchor points; According to the closure of the curve representing the image information and the coordinate data corresponding to each of the anchor points, the slope corresponding to each of the anchor points is obtained; Obtaining coefficients in a general expression corresponding to each of the curve segments according to the slopes corresponding to each of the anchor points, the coordinate data corresponding to each of the anchor points, and the equation group; The actual expressions respectively corresponding to the curve segments are determined according to the coefficients in the general expressions respectively corresponding to the curve segments.
5. The method according to claim 4, wherein the step of obtaining the slopes corresponding to the anchor points according to the closure of the curve representing the image information and the coordinate data corresponding to the anchor points comprises: Determine that the curve representing the image information is an open curve, and obtain the slope corresponding to each anchor point according to the coordinate data corresponding to each anchor point and the first calculation method; or; The curve representing the image information is determined to be a closed curve, and the slopes corresponding to the anchor points are obtained according to the coordinate data corresponding to the anchor points and the second calculation method.
6. The method according to claim 1, further comprising: Get the coordinate data of the first anchor point that has changed; According to the smooth curve drawing condition, the general expressions corresponding to the two adjacent curve segments corresponding to the first anchor point, the coordinate data of the first anchor point, and the coordinate data of the two anchor points adjacent to the first anchor point, first actual expressions corresponding to the two adjacent curve segments corresponding to the first anchor point are obtained; Two adjacent curve segments corresponding to the first anchor point are regenerated according to the first actual expression.
7. The method according to claim 6, wherein obtaining the first actual expressions respectively corresponding to the two adjacent curve segments corresponding to the first anchor point according to the smooth curve drawing condition, the general expressions respectively corresponding to the two adjacent curve segments corresponding to the first anchor point, the coordinate data of the first anchor point, and the coordinate data of the two anchor points adjacent to the first anchor point comprises: Based on the smooth curve drawing condition and the general expressions corresponding to the two adjacent curve segments corresponding to the first anchor point, a first set of equations for the first anchor point and two anchor points adjacent to the first anchor point is obtained; Based on the coordinate data of the first anchor point, the coordinate data corresponding to two anchor points adjacent to the first anchor point, and the first set of equations, first actual expressions corresponding to two adjacent curve segments corresponding to the first anchor point are obtained.
8. A curve generating device for representing image information, comprising: An acquisition module, used to acquire coordinate data corresponding to a plurality of anchor points, wherein the first coordinate data in the coordinate data of each anchor point is used to represent pixel information of a pixel point of an image, and the second coordinate data in the coordinate data of each anchor point is used to represent a correction parameter of the pixel information; A calculation module, used for obtaining actual expressions corresponding to each curve segment according to the smooth curve drawing condition, the general expressions corresponding to each curve segment, and the coordinate data corresponding to each anchor point, wherein the curve segment is a curve between two adjacent anchor points; The drawing module is used to generate a curve representing the image information according to the actual expression corresponding to each of the curve segments.
9. An electronic device, comprising: 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 executes the curve generation method representing image information as described in any one of claims 1-7.
10. A computer-readable storage medium storing computer instructions, wherein the computer instructions are used to enable a computer to execute the method for generating a curve representing image information according to any one of claims 1 to 7.
Citation Information
Patent Citations
Method and device for generating adaptive curve
CN102881033A
Method and device for detecting target object, electronic equipment and storage medium
CN112149636A