Color modification method, image forming device, electronic device and storage medium

By converting the scanned image to the HSV color space and replacing the color of the mask area using processing algorithms, the problem of insufficient color erasing in the image forming device is solved, and precise erasing and natural fusion of multiple colors are achieved, improving the user experience.

CN120263918BActive Publication Date: 2025-08-22ZHUHAI PANTUM ELECTRONICS CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202510707802.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-05-28
Publication Date
2025-08-22
Estimated Expiration
2045-05-28

AI Technical Summary

Technical Problem

The number of colors preset by manufacturers in existing image forming devices is limited, which cannot meet the user's color erasing needs in various scenarios, resulting in the user being unable to erase the colors they want, affecting the user experience and wasting paper.

Method used

Convert the scanned image to the HSV color space, obtain the HSV data of the color to be erased, and replace the color of the mask area through comparison and processing algorithms, and use preset color filling and edge repair techniques to achieve accurate erasing of multiple colors.

Benefits of technology

The color erasing ability of the image forming device in various scenarios is improved, ensuring that the erasing effect is naturally integrated, reducing visual abruptness, and improving user experience and operation efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120263918B_ABST
    Figure CN120263918B_ABST
Patent Text Reader

Abstract

The present application provides a color modification method, an image forming device, an electronic device and a storage medium, the method comprising: converting the color of a scanned image to an HSV color space, obtaining a scanned image converted to an HSV color space; obtaining HSV data corresponding to the color to be erased, the color to be erased being the color that the user desires to erase; comparing the HSV data corresponding to the scanned image converted to the HSV color space with the HSV data corresponding to the color to be erased; replacing the color of the mask area with a preset color to obtain a processed image. The present application is intuitive in converting the color of a scanned image to an HSV color space, and any color can be selected as the object of color erasure. It can be applied to color erasure requirements in a variety of scenarios, thereby improving the practicality of the product and the user's experience. In addition, using a preset color to replace the color of the mask area can make the color of the mask area blend naturally with the surrounding colors, avoid the abruptness of the boundary of the mask area, and ensure the user's viewing experience.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of image processing technology, and in particular to a color modification method, an image forming device, an electronic device, and a storage medium. Background Art

[0002] An image forming device is a device that forms an image on an imaging medium through the imaging principle, such as a printer, a copier, a fax machine, a multifunctional image making and copying device, an electrostatic printing device and any other similar device. Some image forming devices with a copying function have a color erasing function.

[0003] In related technologies, image forming devices can perform color erasing on several colors preset by the manufacturer. When a user needs to erase a certain color in a copied document, he needs to check whether the color he wants to erase exists in the preset color categories. If so, he can select it directly. If not, he cannot erase it.

[0004] It is understandable that the number of colors preset by the manufacturer is limited and cannot meet the user's needs for erasing all colors in various scenarios. This may cause the user to be unable to erase the color they want to erase, resulting in the copied portrait not meeting the user's needs, which not only affects the user experience but also wastes paper.

[0005] It should be pointed out that the information disclosed in the background technology section of this application is only intended to deepen the understanding of the general background technology of this application, and should not be regarded as an admission or any form of implication that the information constitutes prior art already known to those skilled in the art. Summary of the Invention

[0006] In view of this, the present application provides a color modification method, an image forming device, an electronic device and a storage medium, so as to solve the problem in the prior art that the number of colors preset by manufacturers is limited and cannot meet the user's needs for erasing all colors in various scenarios. This may cause the user to be unable to erase the color he wants to erase, resulting in the copied portrait not meeting the user's needs, which not only affects the user experience but also wastes paper.

[0007] In a first aspect, an embodiment of the present application provides an image processing method, comprising:

[0008] Convert the color of the scanned image to the HSV color space, and obtain the scanned image converted to the HSV color space;

[0009] Obtaining HSV data corresponding to the color to be erased, where the color to be erased is the color that the user desires to erase;

[0010] Comparing the HSV data corresponding to the scanned image converted to the HSV color space with the HSV data corresponding to the color to be erased;

[0011] The color of the mask area is replaced with a preset color to obtain a processed image, and the HSV data corresponding to the color of the pixel points in the mask area is the HSV data corresponding to the color to be erased.

[0012] In this embodiment of the present application, the colors of the scanned image are converted to the HSV color space. Because the color distribution in the HSV color space is intuitive, the user can select almost any color as the object for color erasure. This makes the method provided by this embodiment of the present application applicable to color erasure needs in a variety of scenarios, improving the practicality of the product and the user experience. In addition, using a preset color to replace the color of the mask area can make the color of the mask area blend naturally with the surrounding colors as much as possible, avoiding the abrupt feeling of the mask area boundary and ensuring the user's visual experience.

[0013] In a possible implementation, the HSV data corresponding to the color to be erased includes:

[0014] The HSV data corresponding to the color to be erased within the preset error range.

