WO2016107461A1 - Application icon generation method and apparatus, and mobile device - Google Patents

Application icon generation method and apparatus, and mobile device Download PDF

Info

Publication number
WO2016107461A1
WO2016107461A1 PCT/CN2015/098254 CN2015098254W WO2016107461A1 WO 2016107461 A1 WO2016107461 A1 WO 2016107461A1 CN 2015098254 W CN2015098254 W CN 2015098254W WO 2016107461 A1 WO2016107461 A1 WO 2016107461A1
Authority
WO
WIPO (PCT)
Prior art keywords
pixel
sampled
application icon
fitting function
pixel value
Prior art date
Application number
PCT/CN2015/098254
Other languages
French (fr)
Chinese (zh)
Inventor
周士奇
楚汝峰
黄英
Original Assignee
阿里巴巴集团控股有限公司
周士奇
楚汝峰
黄英
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 阿里巴巴集团控股有限公司, 周士奇, 楚汝峰, 黄英 filed Critical 阿里巴巴集团控股有限公司
Publication of WO2016107461A1 publication Critical patent/WO2016107461A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/01Input arrangements or combined input and output arrangements for interaction between user and computer
    • G06F3/048Interaction techniques based on graphical user interfaces [GUI]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T11/002D [Two Dimensional] image generation
    • G06T11/40Filling a planar surface by adding surface attributes, e.g. colour or texture

