Image processing method and apparatus
By applying radial chromatic aberration, distortion, scaling, and radial blurring to video images, an image with a magnifying glass effect is generated, solving the problem of insufficient special effects in video applications and improving the user experience.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-07-30
- Publication Date
- 2026-03-20
AI Technical Summary
Existing video applications lack diversity in special effects, failing to meet user needs.
An image processing method is provided that by obtaining the user's trigger operation coordinates, and using mapping relationships and processing parameters, radial color difference, distortion, scaling and radial blur processing are applied to the video image to simulate a real magnifying glass effect and generate an image with magnifying glass effects.
It increases the diversity of special effects, enhances the user experience, and the image processing method can closely resemble the magnification effect of a real magnifying glass, resulting in a strong sense of realism in the special effects.
Smart Images

Figure CN115695681B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present disclosure relates to the field of image processing, and in particular, to an image processing method and device. BACKGROUND
[0002] With the development of software development technology, the types of application programs (APPs) on mobile terminals are increasing. Among them, video APPs are deeply loved by the public. Users can not only browse videos through video APPs, but also make and publish videos. Users can add special effects to videos, thereby improving user engagement. However, the current special effects are not diversified enough, and user needs cannot be met. SUMMARY
[0003] The present disclosure provides an image processing method and device, which can process images in a video into images with magnifying glass effects, increase the diversity of special effects, and improve user experience.
[0004] In a first aspect, the present disclosure provides an image processing method. In response to a first trigger operation of a user, a screen coordinate of the first trigger operation is obtained. For each frame of a first image obtained after the first trigger operation, a coordinate of a trigger pixel point on the first image is obtained according to the screen coordinate of the first trigger operation. The first image is processed according to the coordinate of the trigger pixel point to obtain an image with a magnifying glass effect.
[0005] Optionally, the processing according to the coordinate of the trigger pixel point on the first image to obtain an image with a magnifying glass effect includes: obtaining a processing parameter corresponding to the first image according to a frame number of the first image and a first mapping relationship. The processing parameter includes at least one of a chromatic aberration intensity coefficient, a distortion coefficient, a scaling coefficient, and a blur coefficient. The first mapping relationship is used to indicate a corresponding relationship between the frame number and the processing parameter. The first image is processed according to the coordinate of the trigger pixel point and the processing parameter corresponding to the first image to obtain the image with the magnifying glass effect. The special effect processing corresponds to the processing parameter and includes at least one of radial chromatic aberration processing, distortion processing, scaling processing, or radial blur processing.
[0006] Optionally, the processing parameter comprises a color difference intensity coefficient, and the special effect processing comprises radial color difference processing; and the special effect processing on the first image according to the coordinates of the trigger pixel point and the processing parameter corresponding to the first image comprises: for each pixel point on the first image, obtaining a sum of color values of a plurality of sampling points corresponding to the pixel point in each color channel according to the coordinates of the trigger pixel point, the coordinates of the pixel point, the number of sampling points, a step length coefficient, an intensity coefficient corresponding to each color channel, a weight coefficient, a texture of the first image, and the color difference intensity coefficient; and determining a color value of the pixel point in each color channel according to the sum of color values of the plurality of sampling points corresponding to the pixel point in each color channel.
[0007] Optionally, the obtaining the sum of color values of the plurality of sampling points corresponding to the pixel point in each color channel according to the coordinates of the trigger pixel point, the coordinates of the pixel point, the number of sampling points, the step length coefficient, the intensity coefficient corresponding to each color channel, the weight coefficient, the texture of the first image, and the color difference intensity coefficient comprises: determining a direction from the trigger pixel point to the pixel point according to the coordinates of the trigger pixel point and the coordinates of the pixel point; determining a sampling step length according to the direction from the trigger pixel point to the pixel point, the step length coefficient, and the number of sampling points; for each color channel in the RGB channel, determining a corresponding offset of the color channel according to the direction from the trigger pixel point to the pixel point, the color difference intensity coefficient, and the intensity coefficient corresponding to the color channel; and for each color channel in the RGB channel, determining the sum of color values of the plurality of sampling points corresponding to the pixel point in the color channel according to the texture of the first image, the coordinates of the pixel point, the offset corresponding to the color channel, the sampling step length, the number of sampling points, and the weight coefficient.
[0008] Optionally, the determining the color value of the pixel point in each color channel according to the sum of color values of the plurality of sampling points corresponding to the pixel point in each color channel comprises: for each color channel in the RGB channel, dividing the sum of color values of the plurality of sampling points corresponding to the pixel point in the color channel by the number of sampling points to obtain the color value of the pixel point in the color channel.
[0009] Optionally, the processing parameter comprises a distortion coefficient, and the special effect processing comprises distortion processing.
[0010] The special effect processing on the first image according to the coordinates of the trigger pixel point and the processing parameter corresponding to the first image comprises: obtaining a distortion function according to the distortion coefficient; for each pixel point on the first image, determining a pre-distortion pixel point corresponding to the pixel point on the first image according to the coordinates of the trigger pixel point, the coordinates of the pixel point, the distance from the trigger pixel point to the pixel point, and the distortion function; and taking the color value of the pre-distortion pixel point as the color value of the pixel point.
[0011] Optionally, the processing parameter comprises a scaling coefficient, and the special effect processing comprises scaling processing; and the special effect processing on the first image according to the coordinates of the trigger pixel point and the processing parameter corresponding to the first image comprises: determining scaled vertex coordinates according to the coordinates of the trigger pixel point, the current vertex coordinates of a quadrilateral model, and the scaling coefficient, the quadrilateral model being used to change the display size of an image; updating the vertex coordinates of the quadrilateral model to the scaled vertex coordinates; and mapping the first image to the quadrilateral model to obtain the image with the magnifying glass special effect.
[0012] Optionally, the processing parameter comprises a blur coefficient, and the special effect processing comprises radial blur processing; and the special effect processing on the first image according to the coordinates of the trigger pixel point and the processing parameter corresponding to the first image comprises: for each pixel point on the first image, obtaining the sum of the color values of a plurality of sampling points corresponding to the pixel point according to the coordinates of the trigger pixel point, the coordinates of the pixel point, the number of sampling points, the texture of the first image, and the blur coefficient; and obtaining the color value of the pixel point according to the sum of the color values of the plurality of sampling points corresponding to the pixel point.
[0013] Optionally, the obtaining of the sum of the color values of the plurality of sampling points corresponding to the pixel point according to the coordinates of the trigger pixel point, the coordinates of the pixel point, the number of sampling points, the texture of the first image, and the blur coefficient comprises: determining the direction from the trigger pixel point to the pixel point according to the coordinates of the trigger pixel point and the coordinates of the pixel point; and determining the sum of the color values of the plurality of sampling points corresponding to the pixel point according to the coordinates of the pixel point, the number of sampling points, the blur coefficient, the texture of the first image, and the direction from the trigger pixel point to the pixel point.
[0014] Optionally, the obtaining of the color value of the pixel point according to the sum of the color values of the plurality of sampling points corresponding to the pixel point comprises: obtaining the color value of the pixel point by dividing the sum of the color values of the plurality of sampling points corresponding to the pixel point by the number of sampling points.
[0015] Optionally, the special effect processing on the first image according to the coordinate of the trigger pixel point and the processing parameter corresponding to the first image comprises: sequentially performing the radial color difference processing, the distortion processing, the scaling processing and the radial blur processing on the first image according to the coordinate of the trigger pixel point and the processing parameter corresponding to the first image.
[0016] Optionally, in the first mapping relationship, the frame sequence number is positively correlated with the color difference intensity coefficient, the scaling coefficient and the blur coefficient respectively, and the frame sequence number is negatively correlated with the distortion coefficient.
[0017] Optionally, the method further comprises: in response to a second trigger operation of a user, acquiring a screen coordinate of the second trigger operation; for each frame of a second image acquired after the second trigger operation, acquiring a coordinate of a trigger pixel point on the second image according to the screen coordinate of the second trigger operation; acquiring a processing parameter corresponding to the second image according to a frame sequence number of the second image and a second mapping relationship, and performing special effect processing on the second image according to the coordinate of the trigger pixel point on the second image and the processing parameter corresponding to the second image, wherein in the second mapping relationship, the frame sequence number is negatively correlated with the color difference intensity coefficient, the scaling coefficient and the blur coefficient respectively, and the frame sequence number is positively correlated with the distortion coefficient.
[0018] In a second aspect, the present disclosure provides a terminal device, comprising: an acquisition module configured to acquire a screen coordinate of a first trigger operation of a user in response to the first trigger operation; and a special effect processing module configured to acquire a coordinate of a trigger pixel point on each frame of a first image acquired after the first trigger operation according to the screen coordinate of the first trigger operation, and perform special effect processing on the first image according to the coordinate of the trigger pixel point, to obtain an image with a magnifying glass special effect.
[0019] In a third aspect, the present disclosure provides a computer readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, causes the processor to implement the method of the first aspect.
[0020] In a fourth aspect, the present disclosure provides a terminal device, comprising: a processor; and a memory configured to store executable instructions of the processor; wherein the processor is configured to implement the method of the first aspect by executing the executable instructions.
[0021] The image processing method and apparatus disclosed herein respond to a user's first trigger operation by acquiring the screen coordinates of the first trigger operation; for each frame of the first image acquired after the first trigger operation, the coordinates of a trigger pixel on the first image are acquired based on the screen coordinates of the first trigger operation; and special effects processing is applied to the first image based on the coordinates of the trigger pixel to obtain an image with a magnifying glass effect. This method can process images in a video into images with a magnifying glass effect, increasing the diversity of special effects and improving the user experience. Attached Figure Description
[0022] Figure 1 This is a flowchart illustrating an embodiment of the image processing method provided in this disclosure;
[0023] Figure 2 User interface diagram provided in this disclosure;
[0024] Figure 3 Flowchart of Embodiment 2 of the image processing method provided in this disclosure Figure 1 ;
[0025] Figure 4 Flowchart of Embodiment 2 of the image processing method provided in this disclosure Figure 2 ;
[0026] Figure 5 This is a schematic diagram of the radial color difference processing principle provided in this disclosure;
[0027] Figure 6 This is a flowchart illustrating a third embodiment of the image processing method provided in this disclosure;
[0028] Figure 7 This is a schematic diagram of the distortion processing principle provided in this disclosure;
[0029] Figure 8 A schematic flowchart of Embodiment 4 of the image processing method provided in this disclosure;
[0030] Figure 9 This is a schematic diagram of the scaling process provided in this disclosure;
[0031] Figure 10 This is a flowchart illustrating Embodiment 5 of the image processing method provided in this disclosure;
[0032] Figure 11 This is a schematic diagram of the structure of the image processing apparatus provided in this disclosure;
[0033] Figure 12 A schematic diagram of the hardware structure of the terminal device provided in this disclosure. Detailed Implementation
[0034] In order to make the purpose, technical solutions and advantages of the present disclosure clearer, the technical solutions in the present disclosure will be described clearly and completely below in combination with the drawings in 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 of ordinary skill in the art without creative labor fall within the protection scope of the present disclosure.
[0035] In the present disclosure, it should be explained that the terms "first" and "second" are only for the purpose of description, and cannot be understood as indicating or implying relative importance. In addition, "at least one" means one or more, and "multiple" means two or more. "And / or" describes the association relationship of the associated objects, which means that there can be three relationships, for example, A and / or B can represent the following three cases: A exists alone, A and B exist together, and B exists alone, where A and B can be singular or plural. The character "or" generally represents a "or" relationship between the associated objects before and after. "At least one of the following" or similar expressions means any combination of these items, including any combination of single item or multiple items. For example, at least one of a, b, or c can represent: a alone, b alone, c alone, a and b in combination, a and c in combination, b and c in combination, or a, b, and c in combination, where a, b, and c can be single or multiple.
[0036] The present disclosure provides an image processing method, which can process images in a video into images with magnifying glass special effects, increasing the special effect of the images and improving the user experience. Observing the magnifying effect of a real magnifying glass, there are phenomena such as radial color difference, distortion, scaling, and radial blur. The present disclosure simulates these phenomena and processes the images in the video accordingly, so that the processed images can be close to the magnifying effect of a real magnifying glass, making the special effect more realistic.
[0037] The image processing method provided by the present disclosure can be executed by a terminal device, and the form of the terminal device includes but is not limited to: a smart phone, a tablet computer, a notebook computer, a wearable electronic device, or a smart home device such as a smart television, and the present disclosure does not limit the form of the terminal device.
[0038] The technical solutions of the present disclosure and how the technical solutions of the present disclosure solve the above technical problems will be described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes can not be described again in some embodiments. The embodiments of the present disclosure will be described below in combination with the drawings.
[0039] Embodiment one
[0040] Figure 1The flowchart of an embodiment one of the image processing method provided by the present disclosure is shown in Figure 1 The image processing method provided by the present disclosure comprises:
[0041] S101, in response to a first trigger operation of a user, obtaining the screen coordinates of the first trigger operation.
[0042] For example, as shown in Figure 2 The first trigger operation can include a touch operation of the user on the screen, which can include a click operation, a double-click operation, or a sliding operation, etc. The first trigger operation can also include an expression trigger operation, etc. The specific form of the first trigger operation is not limited in the present application. The screen coordinates of the first trigger operation refer to the coordinates of the first trigger operation on the screen of the terminal device.
[0043] S102, for each frame of the first image obtained after the first trigger operation, obtaining the coordinates of the trigger pixel points on the first image according to the screen coordinates of the first trigger operation.
[0044] For example, the first image can be an image in a video collected in real time, an image in a locally saved image or video uploaded by the user, or an image in an image or video sent by another device.
[0045] For example, after obtaining the screen coordinates of the first trigger operation, the screen coordinates of the first trigger operation and the coordinates of each pixel point on the first image can be matched, and the matched pixel points can be regarded as the trigger pixel points, and the coordinates of the matched pixel points can be regarded as the coordinates of the trigger pixel points.
[0046] S103, performing special effect processing on the first image according to the coordinates of the trigger pixel points to obtain an image with a magnifying glass effect.
[0047] In one possible implementation, the same processing parameters are used to perform special effect processing on each frame of the first image, in which case the magnification of the processed image is the same.
[0048] In another possible implementation, a corresponding relationship between the frame number and the processing parameters can be established in advance, which is referred to as a first mapping relationship in the present disclosure. When processing the first image, the processing parameters corresponding to the first image are determined according to the frame number of the first image and the first mapping relationship, and then the first image is processed according to the coordinates of the trigger pixel points using the processing parameters corresponding to the first image. In this case, since the processing parameters corresponding to each frame of the first image are different, the magnification of the processed image is variable.
[0049] Optionally, the processing parameters can include at least one of a color difference intensity coefficient, a distortion coefficient, a zoom coefficient, and a blur coefficient, and the special effect processing includes at least one of radial color difference processing, distortion processing, zoom processing, or radial blur processing. The special effect processing includes processing procedures and processing parameters corresponding thereto, for example, the processing parameters include the color difference intensity coefficient and the distortion coefficient, and the special effect processing includes the radial color difference processing and the distortion processing.
[0050] For example, in order to realize that the magnification degree increases frame by frame, in the first mapping relationship, the frame number and the color difference intensity coefficient, the zoom coefficient, and the blur coefficient can be positively correlated, and negatively correlated with the distortion coefficient, so that the magnification degree of the image increases frame by frame.
[0051] The image processing method provided by the present disclosure responds to a first trigger operation of a user, obtains screen coordinates of the first trigger operation, obtains coordinates of a trigger pixel point on a first image according to the screen coordinates of the first trigger operation for each frame of the first image obtained after the first trigger operation, and performs special effect processing on the first image according to the coordinates of the trigger pixel point to obtain an image with a magnifying glass effect. The above method can process the image in the video into an image with a magnifying glass effect, increase the diversity of special effect, and improve the user experience.
[0052] Embodiment Two
[0053] Figure 3 The flowchart of Embodiment Two of the image processing method provided by the present disclosure is shown in the above description. The special effect processing in the present disclosure can include radial color difference processing, and the present embodiment describes the radial color difference processing procedure. As shown in the figure, the image processing method provided by the present embodiment includes: Figure 3
[0054] S301, in response to a first trigger operation of a user, obtaining screen coordinates of the first trigger operation.
[0055] S302, for each frame of a first image obtained after the first trigger operation, obtaining coordinates of a trigger pixel point on the first image according to the screen coordinates of the first trigger operation.
[0056] The implementation procedures of S301 and S302 are described in the above description, and will not be repeated here.
[0057] S303, obtaining a color difference intensity coefficient corresponding to the first image.
[0058] As described above, the first mapping relationship can be established in advance, and the first mapping relationship is used to indicate the corresponding relationship between the frame sequence number and the color difference intensity coefficient. When the first image is processed, the color difference intensity coefficient corresponding to the first image is determined according to the frame sequence number of the first image and the first mapping relationship, and then the first image is processed according to the coordinates of the trigger pixel point using the color difference intensity coefficient corresponding to the first image.
[0059] It should be noted that the essence of the radial color difference processing of the first image is to recalculate the color values of each pixel point on the first image. After each pixel point is assigned a new color value, an image with a radial color difference effect is obtained. Specifically, the radial color difference processing process can include S304-S305.
[0060] S304, for each pixel point on the first image, the sum of the color values of the plurality of sampling points corresponding to the pixel point in each color channel is obtained according to the coordinates of the trigger pixel point, the coordinates of the pixel point, the number of sampling points, the step length coefficient, the intensity coefficient corresponding to each color channel, the weight coefficient, the first image texture and the color difference intensity coefficient.
[0061] In a possible implementation, the sum of the color values of the plurality of sampling points corresponding to each pixel point in each color channel can be obtained by the following steps. Taking any pixel point on the first image as an example, for convenience of description, the pixel point will be referred to as the current pixel point by the disclosure, see Figure 4 , and specifically includes:
[0062] S304-A, the direction from the trigger pixel point to the current pixel point is determined according to the coordinates of the trigger pixel point and the coordinates of the current pixel point.
[0063] S304-B, the sampling step is determined according to the direction from the trigger pixel point to the current pixel point, the step length coefficient and the number of sampling points.
[0064] Specifically, the sampling step can be determined by the following formula:
[0065] step=dir*radiusStrength*u_Sample
[0066] Wherein, step is the sampling step, dir is the direction from the trigger pixel point to the current pixel point, radiusStrength is the step length coefficient, and u_Sample is the number of sampling points, wherein the step length coefficient and the number of sampling points can be preset values.
[0067] S304-C, for each color channel in the RGB channel, the offset corresponding to the color channel is determined according to the direction from the trigger pixel point to the current pixel point, the color difference intensity coefficient and the intensity coefficient corresponding to the color channel.
[0068] Specifically, the offset corresponding to the red channel can be determined by the following formula:
[0069] redOffset = dir * u_Strength * u_RedStrength
[0070] wherein redOffset is the offset corresponding to the red channel, dir is the direction from the trigger pixel point to the current pixel point, u_Strength is the color difference intensity coefficient, u_Strength is obtained through S302, u_RedStrength is the intensity coefficient of the red channel, and the intensity coefficient of the red channel can be a preset value.
[0071] The offset corresponding to the green channel can be determined by the following formula:
[0072] greenOffset = dir * u_Strength * u_GreenStrength
[0073] wherein greenOffset is the offset corresponding to the green channel, dir is the direction from the trigger pixel point to the current pixel point, u_Strength is the color difference intensity coefficient, u_Strength is obtained through S302, u_GreenStrength is the intensity coefficient of the green channel, and the intensity coefficient of the green channel can be a preset value.
[0074] The offset corresponding to the blue channel can be determined by the following formula:
[0075] blueOffset = dir * u_Strength * u_BlueStrength
[0076] wherein blueOffset is the offset corresponding to the blue channel, dir is the direction from the trigger pixel point to the current pixel point, u_Strength is the color difference intensity coefficient, u_Strength is obtained through S302, u_BlueStrength is the intensity coefficient of the blue channel, and the intensity coefficient of the blue channel can be a preset value.
[0077] S304-D, for each color channel in the RGB channel, the sum of the color values of the plurality of sampling points corresponding to the current pixel point in the color channel is determined according to the first image texture, the coordinates of the current pixel point, the offset corresponding to the color channel, the sampling step, the number of sampling points, and the weight coefficient.
[0078] Specifically, for any color channel, a loop statement can be used to determine the sum of the color values of the plurality of sampling points corresponding to the current pixel point in the color channel. Taking the red channel as an example, the formula in the loop statement is:
[0079] R+=texture2D(InputTexture, uv+redOffset).r*weight
[0080] Each time a loop is completed, the offset corresponding to the red channel is reduced by a step, and the number of loops is equal to the number of sampling points. R is the sum of color values of the sampling points in the red channel, InputTexture is the first image texture, uv is the coordinate of the current pixel point, redOffset is the offset corresponding to the red channel, weight is the weight coefficient, and the weight coefficient can be a preset value..r represents the red channel.
[0081] S305, according to the sum of color values of the sampling points corresponding to the current pixel point in each color channel, determine the color value of the current pixel point in each color channel.
[0082] For each channel, the color value of the current pixel point in the color channel can be obtained by using the following formula, taking the red channel as an example: R / =u_Sample. Wherein, R is the sum of color values of the sampling points corresponding to the current pixel point in the red channel, and u_Sample is the number of sampling points.
[0083] The following examples are given:
[0084] Referring to Figure 5 It is assumed that the pixel point O is the trigger pixel point, the pixel point M is the current pixel point, the sampling points corresponding to the current pixel point are M1, M2 and M3, the sum of color values of M1, M2 and M3 in the R channel is R1+R2+R3, the sum of color values of M1, M2 and M3 in the G channel is G1+G2+G3, and the sum of color values of M1, M2 and M3 in the B channel is B1+B2+B3, then the RGB value of M can be determined as: (R1+R2+R3) / 3, (G1+G2+G3) / 3, (B1+B2+B3) / 3.
[0085] All pixel points on the first image are processed as described above S304-S305, and the RGB values of all pixel points can be obtained. The calculated RGB values are assigned to the corresponding pixel points, and the image processed by the radial color difference can be obtained.
[0086] The image processing method provided by the embodiment provides a radial color difference processing method, and the image processed by the method has the effect of radial color difference in a real magnifying glass, and the special effect is strong.
[0087] Embodiment three
[0088] Figure 6The flowchart of the third embodiment of the image processing method provided by the present disclosure is shown in FIG. 6. As described above, the special effect processing in the present disclosure can include distortion processing, and the present embodiment describes the process of distortion processing. As shown in FIG. 6, the image processing method provided by the present embodiment includes the following steps. Figure 6
[0089] S601, in response to a first trigger operation of a user, obtaining screen coordinates of the first trigger operation.
[0090] S602, for each frame of the first image obtained after the first trigger operation, obtaining coordinates of a trigger pixel point on the first image according to the screen coordinates of the first trigger operation.
[0091] The implementation process of S601 and S602 is described above, and will not be repeated here.
[0092] S603, obtaining a distortion coefficient corresponding to the first image.
[0093] As described above, a first mapping relationship can be established in advance, which indicates the corresponding relationship between the frame number and the distortion coefficient. When processing the first image, the distortion coefficient corresponding to the first image is determined according to the frame number of the first image and the first mapping relationship, and then the first image is processed according to the coordinates of the trigger pixel point using the distortion coefficient corresponding to the first image.
[0094] The process of distortion processing is described below. As described above, the radial color difference processing is essentially to recalculate the color value of each pixel point on the first image. Similarly, the essence of distortion processing is also to recalculate the color value of each pixel point on the first image. After each pixel point is assigned a new color value, an image with distortion effect is obtained. Specifically, it includes S604-S607.
[0095] S604, obtaining a distortion function according to the distortion coefficient.
[0096] In one possible implementation, it is assumed that f(x)=(k-1)x 2 +x, all functions with k satisfying 0.5≤k≤1.0 can be used as the distortion function, and k can be used as the distortion coefficient. Assuming that k is 0.75 obtained in S603, the distortion function is f(x)=(0.75-1)x 2 +x=-0.25x 2 +x.
[0097] S605, for each pixel point on the first image, determining a pre-distortion pixel point corresponding to the pixel point on the first image according to the coordinates of the trigger pixel point, the coordinates of the pixel point, the distance between the trigger pixel point and the pixel point, and the distortion function.
[0098] Specifically, taking any pixel point on the first image as an example, for the convenience of description, the pixel point is referred to as a current pixel point in the disclosure, and the coordinate of the pre-distortion pixel point corresponding to the current pixel point can be determined by the following formula:
[0099]
[0100] Wherein, uv is the coordinate of the pre-distortion pixel point corresponding to the current pixel point, textureCoordinate is the coordinate of the current pixel point, center is the coordinate of the trigger pixel point, dis is the distance from the trigger pixel point to the current pixel point, and f is the distortion function.
[0101] S606, taking the color value of the pre-distortion pixel point as the color value of the current pixel point.
[0102] After determining the coordinate of the pre-distortion pixel point corresponding to the current pixel point through S605, the pre-distortion pixel point is found on the first image, and the color value of the pre-distortion pixel point is taken as the color value of the current pixel point.
[0103] The following examples are given:
[0104] Figure 7 The image after radial chromatic aberration processing is assumed to be a trigger pixel point O and a current pixel point M, the pre-distortion pixel point corresponding to the pixel point M is M1 obtained through S605, and the RGB value of M1 is R1, G1 and B1. Then the RGB value of the pixel point M can be determined as R1, G1 and B1.
[0105] For all pixel points on the first image, S605-S606 is processed in the same way, and the color values of all pixel points can be obtained. The calculated color values are assigned to each pixel point, and the image after distortion processing can be obtained.
[0106] The image processing method provided by the embodiment provides a distortion processing method, and the image processed by the method has a real magnifying glass distortion effect and a strong special effect real sense.
[0107] Embodiment four
[0108] Figure 8 The flowchart of embodiment four of the image processing method provided by the disclosure is shown in the above description. The special effect processing in the disclosure can include scaling processing, and the scaling processing process is described in the embodiment. As shown in Figure 8 The image processing method provided by the embodiment includes:
[0109] S801, in response to a first trigger operation of a user, obtaining the screen coordinate of the first trigger operation.
[0110] S802, for each frame of the first image obtained after the first trigger operation, obtaining coordinates of a trigger pixel point on the first image according to screen coordinates of the first trigger operation.
[0111] The implementation process of S801 and S802 is described above, and will not be repeated here.
[0112] S803, obtaining a scaling coefficient corresponding to the first image.
[0113] As described above, the first mapping relationship can be established in advance, and the first mapping relationship is used to indicate the corresponding relationship between the frame number and the scaling coefficient. When the first image is processed, the scaling coefficient corresponding to the first image is determined according to the frame number of the first image and the first mapping relationship, and then the first image is processed according to the coordinates of the trigger pixel point using the scaling coefficient corresponding to the first image.
[0114] The process of scaling processing is introduced below. Specifically, it includes S804-S806.
[0115] S804, determining scaled vertex coordinates according to the coordinates of the trigger pixel point, the current vertex coordinates of the quadrilateral model 10, and the scaling coefficient, the quadrilateral model 10 being used to change the display size of the image.
[0116] Specifically, the scaled vertex coordinates can be calculated by the following formula:
[0117] pos1=(pos-center)*scale+center
[0118] Wherein, pos is the current vertex coordinates of the quadrilateral model 10, center is the coordinates of the trigger pixel point, and scale is the scaling coefficient. pos1 is the scaled vertex coordinates.
[0119] S805, updating the vertex coordinates of the quadrilateral model 10 to the scaled vertex coordinates.
[0120] The following examples are given:
[0121] Referring to FIG. 1, Figure 9 As shown in FIG. 1, assuming that the trigger pixel point is point O, the current vertex of the quadrilateral model 10 is A, B, C and D, and the scaling coefficient obtained by S803 is 1, it can be determined that the quadrilateral model 10 needs to be enlarged by one time with point O as the center, and the scaled vertex is shown using A', B', C' and D'.
[0122] S806, mapping the first image to the quadrilateral model 10 to obtain an image with a magnifying glass effect.
[0123] The image processing method provided by the embodiment provides a zoom processing method, and the image processed by using the method has a zoom effect in a real magnifying glass and strong special effect reality.
[0124] Embodiment five
[0125] Figure 10 The flowchart of embodiment five of the image processing method provided by the present disclosure is shown in the above description. The special effect processing in the present disclosure can include radial blur processing, and the embodiment describes the radial blur processing process. As shown in the figure, Figure 10 The image processing method provided by the embodiment includes:
[0126] S1001, in response to a first trigger operation of a user, obtaining screen coordinates of the first trigger operation.
[0127] S1002, for each frame of the first image obtained after the first trigger operation, obtaining coordinates of a trigger pixel point on the first image according to the screen coordinates of the first trigger operation.
[0128] The implementation process of S1001 and S1002 is described above, and the present application will not be repeated here.
[0129] S1003, obtaining a blur coefficient corresponding to the first image.
[0130] As described above, a first mapping relationship can be established in advance, which indicates the corresponding relationship between the frame number and the blur coefficient. When processing the first image, first, the frame number of the first image and the above-mentioned corresponding relationship are used to determine the blur coefficient corresponding to the first image, and then the first image is processed according to the coordinates of the trigger pixel point using the blur coefficient corresponding to the first image.
[0131] Like radial chromatic aberration processing and distortion processing, the essence of radial blur processing is also to recalculate the color value of each pixel point on the first image. After each pixel point is given a new color value, an image with radial blur effect is obtained. Specifically, it includes S1004-S1005.
[0132] S1004, for each pixel point on the first image, obtaining the sum of the color values of a plurality of sampling points corresponding to the pixel point according to the coordinates of the trigger pixel point, the coordinates of the pixel point, the number of sampling points, the texture of the first image, and the blur coefficient.
[0133] Taking any pixel point on the first image as an example, for the convenience of description, the present disclosure will refer to the pixel point as the current pixel point. The sum of the color values of the plurality of sampling points corresponding to the current pixel point can be obtained by the following method:
[0134] First, according to the coordinates of the trigger pixel point and the coordinates of the current pixel point, the direction from the trigger pixel point to the current pixel point is determined, for details, refer to the above embodiment, and the present disclosure will not be repeated here. Then, according to the coordinates of the current pixel point, the number of sampling points, the blur factor, the first image texture, and the direction from the trigger pixel point to the current pixel point, the sum of the color values of the plurality of sampling points corresponding to the current pixel point is determined.
[0135] Specifically, the sum of the color values of the plurality of sampling points corresponding to the current pixel point can be determined by using a loop statement, and the formula in the loop statement is:
[0136] vec2 uv=uv+blurfactor*dir*i;
[0137] outColor+=texture2D(InputTexture,uv)
[0138] Wherein, i is a loop variable, the number of loops is equal to the number of sampling points, uv is the coordinates of the current pixel point, blur factor is the blur factor, dir is the direction from the trigger pixel point to the current pixel point, InputTexture is the first image texture, and outColor is the sum of the color values of the plurality of sampling points. vec2 is used to represent that the coordinates uv of the current pixel point is a two-dimensional vector.
[0139] S1005, according to the sum of the color values of the plurality of sampling points corresponding to the current pixel point, the color value of the current pixel point is obtained.
[0140] Specifically, the color value of the current pixel point can be obtained by using the following formula: outColor / =u_Sample. Wherein, outColor is the sum of the color values of the plurality of sampling points corresponding to the current pixel point, and u_Sample is the number of sampling points.
[0141] S1004-S1005 are performed on all pixel points on the first image, and the color values of all pixel points can be obtained. By assigning the calculated color value to the corresponding pixel point, the image after radial blur processing can be obtained.
[0142] The image processing method provided by the embodiment provides a radial blur processing method, and the image processed by using the method has a radial blur effect in a real magnifying glass, and the special effect has strong reality.
[0143] In a possible implementation, the first image can be sequentially subjected to radial chromatic aberration processing, distortion processing, scaling processing, and radial blur processing according to the coordinates of the trigger pixel point and the processing parameters corresponding to the first image. In this implementation, the result after radial chromatic aberration processing is the object of distortion processing, that is, Figure 6The first image in the distortion processing is the image after radial chromatic aberration processing, and the result of the distortion processing is the scaled object, i.e. Figure 8 The first image in the scaling process is the distorted image, and the result of the scaling process is the radially blurred object, i.e. Figure 10 The first image in the radial blurring process is a scaled image. This processing order results in an image that more closely resembles the effect of a real magnifying glass.
[0144] For example, in the first mapping relationship, the frame number and the three parameters of color difference intensity coefficient, scaling coefficient, and blur coefficient can be positively correlated, while they are negatively correlated with the distortion coefficient. Therefore, the magnification of the image obtained through the above image processing increases frame by frame. In one possible implementation, the user... Figure 2 After triggering the first trigger operation on the shooting interface shown, a second trigger operation can also be triggered. In response to the second trigger operation, the screen coordinates of the second trigger operation are obtained. For each frame of the second image obtained after the second trigger operation, the coordinates of the trigger pixel on the second image are obtained according to the screen coordinates of the second trigger operation. According to the frame number of the second image and the second mapping relationship, the processing parameters corresponding to the second image are obtained. According to the coordinates of the trigger pixel on the second image and the processing parameters corresponding to the second image, special effects processing is performed on the second image. In the second mapping relationship, the frame number and the color difference intensity coefficient, scaling coefficient, and blur coefficient can be negatively correlated, and the frame number and the distortion coefficient can be positively correlated. In this way, after the terminal device receives the second trigger operation, the magnification of the image obtained through the above image processing process decreases frame by frame. This makes the changes in the image magnification after the user triggers the first trigger operation and the changes in the image magnification after triggering the second trigger operation two opposite processes. After the user triggers the first trigger operation, the magnification increases frame by frame, and after triggering the second trigger operation, the magnification decreases frame by frame, enhancing the user's enjoyment of video production.
[0145] Understandably, in the first mapping relationship, the relationship between frame number and chromatic difference intensity coefficient, scaling coefficient, and blur coefficient can be set to negative correlation, and the relationship between frame number and distortion coefficient can be set to positive correlation. In the second mapping relationship, the relationship between frame number and chromatic difference intensity coefficient, scaling coefficient, and blur coefficient can be set to positive correlation, and the relationship between frame number and distortion coefficient can be set to negative correlation. The effect of this setting is that after the user triggers the first trigger operation, the magnification decreases frame by frame, and after the user triggers the second trigger operation, the magnification increases frame by frame.
[0146] Figure 11 This is a schematic diagram of the structure of the image processing apparatus provided in this disclosure. Figure 11 As shown, the image processing apparatus provided in this disclosure includes:
[0147] The acquisition module 1101 is configured to acquire screen coordinates of a first trigger operation in response to the first trigger operation of a user.
[0148] The special effect processing module 1102 is configured to, for each frame of a first image acquired after the first trigger operation, acquire coordinates of a trigger pixel point on the first image according to the screen coordinates of the first trigger operation, and perform special effect processing on the first image according to the coordinates of the trigger pixel point to obtain an image with a magnifying glass effect.
[0149] Optionally, the special effect processing module 1102 is specifically configured to:
[0150] acquire a processing parameter corresponding to the first image according to the frame number of the first image and a first mapping relationship, the processing parameter including at least one of a chromatic aberration intensity coefficient, a distortion coefficient, a scaling coefficient, and a blur coefficient, and the first mapping relationship being used to indicate a corresponding relationship between a frame number and a processing parameter;
[0151] perform special effect processing on the first image according to the coordinates of the trigger pixel point and the processing parameter corresponding to the first image to obtain the image with the magnifying glass effect;
[0152] The special effect processing corresponds to the processing parameter and includes at least one of radial chromatic aberration processing, distortion processing, scaling processing, or radial blur processing.
[0153] Optionally, the processing parameter includes a chromatic aberration intensity coefficient, and the special effect processing includes radial chromatic aberration processing.
[0154] For each pixel point on the first image, the special effect processing module 1102 is specifically configured to acquire a sum of color values of a plurality of sampling points corresponding to the pixel point in each color channel according to the coordinates of the trigger pixel point, the coordinates of the pixel point, the number of sampling points, a step length coefficient, an intensity coefficient corresponding to each color channel, a weight coefficient, a texture of the first image, and the chromatic aberration intensity coefficient, and determine a color value of the pixel point in each color channel according to the sum of the color values of the plurality of sampling points corresponding to the pixel point in each color channel.
[0155] Optionally, the special effect processing module 1102 is specifically configured to:
[0156] determine a direction from the trigger pixel point to the pixel point according to the coordinates of the trigger pixel point and the coordinates of the pixel point;
[0157] determine a sampling step length according to the direction from the trigger pixel point to the pixel point, the step length coefficient, and the number of sampling points;
[0158] For each color channel in the RGB channel, the offset corresponding to the color channel is determined based on the direction from the trigger pixel to the pixel, the color difference intensity coefficient, and the intensity coefficient corresponding to the color channel.
[0159] For each color channel in the RGB channel, the sum of the color values of multiple sampling points corresponding to the pixel in the color channel is determined based on the first image texture, the coordinates of the pixel, the offset corresponding to the color channel, the sampling step size, the number of sampling points, and the weighting coefficient.
[0160] Optional, special effects processing module 1102, specifically used for:
[0161] For each color channel in the RGB channel, the color value of the pixel in the color channel is obtained by dividing the sum of the color values of multiple sampling points corresponding to the pixel in the color channel by the number of sampling points.
[0162] Optionally, the processing parameters include: distortion coefficients; the special effects processing includes: distortion processing; the special effects processing module 1102 is specifically used for:
[0163] Based on the distortion coefficients, obtain the distortion function;
[0164] For each pixel in the first image, the pixel before distortion is determined based on the coordinates of the trigger pixel, the coordinates of the pixel, the distance from the trigger pixel to the pixel, and the distortion function; the color value of the pixel before distortion is used as the color value of the pixel.
[0165] Optionally, the processing parameters include a scaling factor, and the special effects processing includes scaling processing; the special effects processing module 1102 is specifically used for:
[0166] Based on the coordinates of the trigger pixel, the current vertex coordinates of the quadrilateral model, and the scaling factor, the scaled vertex coordinates are determined, and the quadrilateral model is used to change the display size of the image.
[0167] Update the vertex coordinates of the quadrilateral model to the scaled vertex coordinates;
[0168] The first image is mapped onto the quadrilateral model to obtain the image with the magnifying glass effect.
[0169] Optionally, the processing parameters include: fuzziness coefficients; the special effects processing includes: radial blurring processing; the special effects processing module 1102 is specifically used for:
[0170] For each pixel point on the first image, according to the coordinates of the trigger pixel point, the coordinates of the pixel point, the number of sampling points, the first image texture and the blur coefficient, a sum of color values of a plurality of sampling points corresponding to the pixel point is obtained; and according to the sum of color values of the plurality of sampling points corresponding to the pixel point, a color value of the pixel point is obtained.
[0171] Optionally, the special effect processing module 1102 is specifically configured to:
[0172] According to the coordinates of the trigger pixel point and the coordinates of the pixel point, a direction from the trigger pixel point to the pixel point is determined.
[0173] According to the coordinates of the pixel point, the number of sampling points, the blur coefficient, the first image texture and the direction from the trigger pixel point to the pixel point, a sum of color values of a plurality of sampling points corresponding to the pixel point is determined.
[0174] Optionally, the special effect processing module 1102 is specifically configured to:
[0175] The sum of color values of the plurality of sampling points corresponding to the pixel point is divided by the number of sampling points to obtain the color value of the pixel point.
[0176] Optionally, the special effect processing module 1102 is specifically configured to:
[0177] According to the coordinates of the trigger pixel point and the processing parameters corresponding to the first image, the first image is sequentially subjected to the radial color difference processing, the distortion processing, the scaling processing and the radial blur processing.
[0178] Optionally, in the first mapping relationship, the frame number is positively correlated with the color difference intensity coefficient, the scaling coefficient and the blur coefficient, and the frame number is negatively correlated with the distortion coefficient.
[0179] Optionally, the obtaining module 1101 is further configured to:
[0180] In response to a second trigger operation of a user, a screen coordinate of the second trigger operation is obtained.
[0181] The special effect processing module 1102 is further configured to:
[0182] For each second image obtained after the second trigger operation, coordinates of a trigger pixel point on the second image are obtained according to screen coordinates of the second trigger operation; a processing parameter corresponding to the second image is obtained according to a frame number of the second image and a second mapping relationship, the second image is processed according to the coordinates of the trigger pixel point on the second image and the processing parameter corresponding to the second image, and in the second mapping relationship, the frame number is negatively correlated with a chromatic aberration intensity coefficient, a zooming coefficient and a blur coefficient, and is positively correlated with a distortion coefficient.
[0183] Figure 11 The image processing apparatus shown can be used to execute the steps in any of the method embodiments described above. The implementation principles and technical effects are similar and will not be repeated here.
[0184] Figure 12 A hardware structure schematic diagram of a terminal device provided by the present disclosure is shown. As shown in the figure, Figure 12 The terminal device of the present embodiment can include:
[0185] a processor 1201; and
[0186] a memory 1202 configured to store executable instructions of the processor;
[0187] The processor 1201 is configured to implement the steps of any of the method embodiments described above by executing the executable instructions. The implementation principles and technical effects are similar and will not be repeated here.
[0188] The present disclosure provides a computer-readable storage medium having a computer program stored thereon, the computer program being executed by a processor to cause the processor to implement the steps of any of the method embodiments described above. The implementation principles and technical effects are similar and will not be repeated here.
[0189] The present disclosure also provides a program product including a computer program stored in a readable storage medium, at least one processor can read the computer program from the readable storage medium, and the at least one processor executes the computer program to cause an electronic device to implement the steps of any of the method embodiments described above. The implementation principles and technical effects are similar and will not be repeated here.
[0190] In several embodiments provided by the present disclosure, it should be understood that the disclosed apparatus and method can be implemented in other manners. For example, the described apparatus embodiments are merely schematic. The division of the units is merely logical function division. There can be another division manner in actual implementation. For example, a plurality of units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the displayed or discussed mutual couplings or direct couplings or communication connections can be indirect couplings or communication connections through some interfaces, devices or units, and can be in electrical, mechanical or other forms.
[0191] The units described as separate components can or can not be physically separate, and the components shown as units can or can not be physical units, i.e., can be located in one place, or can be distributed on a plurality of network units. Part or all of the units can be selected according to actual needs to achieve the purpose of the embodiment.
[0192] In addition, each functional unit in the various embodiments of the present disclosure can be integrated in one processing unit, or each unit can be a physically independent unit, or two or more units can be integrated in one unit. The integrated unit can be implemented in the form of hardware, or in the form of hardware plus software function unit.
[0193] The integrated unit implemented in the form of software function unit can be stored in a computer readable storage medium. The software function unit stored in the storage medium includes a plurality of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor (English: processor) to execute part of the steps of the method described in the various embodiments of the present disclosure. The foregoing storage medium includes a U disk, a mobile hard disk, a read-only memory (English: Read-Only Memory, abbreviated as: ROM), a random access memory (English: Random Access Memory, abbreviated as: RAM), a magnetic disk or an optical disk, and various program code storage media.
[0194] It should be understood that the processor described in the present disclosure can be a central processing unit (CPU) and can also be other general-purpose processors, digital signal processors (DSP), application specific integrated circuits (ASIC), etc. The general-purpose processor can be a microprocessor or can also be any conventional processor, etc. The steps of the method disclosed in combination with the present disclosure can be directly embodied as hardware processor execution or executed by a combination of hardware and software modules in the processor.
[0195] Finally, it should be noted that: the above embodiments are only used to illustrate the technical solutions of the present disclosure, but not to limit them; although the present disclosure has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that: it can still modify the technical solutions recorded in the foregoing embodiments, or make equivalent replacement for part or all of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the scope of the technical solutions of the embodiments of the present disclosure.
Claims
1. An image processing method, characterized in that, include: In response to the user's first trigger operation, obtain the screen coordinates of the first trigger operation; For each frame of the first image obtained after the first triggering operation, the coordinates of the triggering pixel on the first image are obtained according to the screen coordinates of the first triggering operation. The first image is an image in a real-time captured video. Based on the frame number of the first image and the first mapping relationship, the processing parameters corresponding to the first image are obtained, wherein the processing parameters corresponding to each frame of the first image are different; the processing parameters include at least one of the following: color difference intensity coefficient, distortion coefficient, scaling coefficient and blur coefficient, and the first mapping relationship is used to indicate the correspondence between the frame number and the processing parameters; Based on the coordinates of the trigger pixel and the processing parameters corresponding to the first image, the first image is subjected to special effects processing to obtain an image with a magnifying glass effect, and the magnification degree of the processed image is variable; wherein, the special effects processing corresponds to the processing parameters and includes at least one of the following: radial color difference processing, distortion processing, scaling processing, or radial blur processing; The processing parameters include a color difference intensity coefficient, and the special effects processing includes radial color difference processing. The process of performing special effects processing on the first image based on the coordinates of the trigger pixel and the processing parameters corresponding to the first image includes: determining the direction from the trigger pixel to the pixel based on the coordinates of the trigger pixel and the pixel itself; determining the sampling step size based on the direction from the trigger pixel to the pixel, the step size coefficient, and the number of sampling points; for each color channel in the RGB channels, determining the offset corresponding to the color channel based on the direction from the trigger pixel to the pixel, the color difference intensity coefficient, and the intensity coefficient corresponding to the color channel; for each color channel in the RGB channels, determining the sum of the color values of multiple sampling points corresponding to the pixel in the color channel based on the first image texture, the coordinates of the pixel, the offset corresponding to the color channel, the sampling step size, the number of sampling points, and the weight coefficient; and for each color channel in the RGB channels, dividing the sum of the color values of multiple sampling points corresponding to the pixel in the color channel by the number of sampling points to obtain the color value of the pixel in the color channel.
2. The method according to claim 1, characterized in that, The processing parameters include: distortion coefficients; the special effects processing includes: distortion processing. The step of performing special effects processing on the first image based on the coordinates of the triggered pixel and the processing parameters corresponding to the first image includes: Based on the distortion coefficients, obtain the distortion function; For each pixel in the first image, the pixel before distortion is determined based on the coordinates of the trigger pixel, the coordinates of the pixel, the distance from the trigger pixel to the pixel, and the distortion function. The color value of the pixel before distortion is used as the color value of the pixel.
3. The method according to claim 1, characterized in that, The processing parameters include: scaling factor; the special effects processing includes: scaling processing. The step of performing special effects processing on the first image based on the coordinates of the triggered pixel and the processing parameters corresponding to the first image includes: Based on the coordinates of the trigger pixel, the current vertex coordinates of the quadrilateral model, and the scaling factor, the scaled vertex coordinates are determined, and the quadrilateral model is used to change the display size of the image. Update the vertex coordinates of the quadrilateral model to the scaled vertex coordinates; The first image is mapped onto the quadrilateral model to obtain the image with the magnifying glass effect.
4. The method according to claim 1, characterized in that, The processing parameters include: fuzziness coefficients; the special effects processing includes: radial fuzziness processing. The step of performing special effects processing on the first image based on the coordinates of the triggered pixel and the processing parameters corresponding to the first image includes: For each pixel in the first image, the sum of the color values of multiple sampling points corresponding to the pixel is obtained based on the coordinates of the trigger pixel, the coordinates of the pixel, the number of sampling points, the texture of the first image, and the blur coefficient. The color value of the pixel is obtained by summing the color values of multiple sampling points corresponding to the pixel.
5. The method according to claim 4, characterized in that, The step of obtaining the sum of color values of multiple sampling points corresponding to the pixel based on the coordinates of the trigger pixel, the coordinates of the pixel, the number of sampling points, the first image texture, and the blur coefficient includes: The direction from the trigger pixel to the pixel is determined based on the coordinates of the trigger pixel and the coordinates of the pixel. The sum of the color values of multiple sampling points corresponding to the pixel is determined based on the coordinates of the pixel, the number of sampling points, the blur coefficient, the first image texture, and the direction from the trigger pixel to the pixel.
6. The method according to claim 4, characterized in that, The step of obtaining the color value of a pixel based on the sum of the color values of multiple sampling points corresponding to the pixel includes: The color value of the pixel is obtained by dividing the sum of the color values of the multiple sampling points corresponding to the pixel by the number of sampling points.
7. The method according to any one of claims 1-5, characterized in that, The step of performing special effects processing on the first image based on the coordinates of the triggered pixel and the processing parameters corresponding to the first image includes: Based on the coordinates of the trigger pixel and the processing parameters corresponding to the first image, the first image is sequentially subjected to radial color difference processing, distortion processing, scaling processing, and radial blur processing.
8. The method according to claim 1, characterized in that, In the first mapping relationship, the frame number is positively correlated with the color difference intensity coefficient, scaling coefficient, and blur coefficient, and negatively correlated with the distortion coefficient.
9. The method according to claim 8, characterized in that, The method further includes: In response to the user's second trigger operation, obtain the screen coordinates of the second trigger operation; For each frame of the second image obtained after the second triggering operation, the coordinates of the triggering pixel on the second image are obtained according to the screen coordinates of the second triggering operation; Based on the frame number of the second image and the second mapping relationship, obtain the processing parameters corresponding to the second image; Based on the coordinates of the trigger pixels in the second image and the corresponding processing parameters, special effects are applied to the second image. In the second mapping relationship, the frame number is negatively correlated with the color difference intensity coefficient, scaling coefficient, and blur coefficient, and positively correlated with the distortion coefficient.
10. A terminal device, characterized in that, include: The acquisition module is used to acquire the screen coordinates of the first trigger operation in response to the user's first trigger operation; The special effects processing module is used to obtain the coordinates of the trigger pixel on each frame of the first image obtained after the first trigger operation, based on the screen coordinates of the first trigger operation. The first image is an image in a real-time captured video. Based on the frame number of the first image and the first mapping relationship, processing parameters corresponding to the first image are obtained, wherein the processing parameters corresponding to each frame of the first image are different; the processing parameters include at least one of the following: color difference intensity coefficient, distortion coefficient, scaling coefficient, and blur coefficient, and the first mapping relationship is used to indicate the correspondence between the frame number and the processing parameters; based on the coordinates of the trigger pixel and the processing parameters corresponding to the first image, special effects processing is performed on the first image to obtain an image with a magnifying glass effect, and the magnification degree of the processed image is variable; wherein the special effects processing corresponds to the processing parameters and includes at least one of the following: radial color difference processing, distortion processing, scaling processing, or radial blur processing; the processing parameters include: color difference intensity coefficient, and the special effects processing includes: radial color difference processing; the special effects processing module performs special effects processing on the first image based on the coordinates of the trigger pixel and the processing parameters corresponding to the first image. The method includes: determining the direction from the trigger pixel to the pixel based on the coordinates of the trigger pixel and the coordinates of the pixel; determining the sampling step size based on the direction from the trigger pixel to the pixel, the step size coefficient, and the number of sampling points; for each color channel in the RGB channel, determining the offset corresponding to the color channel based on the direction from the trigger pixel to the pixel, the color difference intensity coefficient, and the intensity coefficient corresponding to the color channel; for each color channel in the RGB channel, determining the sum of the color values of multiple sampling points corresponding to the pixel in the color channel based on the first image texture, the coordinates of the pixel, the offset corresponding to the color channel, the sampling step size, the number of sampling points, and the weight coefficient; and for each color channel in the RGB channel, dividing the sum of the color values of multiple sampling points corresponding to the pixel in the color channel by the number of sampling points to obtain the color value of the pixel in the color channel.
11. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it causes the processor to implement the method according to any one of claims 1-9.
12. A terminal device, characterized in that, include: processor; as well as Memory for storing the executable instructions of the processor; The processor is configured to implement the method of any one of claims 1-9 by executing the executable instructions.
Citation Information
Patent Citations
Portable terminal and method of enlarging and displaying contents
CN104898919A
Image processing device, image processing method, and program
US20120002113A1