[0015] In an embodiment of the present application, the HSV data corresponding to the color to be erased can be the HSV data corresponding to the color to be erased within a preset error range. The HSV data corresponding to the color to be erased within the preset error range is set as the mask area, and HSV data within a threshold is selected as the mask, rather than setting the accurate HSV data as the mask area. In fact, the mask area is within a reasonable range, which is conducive to subsequent erasing work and can erase the color that the user wants to erase more cleanly and thoroughly, meeting user expectations.

[0016] In a possible implementation, before comparing the HSV data corresponding to the scanned image converted to the HSV color space with the HSV data corresponding to the color to be erased, the method further includes:

[0017] Calculate hue and saturation gradients in HSV color space;

[0018] Applying a first processing algorithm to the region where the hue and saturation gradients are lower than a first gradient threshold, wherein the first processing algorithm is used to enhance edges;

[0019] Applying a second processing algorithm to the area where the hue and saturation gradients are higher than a second gradient threshold, wherein the second processing algorithm is used to reduce the sharpening intensity;

[0020] The first gradient threshold is smaller than the second gradient threshold.

[0021] In the embodiment of the present application, a first processing algorithm is used to enhance edges in areas with low hue and saturation gradients (blurred areas), while a second processing algorithm is used to reduce sharpening intensity in areas with high hue and saturation gradients (clear areas). This avoids excessive contrast between blurred and clear areas, which could cause visual abruptness and ensures a good user experience. Furthermore, blurring the clear areas in advance prevents noise from being retained in the clear areas until the step of comparing the HSV data corresponding to the scanned image with the HSV data corresponding to the color to be erased. This prevents noise from affecting the performance of color erasure, thereby improving the processing performance of color erasure.

[0022] In a possible implementation, before replacing the color of the mask area with a preset color to obtain a processed image, the method further includes:

[0023] A color histogram within a preset range around the mask area is calculated, and the color with the highest frequency of occurrence in the color histogram is set as the preset color.

[0024] In an embodiment of the present application, the preset color that needs to be filled in the mask area is accurately calculated through the color histogram around the mask area, so that the color filling is natural and the visual abruptness caused by the color filling is greatly reduced.

[0025] In a possible implementation, replacing the color of the mask area with a preset color to obtain a processed image includes:

[0026] A third processing algorithm is performed on the mask area, where the third processing algorithm is used to repair the edge of the mask area and fill the mask area with a preset color to obtain a processed image.

[0027] In the embodiment of the present application, the mask area is processed using a third processing algorithm to repair the edge of the filled area, thereby avoiding a break between the edge of the filled area and the original image area, thereby ensuring the user's viewing experience.

[0028] In one possible implementation, obtaining HSV data corresponding to the color to be erased includes:

[0029] Get the main color selected by the user on Hue;

[0030] The k adjacent colors corresponding to the main color are obtained by a fourth processing algorithm, and the main color and the k adjacent colors are used as colors to be erased. The fourth processing algorithm is used to automatically divide data into several groups.

[0031] In an embodiment of the present application, multiple similar colors can be erased at one time. Through the fourth processing algorithm, various colors in the image are accurately clustered, thereby achieving accurate erasure of adjacent colors without the user having to erase the colors multiple times, simplifying the user's operation and improving the user experience.

[0032] In a possible implementation, before obtaining k adjacent colors corresponding to the main color by the fourth processing algorithm and using the main color and the k adjacent colors as colors to be erased, the method further includes:

[0033] Determine whether the one-key erase adjacent color function is selected;

[0034] If selected, the fourth processing algorithm is executed to obtain k adjacent colors corresponding to the main color, and the main color and the k adjacent colors are used as colors to be erased;

[0035] If not selected, the main color is used as the color to be erased, and the step of obtaining k adjacent colors corresponding to the main color through the fourth processing algorithm and using the main color and the k adjacent colors as the colors to be erased is ignored.

[0036] In the embodiment of the present application, when the user selects a primary color, they can choose whether to enable the "one-click erase adjacent colors" function. If the user chooses to enable it, the primary color and adjacent colors are erased. If the user chooses not to enable it, only the primary color is erased. It can be understood that by setting an option, users can choose whether to enable this function according to their needs, so that the image processing results meet the user's expectations and enhance the user experience.

[0037] In a possible implementation, before converting the color of the scanned image into the HSV color space, the method further includes:

[0038] The scanned image is preprocessed, where the preprocessing is used to suppress high-frequency noise in the scanned image.

[0039] In an embodiment of the present application, before processing the scanned image, the scanned image is first preprocessed, that is, the scanned image is preprocessed, so as to suppress high-frequency noise while retaining the edge of the scanned image, thereby improving the accuracy of subsequent color recognition.

[0040] In a second aspect, an embodiment of the present application provides an image forming device, comprising:

[0041] A color conversion module is used to convert the color of the scanned image into the HSV color space and obtain the scanned image converted into the HSV color space;

[0042] A module for obtaining a color to be erased is used to obtain HSV data corresponding to the color to be erased, where the color to be erased is the color that the user desires to erase;