Definitions

  • the present application relates to the field of image processing, and in particular, to a method and an apparatus for generating an application icon.
  • the application also relates to a mobile device
  • Mobile Internet-based software also includes a variety of third-party applications.
  • the application icon of the third-party application is usually displayed directly on the desktop.
  • the design style of the application icons of the third-party applications is completely dependent on the developers of the third-party applications, different applications have different design styles, and the design styles between the applications and the systems are also different. It can be seen that the inconsistency in the design style of the application icons and systems has become a problem to be solved.
  • An existing method for solving the above problem is to manually repaint the application icon of the third party application.
  • the present application provides a method, an apparatus, and a mobile device for generating an application icon, so as to solve the problem that the manual redrawing of the application icon causes a huge workload in the prior art.
  • the application provides a method for generating an application icon, including:
  • the original image is synthesized onto the background image to generate the application icon.
  • a background image of the application icon is generated.
  • the generating according to the pixel value that is the largest proportion of the sampled pixel points, generating a background image of the application icon, including:
  • the background image is generated by using the most number of pixel values as the pixel values of the respective pixels in the background image.
  • sampling the pixel points in the original image of the application icon is as follows:
  • a column or row of pixels is sampled in the original image.
  • the pixel value of the obtained sampled pixel is matched to generate a pixel value fitting function of the sampled pixel, in the following manner:
  • a quadratic polynomial function fitting is performed on the sampled pixel to generate a quadratic pixel value fitting function of the sampled pixel.
  • the quadratic polynomial function fitting is performed on the sampled pixel points by using the following method:
  • a quadratic polynomial function fitting is performed on the sampled pixel points using a RANSAC method or a least squares method.
  • the sampling is performed on the sampled pixel to generate a pixel value of the sampled pixel Fit functions, including:
  • fitting calculations are respectively performed on the respective channels, and a pixel value fitting function of each channel is generated.
  • the following steps are used to determine whether the sampled pixel points meet the fitting function:
  • the determining whether the proportion of the number of sampled pixels that meet the fitting function is greater than a preset ratio is as follows:
  • the sampling manner of the sampling pixel in the original image of the application icon is to sample a column of pixels in the original image, the relationship between the position represented by the fitting function and the pixel value is generated.
  • the background image of the application icon includes:
  • the pixel value corresponding to the ordinate value is taken as the pixel value of each pixel in the row.
  • the sampling manner of sampling the pixel point in the original image of the application icon is to sample a row of pixel points in the original image, the relationship between the position represented by the fitting function and the pixel value is generated.
  • the background image of the application icon includes:
  • the pixel value corresponding to the abscissa value is taken as the pixel value of each pixel in the column.
  • the color mode of the original image includes an RGB color mode.
  • the application also provides an apparatus for generating an application icon, including:
  • a sampling unit configured to sample pixel points in an original image of the application icon, and obtain position coordinates and pixel values of each sampled pixel point;
  • a fitting unit configured to fit the obtained pixel values of the sampled pixel points to generate a pixel value fitting function of the sampled pixel points
  • a determining unit configured to determine whether a proportion of the number of sampled pixels that meet the fitting function is greater than a preset ratio; if yes, generating an application icon according to a position and a pixel value relationship represented by the fitting function Background image
  • a synthesizing unit configured to synthesize the original image onto the background image to generate the application icon.
  • the determining unit includes:
  • a first generating subunit configured to: if the judgment result that the proportion of the number of sampled pixels that meet the fitting function is greater than a preset ratio is not, according to the proportion of the sampled pixels a pixel value that generates a background image of the application icon.
  • the first generating subunit includes:
  • a calculation subunit configured to calculate a quantity of pixel values of each level in the sampled pixel
  • the fitting unit includes:
  • Obtaining a subunit configured to acquire distribution data of the sampled pixel points on respective channel components that represent pixel values
  • the fitting subunit is configured to perform fitting calculation on each channel according to the distribution data on the respective channel components, and generate a pixel value fitting function of each channel.
  • the determining unit includes:
  • a first determining subunit configured to determine whether a proportion of the number of sampled pixels that meet the fitting function is greater than a preset ratio
  • the first determining subunit includes:
  • a first calculating subunit configured to calculate a number of sampled pixels that meet the fitting function
  • the first computing subunit includes:
  • a second determining subunit configured to determine whether the sampled pixel points meet the fitting function
  • the second determining subunit includes:
  • a second calculating subunit configured to bring a position coordinate value of the sampled pixel point into the fitting function, and calculate a fitted pixel value of the sampled pixel point;
  • a third determining subunit configured to determine whether a distance between an actual pixel value of the sampled pixel point and a fitted pixel value of the sampled pixel point is less than a preset distance; if yes, determining the sampled pixel The points conform to the fit function.
  • the determining unit includes:
  • a second generation subunit configured to determine, according to the position and the pixel represented by the fitting function, if the judgment result that the proportion of the number of sampled pixels satisfying the fitting function is greater than a preset ratio is YES A value relationship that generates a background image of the application icon.
  • the second generating subunit includes:
  • a first traversing sub-unit configured to traverse each row of the background image, bring a ordinate value corresponding to the row into the fitting function, and calculate a pixel value corresponding to the ordinate value;
  • a first setting subunit configured to use a pixel value corresponding to the ordinate value as a pixel value of each pixel in the row.
  • the second generating subunit includes:
  • a second traversing sub-unit configured to traverse the columns of the background image, bring the horizontal coordinate value corresponding to the column into the fitting function, and calculate and obtain a pixel value corresponding to the horizontal coordinate value
  • a second setting subunit configured to use a pixel value corresponding to the abscissa value as a pixel value of each pixel in the column.
  • the present application further provides a mobile device, where the mobile device includes:
  • a memory configured to store an original image of an application icon, the original image being displayed by the processor, the application icon being displayed on the display, the application icon being from the original image and a background image Synthesized, the background image is based on the sampled image in the original image
  • the pixel value fitting function of the prime point is generated, and the size of the background image is larger than the original image.
  • the application provides a method, a device and a mobile device for generating an application icon, and by fitting a sampled pixel point in an original image of an application icon, generating a pixel value fitting function of the sampled pixel point, if the fitting function is met
  • the proportion of the number of pixels to be sampled is greater than the preset ratio, and the background image of the application icon is generated according to the position and pixel value relationship represented by the fitting function, and the original image is synthesized onto the background image, so that the application icon is automatically generated to avoid Manually redraw the app icon to reduce the workload.
  • FIG. 1 is a flow chart of an embodiment of a method for generating an application icon of the present application
  • FIG. 2 is a pixel value distribution diagram of a sampled pixel point in a blue channel in an embodiment of a method for generating an application icon of the present application;
  • FIG. 3 is a quadratic fitting curve of a pixel value of a sampled pixel in a blue channel according to an embodiment of a method for generating an application icon of the present application;
  • FIG. 4 is a specific flowchart of determining whether a pixel value of a sampled pixel points conforms to a fitting function according to an embodiment of a method for generating an application icon of the present application;
  • FIG. 5 is a schematic diagram of an embodiment of an apparatus for generating an application icon of the present application.
  • FIG. 6 is a schematic diagram of an embodiment of a mobile device of the present application.
  • the method for generating an application icon provided by the present application is based on a design concept that when the pixel value fitting function of the sampled pixel in the original image can represent the actual pixel value distribution of the sampled pixel,
  • the compositor generates a background image of the application icon and synthesizes the original image and the background image into an application icon. Therefore, by implementing the method provided by the present application, it is possible to generate an application icon that is visually harmonious with the original image.
  • FIG. 1 is a flowchart of an embodiment of a method for generating an application icon of the present application. The method includes the following steps:
  • Step S101 sampling pixel points in the original image of the application icon, and acquiring position coordinates and pixel values of the respective sampled pixel points.
  • the original image described in the embodiment of the present application is an original application icon provided by a third-party application.
  • the image file storage formats commonly used in the original image include PNG format (Portable Network Graphics), BMP format (Bitmap, bitmap format), and JPEG (Joint Photographic Experts Group). Expert group format) and so on.
  • PNG format Portable Network Graphics
  • BMP format Bitmap, bitmap format
  • JPEG Joint Photographic Experts Group
  • Expert group format Joint Photographic Experts Group
  • the PNG format is a bitmap file storage format.
  • PNG is used to store grayscale images
  • the depth of grayscale images can be up to 16 bits.
  • the depth of color images can be as much as 48 bits, and Up to 16-bit alpha channel data can be stored.
  • the BMP format is a standard image file format in the Windows operating system and is very widely used.
  • JPEG JPEG image compression algorithm can provide good compression performance and has better reconstruction quality. It is widely used in image and video processing. From the image color mode perspective, the color mode of the original image includes the RGB color mode. Color mode is an algorithm for representing colors in the digital world. It is a model that represents a color as a digital form, or a way to record the color of an image. In the digital world, in order to represent various colors, people usually divide colors into several components.
  • the color modes are divided into: RGB mode, CMYK mode, HSB mode, Lab color mode, bitmap mode, gray mode, index color mode, two-tone mode, and multi-channel mode. Since the original image is used for display on the screen, not for printing or printing, the original image is usually in RGB mode, which gives a wider color gamut.
  • the application icon which is also referred to as a desktop icon or an operation icon, is an icon of a third-party application displayed on the desktop. By clicking the app icon, you can run the corresponding third-party app.
  • the app icon is an image that is redrawn from the original image provided by the third-party app.
  • pixel points are sampled in the original image, and the position and pixel value data of each sampled pixel point are obtained.
  • the process of sampling pixel points in the original image may be implemented in various specific implementations, for example, one column or one row of pixels may be sampled in the original image, or a continuous region of different rows or columns may be sampled, or Is a completely discrete pixel. Sampling the above different manners is only a modification of the specific embodiment, and does not deviate from the core of the present application, and therefore is within the protection scope of the present application.
  • the computational complexity of the fitting process involved in the subsequent steps corresponding to different sampling modes is different.
  • the computational complexity of the fitting process corresponding to sampling a continuous region of different rows and different columns is higher than the computational complexity of the fitting process corresponding to sampling one column or one row of pixels.
  • the reason is that the pixel corresponding to the pixel value fitting function of the sampling pixels of different rows and columns is a three-dimensional surface, and the pixel corresponding to the pixel value fitting function of one column or one row of sampling pixels can be simplified into a two-dimensional curve.
  • the computational complexity of 3D surfaces is higher than the computational complexity of 2D curves.
  • the effect of the generated background file is different for different sampling methods.
  • a background image is generated according to a specific continuous area of different rows and different columns, and the background image and the original image may be visually more harmonious and natural.
  • the color of a certain edge region in the original image is used as the color of the background image, and the visual effect is likely to be higher than the visual effect of the background image generated according to the color of one column of sampled pixels.
  • the sampling method of sampling a column of pixel points in the original image is preferentially implemented, and the process of sampling the pixel points in the original image of the application icon is realized.
  • the position coordinates and pixel values of each sampled pixel in the column are obtained.
  • the original image of an RGB color mode has a size of 150*150.
  • the sequence of coordinate values of the sampled pixels to be acquired is: (5, 1), (5, 2), (5, 3), ... (5, 150)
  • the sequence of pixel values is: (255, 0, 0), (255, 0, 0), (255, 0, 1), ... (255, 0, 255).
  • Step S102 fitting the obtained pixel values of the sampled pixel points to generate a pixel value fitting function of the sampled pixel points.
  • a polynomial function is fitted to the pixel value of the sampled pixel to generate a pixel value fitting function of the sampled pixel.
  • the process of fitting the obtained pixel values of the sampled pixel points may be implemented in various specific implementation manners, for example, a quadratic polynomial function fitting may be performed on the pixel values of the sampled pixel points, or Higher order polynomial function fitting. The higher the number of fitting functions, the higher the fit to the pixel values of the sampled pixels, ie the better the fitting effect, but the higher the computational complexity.
  • a quadratic polynomial function fitting is performed on the pixel values of the sampled pixel points, and a quadratic pixel value fitting function of the sampled pixel points is generated.
  • the image of the quadratic function is a parabola whose axes of symmetry are parallel or coincident with the y-axis.
  • quadratic fitting that is, fitting the set of data with a quadratic polynomial function according to a given data sequence.
  • the fitting objective is to obtain a fitting function in the sense that the mean square error of the fitting function and the data sequence is the smallest.
  • the process of quadratic polynomial function fitting on the pixel values of the sampled pixels is the process of obtaining the coefficients a, b, and c in the quadratic function.
  • the specific values of the coefficients a, b, and c of the quadratic function depend on the data sequence being fitted. If the fitted data sequence is linearly distributed, the value of the quadratic coefficient a corresponds to zero. .
  • a plurality of specific algorithms can be used to perform quadratic polynomial function fitting on the pixel values of the sampled pixels, such as RANSAC algorithm or least squares method.
  • the least squares method is usually suitable for small errors. If you need to extract a model from a noisy data set, the least squares method is not enough. Since the pixel values of the sampled pixels in the original image are likely to differ greatly, the fitting effect of the RANSAC algorithm is better than the least squares method.
  • the RANSAC algorithm is preferably used to perform quadratic polynomial function fitting on the pixel values of the sampled pixels. The following is an example of performing a quadratic polynomial function fitting on the pixel values of the sampled pixels by using the RANSAC algorithm.
  • the input to the RANSAC algorithm is a set of observations (often containing large noise or invalid points), a parametric model for interpreting the observed data, and some trusted parameters.
  • RANSAC achieves its goal by iteratively selecting a random set of data in the data.
  • the selected subset is assumed to be an intra-site point and verified by the following method: First, there is a model adapted to the assumed intra-point, that is, all unknown parameters can be calculated from the assumed intra-office points;
  • the model obtained in one step tests all other data, and if a point is applied to the estimated model, it is considered to be an intra-point. If there are enough points to be classified as hypothetical intra-points, then the estimated model is reasonable enough.
  • the RANSAC algorithm is applied to perform quadratic polynomial function fitting on the pixel values of the sampled pixels. Assuming that the number of pixels to be sampled is 100, and the pixel value of the sampled pixel is subjected to a quadratic polynomial function fitting, the fitting process is as follows: First, three pixel points are arbitrarily selected among the pixels to be sampled, The quadratic polynomial function is fitted according to the pixel values of the selected three pixel points, and each coefficient is obtained to obtain a quadratic polynomial function; then, the quadratic polynomial function is used to test the pixel values of the remaining 97 pixels. The number of pixels suitable for the function is obtained; after the above process is repeated a fixed number of times (for example, 10 times), the quadratic polynomial function having the largest number of corresponding pixels is selected as the final fitting function.
  • the original image is an image of the RGB mode, that is, each pixel value is represented by three color channels of red, green, and blue, so the pixel to be sampled is fitted to generate a pixel of the sampled pixel.
  • the value fitting function includes the following steps:
  • Step S1021 Acquire distribution data of the sampled pixel points on respective channel components that represent pixel values.
  • the pixel value of each pixel is represented by three components, which are denoted as (r, g, b), where r is the component value of the red channel, g is the component value of the green channel, b is the component value of the blue channel, and the component values of the three channels are superimposed to obtain the color of the pixel. Since each pixel value is represented by three components, it can be determined that the fitting function can represent the actual pixel value of the sampled pixel only when the distribution data of each color channel conforms to the fitting function of the corresponding channel. Distribution status. In order to be able to fit the component values of each color channel of the sampled pixel, respectively, firstly, the distribution data of the sampled pixel on each channel component of the pixel value is obtained.
  • FIG. 2 is a pixel value distribution diagram of a sampled pixel point in a blue channel according to an embodiment of a method for generating an application icon of the present application. Since the sampled pixel is a column of data in the original image, the abscissa in FIG. 2 corresponds to the ordinate position of the sampled pixel, and the ordinate in FIG. 2 represents the pixel value of the sampled pixel. By observing the shape of the curve in Fig. 2, it can be seen that the abrupt portion of the curve has a large difference from the blue component value of the smooth portion.
  • Step S1022 Perform fitting calculation on each channel according to the distribution data on the respective channel components, and generate a pixel value fitting function of each channel.
  • the RANSAC algorithm is used to perform quadratic polynomial function fitting on the distribution data of the sampled pixel points on the blue channel component in Fig. 2, and the obtained coefficients a, b, and c are respectively 0.0, 0.528492, 204.00, of which The coefficient of the item is 0.
  • the ordinate value of each sampled pixel is taken as the independent variable x of the quadratic polynomial function, and the quadratic polynomial function is calculated to calculate the value of the dependent variable y of the quadratic polynomial function; And then draw the corresponding points in the quadratic curve according to the (x, y) value.
  • a quadratic fitting graph of the sampled pixel point in the blue channel is generated.
  • FIG. 3 is a graph of quadratic fitting of pixel values of sampled pixels in a blue channel according to an embodiment of a method for generating an application icon of the present application.
  • the abscissa of Figure 3 corresponds The ordinate position of the pixel, the ordinate in Fig. 3 represents the pixel value.
  • the quadratic fitting curve is a straight line, which means that the color value is gradually changed as the ordinate position of the pixel point changes.
  • Step S103 determining whether the proportion of the number of sampled pixels that meet the fitting function is greater than a preset ratio; if yes, generating a background image of the application icon according to the position and pixel value relationship represented by the fitting function .
  • the method provided by the present application determines whether the fitting function can represent the actual pixel value distribution of the sampled pixel points, and determines whether the proportion of the number of sampled pixels that meet the fitting function is greater than a preset ratio.
  • the so-called fit function means that the distance between the actual pixel value of the sampled pixel and the corresponding fitted pixel value in the fitting function is within a predetermined distance.
  • FIG. 4 is a specific flowchart for determining whether a pixel value of a sampled pixel points conforms to a fitting function according to an embodiment of a method for generating an application icon of the present application.
  • determining whether an actual pixel value of a sampled pixel point meets a corresponding fitting pixel value on the fitting function includes the following steps:
  • Step S401 Bring the position coordinate value of the sampled pixel point into the fitting function, and calculate a fitted pixel value of the sampled pixel point.
  • the argument x of the fitting function obtained in step S102 is position information
  • the dependent variable y is a pixel value
  • Step S402 It is determined whether the distance between the actual pixel value of the sampled pixel point and the fitted pixel value of the sampled pixel point is less than a preset distance.
  • the preset distance may be a value of a minimum mean square error between a sequence of actual pixel values of the sampled pixel and a sequence of fitted pixel values, or a smaller value directly determined.
  • the smaller the preset distance the smaller the number of sampled pixels that match the fitting function, and the less likely it is to adopt a technical solution for generating a background image according to the fitting function.
  • Step S403 If the result of the above determination is yes, it is determined that the sampled pixel points meet the fitting function.
  • the preset distance is set to 3, that is, if the distance between the actual pixel value of the sampled pixel and the fitted pixel value is less than 3, it is determined that The point is on the fitted curve corresponding to the fitting function.
  • each pixel value is represented by a plurality of color components, it can be determined only when the fitting function of each color channel is fitted to the distribution data of the channel.
  • the fitting function can represent the actual pixel value distribution of the sampled pixels. Therefore, when step S103 is performed, it is determined whether the proportion of the number of sampled pixels that meet the fitting function is greater than a preset ratio, and the following method is adopted: determining a pixel value fitting function of each channel that matches the characterizing the pixel value. Whether the proportion of the number of sampled pixels is greater than the preset ratio.
  • the preset ratio in step S103 may be an empirical value obtained through experiments, or may be a direct set value. In this embodiment, the preset ratio is set to 55%, that is, if the number of sampled pixels that meet the fitting function accounts for more than 55% of the number of all sampled pixels, then It is determined that the current fitting function can represent the actual pixel value distribution of the sampled pixel, otherwise it is determined that the current fitting function cannot represent the actual pixel value distribution of the sampled pixel.
  • the specific implementation process of generating the background image of the application icon according to the position and pixel value relationship represented by the fitting function is related to the sampling mode of the pixel. Different pixel sampling methods are used to implement the relationship between the position and the pixel value represented by the fitting function, and the specific process of generating the background image of the application icon is different.
  • the specific process of generating a background image corresponding to sampling a column of pixels and sampling a row of pixels is respectively given below.
  • the sampling mode of the sampling pixel in the original image of the application icon is to sample a column of pixels in the original image
  • the position and the pixel value relationship according to the fitting function are generated to generate the application icon.
  • a background image comprising: traversing each row of the background image, bringing a ordinate value corresponding to the row into the fitting function, and calculating a pixel value corresponding to the ordinate value; corresponding to the ordinate value
  • the pixel value is taken as the pixel value of each pixel in the line.
  • the sampling method of sampling pixel points in the original image of the application icon is to sample a row of pixel points in the original image, generating the application icon according to the position and pixel value relationship represented by the fitting function a background image, comprising: traversing each column of the background image, bringing an abscissa value corresponding to the column into the fitting function, and calculating a pixel value corresponding to the abscissa value; and the abscissa value
  • the corresponding pixel value is taken as the pixel value of each pixel in the column.
  • step S103 if the judgment result that the proportion of the number of sampled pixels corresponding to the fitting function is greater than the preset ratio is negative, indicating that the fitting determination fails, it is determined that the original image is relatively complicated.
  • the method provided by the present application does not adopt a strategy of generating a background image according to a fitting function, but adopts a strategy of statistical pixel value distribution, that is, generating an application icon according to the pixel value that accounts for the largest proportion among the pixels to be sampled. Background image.
  • the statistical result of the same-level pixel value in FIG. 2 is that the pixel value of the RGB pixel value (2, 39, 68) accounts for the highest proportion, and a large background image with a single color is generated by using the color.
  • Step S104 synthesize the original image onto the background image to generate the application icon.
  • the smaller original image is placed in the background image to generate a new larger application icon, which is more harmonious and natural to the original image.
  • a method for generating an application icon is provided.
  • the present application further provides an apparatus for generating an application icon.
  • the apparatus corresponds to an embodiment of the above-described method of generating an application icon.
  • FIG. 5 is a schematic diagram of an embodiment of an apparatus for generating an application icon of the present application. Since the device embodiment is basically similar to the method embodiment, the description is relatively simple, and the method is implemented as described in the relevant method. Part of the description of the example can be. The device embodiments described below are merely illustrative.
  • the apparatus for generating an application icon of the embodiment includes: a sampling unit 101, configured to sample pixel points in an original image of an application icon, acquire position coordinates and pixel values of each sampled pixel point; and the fitting unit 102 uses And fitting the obtained pixel value of the sampled pixel to generate a pixel value fitting function of the sampled pixel; the determining unit 103 is configured to determine the sampled pixel that meets the fitting function Whether the proportion of the quantity is greater than a preset ratio; if yes, generating a background image of the application icon according to the position and pixel value relationship represented by the fitting function; and a synthesizing unit 104, configured to synthesize the original image into the On the background image, the application icon is generated.
  • the determining unit 103 includes:
  • a first generating subunit configured to: if the judgment result that the proportion of the number of sampled pixels that meet the fitting function is greater than a preset ratio is not, according to the proportion of the sampled pixels a pixel value that generates a background image of the application icon.
  • the first generating subunit includes:
  • a calculation subunit configured to calculate a quantity of pixel values of each level in the sampled pixel
  • the fitting unit 102 includes:
  • Obtaining a subunit configured to acquire distribution data of the sampled pixel points on respective channel components that represent pixel values
  • a fitting sub-unit configured to perform fitting calculation on each channel according to the distribution data on the respective channel components, and obtain a pixel value fitting function of each channel.
  • the determining unit 103 includes:
  • a first determining subunit configured to determine whether a proportion of the number of sampled pixels that meet the fitting function is greater than a preset ratio
  • the first determining subunit includes:
  • a first calculating subunit configured to calculate a number of sampled pixels that meet the fitting function
  • the first computing subunit includes:
  • a second determining subunit configured to determine whether the sampled pixel points meet the fitting function
  • the second determining subunit includes:
  • a second calculating subunit configured to bring a position coordinate value of the sampled pixel point into the fitting function, and calculate a fitted pixel value of the sampled pixel point;
  • a third determining subunit configured to determine whether a distance between an actual pixel value of the sampled pixel point and a fitted pixel value of the sampled pixel point is less than a preset distance; if yes, determining the sampled pixel The points conform to the fit function.
  • the determining unit 103 includes:
  • a second generation subunit configured to determine, according to the position and the pixel represented by the fitting function, if the judgment result that the proportion of the number of sampled pixels satisfying the fitting function is greater than a preset ratio is YES A value relationship that generates a background image of the application icon.
  • the second generating subunit includes:
  • a first traversing sub-unit configured to traverse each row of the background image, bring a ordinate value corresponding to the row into the fitting function, and calculate a pixel value corresponding to the ordinate value;
  • a first setting subunit configured to use a pixel value corresponding to the ordinate value as a pixel value of each pixel in the row.
  • the second generating subunit includes:
  • a second traversing sub-unit configured to traverse the columns of the background image, bring the horizontal coordinate value corresponding to the column into the fitting function, and calculate and obtain a pixel value corresponding to the horizontal coordinate value
  • a second setting subunit configured to use a pixel value corresponding to the abscissa value as a pixel value of each pixel in the column.
  • the embodiment of the present application further provides a mobile device, as shown in FIG. 6, the mobile device includes: a display 601; a processor 602; and a memory 603 configured to store an original image of an application icon, When the original image is executed by the processor 602, the application icon is displayed on the display 601, the application icon is synthesized by the original image and the background image, and the background image is according to the original image. The pixel value fitting function of the sampled pixel is generated, and the size of the background image is larger than the original image.
  • the application provides a method, a device and a mobile device for generating an application icon, and by fitting a sampled pixel point in an original image of an application icon, generating a pixel value fitting function of the sampled pixel point, if the fitting function is met
  • the proportion of the number of pixels to be sampled is greater than the preset ratio, and the background image of the application icon is generated according to the position and pixel value relationship represented by the fitting function, and the original image is synthesized onto the background image, so that the application icon is automatically generated to avoid Manually redraw the app icon to reach Reduce the effect of the workload.
  • a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
  • processors CPUs
  • input/output interfaces network interfaces
  • memory volatile and non-volatile memory
  • the memory may include non-persistent memory, random access memory (RAM), and/or non-volatile memory in a computer readable medium, such as read only memory (ROM) or flash memory.
  • RAM random access memory
  • ROM read only memory
  • Memory is an example of a computer readable medium.
  • Computer readable media including both permanent and non-persistent, removable and non-removable media may be implemented by any method or technology.
  • the information can be computer readable instructions, data structures, modules of programs, or other data.
  • Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read only memory. (ROM), electrically erasable programmable read only memory (EEPROM), flash memory or other memory technology, compact disk read only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, Magnetic tape cartridges, magnetic tape storage or other magnetic storage devices or any other non-transportable media can be used to store information that can be accessed by a computing device.
  • computer readable media does not include non-transitory computer readable media, such as modulated data signals and carrier waves.
  • embodiments of the present application can be provided as a method, system, or computer program product.
  • the present application can take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment in combination of software and hardware.
  • the application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) including computer usable program code.

Abstract

Provided are an application icon generation method and apparatus, and mobile device. The generation method comprises: sampling pixel points in an original image of an application icon, so as to acquire the position coordinates and pixel values of various sampled pixel points; performing fitting on the obtained pixel values of the sampled pixel points, so as to generate a fitting function of the pixel values of the sampled pixel points; judging whether the proportion of the number of the sampled pixel points meeting the fitting function is greater than a pre-set proportion, and if so, according to the relationship between the position and the pixel value presented by the fitting function, generating a background image of the application icon; and compositing the original image onto the background image, so as to generate the application icon. By adopting the method provided in the present application, an application icon can be generated automatically, which avoids the manual re-drawing of the application icon, thereby achieving the effect of reducing the workload.

Description

