Picture processing method and device, storage medium and electronic equipment
By obtaining and processing the placement position, size and color attribute information of the software identification picture in software development, and performing scaling and smoothing processing, the problem of jagging when the software icon is adapted is solved, and the display effect is improved.
Patent Information
- Application Number
- CN202411611363.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-12
- Publication Date
- 2025-03-25
Smart Images

Figure CN119690286A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to an image processing method, device, storage medium and electronic device. Background Art
[0002] Software icons are a vital and visible feature of software. With the advent of the digital age, software icons not only play a role in identification and navigation on electronic devices, but also play a vital role in brand promotion and user experience. Effective icon design can convey the core functions and brand personality of the software, allowing users to quickly identify and access the application during use. Summary of the invention
[0003] The present application provides a method, device, computer storage medium and electronic device for image processing, and the technical solution is as follows:
[0004] In a first aspect, an embodiment of the present application provides a method for processing an image, the method comprising:
[0005] Obtaining an original software logo image of the software to be customized, determining an icon placement position of the original software logo image in the software to be customized, and obtaining a target pixel size corresponding to the icon placement position;
[0006] Determine the color attribute information corresponding to the original software logo image, and determine the target image conversion mode based on the color attribute information;
[0007] The original software logo image is scaled and smoothed based on the target pixel size and the target image conversion mode to obtain the target software logo image.
[0008] In a second aspect, an embodiment of the present application provides a picture processing device, the device comprising:
[0009] The original image acquisition module is used to acquire the original software logo image of the software to be customized, determine the icon placement position of the original software logo image in the software to be customized, and acquire the target pixel size corresponding to the icon placement position;
[0010] A conversion mode determination module, used to determine the color attribute information corresponding to the original software logo image, and determine the target image conversion mode based on the color attribute information;
[0011] The image conversion processing module is used to perform scaling and smoothing processing on the original software logo image based on the target pixel size and the target image conversion mode to obtain the target software logo image.
[0012] In a third aspect, an embodiment of the present application provides a computer storage medium, wherein the computer storage medium has a plurality of instructions, and the instructions are suitable for being loaded by a processor and executing the above-mentioned method steps.
[0013] In a fourth aspect, an embodiment of the present application provides an electronic device, which may include: a memory and a processor; wherein the memory stores a computer program, and the computer program is suitable for being loaded by the memory and executing the above-mentioned method steps.
[0014] The beneficial effects brought by the technical solution provided by the embodiment of the present application include at least:
[0015] In the image processing method provided in the embodiment of the present application, by determining the icon placement position of the original software logo image of the software to be customized in the software to be customized, obtaining the target pixel size corresponding to the icon placement position, determining the color attribute information corresponding to the original software logo image, determining the target image conversion mode based on the color attribute information, and performing scaling and smoothing processing on the original software logo image based on the target pixel size and the target image conversion mode to obtain the target software logo image. Thus, the target image conversion mode is determined by the color attribute information, so that the original software logo image is scaled and smoothed by using the target image conversion mode, which can be applied to the smoothing processing of software logo images at any scaling ratio, improves the smoothness and display effect of the scaled software logo image, and can avoid the problem of jaggedness when the scaled and smoothed software logo image is placed in the corresponding position in the software to be customized. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without paying any creative work.
[0017] Figure 1 It is a flowchart of a picture processing method provided in an embodiment of the present application;
[0018] Figure 2 It is a flowchart of another image processing method provided in an embodiment of the present application;
[0019] Figure 3 is a structural schematic diagram of an image processing device provided in an embodiment of the present application;
[0020] Figure 4 is a structural diagram of a conversion mode determination module provided in an embodiment of the present application;
[0021] Figure 5 It is a structural schematic diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0022] In order to make the purpose, features, and advantages of the embodiments of the present application more obvious and understandable, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of this application.
[0023] In the description of the present application, it should be understood that the terms "first", "second", etc. are only used for descriptive purposes and cannot be understood as indicating or implying relative importance. In the description of the present application, it should be noted that, unless otherwise clearly specified and limited, "including" and "having" and any of their variations are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not limited to the listed steps or units, but optionally also includes steps or units that are not listed, or optionally also includes other steps or units inherent to these processes, methods, products or devices. For those of ordinary skill in the art, the specific meanings of the above terms in the present application can be understood in specific circumstances. In addition, in the description of the present application, unless otherwise specified, "multiple" refers to two or more. "And / or" describes the association relationship of associated objects, indicating that there can be three relationships, for example, A and / or B, which can represent: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the associated objects before and after are an "or" relationship.
[0024] In the related art, during the development of customized software, the customer of the customized software will provide high-pixel software icons. In the process of adapting the high-pixel software icons to the customized software, the developers usually directly scale the high-pixel software icons according to the required ratio and export them, or use development tools to directly load the high-pixel software icons to the specified location. However, the above-mentioned software icon importing methods will cause the software icons to be severely jagged in the software, and there is a problem of poor software icon display effect.
[0025] In view of the above problems, the present application proposes a technical solution of an image processing method to avoid the problem of jagged appearance when the software logo image is placed at the corresponding position in the customized software. The specific concept of the technical solution is as follows:
[0026] Since the customer of customized software usually provides a high-pixel file of the software icon, this application takes into account that for a customized software, there will be multiple locations where the software icon is displayed. Taking the customized software running in the Windows operating system as an example, these locations where the software icon is displayed may be the location of a certain control, such as the location of the control used to open the customized software in the desktop taskbar, or the location of the desktop shortcut of the software, or the location where the software icon is displayed in the menu bar, status bar, etc., and the size of the software icon displayed at each location may be completely different. If the high-pixel software icon is scaled only according to the size of the software icon displayed at each location, the scaling ratio is too large, which will easily cause the scaled software icon to appear jagged. Based on this, this application designs a solution for scaling and smoothing the high-pixel software icon in combination with the color information contained in the high-pixel software icon and the size of the software icon displayed at each location. Specifically, the color attribute information corresponding to the high-pixel software icon provided by the customer is used to determine the image conversion mode applicable to the high-pixel software icon, so as to scale and smooth the high-pixel software icon according to the image conversion mode and the icon display size of each location, so as to customize the target software logo image adapted to each software icon display location. This is because the complexity of color information contained in high-pixel software icons of different customized software is different. Some high-pixel software icons have simple color information, while some high-pixel software icons have complex color information. For high-pixel software icons with simple color information, a lower-complexity image conversion mode can achieve a better smoothing effect, while for high-pixel software icons with complex color information, a higher-complexity image conversion mode can achieve a better smoothing effect. Therefore, the image conversion mode suitable for the high-pixel software icon is determined through the color attribute information corresponding to the high-pixel software icon provided by the customer, and the accurate image conversion mode can be matched for the high-pixel software icon, so that the high-pixel software icon can achieve a better smoothing effect during the scaling process, so that the software icon displayed at each software icon display position will not have the problem of jaggedness, but will achieve better smoothing and display effects.
[0027] Based on the above technical concept, the image processing method of the embodiment of the present application is further explained below in combination with specific embodiments.
[0028] In the following method embodiments, each step is described in detail with the execution subject of each step being an electronic device.
[0029] See also Figure 1 , is a flow chart of a method for image processing provided by an embodiment of the present application. Figure 1 As shown, the method of the embodiment of the present application may include the following steps:
[0030] S101, obtaining an original software logo image of the software to be customized, determining an icon placement position of the original software logo image in the software to be customized, and obtaining a target pixel size corresponding to the icon placement position.
[0031] Among them, software to be customized refers to customized software waiting to be produced. Customized software refers to software specially developed according to specific user needs or specific business processes. Customized software is different from standardized software. Customized software can meet the unique requirements of specific industries, enterprises or individuals.
[0032] The original software logo image refers to the high-definition image file of the software icon of the customized software. The original software logo image is an image with high resolution.
[0033] The icon placement position may include the icon display position in the user interface of the customized software and the icon display position of the customized software on the desktop. The icon display position in the user interface of the customized software may include, but is not limited to, a toolbar, a menu bar, a status bar, a sidebar, etc. Taking the customized software in the Windows system as an example, the icon display position of the customized software on the desktop may include, but is not limited to, a desktop shortcut, a desktop taskbar, etc.
[0034] The target pixel size refers to the pixel size occupied by the software icon placed at the icon placement position. The target pixel size may include pixel width and pixel height. For example, a target pixel size of a*b may indicate that the software icon placed at its corresponding icon placement position has a total of b rows and a columns of pixels.
[0035] In some embodiments, the original software logo image of the software to be customized can be obtained from a specified database, or downloaded from a specified image link. The icon placement position of the original software logo image in the software to be customized can be obtained by traversing the interface layout file or code of the software to be customized. After obtaining the icon placement position, the size acquisition method can be called in the development code of the software to be customized to obtain the target pixel size corresponding to each icon placement position.
[0036] S102, determining color attribute information corresponding to the original software logo image, and determining a target image conversion mode based on the color attribute information.
[0037] The color attribute information refers to the attribute information of various color indicators used to describe the original software logo image. Optionally, the color indicators in the color attribute information may include but are not limited to color, brightness, contrast, saturation, transparency, color system type, and hue type.
[0038] The target image conversion mode is used to describe relevant information of an interpolation algorithm used for smoothing icons, and the target image conversion mode may include the name and calculation formula of the interpolation algorithm.
[0039] In some embodiments, the color attribute information can be obtained by obtaining the color space data of the original software logo image, determining the color feature data according to the color space data, and performing color index extraction processing on the color feature data and the color space data. The color space data may include data described using HSV color space, HSB color space, RGB color space, CMYK color space or other color space. Specifically, the color space data may include data such as color, brightness, contrast, saturation, transparency, etc. The color feature data may include data such as color system type and hue type.
[0040] Determining the target image conversion mode based on the color attribute information can specifically be: evaluating the color grade classification corresponding to the original software logo image through the color attribute information, and determining the target image conversion mode that matches the color grade classification. The color grade classification can be used to characterize the color complexity of the original software logo image. The lower the color grade classification, the lower the color complexity of the original software logo image. The higher the color grade classification, the higher the color complexity of the original software logo image. For the original software logo image with a lower color grade classification, the complexity of the interpolation algorithm included in the corresponding target image conversion mode is lower. For the original software logo image with a higher color grade classification, the complexity of the interpolation algorithm included in the corresponding target image conversion mode is higher.
[0041] S103, performing scaling and smoothing processing on the original software logo image based on the target pixel size and the target image conversion mode to obtain a target software logo image.
[0042] It is understandable that the target software logo image is the image obtained by scaling and smoothing the original software logo image. The target pixel size is also the pixel size of the target software logo image, and the original software logo image needs to reach the target pixel size after scaling.
[0043] In some embodiments, the original pixel size and original pixel data of the original software logo image are obtained, the target pixel position is determined based on the target pixel size, pixel position mapping processing is performed on the target pixel position based on the target pixel size and the original pixel size to obtain a mapped pixel position corresponding to the target pixel position, pixel calculation is performed on the original pixel data using a target image conversion mode to obtain target pixel data corresponding to the mapped pixel position, the target pixel data is determined as the pixel data of the target pixel position, and the target software logo image composed of the pixel data of all target pixel positions is determined.
[0044] In the image processing method provided in the embodiment of the present application, by determining the icon placement position of the original software logo image of the software to be customized in the software to be customized, obtaining the target pixel size corresponding to the icon placement position, determining the color attribute information corresponding to the original software logo image, determining the target image conversion mode based on the color attribute information, and performing scaling and smoothing processing on the original software logo image based on the target pixel size and the target image conversion mode to obtain the target software logo image. Thus, the target image conversion mode is determined by the color attribute information, so that the original software logo image is scaled and smoothed by using the target image conversion mode, which can be applied to the smoothing processing of software logo images at any scaling ratio, improves the smoothness and display effect of the scaled software logo image, and can avoid the problem of jaggedness when the scaled and smoothed software logo image is placed in the corresponding position in the software to be customized.
[0045] See also Figure 2 , is a flow chart of a method for image processing provided in an embodiment of the present application. Figure 2 As shown, the method of the embodiment of the present application may include the following steps:
[0046] S201, obtaining an original software logo image of the software to be customized, determining an icon placement position of the original software logo image in the software to be customized, and obtaining a target pixel size corresponding to the icon placement position.
[0047] Specifically, see Figure 1 The description of the relevant parts in the illustrated embodiment will not be repeated here.
[0048] S202, obtaining color space data of the original software logo image, and determining color feature data corresponding to the original software logo image based on the color space data.
[0049] The color space data includes the color data of each pixel in the original software logo image. The color feature data includes data such as color system type and hue type.
[0050] In some embodiments, an image processing tool may be called to convert the original software logo image into a preset color space, and the color space data of the original software logo image in the preset color space may be extracted. Optionally, the preset color space may be any one of an HSV color space, a LAB color space, an HSB color space, an RGB color space, a CMYK color space, or other color spaces. Specifically, the color space data includes data such as the color, brightness, contrast, saturation, and transparency of each pixel.
[0051] The color data of each pixel is determined from the color space data, the color type contained in the original software logo image is determined according to the color data of each pixel, the color system type and the hue type contained in the original software logo image are determined according to the color type, and the color feature data including the color system type and the hue type is generated. It can be understood that the color system type can include but is not limited to red, orange, yellow, blue, green, purple, etc., and each color system type can include multiple hue types. For example, blue can include different hue types such as sky blue, lake blue, and haze blue.
[0052] S203, generating color attribute information based on the color space data and the color feature data.
[0053] In some embodiments, the value of the preset color index can be extracted from the color space data and the color feature data to generate color attribute information including the value of the preset color index. The preset color index can include but is not limited to color, brightness, contrast, saturation, color system type, and hue type. The color value can be represented by a color code, the brightness value can be represented by a brightness value, the contrast value can be represented by a contrast value, the saturation value can be represented by a saturation value, the color system type value can be represented by the number of color system types, and the hue type value can be represented by the number of hue types.
[0054] Therefore, by performing color analysis on the original software logo image to extract specific color attribute information belonging to the original software logo image, it is convenient to subsequently determine a target image conversion mode that matches the original software logo image based on the specific color attribute information.
[0055] S204, inputting the color attribute information into a pattern matching model, performing picture conversion pattern matching processing in a preset picture conversion pattern set through the pattern matching model, and obtaining a target picture conversion pattern.
[0056] The pattern matching model can be pre-trained based on a machine learning model. The principle of obtaining the target image conversion mode through the pattern matching model can be: identifying the color level classification corresponding to the color attribute information through the pattern matching model, and matching the target image conversion mode corresponding to the color level classification in the preset image conversion mode set through the pattern matching model.
[0057] The preset picture conversion mode set may include a variety of picture conversion modes configured based on expert experience. The picture conversion modes in the preset picture conversion mode set may specifically include a first-order interpolation mode, a second-order interpolation mode, and a third-order interpolation mode. The target picture conversion mode may be any one of the first-order interpolation mode, the second-order interpolation mode, and the third-order interpolation mode. Among them, the first-order interpolation mode includes the algorithm information of the first-order interpolation algorithm, the second-order interpolation mode includes the algorithm information of the second-order interpolation algorithm, and the third-order interpolation algorithm includes the algorithm information of the third-order interpolation algorithm. It can be understood that the first-order interpolation algorithm refers to a linear interpolation method, and the result of linear interpolation is a straight line. The first-order interpolation algorithm can be implemented by a first-order function (i.e., a linear function). The second-order interpolation algorithm refers to a method of using a quadratic polynomial interpolation, such as a quadratic polynomial can be constructed by three known data points. The result of the quadratic interpolation is a quadratic function, which can be expressed as a second-order polynomial. The third-order interpolation algorithm refers to a method of using a cubic polynomial interpolation, and the result of the cubic interpolation is a cubic function, which can be expressed as a third-order polynomial. For example, a first-order interpolation algorithm may include nearest neighbor interpolation, a second-order interpolation algorithm may include bilinear interpolation, and a third-order interpolation algorithm may include cubic convolution interpolation.
[0058] For example, for an original software logo image with a single color, the corresponding color grade classification can be evaluated as a low-level classification, and the target image conversion mode matched to it can be a first-order interpolation mode; for an original software logo image with multiple tones of one color system, the corresponding color grade classification can be evaluated as an intermediate classification, and the target image conversion mode matched to it can be a second-order interpolation mode; for an original software logo image with multiple color systems, the corresponding color grade classification can be evaluated as a high-level classification, and the target image conversion mode matched to it can be a third-order interpolation mode.
[0059] The training process of the pattern matching model may include the following steps:
[0060] Create an initial pattern matching model for the icon conversion scenario; obtain a sample software logo image of the sample customized software, determine the sample color attribute information corresponding to the sample software logo image, determine the sample color grade classification corresponding to the sample software logo image based on the sample color attribute information, and annotate the sample color grade classification with an image conversion mode label; input the sample color grade classification into the initial pattern matching model for at least one round of model training to obtain a predicted image conversion mode corresponding to the sample color grade classification; determine the model loss value using a pattern loss function based on the image conversion mode label and the predicted image conversion mode, and adjust the model parameters of the initial pattern matching model based on the model loss value until the model training conditions are met to obtain a pattern matching model.
[0061] The model training end condition may include, for example, the value of the loss function is less than or equal to a preset loss function threshold, the number of iterations reaches a preset number threshold, etc. The specific model training end condition may be determined based on actual conditions and is not specifically limited here.
[0062] It is understandable that the initial pattern matching model can be created using a machine learning model. Optionally, the machine learning model includes but is not limited to a convolutional neural network (CNN) model, a deep neural network (DNN) model, a recurrent neural network (RNN) model, an embedding model, a gradient boosting decision tree (GBDT) model, a logistic regression (LR) model, or one or more of the fitting of a machine learning model.
[0063] Therefore, by matching the original software identification image with the corresponding target image conversion pattern through the pattern matching model, the matching accuracy of the image conversion pattern can be guaranteed, and the matching efficiency of the image conversion pattern can be improved.
[0064] S205, obtaining the original pixel size and original pixel data of the original software logo image.
[0065] The original pixel size refers to the pixel size of the original software logo image, and the original pixel size includes the pixel width and pixel height of the original software logo image.
[0066] The original pixel data includes the pixel value of each pixel in the original software logo image. Each pixel has a unique pixel position in the original software logo image. The pixel value of each pixel can be represented by an array. For example, the pixel value is represented by an RGB value, and the array includes the values of the pixel in the R channel, the G channel, and the B channel.
[0067] In some embodiments, an image processing tool may be called to read the original pixel size and original pixel data from the original software identification image.
[0068] S206, determining a target pixel position based on the target pixel size, and performing pixel position mapping processing on the target pixel position based on the target pixel size and the original pixel size to obtain a mapped pixel position corresponding to the target pixel position.
[0069] It can be understood that, assuming the target pixel size is a*b, a*b can mean that there are b rows and a columns of pixels in the image formed by the target pixel size. Taking the coordinate (x, y) as an example to represent the target pixel position, assuming that the coordinate system where the coordinate (x, y) is located takes the pixel in the lower left corner of the image formed by the target pixel size as the origin, and the coordinates of all pixels in the image formed by the target pixel size are in the first quadrant of the coordinate system, then the value of x can be 0 to (a-1), and the value of y can be 0 to (b-1), and both x and y are integers.
[0070] Specifically, the target pixel position is mapped based on the target pixel size and the original pixel size to obtain the mapped pixel position corresponding to the target pixel position. One implementation method may be: the image scaling ratio is calculated based on the target pixel size and the original pixel size; the target pixel position is mapped based on the image scaling ratio to obtain the mapped pixel position of the target pixel position in the original software identification image. The mapped pixel position refers to the pixel position in the original software identification image that has a position mapping relationship with the target pixel position. The image scaling ratio may include a width scaling ratio and a height scaling ratio. The width scaling ratio may be obtained by calculating the quotient of the pixel width in the original pixel size and the pixel width in the target pixel size, and the height scaling ratio may be obtained by calculating the quotient of the pixel height in the original pixel size and the pixel height in the target pixel size. Taking the target pixel position using coordinates (x, y) as an example, the width scaling ratio is represented by w, the height scaling ratio is represented by h, the horizontal coordinate of the mapped pixel position is the product of x and w, and the vertical coordinate of the mapped pixel position is the product of y and h, so the coordinates of the mapped pixel position can be obtained as (x*w, y*h).
[0071] S207, performing pixel calculation on the original pixel data using the target image conversion mode to obtain target pixel data corresponding to the mapped pixel position.
[0072] In some embodiments, the implementation method of step S207 may include the following steps: determining reference pixel data corresponding to the mapped pixel position from the original pixel data based on the target image conversion mode; performing pixel calculation based on the reference pixel data to obtain target pixel data corresponding to the mapped pixel position.
[0073] Among them, the reference pixel data refers to the pixel value of the reference pixel used to calculate the target pixel data, and the reference pixel is a pixel that has a certain positional relationship with the mapping pixel position among all the pixels included in the original software identification image. The reference pixel corresponding to the mapping pixel position can be determined from all the pixels included in the original software identification image through the interpolation algorithm in the target image conversion mode, and the pixel value of the reference pixel can be determined from the original pixel data, and the pixel value of the reference pixel is used as the reference pixel data corresponding to the mapping pixel position. Furthermore, the pixel calculation formula corresponding to the reference pixel data can be determined through the interpolation algorithm in the target image conversion mode, and the pixel calculation formula is used to perform pixel calculation on the reference pixel data to obtain the target pixel data corresponding to the mapping pixel position.
[0074] Therefore, by using a target image conversion mode that matches the original software logo image for pixel calculation, it can be ensured that a relatively accurate interpolation algorithm is used to smooth the software logo image scaled to the target pixel size, so that the software logo image scaled to the target pixel size achieves a better smoothing effect.
[0075] S208, determining the target pixel data as the pixel data at the target pixel position, and determining a target software logo image composed of the pixel data at all target pixel positions.
[0076] It can be understood that the target pixel data corresponding to the mapped pixel position is used as the pixel data of the target pixel position, and the pixel data of the target pixel position is the pixel value of the target pixel located at the target pixel position. Then the pixel value of the target pixel located at each target pixel position can be determined, and all target pixels can constitute the target software logo image.
[0077] S209, converting the target software logo image into a designated software logo image in a preset icon format, and loading the designated software logo image into an icon placement position.
[0078] The preset icon format may be an icon format preset for the software to be customized, and the preset icon format may be determined according to the software to be customized.
[0079] Optionally, the preset icon format may include but is not limited to .ico format, .png format, .bmp format, .jpg format, .svg format and other formats.
[0080] In some embodiments, loading a designated software identification image to an icon placement position may be performed by: obtaining a designated software engineering directory corresponding to the designated software identification image, storing the designated software identification image in the designated software engineering directory, and loading the designated software identification image to the icon placement position based on a compilation operation corresponding to the software to be customized. The designated software engineering directory refers to a directory for storing designated software identification images in a software engineering corresponding to the software to be customized. Thus, after generating the target software identification image, the target software identification image is converted into an icon format required by the software to be customized, the designated software identification image in the preset icon format is stored in a corresponding engineering directory, and the designated software identification image is loaded to the corresponding icon placement position to complete the formulation process of the software to be customized.
[0081] In the image processing method provided in the embodiment of the present application, the original software logo image of the software to be customized is obtained, the icon placement position of the original software logo image in the software to be customized is determined, the target pixel size corresponding to the icon placement position is obtained, the color space data of the original software logo image is obtained, the color feature data corresponding to the original software logo image is determined based on the color space data, and the color attribute information is generated based on the color space data and the color feature data. Thus, by color analysis of the original software logo image, specific color attribute information belonging to the original software logo image is extracted, so as to facilitate the subsequent determination of the target image conversion mode matching the original software logo image based on the specific color attribute information. Afterwards, the color attribute information is input into the pattern matching model, and the pattern matching model is used to perform image conversion mode matching processing in the preset image conversion mode set to obtain the target image conversion mode. Thus, by matching the original software logo image with the corresponding target image conversion mode through the pattern matching model, the matching accuracy of the image conversion mode can be guaranteed, and the matching efficiency of the image conversion mode can be improved. Then, the original pixel size and original pixel data of the original software logo image are obtained, the target pixel position is determined based on the target pixel size, the target pixel position is subjected to pixel position mapping processing based on the target pixel size and the original pixel size to obtain the mapped pixel position corresponding to the target pixel position, the original pixel data is subjected to pixel calculation using the target image conversion mode to obtain the target pixel data corresponding to the mapped pixel position, the target pixel data is determined as the pixel data of the target pixel position, the target software logo image composed of the pixel data of all target pixel positions is determined, the target software logo image is converted into a designated software logo image in a preset icon format, and the designated software logo image is loaded into the icon placement position. Thus, by performing pixel calculation using the target image conversion mode matching the original software logo image, it is possible to ensure that a relatively accurate interpolation algorithm is used to smooth the software logo image scaled to the target pixel size, so that the software logo image scaled to the target pixel size achieves a better smoothing effect, and the designated software logo image is loaded into the corresponding icon placement position to complete the formulation process of the software to be customized.
[0082] The following will be combined Figure 3 , the image processing device provided in the embodiment of the present application is introduced in detail. It should be noted that, Figure 3 The image processing device shown is used to execute the present application Figure 1 and Figure 2 For the convenience of explanation, only the part related to the embodiment of the present application is shown. For the specific technical details not disclosed, please refer to the present application. Figure 1 and Figure 2 The embodiment shown.
[0083] See also Figure 3, which shows a schematic diagram of the structure of the image processing device of an embodiment of the present application. The image processing device 1 can be implemented as all or part of the device through software, hardware or a combination of both. According to some embodiments, the image processing device 1 includes an original image acquisition module 11, a conversion mode determination module 12 and an image conversion processing module 13, which are specifically used to:
[0084] The original image acquisition module 11 is used to acquire the original software logo image of the software to be customized, determine the icon placement position of the original software logo image in the software to be customized, and acquire the target pixel size corresponding to the icon placement position;
[0085] A conversion mode determination module 12, configured to determine color attribute information corresponding to the original software logo image, and determine a target image conversion mode based on the color attribute information;
[0086] The image conversion processing module 13 is used to perform scaling and smoothing processing on the original software logo image based on the target pixel size and the target image conversion mode to obtain a target software logo image.
[0087] Optional, see Figure 4 The conversion mode determination module 12 shown in the figure is a structural diagram, and the conversion mode determination module 12 includes a first color data determination unit 121 and a second color data determination unit 122, which are specifically used to:
[0088] The first color data determining unit 121 is used to obtain the color space data of the original software logo image, and determine the color feature data corresponding to the original software logo image based on the color space data;
[0089] The second color data determining unit 122 is used to generate color attribute information based on the color space data and the color feature data.
[0090] Optionally, the conversion mode determination module 12 is specifically configured to:
[0091] The color attribute information is input into the pattern matching model, and the pattern matching model is used to perform image conversion pattern matching processing in a preset image conversion pattern set to obtain a target image conversion pattern.
[0092] Optionally, the image processing device 1 is further used for:
[0093] Create an initial pattern matching model for icon conversion scenarios;
[0094] Obtain a sample software logo image of the sample customized software, determine sample color attribute information corresponding to the sample software logo image, determine a sample color grade classification corresponding to the sample software logo image based on the sample color attribute information, and annotate the sample color grade classification with a picture conversion mode label;
[0095] Inputting the sample color level classification into the initial pattern matching model for at least one round of model training to obtain a predicted image conversion pattern corresponding to the sample color level classification;
[0096] Based on the image conversion mode label and the predicted image conversion mode, a pattern loss function is used to determine the model loss value. Based on the model loss value, the model parameters of the initial pattern matching model are adjusted until the model training conditions are met to obtain a pattern matching model.
[0097] Optionally, the image conversion processing module 13 includes:
[0098] A first conversion unit, used for obtaining the original pixel size and original pixel data of the original software logo image;
[0099] A second conversion unit is used to determine a target pixel position based on a target pixel size, and perform pixel position mapping processing on the target pixel position based on the target pixel size and the original pixel size to obtain a mapping pixel position corresponding to the target pixel position;
[0100] A third conversion unit, configured to perform pixel calculation on the original pixel data using a target picture conversion mode to obtain target pixel data corresponding to the mapped pixel position;
[0101] The fourth conversion unit is used to determine the target pixel data as the pixel data at the target pixel position, and determine the target software identification picture composed of the pixel data at all the target pixel positions.
[0102] Optionally, the third conversion unit is specifically configured to:
[0103] Determining reference pixel data corresponding to the mapped pixel position from the original pixel data based on the target image conversion mode;
[0104] Pixel calculation is performed based on the reference pixel data to obtain target pixel data corresponding to the mapped pixel position.
[0105] Optionally, the image processing device 1 is further used for:
[0106] The target software logo image is converted into a designated software logo image in a preset icon format, and the designated software logo image is loaded into the icon placement position.
[0107] In the image processing device provided in the embodiment of the present application, by determining the icon placement position of the original software logo image of the software to be customized in the software to be customized, obtaining the target pixel size corresponding to the icon placement position, determining the color attribute information corresponding to the original software logo image, determining the target image conversion mode based on the color attribute information, and performing scaling and smoothing processing on the original software logo image based on the target pixel size and the target image conversion mode to obtain the target software logo image. Thus, the target image conversion mode is determined by the color attribute information, so that the original software logo image is scaled and smoothed by using the target image conversion mode, which can be applied to the smoothing processing of software logo images at any scaling ratio, improves the smoothness and display effect of the scaled software logo image, and can avoid the problem of jaggedness when the scaled and smoothed software logo image is placed in the corresponding position in the software to be customized.
[0108] Please refer to Figure 5 , is a structural block diagram of an electronic device provided in an embodiment of the present application. The electronic device in the embodiment of the present application may include one or more of the following components: a processor 110, a memory 120, an input device 130, an output device 140, and a bus 150. The processor 110, the memory 120, the input device 130, and the output device 140 may be connected via a bus 150.
[0109] The processor 110 may include one or more processing cores. The processor 110 uses various interfaces and lines to connect various parts of the entire electronic device, and executes various functions and processes data of the electronic device 100 by running or executing instructions, programs, code sets or instruction sets stored in the memory 120, and calling data stored in the memory 120. Optionally, the processor 110 can be implemented in at least one hardware form of digital signal processing (DSP), field-programmable gate array (FPGA), and programmable logic array (PLA). The processor 110 can integrate one or a combination of a central processing unit (CPU), a graphics processing unit (GPU), and a modem. Among them, the CPU mainly processes the operating system, user interface, and application programs; the GPU is responsible for rendering and drawing display content; and the modem is used to process wireless communications. It can be understood that the above-mentioned modem may not be integrated into the processor 110, but may be implemented separately through a communication chip.
[0110] The memory 120 may include a random access memory (RAM) or a read-only memory (ROM). Optionally, the memory 120 includes a non-transitory computer-readable storage medium. The memory 120 may be used to store instructions, programs, codes, code sets, or instruction sets.
[0111] The input device 130 is used to receive input instructions or data, and the input device 130 includes but is not limited to a keyboard, a mouse, a camera, a microphone or a touch device. The output device 140 is used to output instructions or data, and the output device 140 includes but is not limited to a display device and a speaker. In the embodiment of the present application, the input device 130 can be a temperature sensor for obtaining the operating temperature of the electronic device. The output device 140 can be a speaker for outputting audio signals.
[0112] In addition, those skilled in the art will understand that the structure of the electronic device shown in the above drawings does not constitute a limitation on the terminal, and the electronic device may include more or fewer components than shown, or combine certain components, or arrange the components differently. For example, the electronic device also includes a radio frequency circuit, an input unit, a sensor, an audio circuit, a wireless fidelity (WIFI) module, a power supply, a Bluetooth module and other components, which will not be described in detail here.
[0113] In the embodiment of the present application, the execution subject of each step may be the electronic device described above. Optionally, the execution subject of each step is the operating system of the electronic device. The operating system may be an Android system, an IOS system, or other operating systems, which is not limited in the embodiment of the present application.
[0114] exist Figure 5 In the electronic device, the processor 110 may be used to call the program of the image processing method stored in the memory 120, and the processor 110 may be used to call the program of the image processing method stored in the memory 120, and specifically perform the following operations:
[0115] Obtaining an original software logo image of the software to be customized, determining an icon placement position of the original software logo image in the software to be customized, and obtaining a target pixel size corresponding to the icon placement position;
[0116] Determine the color attribute information corresponding to the original software logo image, and determine the target image conversion mode based on the color attribute information;
[0117] The original software logo image is scaled and smoothed based on the target pixel size and the target image conversion mode to obtain the target software logo image.
[0118] In one embodiment, when the processor 110 performs the step of determining the color attribute information corresponding to the original software logo image, the processor 110 specifically performs the following operations:
[0119] Acquire color space data of the original software logo image, and determine color feature data corresponding to the original software logo image based on the color space data;
[0120] Generate color attribute information based on color space data and color feature data.
[0121] In one embodiment, when the processor 110 performs the step of determining the target image conversion mode based on the color attribute information, the processor 110 specifically performs the following operations:
[0122] The color attribute information is input into the pattern matching model, and the pattern matching model is used to perform image conversion pattern matching processing in a preset image conversion pattern set to obtain a target image conversion pattern.
[0123] In one embodiment, the processor 110 further performs the following operations:
[0124] Create an initial pattern matching model for icon conversion scenarios;
[0125] Obtain a sample software logo image of the sample customized software, determine sample color attribute information corresponding to the sample software logo image, determine a sample color grade classification corresponding to the sample software logo image based on the sample color attribute information, and annotate the sample color grade classification with a picture conversion mode label;
[0126] Inputting the sample color level classification into the initial pattern matching model for at least one round of model training to obtain a predicted image conversion pattern corresponding to the sample color level classification;
[0127] Based on the image conversion mode label and the predicted image conversion mode, a pattern loss function is used to determine the model loss value. Based on the model loss value, the model parameters of the initial pattern matching model are adjusted until the model training conditions are met to obtain a pattern matching model.
[0128] In one embodiment, when the processor 110 performs the step of scaling and smoothing the original software logo image based on the target pixel size and the target image conversion mode to obtain the target software logo image, the processor 110 specifically performs the following operations:
[0129] Get the original pixel size and original pixel data of the original software logo image;
[0130] Determine a target pixel position based on the target pixel size, perform pixel position mapping processing on the target pixel position based on the target pixel size and the original pixel size, and obtain a mapped pixel position corresponding to the target pixel position;
[0131] The target image conversion mode is used to perform pixel calculation on the original pixel data to obtain the target pixel data corresponding to the mapped pixel position;
[0132] The target pixel data is determined as the pixel data at the target pixel position, and a target software identification image composed of the pixel data at all target pixel positions is determined.
[0133] In one embodiment, when the processor 110 performs pixel calculation on the original pixel data using the target picture conversion mode to obtain the target pixel data corresponding to the mapped pixel position, the following operations are specifically performed:
[0134] Determining reference pixel data corresponding to the mapped pixel position from the original pixel data based on the target image conversion mode;
[0135] Pixel calculation is performed based on the reference pixel data to obtain target pixel data corresponding to the mapped pixel position.
[0136] In one embodiment, after performing scaling and smoothing processing on the original software logo image based on the target pixel size and the target image conversion mode to obtain the target software logo image, the processor 110 further performs the following operations:
[0137] The target software logo image is converted into a specified software logo image in a preset icon format, and the specified software logo image is loaded into the icon placement position.
[0138] An embodiment of the present application further provides a computer-readable storage medium, which stores at least one instruction, and the at least one instruction is used to be executed by a processor to implement the image processing method as described in the above embodiments.
[0139] An embodiment of the present application further provides a computer program product, which stores at least one instruction, and the at least one instruction is loaded and executed by the processor to implement the image processing method of each of the above embodiments.
[0140] Those skilled in the art should be aware that in one or more of the above examples, the functions described in the embodiments of the present application can be implemented with hardware, software, firmware, or any combination thereof. When implemented using software, these functions can be stored in a computer-readable medium or transmitted as one or more instructions or codes on a computer-readable medium. Computer-readable media include computer storage media and communication media, wherein the communication media include any media that facilitates the transmission of a computer program from one place to another. The storage medium can be any available medium that a general or special-purpose computer can access.
[0141] The above description is only an optional embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application shall be included in the protection scope of the present application.
Claims
1. A method for processing an image, characterized in that: The method comprises: Obtaining an original software logo image of the software to be customized, determining an icon placement position of the original software logo image in the software to be customized, and obtaining a target pixel size corresponding to the icon placement position; Determine color attribute information corresponding to the original software logo image, and determine a target image conversion mode based on the color attribute information; The original software logo image is scaled and smoothed based on the target pixel size and the target image conversion mode to obtain a target software logo image.
2. The method according to claim 1, characterized in that The determining of the color attribute information corresponding to the original software logo image includes: Acquire color space data of the original software logo image, and determine color feature data corresponding to the original software logo image based on the color space data; Color attribute information is generated based on the color space data and the color feature data.
3. The method according to claim 1, characterized in that The determining of the target image conversion mode based on the color attribute information includes: The color attribute information is input into a pattern matching model, and a picture conversion pattern matching process is performed in a preset picture conversion pattern set through the pattern matching model to obtain a target picture conversion pattern.
4. The method according to claim 3, characterized in that The method further comprises: Create an initial pattern matching model for icon conversion scenarios; Obtain a sample software logo image of the sample customized software, determine sample color attribute information corresponding to the sample software logo image, determine a sample color grade classification corresponding to the sample software logo image based on the sample color attribute information, and annotate the sample color grade classification with a picture conversion mode label; Inputting the sample color level classification into the initial pattern matching model for at least one round of model training to obtain a predicted image conversion mode corresponding to the sample color level classification; A model loss value is determined using a pattern loss function based on the image conversion mode label and the predicted image conversion mode, and model parameters of the initial pattern matching model are adjusted based on the model loss value until a model training condition is met to obtain a pattern matching model.
5. The method according to claim 1, characterized in that The step of performing scaling and smoothing processing on the original software logo image based on the target pixel size and the target image conversion mode to obtain the target software logo image includes: Obtaining the original pixel size and original pixel data of the original software logo image; Determine a target pixel position based on the target pixel size, and perform pixel position mapping processing on the target pixel position based on the target pixel size and the original pixel size to obtain a mapped pixel position corresponding to the target pixel position; Performing pixel calculation on the original pixel data using the target image conversion mode to obtain target pixel data corresponding to the mapped pixel position; The target pixel data is determined as the pixel data at the target pixel position, and a target software identification picture composed of the pixel data at all the target pixel positions is determined.
6. The method according to claim 5, characterized in that The adopting the target picture conversion mode to perform pixel calculation on the original pixel data to obtain target pixel data corresponding to the mapped pixel position includes: Determining reference pixel data corresponding to the mapped pixel position from the original pixel data based on the target picture conversion mode; Pixel calculation is performed based on the reference pixel data to obtain target pixel data corresponding to the mapped pixel position.
7. The method according to claim 1, characterized in that After the original software logo image is scaled and smoothed based on the target pixel size and the target image conversion mode to obtain the target software logo image, the method further includes: The target software logo image is converted into a designated software logo image in a preset icon format, and the designated software logo image is loaded into the icon placement position.
8. A picture processing device, characterized in that: The method comprises: The original image acquisition module is used to acquire the original software logo image of the software to be customized, determine the icon placement position of the original software logo image in the software to be customized, and acquire the target pixel size corresponding to the icon placement position; A conversion mode determination module, used to determine the color attribute information corresponding to the original software logo image, and determine the target image conversion mode based on the color attribute information; The image conversion processing module is used to perform scaling and smoothing processing on the original software logo image based on the target pixel size and the target image conversion mode to obtain a target software logo image.
9. A computer storage medium, characterized in that The computer storage medium stores a plurality of instructions, and the instructions are suitable for being loaded by a processor and executing the method according to any one of claims 1 to 7.
10. An electronic device, characterized in that: include: A processor and a memory; wherein the memory stores a computer program, and the computer program is suitable for being loaded by the processor and executing the method according to any one of claims 1 to 7.