[0043] a comparison module, configured to compare the HSV data corresponding to the scanned image converted to the HSV color space with the HSV data corresponding to the color to be erased;

[0044] The color processing module is used to replace the color of the mask area with a preset color to obtain a processed image, and the HSV data corresponding to the color of the pixel points in the mask area is the HSV data corresponding to the color to be erased.

[0045] In a third aspect, an embodiment of the present application provides an electronic device, including:

[0046] processor;

[0047] Memory;

[0048] and a computer program, wherein the computer program is stored in the memory, and the computer program includes instructions, which, when executed by the processor, enable the electronic device to perform any one of the methods described in the first aspect.

[0049] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium includes a stored program, wherein when the program is running, the device where the computer-readable storage medium is located is controlled to execute any one of the methods described in the first aspect.

[0050] It is understood that the image forming apparatus provided in the second aspect, the electronic device provided in the third aspect, and the computer-readable storage medium provided in the fourth aspect are used to perform the methods provided in this application. Therefore, the beneficial effects achievable by these methods can be referenced to the beneficial effects of the corresponding methods and will not be further elaborated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0051] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the following is a brief introduction to the drawings required for use in the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.

[0052] Figure 1 A schematic diagram of an application scenario provided in an embodiment of the present application;

[0053] Figure 2 A schematic diagram of a color modification method provided in an embodiment of the present application;

[0054] Figure 3 A schematic diagram of HSV color space parameters provided in an embodiment of the present application;

[0055] Figure 4 A schematic diagram of cross-sectional data of an HSV color space provided in an embodiment of the present application;

[0056] Figure 5A schematic diagram of an interactive interface provided in an embodiment of the present application;

[0057] Figure 6 A schematic flow chart of another color modification method provided in an embodiment of the present application;

[0058] Figure 7 A schematic structural diagram of an image forming device provided in an embodiment of the present application;

[0059] Figure 8 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0060] In order to better understand the technical solution of the present application, the embodiments of the present application are described in detail below with reference to the accompanying drawings.

[0061] It should be clear that the embodiments described are only part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.

[0062] The terms used in the embodiments of the present application are for the purpose of describing specific embodiments only and are not intended to limit the present application. The singular forms "a", "an", "the" and "the" used in the embodiments of the present application and the appended claims are also intended to include plural forms unless the context clearly indicates otherwise.

[0063] It should be understood that the term "and / or" as used herein simply describes a relationship between associated objects, indicating that three possible relationships exist. For example, "A and / or B" can represent: A alone, A and B together, or B alone. Furthermore, the character " / " in this document generally indicates an "or" relationship between the associated objects.

[0064] To facilitate understanding, a specific application scenario is first exemplified below.

[0065] See also Figure 1 , is a schematic diagram of an application scenario provided by an embodiment of the present application. Figure 1 As shown in FIG. 1 , this application scenario shows a partial structure of an image forming device, specifically including a scanning area 101, a display area 102, and a control panel 103. When a user needs to copy a document, they place the document on the scanning area 101, set some copy parameters on the display area 102, and start the copy job on the control panel 103. The contents of the document to be copied can then be displayed on a recording medium.

[0066] It should be pointed out that Figure 1The image forming device shown in the figure is only an exemplary description and should not be used as a limitation to the scope of protection of this application. The image forming device can be any device with a copying function. Figure 1 The scanning area 101, display area 102 and control panel 103 shown in the figure are only exemplary descriptions and should not be regarded as limiting the scope of protection of this application.

[0067] Some image forming devices with copying capabilities have a color modification function. In related art, image forming devices can perform color erasure on several colors preset by the manufacturer. When a user needs to erase a color from a copy, they need to check whether the desired color exists in the preset color categories. If so, they can select the color directly; otherwise, the color cannot be erased.

[0068] It is understandable that the number of colors preset by the manufacturer is limited and cannot meet the user's needs for erasing all colors in various scenarios. This may cause the user to be unable to erase the color they want to erase, resulting in the copied portrait not meeting the user's needs, which not only affects the user experience but also wastes paper.

[0069] In response to the above problems, an embodiment of the present application provides a color modification method that converts the color of the scanned image into the HSV color space. Because the color distribution in the HSV color space is intuitive, the user can almost select any color as the object of color erasure, so that the method provided by the embodiment of the present application can be applied to color erasure needs in a variety of scenarios, improving the practicality of the product and the user experience. In addition, using a preset color to replace the color of the mask area can make the color of the mask area blend naturally with the surrounding colors as much as possible, avoid the abruptness of the boundary of the mask area, and ensure the user's viewing experience. Detailed description is given below in conjunction with the accompanying drawings and specific embodiments.

[0070] See also Figure 2 , is a flow chart of a color modification method provided in an embodiment of the present application. Figure 2 As shown, it mainly includes the following steps.

[0071] Step S201: Convert the color of the scanned image into the HSV color space, and obtain the scanned image converted into the HSV color space.