一种应用图标的生成方法、装置及移动设备Method, device and mobile device for generating application icons 技术领域Technical field
本申请涉及图像处理领域,具体涉及一种应用图标的生成方法和装置。本申请同时涉及一种移动设备The present application relates to the field of image processing, and in particular, to a method and an apparatus for generating an application icon. The application also relates to a mobile device
背景技术Background technique
随着移动互联网技术的不断发展,基于移动互联网的软件也日益增多,例如:操作系统、刷机包、桌面应用程序等,各种软件为用户提供了丰富多彩的服务。由于各种软件的开发商不同,因此各种软件的设计风格均不相同。例如,在操作系统领域,包括YunOS、IOS、Android等,每一种操作系统都有自己的设计风格;在刷机包(即:ROM包)领域,包括MIUI、乐蛙OS、Smartisan OS等,每一种刷机包的设计风格均不相同;在桌面应用程序领域,包括小米桌面、点心桌面等,每一种应用也都有自己的设计风格。综上所述,基于移动互联网的软件没有统一的设计风格。With the continuous development of mobile Internet technology, mobile Internet-based software is also increasing, such as operating systems, flashing packages, desktop applications, etc., and various software provides users with a variety of services. Because of the different developers of various software, the design styles of various softwares are different. For example, in the operating system field, including YunOS, IOS, Android, etc., each operating system has its own design style; in the field of Brush Pack (ie: ROM package), including MIUI, Le Frog OS, Smartisan OS, etc. A brush bag design style is different; in the field of desktop applications, including Xiaomi desktop, dim sum desktop, etc., each application also has its own design style. In summary, mobile Internet-based software does not have a unified design style.
基于移动互联网的软件还包括各种第三方应用。为了方便用户运行第三方应用,通常将第三方应用的应用图标直接显示在桌面上。在实际应用中,为提高用户的体验,需要使第三方应用的应用图标能够符合整个系统的设计风格。然而,由于第三方应用的应用图标的设计风格完全取决于第三方应用的开发商,因此不同的应用具有不同的设计风格,应用与系统之间的设计风格也不相同。由此可见,应用图标和系统的设计风格不一致成为一个需要解决的问题。Mobile Internet-based software also includes a variety of third-party applications. In order to facilitate the user to run a third-party application, the application icon of the third-party application is usually displayed directly on the desktop. In practical applications, in order to improve the user experience, it is necessary to make the application icons of the third-party applications conform to the design style of the entire system. However, since the design style of the application icons of the third-party applications is completely dependent on the developers of the third-party applications, different applications have different design styles, and the design styles between the applications and the systems are also different. It can be seen that the inconsistency in the design style of the application icons and systems has become a problem to be solved.
解决上述问题的现有方法,是对第三方应用的应用图标进行手动的重新绘制。采用人工重新绘制方法,主要存在两个缺点:1)由于第三方应用的数量巨大,因此人工重新绘制的工作量也是巨大的,对公司或者团队来说从经济、时间上都是巨大的消耗;2)由于第三方可能会不定期的更新应用图标,如果没有及时的发现并进行重新绘制可能会给用户带来不好的体验。在实际应用中,为减少工作量,通常采取的策略是,选取在应用商店中排名比较靠前的一些应用来重新绘制其应用图标。An existing method for solving the above problem is to manually repaint the application icon of the third party application. There are two main disadvantages in using the manual redrawing method: 1) Due to the large number of third-party applications, the workload of manual redrawing is also huge, which is huge consumption for the company or the team in terms of economy and time; 2) Because the third party may update the application icon from time to time, if it is not found in time and repainted, it may bring a bad experience to the user. In practical applications, in order to reduce the workload, the usual strategy is to select some applications that are ranked higher in the app store to redraw their application icons.
综上所述,为使得应用图标和系统的设计风格能够一致,现有技术存在人工重绘应用图标导致工作量巨大的问题。In summary, in order to make the design style of the application icon and the system consistent, the prior art has the problem that the manual redrawing of the application icon leads to a huge workload.
发明内容 Summary of the invention
本申请提供一种应用图标的生成方法、装置及移动设备,以解决现有技术存在人工重绘应用图标导致工作量巨大的问题。The present application provides a method, an apparatus, and a mobile device for generating an application icon, so as to solve the problem that the manual redrawing of the application icon causes a huge workload in the prior art.
本申请提供一种应用图标的生成方法,包括:The application provides a method for generating an application icon, including:
在应用图标的原始图像中采样像素点,获取各个被采样像素点的位置坐标和像素值;Sampling pixel points in an original image of the application icon, obtaining position coordinates and pixel values of each sampled pixel point;
对所获得的所述被采样像素点的像素值进行拟合,生成所述被采样像素点的像素值拟合函数;And fitting the obtained pixel values of the sampled pixel points to generate a pixel value fitting function of the sampled pixel points;
判断符合所述拟合函数的被采样像素点数量所占比例是否大于预设比例;若是,则根据所述拟合函数表示的位置与像素值关系,生成所述应用图标的背景图像;Determining whether a proportion of the number of sampled pixels that meet the fitting function is greater than a preset ratio; if yes, generating a background image of the application icon according to a position and a pixel value relationship represented by the fitting function;
将所述原始图像合成到所述背景图像上,生成所述应用图标。The original image is synthesized onto the background image to generate the application icon.
可选的,如果所述判断符合所述拟合函数的被采样像素点数量所占比例是否大于预设比例的判断结果为否,则根据所述被采样像素点中占比例最大的像素值,生成所述应用图标的背景图像。Optionally, if the determining whether the proportion of the number of sampled pixels that meet the fitting function is greater than a preset ratio is negative, according to the pixel value that is the largest proportion of the sampled pixels, A background image of the application icon is generated.
可选的,所述根据所述被采样像素点中占比例最大的像素值,生成所述应用图标的背景图像,包括:Optionally, the generating, according to the pixel value that is the largest proportion of the sampled pixel points, generating a background image of the application icon, including:
计算所述被采样像素点中各级像素值的数量;Calculating a quantity of pixel values of each of the sampled pixels;
将数量最多的像素值作为所述背景图像中各个像素点的像素值,生成所述背景图像。The background image is generated by using the most number of pixel values as the pixel values of the respective pixels in the background image.
可选的,所述在应用图标的原始图像中采样像素点,采用如下方式:Optionally, the sampling the pixel points in the original image of the application icon is as follows:
在所述原始图像中采样一列或者一行像素点。A column or row of pixels is sampled in the original image.
可选的,所述对所获得的所述被采样像素点的像素值进行拟合,生成所述被采样像素点的像素值拟合函数,采用如下方式:Optionally, the pixel value of the obtained sampled pixel is matched to generate a pixel value fitting function of the sampled pixel, in the following manner:
对被采样像素点进行二次多项式函数拟合,生成所述被采样像素点的二次像素值拟合函数。A quadratic polynomial function fitting is performed on the sampled pixel to generate a quadratic pixel value fitting function of the sampled pixel.
可选的,所述对被采样像素点进行二次多项式函数拟合,采用如下方式:Optionally, the quadratic polynomial function fitting is performed on the sampled pixel points by using the following method:
采用RANSAC方法或者最小二乘法,对所述被采样像素点进行二次多项式函数拟合。A quadratic polynomial function fitting is performed on the sampled pixel points using a RANSAC method or a least squares method.
可选的,所述对被采样像素点进行拟合,生成所述被采样像素点的像素值 拟合函数,包括:Optionally, the sampling is performed on the sampled pixel to generate a pixel value of the sampled pixel Fit functions, including:
获取所述被采样像素点在表征像素值的各个通道分量上的分布数据;Obtaining distribution data of the sampled pixel points on respective channel components characterizing pixel values;
根据所述各个通道分量上的分布数据,在各个通道上分别进行拟合计算,生成各个通道的像素值拟合函数。According to the distribution data on the respective channel components, fitting calculations are respectively performed on the respective channels, and a pixel value fitting function of each channel is generated.
可选的,所述判断符合所述拟合函数的被采样像素点数量所占比例是否大于预设比例的步骤中,采用如下步骤判断被采样像素点是否符合所述拟合函数:Optionally, in the step of determining whether the proportion of the number of sampled pixels in the fitting function is greater than a preset ratio, the following steps are used to determine whether the sampled pixel points meet the fitting function:
将被采样像素点的位置坐标值带入所述拟合函数,计算所述被采样像素点的拟合像素值;Taking a position coordinate value of the sampled pixel point into the fitting function, and calculating a fitted pixel value of the sampled pixel point;
判断所述被采样像素点的实际像素值和所述被采样像素点的拟合像素值之间的距离是否小于预设距离;Determining whether a distance between an actual pixel value of the sampled pixel point and a fitted pixel value of the sampled pixel point is less than a preset distance;
若上述判断结果为是,则判定所述被采样像素点符合所述拟合函数;If the result of the above determination is yes, determining that the sampled pixel points meet the fitting function;
遍历被采样像素点,对每个被采样像素点执行上述判断;每次判断完成后,若判断结果为是,则将符合所述拟合函数的被采样像素点数量加一;遍历完成后,即获得所述符合所述拟合函数的被采样像素点数量。Traversing the sampled pixel points, performing the above determination on each sampled pixel; after each determination is completed, if the determination result is yes, the number of sampled pixels that meet the fitting function is incremented by one; after the traversal is completed, That is, the number of sampled pixels that meet the fitting function is obtained.
可选的,所述判断符合所述拟合函数的被采样像素点数量所占比例是否大于预设比例,采用如下方式:Optionally, the determining whether the proportion of the number of sampled pixels that meet the fitting function is greater than a preset ratio is as follows:
判断符合表征像素值的各个通道的像素值拟合函数的被采样像素点数量所占比例是否均大于预设比例。It is determined whether the proportion of the number of sampled pixels corresponding to the pixel value fitting function of each channel that matches the pixel value is greater than a preset ratio.
可选的,如果所述在应用图标的原始图像中采样像素点的采样方式是在所述原始图像中采样一列像素点,则所述根据所述拟合函数表示的位置与像素值关系,生成所述应用图标的背景图像,包括:Optionally, if the sampling manner of the sampling pixel in the original image of the application icon is to sample a column of pixels in the original image, the relationship between the position represented by the fitting function and the pixel value is generated. The background image of the application icon includes:
遍历所述背景图像的各行,将所述行对应的纵坐标值带入所述拟合函数,计算获取所述纵坐标值对应的像素值;Traversing each row of the background image, bringing the ordinate value corresponding to the row into the fitting function, and calculating a pixel value corresponding to the ordinate value;
将所述纵坐标值对应的像素值作为所述行中每一个像素点的像素值。The pixel value corresponding to the ordinate value is taken as the pixel value of each pixel in the row.
可选的,如果所述在应用图标的原始图像中采样像素点的采样方式是在所述原始图像中采样一行像素点,则所述根据所述拟合函数表示的位置与像素值关系,生成所述应用图标的背景图像,包括:Optionally, if the sampling manner of sampling the pixel point in the original image of the application icon is to sample a row of pixel points in the original image, the relationship between the position represented by the fitting function and the pixel value is generated. The background image of the application icon includes:
遍历所述背景图像的各列,将所述列对应的横坐标值带入所述拟合函数,计算获取所述横坐标值对应的像素值; Traversing the columns of the background image, bringing the corresponding abscissa value of the column into the fitting function, and calculating a pixel value corresponding to the abscissa value;
将所述横坐标值对应的像素值作为所述列中每一个像素点的像素值。The pixel value corresponding to the abscissa value is taken as the pixel value of each pixel in the column.
可选的,所述原始图像的色彩模式包括RGB色彩模式。Optionally, the color mode of the original image includes an RGB color mode.
本申请还提供一种应用图标的生成装置,包括:The application also provides an apparatus for generating an application icon, including:
采样单元,用于在应用图标的原始图像中采样像素点,获取各个被采样像素点的位置坐标和像素值;a sampling unit, configured to sample pixel points in an original image of the application icon, and obtain position coordinates and pixel values of each sampled pixel point;
拟合单元,用于对所获得的所述被采样像素点的像素值进行拟合,生成所述被采样像素点的像素值拟合函数;a fitting unit, configured to fit the obtained pixel values of the sampled pixel points to generate a pixel value fitting function of the sampled pixel points;
判断单元,用于判断符合所述拟合函数的被采样像素点数量所占比例是否大于预设比例;若是,则根据所述拟合函数表示的位置与像素值关系,生成所述应用图标的背景图像;a determining unit, configured to determine whether a proportion of the number of sampled pixels that meet the fitting function is greater than a preset ratio; if yes, generating an application icon according to a position and a pixel value relationship represented by the fitting function Background image
合成单元,用于将所述原始图像合成到所述背景图像上,生成所述应用图标。And a synthesizing unit, configured to synthesize the original image onto the background image to generate the application icon.
可选的,所述判断单元包括:Optionally, the determining unit includes:
第一生成子单元,用于如果所述判断符合所述拟合函数的被采样像素点数量所占比例是否大于预设比例的判断结果为否,则根据所述被采样像素点中占比例最大的像素值,生成所述应用图标的背景图像。a first generating subunit, configured to: if the judgment result that the proportion of the number of sampled pixels that meet the fitting function is greater than a preset ratio is not, according to the proportion of the sampled pixels a pixel value that generates a background image of the application icon.
可选的,所述第一生成子单元包括:Optionally, the first generating subunit includes:
计算子单元,用于计算所述被采样像素点中各级像素值的数量;a calculation subunit, configured to calculate a quantity of pixel values of each level in the sampled pixel;
生成子单元,用于将数量最多的像素值作为所述背景图像中各个像素点的像素值,生成所述背景图像。Generating a subunit for generating the background image by using the most number of pixel values as pixel values of respective pixels in the background image.
可选的,所述拟合单元包括:Optionally, the fitting unit includes:
获取子单元,用于获取所述被采样像素点在表征像素值的各个通道分量上的分布数据;Obtaining a subunit, configured to acquire distribution data of the sampled pixel points on respective channel components that represent pixel values;
拟合子单元,用于根据所述各个通道分量上的分布数据,在各个通道上分别进行拟合计算,生成各个通道的像素值拟合函数。The fitting subunit is configured to perform fitting calculation on each channel according to the distribution data on the respective channel components, and generate a pixel value fitting function of each channel.
可选的,所述判断单元包括:Optionally, the determining unit includes:
第一判断子单元,用于判断符合所述拟合函数的被采样像素点数量所占比例是否大于预设比例;a first determining subunit, configured to determine whether a proportion of the number of sampled pixels that meet the fitting function is greater than a preset ratio;
所述第一判断子单元包括: The first determining subunit includes:
第一计算子单元,用于计算符合所述拟合函数的被采样像素点数量;a first calculating subunit, configured to calculate a number of sampled pixels that meet the fitting function;
所述第一计算子单元包括:The first computing subunit includes:
第二判断子单元,用于判断被采样像素点是否符合所述拟合函数;a second determining subunit, configured to determine whether the sampled pixel points meet the fitting function;
所述第二判断子单元包括:The second determining subunit includes:
第二计算子单元,用于将被采样像素点的位置坐标值带入所述拟合函数,计算所述被采样像素点的拟合像素值;a second calculating subunit, configured to bring a position coordinate value of the sampled pixel point into the fitting function, and calculate a fitted pixel value of the sampled pixel point;
第三判断子单元,用于判断所述被采样像素点的实际像素值和所述被采样像素点的拟合像素值之间的距离是否小于预设距离;若是,则判定所述被采样像素点符合所述拟合函数。a third determining subunit, configured to determine whether a distance between an actual pixel value of the sampled pixel point and a fitted pixel value of the sampled pixel point is less than a preset distance; if yes, determining the sampled pixel The points conform to the fit function.
可选的,所述判断单元包括:Optionally, the determining unit includes:
第二生成子单元,用于如果所述判断符合所述拟合函数的被采样像素点数量所占比例是否大于预设比例的判断结果为是,则根据所述拟合函数表示的位置与像素值关系,生成所述应用图标的背景图像。a second generation subunit, configured to determine, according to the position and the pixel represented by the fitting function, if the judgment result that the proportion of the number of sampled pixels satisfying the fitting function is greater than a preset ratio is YES A value relationship that generates a background image of the application icon.
可选的,所述第二生成子单元包括:Optionally, the second generating subunit includes:
第一遍历子单元,用于遍历所述背景图像的各行,将所述行对应的纵坐标值带入所述拟合函数,计算获取所述纵坐标值对应的像素值;a first traversing sub-unit, configured to traverse each row of the background image, bring a ordinate value corresponding to the row into the fitting function, and calculate a pixel value corresponding to the ordinate value;
第一设置子单元,用于将所述纵坐标值对应的像素值作为所述行中每一个像素点的像素值。a first setting subunit, configured to use a pixel value corresponding to the ordinate value as a pixel value of each pixel in the row.
可选的,所述第二生成子单元包括:Optionally, the second generating subunit includes:
第二遍历子单元,用于遍历所述背景图像的各列,将所述列对应的横坐标值带入所述拟合函数,计算获取所述横坐标值对应的像素值;a second traversing sub-unit, configured to traverse the columns of the background image, bring the horizontal coordinate value corresponding to the column into the fitting function, and calculate and obtain a pixel value corresponding to the horizontal coordinate value;
第二设置子单元,用于将所述横坐标值对应的像素值作为所述列中每一个像素点的像素值。a second setting subunit, configured to use a pixel value corresponding to the abscissa value as a pixel value of each pixel in the column.
此外,本申请还提供一种移动设备,其特征在于,所述移动设备包括:In addition, the present application further provides a mobile device, where the mobile device includes:
显示器;monitor;
处理器;以及Processor;
存储器,所述存储器被配置成存储应用图标的原始图像,所述原始图像被所述处理器执行时,在所述显示器显示所述应用图标,所述应用图标是由所述原始图像和背景图像合成的,所述背景图像是根据所述原始图像中的被采样像 素点的像素值拟合函数生成的,并且所述背景图像的尺寸大于所述原始图像。a memory configured to store an original image of an application icon, the original image being displayed by the processor, the application icon being displayed on the display, the application icon being from the original image and a background image Synthesized, the background image is based on the sampled image in the original image The pixel value fitting function of the prime point is generated, and the size of the background image is larger than the original image.
与现有技术相比,本申请具有以下优点:Compared with the prior art, the present application has the following advantages:
本申请提供一种应用图标的生成方法、装置及移动设备,通过对应用图标的原始图像中被采样像素点进行拟合,生成被采样像素点的像素值拟合函数,如果符合拟合函数的被采样像素点数量所占比例大于预设比例,则根据拟合函数表示的位置与像素值关系,生成应用图标的背景图像,并将原始图像合成到背景图像上,使得自动生成应用图标,避免人工重新绘制应用图标,从而达到减少工作量的效果。The application provides a method, a device and a mobile device for generating an application icon, and by fitting a sampled pixel point in an original image of an application icon, generating a pixel value fitting function of the sampled pixel point, if the fitting function is met The proportion of the number of pixels to be sampled is greater than the preset ratio, and the background image of the application icon is generated according to the position and pixel value relationship represented by the fitting function, and the original image is synthesized onto the background image, so that the application icon is automatically generated to avoid Manually redraw the app icon to reduce the workload.
附图说明DRAWINGS
图1是本申请的应用图标的生成方法实施例的流程图;1 is a flow chart of an embodiment of a method for generating an application icon of the present application;
图2是本申请的应用图标的生成方法实施例的被采样像素点在蓝色通道的像素值分布图;2 is a pixel value distribution diagram of a sampled pixel point in a blue channel in an embodiment of a method for generating an application icon of the present application;
图3是本申请的应用图标的生成方法实施例的被采样像素点在蓝色通道的像素值二次拟合曲线图;3 is a quadratic fitting curve of a pixel value of a sampled pixel in a blue channel according to an embodiment of a method for generating an application icon of the present application;
图4是本申请的应用图标的生成方法实施例的判断被采样像素点的像素值是否符合拟合函数的具体流程图;4 is a specific flowchart of determining whether a pixel value of a sampled pixel points conforms to a fitting function according to an embodiment of a method for generating an application icon of the present application;
图5是本申请的应用图标的生成装置实施例的示意图;FIG. 5 is a schematic diagram of an embodiment of an apparatus for generating an application icon of the present application; FIG.
图6是本申请的移动设备实施例的示意图。6 is a schematic diagram of an embodiment of a mobile device of the present application.
具体实施方式detailed description
在下面的描述中阐述了很多具体细节以便于充分理解本发明。但是本发明能够以很多不同于在此描述的其它方式来实施,本领域技术人员可以在不违背本发明内涵的情况下做类似推广,因此本发明不受下面公开的具体实施的限制。Numerous specific details are set forth in the description below in order to provide a thorough understanding of the invention. However, the present invention can be implemented in many other ways than those described herein, and a person skilled in the art can make a similar promotion without departing from the spirit of the invention, and thus the invention is not limited by the specific embodiments disclosed below.
在本申请中,提供了一种应用图标的生成方法、装置,以及一种移动设备。在下面的实施例中逐一进行详细说明。In the present application, a method and an apparatus for generating an application icon, and a mobile device are provided. Detailed description will be made one by one in the following embodiments.
本申请提供的应用图标的生成方法,是基于这样一种设计构思,即:当原始图像中被采样像素点的像素值拟合函数能够代表被采样像素点的实际像素值分布状况时,根据拟合函数生成应用图标的背景图像,并将原始图像和背景图像合成为应用图标。因此,通过实施本申请提供的方法,能够生成在视觉上与原始图像较为和谐自然的应用图标。 The method for generating an application icon provided by the present application is based on a design concept that when the pixel value fitting function of the sampled pixel in the original image can represent the actual pixel value distribution of the sampled pixel, The compositor generates a background image of the application icon and synthesizes the original image and the background image into an application icon. Therefore, by implementing the method provided by the present application, it is possible to generate an application icon that is visually harmonious with the original image.
请参考图1,其为本申请的应用图标的生成方法实施例的流程图。所述方法包括如下步骤:Please refer to FIG. 1 , which is a flowchart of an embodiment of a method for generating an application icon of the present application. The method includes the following steps:
步骤S101:在应用图标的原始图像中采样像素点,获取各个被采样像素点的位置坐标和像素值。Step S101: sampling pixel points in the original image of the application icon, and acquiring position coordinates and pixel values of the respective sampled pixel points.
本申请实施例所述的原始图像,是第三方应用提供的原始应用图标。从图像的图像文件存储格式角度,原始图像常用的图像文件存储格式包括PNG格式(Portable Network Graphics,便携式网络图形格式)、BMP格式(Bitmap,位图格式)、JPEG(Joint Photographic Experts Group,联合图像专家组格式)等。其中,PNG格式是一种位图文件存储格式,PNG用来存储灰度图像时,灰度图像的深度可多到16位,存储彩色图像时,彩色图像的深度可多到48位,并且还可存储多到16位的α通道数据。BMP格式是Windows操作系统中的标准图像文件格式,使用非常广。它采用位映射存储格式,除了图像深度可选以外,不采用其他任何压缩,因此,BMP文件所占用的空间很大。JPEG是第一个国际图像压缩标准,JPEG图像压缩算法能够在提供良好的压缩性能的同时,具有比较好的重建质量,被广泛应用于图像、视频处理领域。从图像色彩模式角度,原始图像的色彩模式包括RGB色彩模式。色彩模式是数字世界中表示颜色的一种算法,是将某种颜色表现为数字形式的模型,或者说是一种记录图像颜色的方式。在数字世界中,为了表示各种颜色,人们通常将颜色划分为若干分量。色彩模式分为:RGB模式、CMYK模式、HSB模式、Lab颜色模式、位图模式、灰度模式、索引颜色模式、双色调模式和多通道模式。由于原始图像用于在屏幕上显示,而非用于打印或者印刷,因此原始图像通常使用RGB模式,这样可以得到较广的色域。The original image described in the embodiment of the present application is an original application icon provided by a third-party application. From the image file storage format of the image, the image file storage formats commonly used in the original image include PNG format (Portable Network Graphics), BMP format (Bitmap, bitmap format), and JPEG (Joint Photographic Experts Group). Expert group format) and so on. Among them, the PNG format is a bitmap file storage format. When PNG is used to store grayscale images, the depth of grayscale images can be up to 16 bits. When storing color images, the depth of color images can be as much as 48 bits, and Up to 16-bit alpha channel data can be stored. The BMP format is a standard image file format in the Windows operating system and is very widely used. It uses a bitmapped storage format. Except for the image depth optional, no other compression is used. Therefore, the BMP file takes up a lot of space. JPEG is the first international image compression standard. JPEG image compression algorithm can provide good compression performance and has better reconstruction quality. It is widely used in image and video processing. From the image color mode perspective, the color mode of the original image includes the RGB color mode. Color mode is an algorithm for representing colors in the digital world. It is a model that represents a color as a digital form, or a way to record the color of an image. In the digital world, in order to represent various colors, people usually divide colors into several components. The color modes are divided into: RGB mode, CMYK mode, HSB mode, Lab color mode, bitmap mode, gray mode, index color mode, two-tone mode, and multi-channel mode. Since the original image is used for display on the screen, not for printing or printing, the original image is usually in RGB mode, which gives a wider color gamut.
本申请实施例所述的应用图标,又称桌面图标或操作图标,是显示在桌面上的第三方应用的图标。通过点击应用图标,能够运行对应的第三方应用。应用图标是对第三方应用提供的原始图像进行重绘后的图像。The application icon, which is also referred to as a desktop icon or an operation icon, is an icon of a third-party application displayed on the desktop. By clicking the app icon, you can run the corresponding third-party app. The app icon is an image that is redrawn from the original image provided by the third-party app.
要实施本申请提供的方法,首先要在原始图像中采样像素点,获取各个被采样像素点的位置和像素值数据。实现在原始图像中采样像素点的过程,可以采用多种具体实现方案,例如:可以在原始图像中采样一列或者一行像素点,还可以是采样位于不同行、不同列的一块连续区域,也可以是完全离散的像素点。采样上述这些不同的方式,都只是具体实施方式的变更,都不偏离本申请的核心,因此都在本申请的保护范围之内。 To implement the method provided by the present application, first, pixel points are sampled in the original image, and the position and pixel value data of each sampled pixel point are obtained. The process of sampling pixel points in the original image may be implemented in various specific implementations, for example, one column or one row of pixels may be sampled in the original image, or a continuous region of different rows or columns may be sampled, or Is a completely discrete pixel. Sampling the above different manners is only a modification of the specific embodiment, and does not deviate from the core of the present application, and therefore is within the protection scope of the present application.
不同的采样方式对应的后续步骤中涉及的拟合处理的计算复杂度不同。例如:采样位于不同行、不同列的一块连续区域对应的拟合处理的计算复杂度,高于采样一列或者一行像素点对应的拟合处理的计算复杂度。原因在于,不同行、不同列的采样像素点的像素值拟合函数对应的图形是一个三维曲面,而一列或者一行采样像素点的像素值拟合函数对应的图形可以简化为一条二维曲线。三维曲面的计算复杂度高于二维曲线的计算复杂度。对应不同的采样方式,生成的背景文件的效果也不同。根据不同行、不同列的一块特定的连续区域,生成背景图像,该背景图像与原始图像从视觉上可能更加和谐自然。例如:将原始图像中的某一块边缘区域的颜色作为背景图像的颜色,其视觉效果很可能高于根据一列采样像素点的颜色生成的背景图像的视觉效果。The computational complexity of the fitting process involved in the subsequent steps corresponding to different sampling modes is different. For example, the computational complexity of the fitting process corresponding to sampling a continuous region of different rows and different columns is higher than the computational complexity of the fitting process corresponding to sampling one column or one row of pixels. The reason is that the pixel corresponding to the pixel value fitting function of the sampling pixels of different rows and columns is a three-dimensional surface, and the pixel corresponding to the pixel value fitting function of one column or one row of sampling pixels can be simplified into a two-dimensional curve. The computational complexity of 3D surfaces is higher than the computational complexity of 2D curves. The effect of the generated background file is different for different sampling methods. A background image is generated according to a specific continuous area of different rows and different columns, and the background image and the original image may be visually more harmonious and natural. For example, the color of a certain edge region in the original image is used as the color of the background image, and the visual effect is likely to be higher than the visual effect of the background image generated according to the color of one column of sampled pixels.
综合考虑计算复杂度和视觉效果,在本实施例中,优先采用在原始图像中采样一列像素点的采样方式,实现在应用图标的原始图像中采样像素点的过程。在应用图标的原始图像中采样一列像素点后,获取该列中各个被采样像素点的位置坐标和像素值。例如:一个RGB色彩模式的原始图像,其尺寸为150*150,采样该图像中的第5列像素点后,获取的被采样像素点的坐标值序列为:(5,1)、(5,2)、(5,3)、…(5,150),像素值序列为:(255,0,0)、(255,0,0)、(255,0,1)、…(255,0,255)。Considering the computational complexity and the visual effect in a comprehensive manner, in the embodiment, the sampling method of sampling a column of pixel points in the original image is preferentially implemented, and the process of sampling the pixel points in the original image of the application icon is realized. After sampling a column of pixels in the original image of the application icon, the position coordinates and pixel values of each sampled pixel in the column are obtained. For example, the original image of an RGB color mode has a size of 150*150. After sampling the 5th column of pixels in the image, the sequence of coordinate values of the sampled pixels to be acquired is: (5, 1), (5, 2), (5, 3), ... (5, 150), the sequence of pixel values is: (255, 0, 0), (255, 0, 0), (255, 0, 1), ... (255, 0, 255).
步骤S102:对所获得的所述被采样像素点的像素值进行拟合,生成所述被采样像素点的像素值拟合函数。Step S102: fitting the obtained pixel values of the sampled pixel points to generate a pixel value fitting function of the sampled pixel points.
在原始图像中采样一列像素点后,根据获得的各个被采样像素点的位置坐标和像素值,对被采样像素点的像素值进行多项式函数拟合,生成被采样像素点的像素值拟合函数。实现对所获得的所述被采样像素点的像素值进行拟合的过程,可以采用多种具体实现方案,例如:可以对被采样像素点的像素值进行二次多项式函数拟合,还可以是更高次的多项式函数拟合。拟合函数的次数越高,对被采样像素点的像素值的拟合程度越高,即:拟合效果越佳,但是对应的计算复杂度也越高。After sampling a column of pixels in the original image, according to the obtained position coordinates and pixel values of each sampled pixel, a polynomial function is fitted to the pixel value of the sampled pixel to generate a pixel value fitting function of the sampled pixel. . The process of fitting the obtained pixel values of the sampled pixel points may be implemented in various specific implementation manners, for example, a quadratic polynomial function fitting may be performed on the pixel values of the sampled pixel points, or Higher order polynomial function fitting. The higher the number of fitting functions, the higher the fit to the pixel values of the sampled pixels, ie the better the fitting effect, but the higher the computational complexity.
综合考虑拟合效果和计算复杂度,在本实施例中,优先选择对被采样像素点的像素值进行二次多项式函数拟合,生成被采样像素点的二次像素值拟合函数。Considering the fitting effect and the computational complexity in a comprehensive manner, in this embodiment, a quadratic polynomial function fitting is performed on the pixel values of the sampled pixel points, and a quadratic pixel value fitting function of the sampled pixel points is generated.
在数学中,二次函数的最高次必须为二次,二次函数的基本表示形式为y=ax2+bx+c(a≠0)。二次函数的图像是一条对称轴平行或重合于y轴的抛物线。所谓二次拟合,即根据给定的数据序列,用二次多项式函数拟合这组数据。在 本实施例中,拟合目标是得到在拟合函数与数据序列的均方误差最小意义下的拟合函数。由于二次函数表示为:y=ax2+bx+c,对被采样像素点的像素值进行二次多项式函数拟合的过程,就是求取二次函数中系数a、b、c的过程。在实际应用中,二次函数的系数a、b、c的具体值取决于被拟合的数据序列,如果被拟合的数据序列是线性分布的,则二次项系数a的值对应为零。In mathematics, the highest order of the quadratic function must be quadratic, and the basic representation of the quadratic function is y=ax 2 +bx+c(a≠0). The image of the quadratic function is a parabola whose axes of symmetry are parallel or coincident with the y-axis. The so-called quadratic fitting, that is, fitting the set of data with a quadratic polynomial function according to a given data sequence. In this embodiment, the fitting objective is to obtain a fitting function in the sense that the mean square error of the fitting function and the data sequence is the smallest. Since the quadratic function is expressed as: y=ax 2 +bx+c, the process of quadratic polynomial function fitting on the pixel values of the sampled pixels is the process of obtaining the coefficients a, b, and c in the quadratic function. In practical applications, the specific values of the coefficients a, b, and c of the quadratic function depend on the data sequence being fitted. If the fitted data sequence is linearly distributed, the value of the quadratic coefficient a corresponds to zero. .
在实际应用中,可以采用多种具体算法,实现对被采样像素点的像素值进行二次多项式函数拟合,例如:RANSAC算法或者最小二乘法等。最小二乘法通常适合于误差较小的情况,如果需要从一个噪音较大的数据集中提取模型时,最小二乘法就显得力不从心了。由于原始图像中被采样像素点的像素值很可能相差较大,此时,RANSAC算法的拟合效果优于最小二乘法。在本实施例中,优选RANSAC算法对被采样像素点的像素值进行二次多项式函数拟合。下面以采用RANSAC算法对被采样像素点的像素值进行二次多项式函数拟合为例进行说明。In practical applications, a plurality of specific algorithms can be used to perform quadratic polynomial function fitting on the pixel values of the sampled pixels, such as RANSAC algorithm or least squares method. The least squares method is usually suitable for small errors. If you need to extract a model from a noisy data set, the least squares method is not enough. Since the pixel values of the sampled pixels in the original image are likely to differ greatly, the fitting effect of the RANSAC algorithm is better than the least squares method. In this embodiment, the RANSAC algorithm is preferably used to perform quadratic polynomial function fitting on the pixel values of the sampled pixels. The following is an example of performing a quadratic polynomial function fitting on the pixel values of the sampled pixels by using the RANSAC algorithm.
RANSAC算法的输入是一组观测数据(往往含有较大的噪声或无效点),一个用于解释观测数据的参数化模型以及一些可信的参数。RANSAC通过反复选择数据中的一组随机子集来达成目标。被选取的子集被假设为局内点,并用下述方法进行验证:首先,有一个模型适应于假设的局内点,即所有的未知参数都能从假设的局内点计算得出;然后,用第一步中得到的模型去测试所有的其它数据,如果某个点适用于估计的模型,认为它也是局内点。如果有足够多的点被归类为假设的局内点,那么估计的模型就足够合理。然后,用所有假设的局内点去重新估计模型(例如:使用最小二乘法),因为它仅仅被初始的假设局内点估计过。最后,通过估计局内点与模型的错误率来评估模型。上述过程被重复执行固定的次数,每次产生的模型要么因为局内点太少而被舍弃,要么因为比现有的模型更好而被选用。The input to the RANSAC algorithm is a set of observations (often containing large noise or invalid points), a parametric model for interpreting the observed data, and some trusted parameters. RANSAC achieves its goal by iteratively selecting a random set of data in the data. The selected subset is assumed to be an intra-site point and verified by the following method: First, there is a model adapted to the assumed intra-point, that is, all unknown parameters can be calculated from the assumed intra-office points; The model obtained in one step tests all other data, and if a point is applied to the estimated model, it is considered to be an intra-point. If there are enough points to be classified as hypothetical intra-points, then the estimated model is reasonable enough. Then, all hypothetical intra-points are used to re-estimate the model (eg, using least squares) because it is only estimated by the initial hypothetical intra-point. Finally, the model is evaluated by estimating the error rate of the intra-point and model. The above process is repeated a fixed number of times, and each time the generated model is either discarded because there are too few intra-points or selected because it is better than the existing model.
应用RANSAC算法,对被采样像素点的像素值进行二次多项式函数拟合。假设被采样像素点的数量为100个,对被采样像素点的像素值进行二次多项式函数拟合,则拟合过程如下所述:首先,在被采样像素点中任意选取三个像素点,根据选取的三个像素点的像素值进行二次多项式函数拟合,求出各个系数,得到一个二次多项式函数;然后,用该二次多项式函数去测试剩余的97个像素点的像素值,得到适用于该函数的像素点个数;将上述过程重复固定次数(例如10次)后,选择对应的像素点个数最多的二次多项式函数作为最终拟合函数。 The RANSAC algorithm is applied to perform quadratic polynomial function fitting on the pixel values of the sampled pixels. Assuming that the number of pixels to be sampled is 100, and the pixel value of the sampled pixel is subjected to a quadratic polynomial function fitting, the fitting process is as follows: First, three pixel points are arbitrarily selected among the pixels to be sampled, The quadratic polynomial function is fitted according to the pixel values of the selected three pixel points, and each coefficient is obtained to obtain a quadratic polynomial function; then, the quadratic polynomial function is used to test the pixel values of the remaining 97 pixels. The number of pixels suitable for the function is obtained; after the above process is repeated a fixed number of times (for example, 10 times), the quadratic polynomial function having the largest number of corresponding pixels is selected as the final fitting function.
在本实施例中,原始图像为RGB模式的图像,即每一个像素值是由红、绿、蓝三个颜色通道表征的,因此对被采样像素点进行拟合,生成被采样像素点的像素值拟合函数,包括如下步骤:In this embodiment, the original image is an image of the RGB mode, that is, each pixel value is represented by three color channels of red, green, and blue, so the pixel to be sampled is fitted to generate a pixel of the sampled pixel. The value fitting function includes the following steps:
步骤S1021:获取所述被采样像素点在表征像素值的各个通道分量上的分布数据。Step S1021: Acquire distribution data of the sampled pixel points on respective channel components that represent pixel values.
在RGB模式的图像中,每一个像素点的像素值是由三个分量共同表示的,记为(r,g,b),其中r为红色通道的分量值、g为绿色通道的分量值、b为蓝色通道的分量值,将三个通道的分量值叠加得到像素点的颜色。由于每一个像素值是由三个分量表示的,因此,只有当每个颜色通道的分布数据均符合对应通道的拟合函数时,才能够判定拟合函数能够代表被采样像素点的实际像素值分布状况。为了能够对被采样像素点的每个颜色通道的分量值分别进行拟合,首先要获取被采样像素点在表征像素值的各个通道分量上的分布数据。In the RGB mode image, the pixel value of each pixel is represented by three components, which are denoted as (r, g, b), where r is the component value of the red channel, g is the component value of the green channel, b is the component value of the blue channel, and the component values of the three channels are superimposed to obtain the color of the pixel. Since each pixel value is represented by three components, it can be determined that the fitting function can represent the actual pixel value of the sampled pixel only when the distribution data of each color channel conforms to the fitting function of the corresponding channel. Distribution status. In order to be able to fit the component values of each color channel of the sampled pixel, respectively, firstly, the distribution data of the sampled pixel on each channel component of the pixel value is obtained.
请参考图2,其为本申请的应用图标的生成方法实施例的被采样像素点在蓝色通道的像素值分布图。由于被采样像素点是原始图像中的一列数据,因此图2中的横坐标对应被采样像素点的纵坐标位置,图2中的纵坐标表示被采样像素点的像素值。通过观察图2中曲线的形状,可以看到曲线的突变部分与平滑部分的蓝色分量值有较大的差别。Please refer to FIG. 2 , which is a pixel value distribution diagram of a sampled pixel point in a blue channel according to an embodiment of a method for generating an application icon of the present application. Since the sampled pixel is a column of data in the original image, the abscissa in FIG. 2 corresponds to the ordinate position of the sampled pixel, and the ordinate in FIG. 2 represents the pixel value of the sampled pixel. By observing the shape of the curve in Fig. 2, it can be seen that the abrupt portion of the curve has a large difference from the blue component value of the smooth portion.
步骤S1022:根据所述各个通道分量上的分布数据,在各个通道上分别进行拟合计算,生成各个通道的像素值拟合函数。Step S1022: Perform fitting calculation on each channel according to the distribution data on the respective channel components, and generate a pixel value fitting function of each channel.
在获取到被采样像素点在表征像素值的各个通道分量上的分布数据后,还需要针对各个通道的分布数据分别进行拟合计算,生成各个通道的像素值拟合函数。例如:采用RANSAC算法对图2中被采样像素点在蓝色通道分量上的分布数据进行二次多项式函数拟合,求出的系数a、b、c分别为0.0,0.528492,204.00,其中二次项系数为0。根据获得的二次多项式函数,首先将各个被采样像素点的纵坐标值作为二次多项式函数的自变量x,带入二次多项式函数,计算出二次多项式函数的因变量y的值;然后,再根据(x,y)值画出二次拟合曲线中的对应点。当对每一个被采样像素点进行上述处理后,生成了一条被采样像素点在蓝色通道的二次拟合曲线图。After obtaining the distribution data of the sampled pixel points on the respective channel components of the pixel values, it is also necessary to separately perform fitting calculation for the distribution data of each channel to generate a pixel value fitting function of each channel. For example, the RANSAC algorithm is used to perform quadratic polynomial function fitting on the distribution data of the sampled pixel points on the blue channel component in Fig. 2, and the obtained coefficients a, b, and c are respectively 0.0, 0.528492, 204.00, of which The coefficient of the item is 0. According to the obtained quadratic polynomial function, firstly, the ordinate value of each sampled pixel is taken as the independent variable x of the quadratic polynomial function, and the quadratic polynomial function is calculated to calculate the value of the dependent variable y of the quadratic polynomial function; And then draw the corresponding points in the quadratic curve according to the (x, y) value. When the above processing is performed on each sampled pixel, a quadratic fitting graph of the sampled pixel point in the blue channel is generated.
请参考图3,其为本申请的应用图标的生成方法实施例的被采样像素点在蓝色通道的像素值二次拟合曲线图。与图2的坐标维度一致,图3的横坐标对应 像素点的纵坐标位置,图3中的纵坐标表示像素值。通过观察图3中二次拟合曲线的形状,可以看到二次拟合曲线是一条直线,这表示随着像素点的纵坐标位置变化,颜色值发生渐变。Please refer to FIG. 3 , which is a graph of quadratic fitting of pixel values of sampled pixels in a blue channel according to an embodiment of a method for generating an application icon of the present application. Consistent with the coordinate dimension of Figure 2, the abscissa of Figure 3 corresponds The ordinate position of the pixel, the ordinate in Fig. 3 represents the pixel value. By observing the shape of the quadratic fitting curve in Fig. 3, it can be seen that the quadratic fitting curve is a straight line, which means that the color value is gradually changed as the ordinate position of the pixel point changes.
步骤S103:判断符合所述拟合函数的被采样像素点数量所占比例是否大于预设比例;若是,则根据所述拟合函数表示的位置与像素值关系,生成所述应用图标的背景图像。Step S103: determining whether the proportion of the number of sampled pixels that meet the fitting function is greater than a preset ratio; if yes, generating a background image of the application icon according to the position and pixel value relationship represented by the fitting function .
在生成被采样像素点的像素值拟合函数后,需要判断拟合函数是否能够代表被采样像素点的实际像素值分布状况,并根据判断结果,决定生成背景图像的具体实施方案。本申请提供的方法,判断拟合函数是否能够代表被采样像素点的实际像素值分布状况的实施方案是,判断符合拟合函数的被采样像素点数量所占比例是否大于预设比例。所谓符合拟合函数,是指被采样像素点的实际像素值与拟合函数中对应的拟合像素值之间的距离在预定距离内。要计算符合拟合函数的被采样像素点数量,首先要判断被采样像素点的实际像素值是否符合拟合函数中对应的拟合像素值。After generating the pixel value fitting function of the sampled pixel, it is necessary to determine whether the fitting function can represent the actual pixel value distribution of the sampled pixel, and determine a specific implementation of the background image according to the determination result. The method provided by the present application determines whether the fitting function can represent the actual pixel value distribution of the sampled pixel points, and determines whether the proportion of the number of sampled pixels that meet the fitting function is greater than a preset ratio. The so-called fit function means that the distance between the actual pixel value of the sampled pixel and the corresponding fitted pixel value in the fitting function is within a predetermined distance. To calculate the number of sampled pixels that match the fit function, first determine whether the actual pixel value of the sampled pixel matches the corresponding fitted pixel value in the fit function.
请参考图4,其为本申请的应用图标的生成方法实施例的判断被采样像素点的像素值是否符合拟合函数的具体流程图。在本实施例中,判断一个被采样像素点的实际像素值是否符合所述拟合函数上对应的拟合像素值,包括如下步骤:Please refer to FIG. 4 , which is a specific flowchart for determining whether a pixel value of a sampled pixel points conforms to a fitting function according to an embodiment of a method for generating an application icon of the present application. In this embodiment, determining whether an actual pixel value of a sampled pixel point meets a corresponding fitting pixel value on the fitting function includes the following steps:
步骤S401:将被采样像素点的位置坐标值带入所述拟合函数,计算所述被采样像素点的拟合像素值。Step S401: Bring the position coordinate value of the sampled pixel point into the fitting function, and calculate a fitted pixel value of the sampled pixel point.
以采样方式为采样一列像素点为例,通过步骤S102得到的拟合函数的自变量x为位置信息,因变量y为像素值,因此,将被采样像素点的位置坐标值带入拟合函数,就能够计算出被采样像素点的拟合像素值。Taking the sampling method as a sample of a column of pixels as an example, the argument x of the fitting function obtained in step S102 is position information, and the dependent variable y is a pixel value, so the position coordinate value of the sampled pixel point is brought into the fitting function. , it is possible to calculate the fitted pixel value of the sampled pixel.
步骤S402:判断所述被采样像素点的实际像素值和所述被采样像素点的拟合像素值之间的距离是否小于预设距离。Step S402: It is determined whether the distance between the actual pixel value of the sampled pixel point and the fitted pixel value of the sampled pixel point is less than a preset distance.
在本实施例中,预设距离可以取值为:被采样像素点的实际像素值序列和拟合像素值序列之间的最小均方差,也可以是直接确定的一个较小值。预设距离越小,符合拟合函数的被采样像素点数量越少,采用根据拟合函数生成背景图像的技术方案的可能性越小。In this embodiment, the preset distance may be a value of a minimum mean square error between a sequence of actual pixel values of the sampled pixel and a sequence of fitted pixel values, or a smaller value directly determined. The smaller the preset distance, the smaller the number of sampled pixels that match the fitting function, and the less likely it is to adopt a technical solution for generating a background image according to the fitting function.
步骤S403:若上述判断结果为是,则判定所述被采样像素点符合所述拟合函数。 Step S403: If the result of the above determination is yes, it is determined that the sampled pixel points meet the fitting function.
在图2、3所示的蓝色通道的例子中,将预设距离设定为3,即:如果被采样像素点的实际像素值和拟合像素值之间的距离小于3,则判定该点在拟合函数对应的拟合曲线上。In the example of the blue channel shown in FIGS. 2 and 3, the preset distance is set to 3, that is, if the distance between the actual pixel value of the sampled pixel and the fitted pixel value is less than 3, it is determined that The point is on the fitted curve corresponding to the fitting function.
为了计算获取所述符合拟合函数的被采样像素点数量,需要遍历每一个被采样像素点,对每个被采样像素点执行图4中的步骤进行相应的判断。每次判断完成后,若判断结果为是,则将符合所述拟合函数的被采样像素点数量加一;遍历完成后,即获得所述符合所述拟合函数的被采样像素点数量。In order to calculate the number of sampled pixels that meet the fitting function, it is necessary to traverse each of the sampled pixels, and perform the corresponding determination on the steps of FIG. 4 for each sampled pixel. After each judgment is completed, if the judgment result is yes, the number of sampled pixels that meet the fitting function is incremented by one; after the traversal is completed, the number of sampled pixels that meet the fitting function is obtained.
对于多通道色彩模式的原始图像,由于每一个像素值是由多个颜色分量共同表示的,因此,只有当每个颜色通道的拟合函数均与该通道的分布数据拟合时,才能够判定拟合函数能够代表被采样像素点的实际像素值分布状况。因此,在执行步骤S103时,判断符合所述拟合函数的被采样像素点数量所占比例是否大于预设比例的过程,采用如下方式:判断符合表征像素值的各个通道的像素值拟合函数的被采样像素点数量所占比例是否均大于预设比例。例如:对于RGB色彩模式的原始图像,需要分别在每个颜色通道上判断符合所述拟合函数的该采样像素点数量所占比例是否大于预设比例,只有当三个颜色通道的判断结果均为大于预设比例时,才能够判定符合所述拟合函数的被采样像素点数量所占比例大于预设比例。For the original image of the multi-channel color mode, since each pixel value is represented by a plurality of color components, it can be determined only when the fitting function of each color channel is fitted to the distribution data of the channel. The fitting function can represent the actual pixel value distribution of the sampled pixels. Therefore, when step S103 is performed, it is determined whether the proportion of the number of sampled pixels that meet the fitting function is greater than a preset ratio, and the following method is adopted: determining a pixel value fitting function of each channel that matches the characterizing the pixel value. Whether the proportion of the number of sampled pixels is greater than the preset ratio. For example, for the original image of the RGB color mode, it is necessary to determine, on each color channel, whether the proportion of the number of sampled pixels that meet the fitting function is greater than a preset ratio, and only when the judgment results of the three color channels are When it is greater than the preset ratio, it can be determined that the proportion of the number of sampled pixels that meet the fitting function is greater than a preset ratio.
步骤S103中的预设比例,可以是通过实验获取的一个经验值,也可以是一个直接的设定值。在本实施例中,将预设比例设定为55%,即如果符合拟合函数的被采样像素点的个数在所有被采样像素点的个数中所占的比重大于55%时,则判定本次拟合函数能够代表被采样像素点的实际像素值分布状况,否则判定本次拟合函数不能代表被采样像素点的实际像素值分布状况。The preset ratio in step S103 may be an empirical value obtained through experiments, or may be a direct set value. In this embodiment, the preset ratio is set to 55%, that is, if the number of sampled pixels that meet the fitting function accounts for more than 55% of the number of all sampled pixels, then It is determined that the current fitting function can represent the actual pixel value distribution of the sampled pixel, otherwise it is determined that the current fitting function cannot represent the actual pixel value distribution of the sampled pixel.
对于RGB色彩模式的原始图像,如果在RGB三个通道上的拟合结果都符合要求,那么就在每一条颜色通道对应的拟合函数上重新采样选取相应的像素值,构成新的较大背景图像,即:根据所述拟合函数表示的位置与像素值关系,生成所述应用图标的背景图像。For the original image of RGB color mode, if the fitting results on the three channels of RGB meet the requirements, then the corresponding pixel values are resampled on the fitting function corresponding to each color channel to form a new larger background. An image, that is, a background image of the application icon is generated according to a position represented by the fitting function and a pixel value relationship.
根据所述拟合函数表示的位置与像素值关系,生成所述应用图标的背景图像的具体实现过程,与像素点的采样方式相关。不同的像素点采样方式,实现所述根据所述拟合函数表示的位置与像素值关系,生成所述应用图标的背景图像的具体过程是不同的。下面分别给出采样一列像素点和采样一行像素点各自对应的生成背景图像的具体过程。 The specific implementation process of generating the background image of the application icon according to the position and pixel value relationship represented by the fitting function is related to the sampling mode of the pixel. Different pixel sampling methods are used to implement the relationship between the position and the pixel value represented by the fitting function, and the specific process of generating the background image of the application icon is different. The specific process of generating a background image corresponding to sampling a column of pixels and sampling a row of pixels is respectively given below.
1)采样方式:采样一列像素点1) Sampling method: sampling a column of pixels
如果所述在应用图标的原始图像中采样像素点的采样方式是在所述原始图像中采样一列像素点,则所述根据所述拟合函数表示的位置与像素值关系,生成所述应用图标的背景图像,包括:遍历所述背景图像的各行,将所述行对应的纵坐标值带入所述拟合函数,计算获取所述纵坐标值对应的像素值;将所述纵坐标值对应的像素值作为所述行中每一个像素点的像素值。If the sampling mode of the sampling pixel in the original image of the application icon is to sample a column of pixels in the original image, the position and the pixel value relationship according to the fitting function are generated to generate the application icon. a background image, comprising: traversing each row of the background image, bringing a ordinate value corresponding to the row into the fitting function, and calculating a pixel value corresponding to the ordinate value; corresponding to the ordinate value The pixel value is taken as the pixel value of each pixel in the line.
2)采样方式:采样一行像素点2) Sampling method: sampling one line of pixels
如果所述在应用图标的原始图像中采样像素点的采样方式是在所述原始图像中采样一行像素点,则所述根据所述拟合函数表示的位置与像素值关系,生成所述应用图标的背景图像,包括:遍历所述背景图像的各列,将所述列对应的横坐标值带入所述拟合函数,计算获取所述横坐标值对应的像素值;将所述横坐标值对应的像素值作为所述列中每一个像素点的像素值。If the sampling method of sampling pixel points in the original image of the application icon is to sample a row of pixel points in the original image, generating the application icon according to the position and pixel value relationship represented by the fitting function a background image, comprising: traversing each column of the background image, bringing an abscissa value corresponding to the column into the fitting function, and calculating a pixel value corresponding to the abscissa value; and the abscissa value The corresponding pixel value is taken as the pixel value of each pixel in the column.
在步骤S103中,如果上述判断符合拟合函数的被采样像素点数量所占比例是否大于预设比例的判断结果为否,说明拟合判定失败,则判定原始图像比较复杂。对于复杂的原始图像,本申请提供的方法,不采用根据拟合函数生成背景图像,而是采用统计像素值分布的策略,即:根据被采样像素点中占比例最大的像素值,生成应用图标的背景图像。In step S103, if the judgment result that the proportion of the number of sampled pixels corresponding to the fitting function is greater than the preset ratio is negative, indicating that the fitting determination fails, it is determined that the original image is relatively complicated. For a complex original image, the method provided by the present application does not adopt a strategy of generating a background image according to a fitting function, but adopts a strategy of statistical pixel value distribution, that is, generating an application icon according to the pixel value that accounts for the largest proportion among the pixels to be sampled. Background image.
在本实施例中,所述根据所述被采样像素点中占比例最大的像素值,生成应用图标的背景图像,包括:计算所述被采样像素点中各级像素值的数量;将数量最多的像素值作为所述背景图像中各个像素点的像素值,生成所述背景图像。例如:图2中同级像素值的统计结果为,RGB像素值为(2,39,68)的像素值占比例最高,则利用该颜色生成一张颜色单一的较大的背景图像。In this embodiment, the generating, according to the pixel value that is the largest proportion of the sampled pixel points, generating a background image of the application icon, including: calculating a quantity of pixel values of each level in the sampled pixel point; The pixel value is generated as a pixel value of each pixel in the background image. For example, the statistical result of the same-level pixel value in FIG. 2 is that the pixel value of the RGB pixel value (2, 39, 68) accounts for the highest proportion, and a large background image with a single color is generated by using the color.
步骤S104:将所述原始图像合成到所述背景图像上,生成所述应用图标。Step S104: synthesize the original image onto the background image to generate the application icon.
在生成新的背景图像之后,把较小的原始图像放入背景图像中,生成新的较大的应用图标,该应用图标与原始图像的视觉效果较为和谐自然。After generating a new background image, the smaller original image is placed in the background image to generate a new larger application icon, which is more harmonious and natural to the original image.
在上述的实施例中,提供了一种应用图标的生成方法,与之相对应的,本申请还提供一种应用图标的生成装置。该装置是与上述应用图标的生成方法的实施例相对应。In the above embodiment, a method for generating an application icon is provided. Correspondingly, the present application further provides an apparatus for generating an application icon. The apparatus corresponds to an embodiment of the above-described method of generating an application icon.
请参看图5,其为本申请的应用图标的生成装置实施例的示意图。由于装置实施例基本相似于方法实施例,所以描述得比较简单,相关之处参见方法实施 例的部分说明即可。下述描述的装置实施例仅仅是示意性的。Please refer to FIG. 5 , which is a schematic diagram of an embodiment of an apparatus for generating an application icon of the present application. Since the device embodiment is basically similar to the method embodiment, the description is relatively simple, and the method is implemented as described in the relevant method. Part of the description of the example can be. The device embodiments described below are merely illustrative.
本实施例的一种应用图标的生成装置,包括:采样单元101,用于在应用图标的原始图像中采样像素点,获取各个被采样像素点的位置坐标和像素值;拟合单元102,用于对所获得的所述被采样像素点的像素值进行拟合,生成所述被采样像素点的像素值拟合函数;判断单元103,用于判断符合所述拟合函数的被采样像素点数量所占比例是否大于预设比例;若是,则根据所述拟合函数表示的位置与像素值关系,生成所述应用图标的背景图像;合成单元104,用于将所述原始图像合成到所述背景图像上,生成所述应用图标。The apparatus for generating an application icon of the embodiment includes: a sampling unit 101, configured to sample pixel points in an original image of an application icon, acquire position coordinates and pixel values of each sampled pixel point; and the fitting unit 102 uses And fitting the obtained pixel value of the sampled pixel to generate a pixel value fitting function of the sampled pixel; the determining unit 103 is configured to determine the sampled pixel that meets the fitting function Whether the proportion of the quantity is greater than a preset ratio; if yes, generating a background image of the application icon according to the position and pixel value relationship represented by the fitting function; and a synthesizing unit 104, configured to synthesize the original image into the On the background image, the application icon is generated.
可选的,所述判断单元103包括:Optionally, the determining unit 103 includes:
第一生成子单元,用于如果所述判断符合所述拟合函数的被采样像素点数量所占比例是否大于预设比例的判断结果为否,则根据所述被采样像素点中占比例最大的像素值,生成所述应用图标的背景图像。a first generating subunit, configured to: if the judgment result that the proportion of the number of sampled pixels that meet the fitting function is greater than a preset ratio is not, according to the proportion of the sampled pixels a pixel value that generates a background image of the application icon.
可选的,所述第一生成子单元包括:Optionally, the first generating subunit includes:
计算子单元,用于计算所述被采样像素点中各级像素值的数量;a calculation subunit, configured to calculate a quantity of pixel values of each level in the sampled pixel;
生成子单元,用于将数量最多的像素值作为所述背景图像中各个像素点的像素值,生成所述背景图像。Generating a subunit for generating the background image by using the most number of pixel values as pixel values of respective pixels in the background image.
可选的,所述拟合单元102包括:Optionally, the fitting unit 102 includes:
获取子单元,用于获取所述被采样像素点在表征像素值的各个通道分量上的分布数据;Obtaining a subunit, configured to acquire distribution data of the sampled pixel points on respective channel components that represent pixel values;
拟合子单元,用于根据所述各个通道分量上的分布数据,在各个通道上分别进行拟合计算,获取各个通道的像素值拟合函数。And a fitting sub-unit, configured to perform fitting calculation on each channel according to the distribution data on the respective channel components, and obtain a pixel value fitting function of each channel.
可选的,所述判断单元103包括:Optionally, the determining unit 103 includes:
第一判断子单元,用于判断符合所述拟合函数的被采样像素点数量所占比例是否大于预设比例;a first determining subunit, configured to determine whether a proportion of the number of sampled pixels that meet the fitting function is greater than a preset ratio;
所述第一判断子单元包括:The first determining subunit includes:
第一计算子单元,用于计算符合所述拟合函数的被采样像素点数量;a first calculating subunit, configured to calculate a number of sampled pixels that meet the fitting function;
所述第一计算子单元包括:The first computing subunit includes:
第二判断子单元,用于判断被采样像素点是否符合所述拟合函数;a second determining subunit, configured to determine whether the sampled pixel points meet the fitting function;
所述第二判断子单元包括: The second determining subunit includes:
第二计算子单元,用于将被采样像素点的位置坐标值带入所述拟合函数,计算所述被采样像素点的拟合像素值;a second calculating subunit, configured to bring a position coordinate value of the sampled pixel point into the fitting function, and calculate a fitted pixel value of the sampled pixel point;
第三判断子单元,用于判断所述被采样像素点的实际像素值和所述被采样像素点的拟合像素值之间的距离是否小于预设距离;若是,则判定所述被采样像素点符合所述拟合函数。a third determining subunit, configured to determine whether a distance between an actual pixel value of the sampled pixel point and a fitted pixel value of the sampled pixel point is less than a preset distance; if yes, determining the sampled pixel The points conform to the fit function.
可选的,所述判断单元103包括:Optionally, the determining unit 103 includes:
第二生成子单元,用于如果所述判断符合所述拟合函数的被采样像素点数量所占比例是否大于预设比例的判断结果为是,则根据所述拟合函数表示的位置与像素值关系,生成所述应用图标的背景图像。a second generation subunit, configured to determine, according to the position and the pixel represented by the fitting function, if the judgment result that the proportion of the number of sampled pixels satisfying the fitting function is greater than a preset ratio is YES A value relationship that generates a background image of the application icon.
可选的,所述第二生成子单元包括:Optionally, the second generating subunit includes:
第一遍历子单元,用于遍历所述背景图像的各行,将所述行对应的纵坐标值带入所述拟合函数,计算获取所述纵坐标值对应的像素值;a first traversing sub-unit, configured to traverse each row of the background image, bring a ordinate value corresponding to the row into the fitting function, and calculate a pixel value corresponding to the ordinate value;
第一设置子单元,用于将所述纵坐标值对应的像素值作为所述行中每一个像素点的像素值。a first setting subunit, configured to use a pixel value corresponding to the ordinate value as a pixel value of each pixel in the row.
可选的,所述第二生成子单元包括:Optionally, the second generating subunit includes:
第二遍历子单元,用于遍历所述背景图像的各列,将所述列对应的横坐标值带入所述拟合函数,计算获取所述横坐标值对应的像素值;a second traversing sub-unit, configured to traverse the columns of the background image, bring the horizontal coordinate value corresponding to the column into the fitting function, and calculate and obtain a pixel value corresponding to the horizontal coordinate value;
第二设置子单元,用于将所述横坐标值对应的像素值作为所述列中每一个像素点的像素值。a second setting subunit, configured to use a pixel value corresponding to the abscissa value as a pixel value of each pixel in the column.
本申请实施例还提供了一种移动设备,如图6所示,该移动设备包括:显示器601;处理器602;以及存储器603,所述存储器603被配置成存储应用图标的原始图像,所述原始图像被所述处理器602执行时,在所述显示器601显示所述应用图标,所述应用图标是由所述原始图像和背景图像合成的,所述背景图像是根据所述原始图像中的被采样像素点的像素值拟合函数生成的,并且所述背景图像的尺寸大于所述原始图像。The embodiment of the present application further provides a mobile device, as shown in FIG. 6, the mobile device includes: a display 601; a processor 602; and a memory 603 configured to store an original image of an application icon, When the original image is executed by the processor 602, the application icon is displayed on the display 601, the application icon is synthesized by the original image and the background image, and the background image is according to the original image. The pixel value fitting function of the sampled pixel is generated, and the size of the background image is larger than the original image.
本申请提供一种应用图标的生成方法、装置及移动设备,通过对应用图标的原始图像中被采样像素点进行拟合,生成被采样像素点的像素值拟合函数,如果符合拟合函数的被采样像素点数量所占比例大于预设比例,则根据拟合函数表示的位置与像素值关系,生成应用图标的背景图像,并将原始图像合成到背景图像上,使得自动生成应用图标,避免人工重新绘制应用图标,从而达到 减少工作量的效果。The application provides a method, a device and a mobile device for generating an application icon, and by fitting a sampled pixel point in an original image of an application icon, generating a pixel value fitting function of the sampled pixel point, if the fitting function is met The proportion of the number of pixels to be sampled is greater than the preset ratio, and the background image of the application icon is generated according to the position and pixel value relationship represented by the fitting function, and the original image is synthesized onto the background image, so that the application icon is automatically generated to avoid Manually redraw the app icon to reach Reduce the effect of the workload.
本发明虽然以较佳实施例公开如上,但其并不是用来限定本发明,任何本领域技术人员在不脱离本发明的精神和范围内,都可以做出可能的变动和修改,因此本发明的保护范围应当以本发明权利要求所界定的范围为准。The present invention is disclosed in the above preferred embodiments, but it is not intended to limit the present invention, and any one skilled in the art can make possible variations and modifications without departing from the spirit and scope of the invention. The scope of protection should be determined by the scope defined by the claims of the present invention.
在一个典型的配置中,计算设备包括一个或多个处理器(CPU)、输入/输出接口、网络接口和内存。In a typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
内存可能包括计算机可读介质中的非永久性存储器,随机存取存储器(RAM)和/或非易失性内存等形式,如只读存储器(ROM)或闪存(flash RAM)。内存是计算机可读介质的示例。The memory may include non-persistent memory, random access memory (RAM), and/or non-volatile memory in a computer readable medium, such as read only memory (ROM) or flash memory. Memory is an example of a computer readable medium.
1、计算机可读介质包括永久性和非永久性、可移动和非可移动媒体可以由任何方法或技术来实现信息存储。信息可以是计算机可读指令、数据结构、程序的模块或其他数据。计算机的存储介质的例子包括,但不限于相变内存(PRAM)、静态随机存取存储器(SRAM)、动态随机存取存储器(DRAM)、其他类型的随机存取存储器(RAM)、只读存储器(ROM)、电可擦除可编程只读存储器(EEPROM)、快闪记忆体或其他内存技术、只读光盘只读存储器(CD-ROM)、数字多功能光盘(DVD)或其他光学存储、磁盒式磁带,磁带磁磁盘存储或其他磁性存储设备或任何其他非传输介质,可用于存储可以被计算设备访问的信息。按照本文中的界定,计算机可读介质不包括非暂存电脑可读媒体(transitory media),如调制的数据信号和载波。1. Computer readable media including both permanent and non-persistent, removable and non-removable media may be implemented by any method or technology. The information can be computer readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read only memory. (ROM), electrically erasable programmable read only memory (EEPROM), flash memory or other memory technology, compact disk read only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, Magnetic tape cartridges, magnetic tape storage or other magnetic storage devices or any other non-transportable media can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include non-transitory computer readable media, such as modulated data signals and carrier waves.
2、本领域技术人员应明白,本申请的实施例可提供为方法、系统或计算机程序产品。因此,本申请可采用完全硬件实施例、完全软件实施例或结合软件和硬件方面的实施例的形式。而且,本申请可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储介质(包括但不限于磁盘存储器、CD-ROM、光学存储器等)上实施的计算机程序产品的形式。 2. Those skilled in the art will appreciate that embodiments of the present application can be provided as a method, system, or computer program product. Thus, the present application can take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment in combination of software and hardware. Moreover, the application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) including computer usable program code.