[0072] Specifically, when the user turns on the copy function, the image forming device scans the document to be copied to obtain a scanned image, but the scanned image is in the RGB color space. The RGB color space is based on the three basic colors of red (Red, R), green (Green, G), and blue (Blue, B), and performs different degrees of superposition to produce other colors. It can be understood that the RGB color space uses a combination of linear components of three colors to represent the characteristics of color, so the RGB color space is not intuitive in application scenarios where colors are continuously changed. Therefore, in order to more accurately identify colors and adjust these colors, the image forming device in the embodiment of the present application converts the color of the scanned image into the HSV color space and obtains a scanned image converted to the HSV color space. Among them, the HSV color space refers to a subset of visible light in the three-dimensional color space of hue (Hue, H), saturation (Saturation, S), and value (Value, V), which contains all colors in a certain color domain.

[0073] For ease of understanding, an embodiment of the present application provides a parameter diagram of the HSV color space.

[0074] See also Figure 3 , is a parameter diagram of an HSV color space provided in an embodiment of the present application. Figure 3 As shown, Hue is the color of different positions on the top view of the cylinder in the figure, and different positions have different color tones; Saturation represents the purity of the color. When viewed from above, the same radius corresponds to the same color tone, and along the radius from the inside to the outside is the transition from pure white to pure color. The saturation at the center of the circle is 0, and the saturation on the arc is 100; Value is also called brightness. When viewed from the side, the same height line corresponds to the same color tone, and the brightness increases from bottom to top along the height line.

[0075] For ease of understanding, an embodiment of the present application provides a schematic diagram of cross-sectional data of an HSV color space.

[0076] See also Figure 4 , is a schematic diagram of cross-sectional data of an HSV color space provided in an embodiment of the present application. Figure 4 As shown, the hue adjustment area 401 includes hues corresponding to different colors, and the saturation and brightness adjustment area 402 includes saturations and brightnesses corresponding to different colors. Figure 4 The left side of the image shows a preview of the hue, saturation, and brightness of different colors, while the right side shows the corresponding RGB and HSV data for each color. The image forming device can convert the RGB data corresponding to each color into the corresponding HSV data to facilitate subsequent color erasure.

[0077] In one possible implementation, the scanned image is preprocessed before being converted to the HSV color space. The preprocessing is used to suppress high-frequency noise in the scanned image. It is understood that preprocessing the scanned image before processing it can suppress high-frequency noise while preserving the edges of the scanned image, thereby improving the accuracy of subsequent color recognition.

[0078] In one possible implementation, preprocessing includes Gaussian filtering. Those skilled in the art will understand that performing Gaussian filtering on the scanned image before processing it can suppress high-frequency noise while retaining the edges of the scanned image, thereby improving the accuracy of subsequent color recognition.

[0079] In actual applications, the hue and saturation of different areas of the same scanned image may differ, with some areas being clearer and others being more blurred. To address this issue, the embodiment of the present application converts the color of the scanned image to the HSV color space, and then calculates the hue and saturation gradients in the HSV color space before comparing the HSV data corresponding to the scanned image converted to the HSV color space with the HSV data corresponding to the color to be erased; a first processing algorithm is used for areas where the hue and saturation gradients are lower than a first gradient threshold; and a second processing algorithm is used for areas where the hue and saturation gradients are higher than a second gradient threshold; wherein the first gradient threshold is lower than the second gradient threshold.

[0080] In one possible implementation, the first processing algorithm is a Laplace operator. The Laplace operator is an important tool in image processing for detecting second-order changes in regions. It is particularly adept at detecting regional features such as edges and spots in images. It describes the acceleration of pixel intensity changes in the spatial domain based on the second-order derivative of the image. It should be noted that the first processing algorithm may also be other algorithms for enhancing edges, and this application does not impose specific limitations on this.

[0081] In one possible implementation, the second processing algorithm is fuzzy filtering. The core idea of ​​fuzzy filtering is the averaging or weighted averaging of local pixels. It should be noted that the second processing algorithm can also be other algorithms that reduce the sharpening intensity, and this application does not impose specific restrictions on this.

[0082] In one possible implementation, blur filtering includes Gaussian blur, median blur, and bilateral filtering. It should be noted that blur filtering may also be other algorithms for reducing sharpening intensity, and this application does not impose any specific restrictions on this.

[0083] It can be understood that the first processing algorithm is used to enhance the edge of the area with lower hue and saturation gradient (blurred area), and the fuzzy filter is used to reduce the sharpening intensity for the area with higher hue and saturation gradient (clear area), so that after the color to be erased is erased later, the abruptness of the transition area can be avoided, so that the transition part between the area of ​​erased color and the area of ​​non-erased color is more natural, which improves the quality of the image after erasing the color to be erased and ensures the user's viewing experience. In addition, if the fuzzy filter is not used to reduce the sharpening intensity for the area with higher hue and saturation gradient (clear area) before comparing the HSV data corresponding to the scanned image converted to the HSV color space with the HSV data corresponding to the color to be erased, the noise in the scanned image will also be counted in the mask area, that is, these noises need to be considered when erasing the color later, but the more areas are counted, the more pixels need to be processed, which will lead to the algorithm The time becomes longer and the performance decreases. Therefore, the embodiment of the present application uses the first processing algorithm to enhance the edges of the areas with lower hue and saturation gradients (blurred areas) before comparing the HSV data corresponding to the scanned image converted to the HSV color space with the HSV data corresponding to the color to be erased, and uses a fuzzy filter to reduce the sharpening intensity for the areas with higher hue and saturation gradients (clear areas), and blurs the clear areas in advance to avoid leaving the noise in the clear areas until the step of comparing the HSV data corresponding to the scanned image with the HSV data corresponding to the color to be erased, thereby avoiding the noise affecting the performance of erasing colors, thereby improving the processing performance of erasing colors. It should be noted that in the embodiment of the present application, using the first processing algorithm to enhance the edges of the areas with lower hue and saturation gradients (blurred areas) generally does not increase noise, so using the first processing algorithm to enhance the edges of the fuzzy areas will not affect the performance of subsequent processing.

[0084] Step S202: Obtain HSV data corresponding to the color to be erased.

[0085] Specifically, the image forming device outputs an interactive interface through the display area, and the user can select the color he or she wants to erase on the interactive interface, so that the image forming device can obtain the HSV data corresponding to the color to be erased.

[0086] To facilitate understanding, an embodiment of the present application provides a schematic diagram of an interactive interface.

[0087] See also Figure 5 , is a schematic diagram of an interactive interface provided in an embodiment of the present application. Figure 5 As shown, the user can select the hue of the primary color on the hue wheel 501 and select the saturation and brightness of the primary color in the corresponding saturation and brightness selection area 502. The interactive interface also includes a data adjustment area 503, in which the user can also select corresponding hue, saturation, and brightness values.

[0088] In practical applications, Figure 5 The primary color is the color to be erased, so the user can only erase one color at a time. If the user wants to erase multiple similar colors, multiple erasing operations are required, which is cumbersome and does not meet the user's needs, resulting in a poor user experience. To address this problem, in an embodiment of the present application, the primary color selected by the user on the color wheel and the k adjacent colors corresponding to that color can be directly erased.

[0089] Specifically, the image forming device obtains the main color selected by the user on the color wheel, obtains k adjacent colors corresponding to the main color through the fourth processing algorithm, and uses the main color and the k adjacent colors as the colors to be erased, wherein the fourth processing algorithm is used to automatically divide the data into several groups.

[0090] In one possible implementation, the fourth processing algorithm is a clustering algorithm, which generally refers to all unsupervised grouping methods, and the goal is to divide natural clusters by data similarity.

[0091] In one possible implementation, the clustering algorithm is the k-means clustering algorithm (KMA), an iterative cluster analysis algorithm. Its steps involve partitioning the data into K groups, randomly selecting K objects as initial cluster centers, then calculating the distance between each object and each cluster center and assigning each object to the cluster center closest to it. The cluster centers and the objects assigned to them represent a cluster. With each assignment of a sample, the cluster center is recalculated based on the existing objects in the cluster. This process repeats until a termination criterion is met. These termination criteria can include no (or a minimum number of) objects being reassigned to different clusters, no (or a minimum number of) cluster centers changing, and a local minimum sum of squared errors. The number of adjacent colors, k, can be pre-set by the developer, and the number of adjacent colors can be adjusted as needed to meet user requirements.

[0092] For example, if the main color selected by the user is red and two adjacent colors, the image forming device can extract the hue, saturation and brightness values ​​of the three colors, red, dark red and bright red, as the hue, saturation and brightness values ​​of the color to be erased, and use the hue, saturation and brightness values ​​of the color to be erased as the threshold for the next image segmentation.

[0093] In order to confirm whether the adjacent colors have been erased, after the image forming device erases the main color and the adjacent colors, the user or developer can use professional image processing tools (such as photoshop) to analyze and compare the color histogram of the erased area. If the peak values ​​of the main color and the adjacent colors are significantly reduced, it means that the main color and the adjacent colors have been successfully erased. It should be pointed out that in the color histogram, the more a certain color there is, the higher the histogram corresponding to that color. The histogram area that visually looks like a mountain peak is called a peak. Before erasing the color, the main colors of the erased area are the main color and the adjacent colors, so in the color histogram corresponding to the erased area, the histogram corresponding to the main color and the adjacent colors is the peak. If the erasure is successful, the main color and the adjacent colors should be greatly reduced in the erased area, so the histogram (peak) corresponding to the main color and the adjacent colors in the color histogram should also be significantly reduced.

[0094] Of course, to ensure a user experience, the user can choose whether to enable the one-key erase adjacent color function. Specifically, the image forming device determines whether the one-key erase adjacent color function is selected; if selected, the image forming device executes the step of obtaining k adjacent colors corresponding to the main color through the fourth processing algorithm, and using the main color and the k adjacent colors as the colors to be erased; if not selected, the main color is used as the color to be erased, and the step of obtaining k adjacent colors corresponding to the main color through the fourth processing algorithm and using the main color and the k adjacent colors as the colors to be erased is ignored.