Claims (21)

  1. 一种应用图标的生成方法,其特征在于,包括:A method for generating an application icon, comprising:
    在应用图标的原始图像中采样像素点,获取各个被采样像素点的位置坐标和像素值;Sampling pixel points in an original image of the application icon, obtaining position coordinates and pixel values of each sampled pixel point;
    对所获得的所述被采样像素点的像素值进行拟合,生成所述被采样像素点的像素值拟合函数;And fitting the obtained pixel values of the sampled pixel points to generate a pixel value fitting function of the sampled pixel points;
    判断符合所述拟合函数的被采样像素点数量所占比例是否大于预设比例;若是,则根据所述拟合函数表示的位置与像素值关系,生成所述应用图标的背景图像;Determining whether a proportion of the number of sampled pixels that meet the fitting function is greater than a preset ratio; if yes, generating a background image of the application icon according to a position and a pixel value relationship represented by the fitting function;
    将所述原始图像合成到所述背景图像上,生成所述应用图标。The original image is synthesized onto the background image to generate the application icon.
  2. 根据权利要求1所述的应用图标的生成方法,其特征在于,如果所述判断符合所述拟合函数的被采样像素点数量所占比例是否大于预设比例的判断结果为否,则根据所述被采样像素点中占比例最大的像素值,生成所述应用图标的背景图像。The method for generating an application icon according to claim 1, wherein if the judgment determines whether the proportion of the number of sampled pixels corresponding to the fitting function is greater than a preset ratio, the determination result is no, A pixel value having the largest proportion among the sampled pixels is generated, and a background image of the application icon is generated.
  3. 根据权利要求2所述的应用图标的生成方法,其特征在于,所述根据所述被采样像素点中占比例最大的像素值,生成所述应用图标的背景图像,包括:The method for generating an application icon according to claim 2, wherein the generating a background image of the application icon according to a pixel value that is the largest proportion of the sampled pixel points comprises:
    计算所述被采样像素点中各级像素值的数量;Calculating a quantity of pixel values of each of the sampled pixels;
    将数量最多的像素值作为所述背景图像中各个像素点的像素值,生成所述背景图像。The background image is generated by using the most number of pixel values as the pixel values of the respective pixels in the background image.
  4. 根据权利要求1所述的应用图标的生成方法,其特征在于,所述在应用图标的原始图像中采样像素点,采用如下方式:The method for generating an application icon according to claim 1, wherein the sampling the pixel point in the original image of the application icon is as follows:
    在所述原始图像中采样一列或者一行像素点。A column or row of pixels is sampled in the original image.
  5. 根据权利要求1所述的应用图标的生成方法,其特征在于,所述对所获得的所述被采样像素点的像素值进行拟合,生成所述被采样像素点的像素值拟合函数,采用如下方式:The method for generating an application icon according to claim 1, wherein the fitting the obtained pixel values of the sampled pixel points to generate a pixel value fitting function of the sampled pixel points, Use the following method:
    对被采样像素点进行二次多项式函数拟合,生成所述被采样像素点的二次像素值拟合函数。A quadratic polynomial function fitting is performed on the sampled pixel to generate a quadratic pixel value fitting function of the sampled pixel.
  6. 根据权利要求5所述的应用图标的生成方法,其特征在于,所述对被采样像素点进行二次多项式函数拟合,采用如下方式: The method for generating an application icon according to claim 5, wherein the quadratic polynomial function fitting of the sampled pixel points is as follows:
    采用RANSAC方法或者最小二乘法,对所述被采样像素点进行二次多项式函数拟合。A quadratic polynomial function fitting is performed on the sampled pixel points using a RANSAC method or a least squares method.
  7. 根据权利要求1所述的应用图标的生成方法,其特征在于,所述对被采样像素点进行拟合,生成所述被采样像素点的像素值拟合函数,包括:The method for generating an application icon according to claim 1, wherein the fitting the sampled pixel points to generate a pixel value fitting function of the sampled pixel points comprises:
    获取所述被采样像素点在表征像素值的各个通道分量上的分布数据;Obtaining distribution data of the sampled pixel points on respective channel components characterizing pixel values;
    根据所述各个通道分量上的分布数据,在各个通道上分别进行拟合计算,生成各个通道的像素值拟合函数。According to the distribution data on the respective channel components, fitting calculations are respectively performed on the respective channels, and a pixel value fitting function of each channel is generated.
  8. 根据权利要求1所述的应用图标的生成方法,其特征在于,所述判断符合所述拟合函数的被采样像素点数量所占比例是否大于预设比例的步骤中,采用如下步骤判断被采样像素点是否符合所述拟合函数:The method for generating an application icon according to claim 1, wherein in the step of determining whether the proportion of the number of sampled pixels that meet the fitting function is greater than a preset ratio, the following steps are used to determine that the sample is sampled. Whether the pixel points meet the fit function:
    将被采样像素点的位置坐标值带入所述拟合函数,计算所述被采样像素点的拟合像素值;Taking a position coordinate value of the sampled pixel point into the fitting function, and calculating a fitted pixel value of the sampled pixel point;
    判断所述被采样像素点的实际像素值和所述被采样像素点的拟合像素值之间的距离是否小于预设距离;Determining whether a distance between an actual pixel value of the sampled pixel point and a fitted pixel value of the sampled pixel point is less than a preset distance;
    若上述判断结果为是,则判定所述被采样像素点符合所述拟合函数;If the result of the above determination is yes, determining that the sampled pixel points meet the fitting function;
    遍历被采样像素点,对每个被采样像素点执行上述判断;每次判断完成后,若判断结果为是,则将符合所述拟合函数的被采样像素点数量加一;遍历完成后,即获得所述符合所述拟合函数的被采样像素点数量。Traversing the sampled pixel points, performing the above determination on each sampled pixel; after each determination is completed, if the determination result is yes, the number of sampled pixels that meet the fitting function is incremented by one; after the traversal is completed, That is, the number of sampled pixels that meet the fitting function is obtained.
  9. 根据权利要求1所述的应用图标的生成方法,其特征在于,所述判断符合所述拟合函数的被采样像素点数量所占比例是否大于预设比例,采用如下方式:The method for generating an application icon according to claim 1, wherein the determining whether the proportion of the number of sampled pixels that meet the fitting function is greater than a preset ratio is as follows:
    判断符合表征像素值的各个通道的像素值拟合函数的被采样像素点数量所占比例是否均大于预设比例。It is determined whether the proportion of the number of sampled pixels corresponding to the pixel value fitting function of each channel that matches the pixel value is greater than a preset ratio.
  10. 根据权利要求4所述的应用图标的生成方法,其特征在于,如果所述在应用图标的原始图像中采样像素点的采样方式是在所述原始图像中采样一列像素点,则所述根据所述拟合函数表示的位置与像素值关系,生成所述应用图标的背景图像,包括:The method for generating an application icon according to claim 4, wherein if the sampling mode of the sampling pixel in the original image of the application icon is to sample a column of pixels in the original image, the basis The relationship between the position of the fitting function and the pixel value is generated, and the background image of the application icon is generated, including:
    遍历所述背景图像的各行,将所述行对应的纵坐标值带入所述拟合函数,计算获取所述纵坐标值对应的像素值; Traversing each row of the background image, bringing the ordinate value corresponding to the row into the fitting function, and calculating a pixel value corresponding to the ordinate value;
    将所述纵坐标值对应的像素值作为所述行中每一个像素点的像素值。The pixel value corresponding to the ordinate value is taken as the pixel value of each pixel in the row.
  11. 根据权利要求4所述的应用图标的生成方法,其特征在于,如果所述在应用图标的原始图像中采样像素点的采样方式是在所述原始图像中采样一行像素点,则所述根据所述拟合函数表示的位置与像素值关系,生成所述应用图标的背景图像,包括:The method for generating an application icon according to claim 4, wherein if the sampling mode of the sampling pixel in the original image of the application icon is to sample a row of pixels in the original image, the basis The relationship between the position of the fitting function and the pixel value is generated, and the background image of the application icon is generated, including:
    遍历所述背景图像的各列,将所述列对应的横坐标值带入所述拟合函数,计算获取所述横坐标值对应的像素值;Traversing the columns of the background image, bringing the corresponding abscissa value of the column into the fitting function, and calculating a pixel value corresponding to the abscissa value;
    将所述横坐标值对应的像素值作为所述列中每一个像素点的像素值。The pixel value corresponding to the abscissa value is taken as the pixel value of each pixel in the column.
  12. 根据权利要求1-11任一项所述的应用图标的生成方法,其特征在于,所述原始图像的色彩模式包括RGB色彩模式。The method of generating an application icon according to any one of claims 1 to 11, wherein the color mode of the original image comprises an RGB color mode.
  13. 一种应用图标的生成装置,其特征在于,包括:An apparatus for generating an application icon, comprising:
    采样单元,用于在应用图标的原始图像中采样像素点,获取各个被采样像素点的位置坐标和像素值;a sampling unit, configured to sample pixel points in an original image of the application icon, and obtain position coordinates and pixel values of each sampled pixel point;
    拟合单元,用于对所获得的所述被采样像素点的像素值进行拟合,生成所述被采样像素点的像素值拟合函数;a fitting unit, configured to fit the obtained pixel values of the sampled pixel points to generate a pixel value fitting function of the sampled pixel points;
    判断单元,用于判断符合所述拟合函数的被采样像素点数量所占比例是否大于预设比例;若是,则根据所述拟合函数表示的位置与像素值关系,生成所述应用图标的背景图像;a determining unit, configured to determine whether a proportion of the number of sampled pixels that meet the fitting function is greater than a preset ratio; if yes, generating an application icon according to a position and a pixel value relationship represented by the fitting function Background image
    合成单元,用于将所述原始图像合成到所述背景图像上,生成所述应用图标。And a synthesizing unit, configured to synthesize the original image onto the background image to generate the application icon.
  14. 根据权利要求13所述的应用图标的生成装置,其特征在于,所述判断单元包括:The apparatus for generating an application icon according to claim 13, wherein the determining unit comprises:
    第一生成子单元,用于如果所述判断符合所述拟合函数的被采样像素点数量所占比例是否大于预设比例的判断结果为否,则根据所述被采样像素点中占比例最大的像素值,生成所述应用图标的背景图像。a first generating subunit, configured to: if the judgment result that the proportion of the number of sampled pixels that meet the fitting function is greater than a preset ratio is not, according to the proportion of the sampled pixels a pixel value that generates a background image of the application icon.
  15. 根据权利要求14所述的应用图标的生成装置,其特征在于,所述第一生成子单元包括:The apparatus for generating an application icon according to claim 14, wherein the first generating subunit comprises:
    计算子单元,用于计算所述被采样像素点中各级像素值的数量;a calculation subunit, configured to calculate a quantity of pixel values of each level in the sampled pixel;
    生成子单元,用于将数量最多的像素值作为所述背景图像中各个像素点的 像素值,生成所述背景图像。Generating a subunit for using the largest number of pixel values as each pixel in the background image A pixel value is generated to generate the background image.
  16. 根据权利要求13所述的应用图标的生成装置,其特征在于,所述拟合单元包括:The apparatus for generating an application icon according to claim 13, wherein the fitting unit comprises:
    获取子单元,用于获取所述被采样像素点在表征像素值的各个通道分量上的分布数据;Obtaining a subunit, configured to acquire distribution data of the sampled pixel points on respective channel components that represent pixel values;
    拟合子单元,用于根据所述各个通道分量上的分布数据,在各个通道上分别进行拟合计算,生成各个通道的像素值拟合函数。The fitting subunit is configured to perform fitting calculation on each channel according to the distribution data on the respective channel components, and generate a pixel value fitting function of each channel.
  17. 根据权利要求13所述的应用图标的生成装置,其特征在于,所述判断单元包括:The apparatus for generating an application icon according to claim 13, wherein the determining unit comprises:
    第一判断子单元,用于判断符合所述拟合函数的被采样像素点数量所占比例是否大于预设比例;a first determining subunit, configured to determine whether a proportion of the number of sampled pixels that meet the fitting function is greater than a preset ratio;
    所述第一判断子单元包括:The first determining subunit includes:
    第一计算子单元,用于计算符合所述拟合函数的被采样像素点数量;a first calculating subunit, configured to calculate a number of sampled pixels that meet the fitting function;
    所述第一计算子单元包括:The first computing subunit includes:
    第二判断子单元,用于判断被采样像素点是否符合所述拟合函数;a second determining subunit, configured to determine whether the sampled pixel points meet the fitting function;
    所述第二判断子单元包括:The second determining subunit includes:
    第二计算子单元,用于将被采样像素点的位置坐标值带入所述拟合函数,计算所述被采样像素点的拟合像素值;a second calculating subunit, configured to bring a position coordinate value of the sampled pixel point into the fitting function, and calculate a fitted pixel value of the sampled pixel point;
    第三判断子单元,用于判断所述被采样像素点的实际像素值和所述被采样像素点的拟合像素值之间的距离是否小于预设距离;若是,则判定所述被采样像素点符合所述拟合函数。a third determining subunit, configured to determine whether a distance between an actual pixel value of the sampled pixel point and a fitted pixel value of the sampled pixel point is less than a preset distance; if yes, determining the sampled pixel The points conform to the fit function.
  18. 根据权利要求13所述的应用图标的生成装置,其特征在于,所述判断单元包括:The apparatus for generating an application icon according to claim 13, wherein the determining unit comprises:
    第二生成子单元,用于如果所述判断符合所述拟合函数的被采样像素点数量所占比例是否大于预设比例的判断结果为是,则根据所述拟合函数表示的位置与像素值关系,生成所述应用图标的背景图像。a second generation subunit, configured to determine, according to the position and the pixel represented by the fitting function, if the judgment result that the proportion of the number of sampled pixels satisfying the fitting function is greater than a preset ratio is YES A value relationship that generates a background image of the application icon.
  19. 根据权利要求18所述的应用图标的生成装置,其特征在于,所述第二生成子单元包括:The apparatus for generating an application icon according to claim 18, wherein the second generation subunit comprises:
    第一遍历子单元,用于遍历所述背景图像的各行,将所述行对应的纵坐标 值带入所述拟合函数,计算获取所述纵坐标值对应的像素值;a first traversal subunit for traversing each row of the background image, and ordinate the row Taking a value into the fitting function, and calculating a pixel value corresponding to the ordinate value;
    第一设置子单元,用于将所述纵坐标值对应的像素值作为所述行中每一个像素点的像素值。a first setting subunit, configured to use a pixel value corresponding to the ordinate value as a pixel value of each pixel in the row.
  20. 根据权利要求18所述的应用图标的生成装置,其特征在于,所述第二生成子单元包括:The apparatus for generating an application icon according to claim 18, wherein the second generation subunit comprises:
    第二遍历子单元,用于遍历所述背景图像的各列,将所述列对应的横坐标值带入所述拟合函数,计算获取所述横坐标值对应的像素值;a second traversing sub-unit, configured to traverse the columns of the background image, bring the horizontal coordinate value corresponding to the column into the fitting function, and calculate and obtain a pixel value corresponding to the horizontal coordinate value;
    第二设置子单元,用于将所述横坐标值对应的像素值作为所述列中每一个像素点的像素值。a second setting subunit, configured to use a pixel value corresponding to the abscissa value as a pixel value of each pixel in the column.
  21. 一种移动设备,其特征在于,所述移动设备包括:A mobile device, characterized in that the mobile device comprises:
    显示器;monitor;
    处理器;以及Processor;
    存储器,所述存储器被配置成存储应用图标的原始图像,所述原始图像被所述处理器执行时,在所述显示器显示所述应用图标,所述应用图标是由所述原始图像和背景图像合成的,所述背景图像是根据所述原始图像中的被采样像素点的像素值拟合函数生成的,并且所述背景图像的尺寸大于所述原始图像。 a memory configured to store an original image of an application icon, the original image being displayed by the processor, the application icon being displayed on the display, the application icon being from the original image and a background image Synthesized, the background image is generated according to a pixel value fitting function of the sampled pixel points in the original image, and the size of the background image is larger than the original image.