[0095] It is understandable that by setting an option, users can choose whether to turn on the function according to their needs, so that the image processing results meet user expectations and improve user experience.

[0096] Step S203: Compare the HSV data corresponding to the scanned image converted into the HSV color space with the HSV data corresponding to the color to be erased.

[0097] Specifically, the HSV data corresponding to the scanned image converted into the HSV color space is compared with the HSV data corresponding to the color to be erased by an image forming apparatus or other terminal device, so as to obtain a mask area and facilitate the execution of subsequent steps.

[0098] Step S204: replacing the color of the mask area with a preset color to obtain a processed image.

[0099] Specifically, the color of the masked area is replaced with a preset color to obtain a processed image, wherein the HSV data corresponding to the color of the pixels within the masked area is the HSV data corresponding to the color to be erased. Because the image forming device obtains the color to be erased, the HSV data corresponding to the color of each pixel is compared with the HSV data corresponding to the color to be erased, and the pixels with the same HSV data corresponding to the color to be erased are marked. The area consisting of the marked pixels is the masked area.

[0100] In one possible implementation, the HSV data corresponding to the color to be erased includes the HSV data corresponding to the color to be erased within a preset error range. Specifically, the pixel points whose difference is within the preset error range are marked, and the area composed of the marked pixel points is the mask area. For example, if the HSV value of the color to be erased set or selected by the user is: H: 60°, S: 70%, V: 60% (the meanings of H, S, and V have been explained above and will not be repeated below), and the preset error range set by the user is: the error of H is less than or equal to 1°, the error of S is less than or equal to 2%, and the error of V is less than or equal to 2%, then the HSV data finally set as the mask area is: the HSV data with H of 59° - 61°, S of 68% - 72%, and V of 58%-62% is set as the mask area. Those skilled in the art will understand that H of 60° and H of 59° are easily classified as the same color under naked eye observation. If only the data with H of 60° is erased and the data with H of 59° is not erased, the user may actually feel that the erasure is not clean, which affects the user experience. The embodiment of the present application allows the user to customize the preset error range, so that the HSV data defined as the mask area is the one that the user actually needs to erase. In fact, the mask area is within a reasonable range, which is beneficial for subsequent erasure work and can erase the color that the user wants to erase more cleanly and thoroughly, meeting the user's expectations.

[0101] Among them, the preset error range is a preset range. Those skilled in the art can set the preset error range to any value according to actual needs, and the embodiments of the present application do not impose specific limitations on this.

[0102] In one possible implementation, the preset color is calculated by the image forming device based on the colors surrounding the mask area. Specifically, a color histogram within a preset range around the mask area is calculated, and the color that appears most frequently in the color histogram is set as the preset color. The preset range around the mask area is a 5x5 pixel range around the mask area. Of course, this preset range is merely an example, and those skilled in the art may set the preset range to any range based on actual needs. This is not specifically limited in this embodiment of the present application.

[0103] When the color of the mask area is replaced with the preset color, the mask area is processed using the third processing algorithm, and the mask area is filled with the preset color.

[0104] In one possible implementation, the third processing algorithm is a morphological closing operation, wherein the morphological closing operation is a process in which the image is sequentially dilated and eroded, the purpose of which is to connect the broken edges after the color is erased, thereby ensuring the user's viewing experience.

[0105] Finally, a processed image is obtained and output to an image forming device so that the image forming device performs image formation.

[0106] Corresponding to the above embodiment, the embodiment of the present application also provides another color modification method.

[0107] See also Figure 6 , is a flow chart of another color modification method provided in an embodiment of the present application. Figure 6 As shown, it mainly includes the following steps.

[0108] Step S601: receiving a color erasing instruction and a scanned image input by a user.

[0109] Step S602: Obtain the main color selected by the user.

[0110] Step S603: Image preprocessing.

[0111] Specifically, image preprocessing is the step of preprocessing the scanned image as mentioned above.

[0112] Step S604: Determine whether the user selects the one-key erase adjacent color function.

[0113] Specifically, if yes, execute step S605; if no, execute step S606.

[0114] Step S605: Calculate adjacent colors using the fourth processing algorithm, and use the main color and the adjacent colors as colors to be erased.

[0115] Step S606: Use the main color as the color to be erased.

[0116] Step S607: image post-processing.

[0117] Specifically, image post-processing includes erasing the mask portion and performing edge compensation and adjacent color filling, wherein edge compensation is to perform a third processing algorithm on the mask portion, and the adjacent color is the color that appears most frequently in the color histogram within a preset range around the mask area.

[0118] Step S608: Output the processed image.

[0119] For details of the embodiments of this application, please refer to the above Figure 2 For the sake of brevity, the description in the illustrated embodiment will not be repeated here.

[0120] In one possible implementation, the embodiment shown in steps S201 to S204 or the embodiment shown in steps S601 to S608 can be performed by an image forming apparatus or by another terminal device that is communicatively connected to the image forming apparatus. Specifically, if steps S201 to S204 or steps S601 to S608 are performed by a terminal device, then before step S201 or step S601, the process further includes: the terminal device receiving a scanned original image sent by the image forming apparatus; after the terminal device completes steps S201 to S204 or steps S601 to S608, the terminal device transmits the processed image to the image forming apparatus, and the image forming apparatus then performs an image forming operation based on the received processed image.

[0121] The terminal device may be a mobile phone, a tablet computer, a portable personal computer (PC), etc., and this application does not impose any specific restrictions on this.

[0122] Corresponding to the above embodiments, the present application also provides an image forming device.

[0123] See also Figure 7 , is a schematic diagram of the structure of an image forming device provided in an embodiment of the present application. Figure 7 As shown, the image forming apparatus may include: a color conversion module 701, a to-be-erased color acquisition module 702, a comparison module 703, and a color processing module 704. These components communicate via one or more buses. Those skilled in the art will appreciate that the structure of the electronic device shown in the figure does not limit the embodiments of the present application. It may be a bus structure or a star structure, and may include more or fewer components than shown, or combine certain components, or arrange the components differently.

[0124] The color conversion module 701 is used to convert the color of the scanned image into the HSV color space, and obtain the scanned image converted into the HSV color space;

[0125] The to-be-erased color acquisition module 702 is configured to acquire HSV data corresponding to the to-be-erased color, where the to-be-erased color is the color that the user desires to erase.

[0126] A comparison module 703 is configured to compare the HSV data corresponding to the scanned image converted to the HSV color space with the HSV data corresponding to the color to be erased;

[0127] The color processing module 704 is used to replace the color of the mask area with a preset color to obtain a processed image, and the HSV data corresponding to the color of the pixel points in the mask area is the HSV data corresponding to the color to be erased.

[0128] Corresponding to the above embodiments, the present application also provides an electronic device.

[0129] See also Figure 8 , is a structural diagram of an electronic device provided in an embodiment of the present application. Figure 8 As shown, the electronic device 800 may include: a processor 801, a memory 802, and a communication unit 803. These components communicate via one or more buses. Those skilled in the art will appreciate that the structure of the electronic device shown in the figure does not limit the embodiments of the present application. It may be a bus structure or a star structure, and may include more or fewer components than shown, or combine certain components, or arrange the components differently.

[0130] The communication unit 803 is configured to establish a communication channel so that the electronic device can communicate with other devices and receive user data sent by other devices or send user data to other devices.

[0131] The processor 801 is the control center of the electronic device. It uses various interfaces and lines to connect various parts of the entire electronic device. It runs or executes software programs, instructions, and / or modules stored in the memory 802, and calls data stored in the memory to perform various functions of the electronic device and / or process data. The processor can be composed of an integrated circuit (IC), for example, it can be composed of a single packaged IC, or it can be composed of multiple packaged ICs with the same or different functions. For example, the processor 801 can only include a central processing unit (CPU). In the embodiment of the present application, the CPU can be a single computing core or multiple computing cores.

[0132] The memory 802 is used to store execution instructions of the processor 801. The memory 802 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk.

[0133] When the execution instructions in the memory 802 are executed by the processor 801, the electronic device 800 can execute Figure 2 Some or all of the steps in the illustrated embodiments.

[0134] In a specific implementation, embodiments of the present application further provide a computer storage medium, wherein the computer storage medium may store a program that, when executed, may include some or all of the steps of each embodiment of the simulation scenario generation method provided in embodiments of the present application. The storage medium may be a magnetic disk, an optical disk, a read-only memory (ROM), or a random access memory (RAM).

[0135] In a specific implementation, an embodiment of the present application also provides a computer program product, wherein the computer program product includes executable instructions, which, when executed on a computer, enable the computer to execute some or all of the steps in each embodiment of the simulation scenario generation method provided in the embodiment of the present application.

[0136] In the embodiments of the present application, "at least one" refers to one or more, and "more" refers to two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent the existence of A alone, the existence of A and B at the same time, and the existence of B alone. Among them, A and B can be singular or plural. The character " / " generally indicates that the previous and next associated objects are in an "or" relationship. "At least one of the following" and similar expressions refer to any combination of these items, including any combination of single or plural items. For example, at least one of a, b and c can be represented by: a, b, c, ab, ac, bc, or abc, where a, b, c can be single or multiple.

[0137] Those skilled in the art will appreciate that the various units and algorithm steps described in the embodiments disclosed herein can be implemented using a combination of electronic hardware, computer software, and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0138] Those skilled in the art will clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0139] In the several embodiments provided in this application, if any function is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, or the part that contributes to the existing technology, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the method described in each embodiment of this application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk, and other media that can store program code.

[0140] In this specification, reference can be made to the same or similar parts between the various embodiments. In particular, for the device embodiment and the terminal embodiment, since they are basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the description in the method embodiment.

Claims