PCT/CN2015/098254 2014-12-30 2015-12-22 Application icon generation method and apparatus, and mobile device WO2016107461A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201410842996.0 2014-12-30
CN201410842996.0A CN105809721B (en) 2014-12-30 2014-12-30 A kind of generation method of application icon, device and mobile device

Publications (1)

Publication Number Publication Date
WO2016107461A1 true WO2016107461A1 (en) 2016-07-07

Family

ID=56284239

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2015/098254 WO2016107461A1 (en) 2014-12-30 2015-12-22 Application icon generation method and apparatus, and mobile device

Country Status (2)

Country Link
CN (1) CN105809721B (en)
WO (1) WO2016107461A1 (en)

Families Citing this family (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106293393A (en) * 2016-08-01 2017-01-04 北京奇虎科技有限公司 Synthesis display packing based on electronics paster, device and terminal unit
CN111295637B (en) * 2017-09-07 2024-03-26 深圳传音通讯有限公司 Display method and display device for intelligent terminal
CN109240689B (en) * 2018-08-15 2022-08-09 腾讯科技(深圳)有限公司 Application icon generation method, device, server and medium
CN109831584A (en) * 2019-01-30 2019-05-31 努比亚技术有限公司 Application icon adaptation processing method, storage medium and mobile terminal
CN110310239B (en) * 2019-06-20 2023-05-05 四川阿泰因机器人智能装备有限公司 Image processing method for eliminating illumination influence based on characteristic value fitting
CN113129402B (en) * 2021-04-19 2024-01-30 中国航发沈阳发动机研究所 Cross section data cloud picture drawing method
CN114283736B (en) * 2022-03-03 2022-06-03 武汉精立电子技术有限公司 Method, device and equipment for correcting positioning coordinates of sub-pixels and readable storage medium
CN114708342B (en) * 2022-06-06 2022-08-23 广东欧谱曼迪科技有限公司 File conversion method, device, equipment, storage medium and simulation verification method

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101706724A (en) * 2009-09-29 2010-05-12 宇龙计算机通信科技(深圳)有限公司 Icon generation method and icon processing device
CN102622163A (en) * 2011-03-14 2012-08-01 北京小米科技有限责任公司 Icon generation method
CN102736920A (en) * 2012-06-11 2012-10-17 广东欧珀移动通信有限公司 Adaptive color matching method of desktop icon background mask
CN103513946A (en) * 2012-06-26 2014-01-15 腾讯科技(深圳)有限公司 Display control method and device
US20140168248A1 (en) * 2012-12-19 2014-06-19 Microsoft Corporation Runtime transformation of images to match a user interface theme

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR101587211B1 (en) * 2009-05-25 2016-01-20 엘지전자 주식회사 Mobile Terminal And Method Of Controlling Same
CN104679380A (en) * 2013-11-30 2015-06-03 富泰华工业(深圳)有限公司 System and method for adjusting background color of user interface

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101706724A (en) * 2009-09-29 2010-05-12 宇龙计算机通信科技(深圳)有限公司 Icon generation method and icon processing device
CN102622163A (en) * 2011-03-14 2012-08-01 北京小米科技有限责任公司 Icon generation method
CN102736920A (en) * 2012-06-11 2012-10-17 广东欧珀移动通信有限公司 Adaptive color matching method of desktop icon background mask
CN103513946A (en) * 2012-06-26 2014-01-15 腾讯科技(深圳)有限公司 Display control method and device
US20140168248A1 (en) * 2012-12-19 2014-06-19 Microsoft Corporation Runtime transformation of images to match a user interface theme

Also Published As

Publication number Publication date
CN105809721B (en) 2019-02-15
CN105809721A (en) 2016-07-27

Similar Documents

Publication Publication Date Title
WO2016107461A1 (en) Application icon generation method and apparatus, and mobile device
US10417770B2 (en) Efficient acquisition of a target image from an original image
US10789767B2 (en) Reducing computational complexity in three-dimensional modeling based on two-dimensional images
US10878612B2 (en) Facial image replacement using 3-dimensional modelling techniques
WO2020108610A1 (en) Image processing method, apparatus, computer readable medium and electronic device
US20210349915A1 (en) Generating varied-scale visualizations of multi-dimensional data
JP6634387B2 (en) A nonparametric microfacet factor model for the isotropic bidirectional reflectance distribution function
US9865032B2 (en) Focal length warping
WO2015131787A1 (en) Screen adaptation method and apparatus
US10318102B2 (en) 3D model generation from 2D images
WO2022012085A1 (en) Face image processing method and apparatus, storage medium, and electronic device
US20140225894A1 (en) 3d-rendering method and device for logical window
US9978120B2 (en) Warping panoramic images to fit a boundary
US9959672B2 (en) Color-based dynamic sub-division to generate 3D mesh
JP2019527355A (en) Computer system and method for improved gloss rendering in digital images
US20220358694A1 (en) Method and apparatus for generating a floor plan
US20130176304A1 (en) Method and apparatus for processing three-dimensional model data
WO2022179544A1 (en) Handwriting drawing method, apparatus, medium, and interactive tablet
US10313653B1 (en) Systems and methods for procedural rendering of cinematic virtual reality content
US20240087089A1 (en) Reconstructing linear gradients
CN113436325B (en) Image processing method and device, electronic equipment and storage medium
US11954802B2 (en) Method and system for generating polygon meshes approximating surfaces using iteration for mesh vertex positions
CN112351213B (en) System dynamic allocation on chip resources for efficient signal processing
US20230394767A1 (en) Method and system for generating polygon meshes approximating surfaces using root-finding and iteration for mesh vertex positions
US20230336799A1 (en) Video streaming scaling using virtual resolution adjustment

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 15875139

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 15875139

Country of ref document: EP

Kind code of ref document: A1