1. A color modification method, characterized in that: include: When the copy function is turned on, the image forming device outputs an interactive interface through the display area, the image forming device obtains a desired color to be erased selected by the user in the HSV color space through the interactive interface, converts the color of the scanned image into the HSV color space, and obtains the scanned image converted into the HSV color space; Obtaining HSV data corresponding to the color to be erased, where the color to be erased is the color that the user desires to erase; Comparing the HSV data corresponding to the scanned image converted to the HSV color space with the HSV data corresponding to the color to be erased; Replacing the color of the mask area with a preset color to obtain a processed image, wherein the image forming device performs an image forming operation on the processed image, and the HSV data corresponding to the color of the pixel points in the mask area is the HSV data corresponding to the color to be erased; Before comparing the HSV data corresponding to the scanned image converted into the HSV color space with the HSV data corresponding to the color to be erased, the method further includes: Calculating the hue and saturation gradients of the scanned image in the HSV color space; Applying a first processing algorithm to the region where the hue and saturation gradients are lower than a first gradient threshold, wherein the first processing algorithm is used to enhance edges; Applying a second processing algorithm to the area where the hue and saturation gradients are higher than a second gradient threshold, wherein the second processing algorithm is used to reduce the sharpening intensity; The first gradient threshold is smaller than the second gradient threshold, the first processing algorithm is a Laplace operator, and the second processing algorithm is a fuzzy filter.

2. The method according to claim 1, characterized in that The HSV data corresponding to the color to be erased includes: The HSV data corresponding to the color to be erased within the preset error range.

3. The method according to claim 2, characterized in that Before replacing the color of the mask area with a preset color to obtain a processed image, the method further includes: A color histogram within a preset range around the mask area is calculated, and the color with the highest frequency of occurrence in the color histogram is set as the preset color.

4. The method according to claim 2, characterized in that The step of replacing the color of the mask area with a preset color to obtain a processed image includes: A third processing algorithm is performed on the mask area, where the third processing algorithm is used to repair the edge of the mask area and fill the mask area with a preset color to obtain a processed image.

5. The method according to claim 2, characterized in that The obtaining of HSV data corresponding to the color to be erased includes: Get the main color selected by the user on Hue; The k adjacent colors corresponding to the main color are obtained by a fourth processing algorithm, and the main color and the k adjacent colors are used as colors to be erased. The fourth processing algorithm is used to automatically divide data into several groups.

6. The method according to claim 5, characterized in that Before obtaining k adjacent colors corresponding to the main color by the fourth processing algorithm and using the main color and the k adjacent colors as colors to be erased, the method further includes: Determine whether the one-key erase adjacent color function is selected; If selected, the fourth processing algorithm is executed to obtain k adjacent colors corresponding to the main color, and the main color and the k adjacent colors are used as colors to be erased; If not selected, the main color is used as the color to be erased, and the step of obtaining k adjacent colors corresponding to the main color through the fourth processing algorithm and using the main color and the k adjacent colors as the colors to be erased is ignored.

7. The method according to claim 2, characterized in that Before converting the color of the scanned image into the HSV color space, the method further includes: The scanned image is preprocessed, where the preprocessing is used to suppress high-frequency noise in the scanned image.

8. An image forming apparatus, characterized in that: include: a color conversion module configured to, when the copy function is activated, cause the image forming device to output an interactive interface through the display area, obtain a desired color to be erased selected by the user in the HSV color space through the interactive interface, convert the color of the scanned image into the HSV color space, and obtain the scanned image converted into the HSV color space; A module for obtaining a color to be erased is used to obtain HSV data corresponding to the color to be erased, where the color to be erased is the color that the user desires to erase; a comparison module, configured to compare the HSV data corresponding to the scanned image converted to the HSV color space with the HSV data corresponding to the color to be erased; A color processing module is configured to replace the color of the mask area with a preset color to obtain a processed image, wherein the image forming device performs an image forming operation on the processed image, and the HSV data corresponding to the color of the pixel points in the mask area is the HSV data corresponding to the color to be erased; A hue and saturation processing module is configured to calculate the hue and saturation gradients of the scanned image in the HSV color space before comparing the HSV data corresponding to the scanned image converted to the HSV color space with the HSV data corresponding to the color to be erased; apply a first processing algorithm to areas where the hue and saturation gradients are lower than a first gradient threshold, the first processing algorithm being used to enhance edges; and apply a second processing algorithm to areas where the hue and saturation gradients are higher than a second gradient threshold, the second processing algorithm being used to reduce sharpening intensity; wherein the first gradient threshold is lower than the second gradient threshold, the first processing algorithm is a Laplacian operator, and the second processing algorithm is a fuzzy filter.

9. An electronic device, characterized in that: include: processor; Memory; and a computer program, wherein the computer program is stored in the memory, and the computer program includes instructions, which, when executed by the processor, enable the electronic device to perform the method according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that The computer-readable storage medium includes a stored program, wherein when the program is executed, the device where the computer-readable storage medium is located is controlled to execute the method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Color replacement method base on HSV space

    CN101764913A