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

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

CN120263918AActive Publication Date: 2025-07-04ZHUHAI PANTUM ELECTRONICS CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202510707802.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-05-28
Publication Date
2025-07-04
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 compare the data with the preset color space, replace the color of the mask area with the preset color, realize accurate erasing of any color, and improve the user experience through algorithm processing.

Benefits of technology

The color erasing needs in various scenarios are realized, which improves the practicality of the product and user experience, avoids the abrupt feeling of the mask area, and ensures the natural integration of user perception.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120263918A_ABST
    Figure CN120263918A_ABST
Patent Text Reader

Abstract

The invention provides a color modification method, an image forming device, electronic equipment and a storage medium, and the method comprises the steps: converting the color of a scanned image to an HSV color space, and obtaining the scanned image converted to the HSV color space; acquiring HSV data corresponding to a to-be-erased color, wherein the to-be-erased color is a color expected to be erased by a user; 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 replacing the color of the mask area with a preset color to obtain a processed image. According to the method and the device, the color of the scanned image is converted into the HSV color space intuitively, any color can be selected as a color erasing object, the method and the device can be suitable for color erasing requirements in various scenes, and the practicability of a product and the experience feeling of a user are improved. Besides, the preset color is used for replacing the color of the mask area, so that the color of the mask area can be naturally fused with the surrounding color, the abrupt feeling of the boundary of the mask area is avoided, and the user impression is ensured.
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 technologies, and particularly to a color modification method, an image forming apparatus, an electronic device, and a storage medium. Background Art

[0002] An image forming apparatus is a device that forms an image on an imaging medium through an imaging principle, such as a printer, a copier, a fax machine, a multifunctional image production and copying device, an electrophotographic device, and any other similar devices. Some image forming apparatuses with a copying function have a function of erasing colors.

[0003] In the related art, an image forming apparatus can erase several colors preset by a manufacturer. When a user needs to erase a certain color in a copied document, it is necessary to check whether the desired erased color exists in the preset color types. If it exists, it can be directly selected; if not, it cannot be erased.

[0004] It can be understood that the number of colors preset by the manufacturer is limited and cannot meet the user's erasing requirements for 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 image not meeting the user's requirements, which not only affects the user experience but also wastes paper.

[0005] It should be noted that the information disclosed in the background art part of the present application is only intended to deepen the understanding of the general background art of the present application, and should not be regarded as an admission or any form of implication that this information constitutes the prior art 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 apparatus, an electronic device, and a storage medium, which are conducive to solving the problem in the prior art that the number of colors preset by the manufacturer is limited and cannot meet the user's erasing requirements for 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 image not meeting the user's requirements, 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, including: Converting the color of a scanned image to the HSV color space to obtain the scanned image converted to the HSV color space; Obtaining the HSV data corresponding to the color to be erased, where the color to be erased is the color that the user expects 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; Replace the color of the mask area with a preset color to obtain a processed image, where 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.

[0008] In the embodiment of the present application, the color of the scanned image is converted to the HSV color space. Because the color distribution in the HSV color space is intuitive, users can almost select any color as the object of color erasure. Therefore, the method provided in the embodiment of the present application can meet the color erasure requirements in multiple 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 abruptness at the boundary of the mask area and ensuring the user's visual experience.

[0009] In a possible implementation manner, 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.

[0010] In the 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. Setting the HSV data corresponding to the color to be erased within the preset error range as the mask area and setting the HSV data within a selected threshold as the mask, rather than setting the exact HSV data as the mask area, actually makes the area of the mask within a reasonable range, which is beneficial to subsequent erasure work and can erase the color that the user expects to erase more cleanly and thoroughly, meeting the user's expectations.

[0011] In a possible implementation manner, 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, it further includes: Calculate the hue and saturation gradients in the HSV color space; Use a first processing algorithm for the area where the hue and saturation gradients are lower than the first gradient threshold, and the first processing algorithm is used to enhance the edge; Use a second processing algorithm for the area where the hue and saturation gradients are higher than the second gradient threshold, and the second processing algorithm is used to reduce the sharpening intensity; Wherein, the first gradient threshold is less than the second gradient threshold.

[0012] In the embodiments of the present application, for regions with lower hue and saturation gradients (blurred regions), a first processing algorithm is used to enhance the edges, and for regions with higher hue and saturation gradients (clear regions), a second processing algorithm is used to reduce the sharpening intensity, thereby avoiding excessive contrast between the blurred regions and the clear regions, causing visual abruptness and ensuring the user's viewing experience. Moreover, the clear regions are blurred in advance to avoid leaving the noise points in the clear regions in the step of comparing the HSV data of the scanned image corresponding to the masked region with the HSV data corresponding to the color to be erased, and to avoid the influence of the noise points on the performance of erasing the color, thereby improving the processing performance of erasing the color.

[0013] In a possible implementation manner, before replacing the color of the masked region with a preset color to obtain a processed image, it further includes: Calculating the color histogram within a preset range around the masked region, and setting the color with the highest occurrence frequency in the color histogram as the preset color.

[0014] In the embodiments of the present application, through the color histogram around the masked region, the preset color to be filled in the masked region is accurately calculated, making the color filling natural and greatly reducing the visual abruptness caused after the color filling.

[0015] In a possible implementation manner, the replacing the color of the masked region with a preset color to obtain a processed image includes: Performing a third processing algorithm on the masked region, where the third processing algorithm is used to repair the edges of the masked region and fill the masked region with a preset color to obtain a processed image.

[0016] In the embodiments of the present application, by using the third processing algorithm to process the masked region, the edges of the filled region are repaired, avoiding the breakage of the edges between the filled region and the original image region, and ensuring the user's viewing experience.

[0017] In a possible implementation manner, the obtaining the HSV data corresponding to the color to be erased includes: Obtaining the main color selected by the user on the hue; Through a fourth processing algorithm, obtaining k adjacent colors corresponding to the main color, and using the main color and the k adjacent colors as the color to be erased, where the fourth processing algorithm is used to automatically divide the data into several groups.

[0018] In the embodiments 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 realizing the accurate erasure of adjacent colors, without the need for the user to erase the color multiple times, simplifying the user's operation and enhancing the user experience.

[0019] In a possible implementation, before 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, the following steps are further included: Determine whether the one-key erase adjacent colors function is selected; If it is selected, execute 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 it is not selected, use the main color as the color to be erased and ignore the execution of 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.

[0020] In the embodiments of the present application, when the user selects the main color, the user can choose whether to enable the "one-key erase adjacent colors" function. If the user selects to enable it, the main color and the adjacent colors are erased. If the user selects not to enable it, only the main color selected by the user is erased. It can be understood that by setting an option, the user can choose whether to enable this function according to their own needs, so that the image processing result meets the user's expectations and improves the user experience.

[0021] In a possible implementation, before converting the color of the scanned image to the HSV color space, the following steps are further included: Preprocess the scanned image, and the preprocessing is used to suppress the high-frequency noise of the scanned image.

[0022] In the embodiments of the present application, before processing the scanned image, the scanned image is preprocessed first, that is, the scanned image is preprocessed, so as to suppress the high-frequency noise while retaining the edges of the scanned image and improve the accuracy of subsequent color recognition.

[0023] In a second aspect, the embodiments of the present application provide an image forming apparatus, including: A color conversion module, configured to convert the color of the scanned image to the HSV color space and obtain the scanned image converted to the HSV color space; A color-to-be-erased acquisition module, configured to acquire the HSV data corresponding to the color to be erased, where the color to be erased is the color that the user expects 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, configured to replace the color of the mask area with a preset color to obtain a processed image, where 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.

[0024] In a third aspect, an embodiment of the present application provides an electronic device, including: a processor; a memory; and a computer program, wherein the computer program is stored in the memory, and the computer program includes instructions that, when executed by the processor, cause the electronic device to execute the method according to any one of the first aspect.

[0025] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, which includes a stored program, wherein when the program runs, it controls the device where the computer-readable storage medium is located to execute the method according to any one of the first aspect.

[0026] It can be 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 execute the method provided by the present application. Therefore, the beneficial effects that can be achieved can refer to the beneficial effects in the corresponding method, and will not be elaborated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0027] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the present application. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.

[0028] Figure 1 A schematic diagram of an application scenario provided by an embodiment of the present application; Figure 2 A flowchart of a color modification method provided by an embodiment of the present application; Figure 3 A parameter schematic diagram of an HSV color space provided by an embodiment of the present application; Figure 4 A cross-sectional data schematic diagram of an HSV color space provided by an embodiment of the present application; Figure 5 A schematic diagram of an interaction interface provided by an embodiment of the present application; Figure 6 A flowchart of another color modification method provided by an embodiment of the present application; Figure 7 A structural schematic diagram of an image forming apparatus provided by an embodiment of the present application; Figure 8 A structural schematic diagram of an electronic device provided by an embodiment of the present application. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0029] For a better understanding of the technical solution of the present application, the embodiments of the present application will be described in detail below with reference to the accompanying drawings.

[0030] It should be clear that the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments in the present application without creative work belong to the scope of protection of the present application.

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

[0032] It should be understood that the term " / and" used herein is only a description of the association relationship of associated objects, indicating that there can be three relationships. For example, A / and B can mean: A exists alone, A and B exist simultaneously, and B exists alone. In addition, the character " / " herein generally means that the associated objects before and after are in an "or" relationship.

[0033] For ease of understanding, the following first gives an exemplary description of a specific application scenario.

[0034] See Figure 1 , which is a schematic diagram of an application scenario provided by an embodiment of the present application. As Figure 1 shown, in this application scenario, a partial structure of an image forming apparatus is shown, specifically including: a scanning area 101, a display area 102, and a control panel 103. When a user needs to copy a document, the document to be copied can be placed on the scanning area 101, and some copying parameters can be set through the display area 102, and the copying operation can be controlled to start in the control panel 103, so that the content of the document to be copied can be presented on a recording medium.

[0035] It should be noted that Figure 1 the image forming apparatus shown in Figure 1 is only an exemplary description, and should not be regarded as a limitation of the protection scope of the present application. The image forming apparatus can be any apparatus having a copying function. And the layout of each area of the image forming apparatus (that is,

[0036] An image forming apparatus with a copying function has a function of modifying colors. In the related art, the image forming apparatus can perform color erasure on several colors preset by the manufacturer. When the user needs to erase a certain color in a copied document, it is necessary to check whether the desired color to be erased exists in the preset color types. If it exists, it can be directly selected; if not, it cannot be erased.

[0037] It can be understood that the number of colors preset by the manufacturer is limited and cannot meet the user's demand 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 image not meeting the user's requirements, which not only affects the user experience but also wastes paper.

[0038] In view of the above problems, the embodiments of the present application provide a color modification method, which converts the color of a scanned image to the HSV color space. Since 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 embodiments of the present application can be applicable to the color erasure requirements in various 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 abruptness at the boundary of the mask area and ensuring the user's visual perception. Specifically, it will be described in detail below in combination with the drawings and specific embodiments.

[0039] See Figure 2 FIG. Figure 2 shown, which mainly includes the following steps.

[0040] Step S201: Convert the color of the scanned image to the HSV color space to obtain the scanned image converted to the HSV color space.

[0041] Specifically, when the user enables the copying function, the image forming apparatus scans the document to be copied to obtain a scanned image. However, the scanned image is in the RGB color space. The RGB color space is based on three primary colors, namely red (R), green (G), and blue (B), and different degrees of superposition are performed to produce other colors. It can be understood that the RGB color space represents the characteristics of colors using a linear combination of three colors. Therefore, in the application scenario of continuously changing colors, the RGB color space is not intuitive. Therefore, in order to more accurately identify colors and adjust these colors, in the embodiments of the present application, the image forming apparatus converts the color of the scanned image to the HSV color space to obtain a scanned image converted to the HSV color space. Among them, the HSV color space refers to a visible photon subset in the three-dimensional color space of hue (H), saturation (S), and value (V), and it contains all colors in a certain color domain.

[0042] For ease of understanding, the embodiments of the present application provide a parameter schematic diagram of the HSV color space.

[0043] See Figure 3 , which is a parameter schematic diagram of the HSV color space provided by the embodiments of the present application. As Figure 3 shown, the hue is the color at different positions on the top view of the cylinder in the figure, and different positions have different color tones; the saturation represents the purity of the color. When observing in the top view direction of the cylinder, the same radius corresponds to the same color tone, and from the inside to the outside along the radius direction is the transition from pure white to pure color. The saturation corresponding to the center of the circle is 0, and the saturation corresponding to the arc is 100; the value, also called brightness, when observing in the side view direction of the cylinder, the same height line corresponds to the same color tone, and the value increases from bottom to top along the height line direction.

[0044] For ease of understanding, the embodiments of the present application provide a cross-sectional data schematic diagram of the HSV color space.

[0045] See Figure 4 , which is a cross-sectional data schematic diagram of the HSV color space provided by the embodiments of the present application. As Figure 4 shown, the hue adjustment area 401 includes the hues corresponding to different colors, and the saturation and value adjustment area 402 includes the saturation and value corresponding to different colors. Figure 4 On the left in is the preview interface of the hue, saturation, and value of different colors, and on the right are the RGB numerical data and HSV numerical data corresponding to different colors. The image forming apparatus can convert the RGB data corresponding to each color into the corresponding HSV data for subsequent color erasure.

[0046] In addition, in a possible implementation, before converting the color of the scanned image to the HSV color space, preprocessing is performed on the scanned image, where the preprocessing is used to suppress the high-frequency noise of the scanned image. It can be understood that preprocessing the scanned image before processing it can suppress high-frequency noise while retaining the edges of the scanned image, improving the accuracy of subsequent color recognition.

[0047] In a possible implementation, the preprocessing includes Gaussian filtering. Those skilled in the art can 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, improving the accuracy of subsequent color recognition.

[0048] In practical applications, the hue and saturation of different regions of the same scanned image may vary, with some regions being clearer and some being blurrier. To address this issue, after converting the color of the scanned image to the HSV color space and 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 hue and saturation gradients are calculated in the HSV color space; a first processing algorithm is used for regions where the hue and saturation gradients are lower than a first gradient threshold; a second processing algorithm is used for regions where the hue and saturation gradients are higher than a second gradient threshold; where the first gradient threshold is less than the second gradient threshold.

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

[0050] In a possible implementation, the second processing algorithm is blur filtering. The core idea of blur filtering is the averaging or weighted averaging of local pixels. It should be noted that the second processing algorithm can also be other algorithms for reducing the sharpening intensity, and this application does not make specific limitations in this regard.

[0051] In a possible implementation, the blur filtering includes Gaussian blur, median blur, and bilateral filtering. It should be noted that the blur filtering can also be other algorithms for reducing the sharpening intensity, and this application does not make specific limitations in this regard.

[0052] It can be understood that for areas with low hue and saturation gradients (blurred areas), the first processing algorithm is used to enhance the edges, and for areas with high hue and saturation gradients (clear areas), a blur filter is used to reduce the sharpening intensity. After the subsequent erasure of the color to be erased, the abruptness of the transition area can be avoided, so that the transition part between the area of the erased color and the area of the non-erased color is more natural, improving the quality of the image after erasing the color to be erased and ensuring the user's visual experience. In addition, if the sharpening intensity of the areas with high hue and saturation gradients (clear areas) is not reduced using a blur filter 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 points in the scanned image will also be counted into the mask area, that is, these noise points need to be considered when erasing the color subsequently. However, the more areas are counted, the more pixels need to be processed, which will cause the algorithm time to become longer and the performance to decrease. Therefore, in the embodiments of the present application, 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 first processing algorithm is used to enhance the edges of the areas with low hue and saturation gradients (blurred areas), and a blur filter is used to reduce the sharpening intensity of the areas with high hue and saturation gradients (clear areas), performing blurring processing on the clear areas in advance to avoid leaving the noise points in the clear areas to the step of comparing the HSV data corresponding to the scanned image with the HSV data corresponding to the color to be erased, avoiding the influence of noise points on the performance of erasing the color, thereby improving the processing performance of erasing the color. It should be noted that in the embodiments of the present application, using the first processing algorithm to enhance the edges of the areas with low hue and saturation gradients (blurred areas) generally does not increase noise points, so using the first processing algorithm to enhance the edges of the blurred areas will not affect the performance of subsequent processing.

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

[0054] Specifically, the image forming device outputs an interaction interface through the display area, and the user can select the color that they expect to erase on the interaction interface, so that the image forming device can obtain the HSV data corresponding to the color to be erased.

[0055] For ease of understanding, the embodiments of the present application provide a schematic diagram of an interaction interface.

[0056] See Figure 5 , which is a schematic diagram of an interaction interface provided by the embodiments of the present application. As Figure 5 shown, the user can select the hue of the main color on the hue ring 501, and select the saturation and lightness of the main color in the saturation and lightness selection area 502 corresponding to the hue. The interaction interface also includes a data adjustment area 503, and the user can also select the corresponding hue, saturation, and lightness values in the data adjustment area 503.

[0057] In practical applications, Figure 5 the main color mentioned above is the color to be erased. In this way, the user can only erase one color at a time. When the user hopes to erase multiple similar colors, multiple erasures are required. The operation is not only cumbersome but also fails to meet the user's needs, resulting in a poor user experience. To address this issue, in the embodiments of the present application, the main color selected by the user on the hue ring and the k adjacent colors corresponding to this color can be directly erased.

[0058] Specifically, the image forming apparatus obtains the main color selected by the user on the hue ring, and through the fourth processing algorithm, obtains the k adjacent colors corresponding to this main color. The main color and the k adjacent colors are used as the colors to be erased. Among them, the fourth processing algorithm is used to automatically divide the data into several groups.

[0059] In a possible implementation manner, the fourth processing algorithm is a clustering algorithm. The clustering algorithm generally refers to all unsupervised grouping methods, and the goal is to divide natural clusters through data similarity.

[0060] In a possible implementation manner, the clustering algorithm is the k-means clustering algorithm (KMA). This algorithm is an iterative clustering analysis algorithm. Its steps are as follows: divide the data into K groups, randomly select K objects as the initial clustering centers, then calculate the distance between each object and each clustering center, and assign each object to the clustering center closest to it. The clustering centers and the objects assigned to them represent a cluster. Each time a sample is assigned, the clustering center of the cluster will be recalculated based on the existing objects in the cluster. This process will continue to repeat until a certain termination condition is met. The termination condition can be that no (or the minimum number of) objects are reassigned to different clusters, no (or the minimum number of) clustering centers change anymore, and the sum of squared errors is locally minimized. The number k of adjacent colors can be preset by the developer, and the number of adjacent colors can be changed according to needs, so that the number of adjacent colors meets the user's requirements.

[0061] Exemplarily, if the main color selected by the user is red and 2 adjacent colors, the image forming apparatus can extract the hue, saturation, and lightness values of red, dark red, and bright red as the hue, saturation, and lightness values of the colors to be erased, and use the hue, saturation, and lightness values of the colors to be erased as the threshold for the next image segmentation.

[0062] To confirm whether the adjacent color has been erased, after the image forming apparatus erases the main color and the adjacent color, the user or developer can use a professional image processing tool (such as Photoshop) to analyze and compare the color histogram of the erased area. If the peaks of the main color and the adjacent color are significantly reduced, it indicates that the main color and the adjacent color have been successfully erased. It should be noted that in the color histogram, the more a certain color is, the higher the corresponding bar graph of that color is. The area of the bar graph that visually looks like a mountain peak is called the peak. Before erasing the color, the main colors in the erased area are the main color and the adjacent color. Therefore, in the color histogram corresponding to the erased area, the bar graphs corresponding to the main color and the adjacent color are the peaks. If the erasure is successful, the main color and the adjacent color should be significantly reduced in the erased area. Therefore, the bar graphs (peaks) corresponding to the main color and the adjacent color in the color histogram should also be significantly reduced.

[0063] Of course, to ensure the user experience, the user can choose whether to enable the function of one - key erasing adjacent colors. Specifically, the image forming apparatus determines whether the function of one - key erasing adjacent colors is selected; if it is selected, it executes the step of obtaining k adjacent colors corresponding to the main color through the fourth processing algorithm and taking the main color and the k adjacent colors as the colors to be erased; if it is not selected, it takes the main color as the color to be erased and ignores the execution of the step of obtaining k adjacent colors corresponding to the main color through the fourth processing algorithm and taking the main color and the k adjacent colors as the colors to be erased.

[0064] It can be understood that by setting an option, the user can choose whether to enable this function according to their own needs, making the image processing result meet the user's expectations and improving the user experience.

[0065] Step S203: 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.

[0066] Specifically, the image forming apparatus or other terminal devices 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, so as to obtain the mask area and facilitate the execution of subsequent steps.

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

[0068] Specifically, replace the color of the mask area with a preset color to obtain a processed image. Among them, 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. Since the image forming device obtains the color to be erased, compare the HSV data corresponding to the color of each pixel point with the HSV data corresponding to the color to be erased, and mark the pixel points with the same HSV data as the color to be erased. The area composed of the marked pixel points is the mask area.

[0069] In a possible implementation manner, 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, mark the pixel points with the difference within the preset error range. The area composed of the marked pixel points is the mask area. Exemplarily, 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 described 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: set the HSV data with H being 59° - 61°, S being 68% - 72%, and V being 58% - 62% as the mask area. Those skilled in the art can understand that H being 60° and H being 59° are easily classified as the same color under the observation of the naked eye. If only the data with H being 60° is erased and the data with H being 59° is not erased, in fact, the user may think that the erasure is not clean, which affects the user experience. In the embodiment of the present application, the user can customize the preset error range, so that the HSV data defined as the mask area is what the user actually needs to erase. In fact, it makes the area of the mask within a reasonable range, which is beneficial to the subsequent erasure work, can erase the color that the user expects to erase more cleanly and thoroughly, and meets the user's expectations.

[0070] 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. The embodiment of the present application does not make specific limitations on this.

[0071] In a possible implementation manner, the preset color is calculated by the image forming device according to the colors around the mask area. Specifically, calculate the color histogram within a preset range around the mask area, and set the color with the highest appearance frequency in the color histogram as the preset color. Among them, the preset range around the mask area is a 5*5 pixel range around the mask area. Of course, this preset range is only an exemplary illustration. Those skilled in the art can set the preset range to any range according to actual needs. The embodiment of the present application does not make specific limitations on this.

[0072] When replacing the color of the mask area with a preset color, the third processing algorithm is used to process the mask area, and the mask area is filled with the preset color.

[0073] In a possible implementation manner, the third processing algorithm is a morphological closing operation. Among them, the morphological closing operation is a process in which the image is successively subjected to dilation and erosion processing, aiming to connect the broken edges after erasing the color, so as to ensure the user's visual experience.

[0074] Finally, the processed image is obtained, and the processed image is output to the image forming device so that the image forming device can perform image formation.

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

[0076] See Figure 6 , which is a schematic flowchart of another color modification method provided by the embodiment of the present application. As Figure 6 shown, it mainly includes the following steps.

[0077] Step S601: Receive the color erasing instruction and the scanned image input by the user.

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

[0079] Step S603: Image preprocessing.

[0080] Specifically, the image preprocessing is the step of preprocessing the scanned image described above.

[0081] Step S604: Determine whether the user selects the function of erasing adjacent colors with one key.

[0082] Specifically, if so, execute step S605; if not, execute step S606.

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

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

[0085] Step S607: Image post-processing.

[0086] Specifically, the image post-processing includes erasing the mask part, and performing edge compensation and adjacent color filling. Among them, the edge compensation is to perform the third processing algorithm on the mask part, and the adjacent color is the color with the highest frequency of occurrence in the color histogram within a preset range around the mask area.

[0087] Step S608: Output the processed image.

[0088] For the specific content involved in the embodiments of the present application, reference may be made to the description in the above Figure 2 illustrated embodiments. For the sake of brevity of description, it will not be elaborated herein.

[0089] In a possible implementation manner, the embodiments shown in steps S201 to S204 or the embodiments shown in steps S601 to S608 may be executed by an image forming apparatus or may be executed by other terminal devices, and the terminal device is communicatively connected to the image forming apparatus. Specifically, if steps S201 to S204 or steps S601 to S608 are executed by the terminal device, then before step S201 or step S601, it further includes: the terminal device receives the original image obtained by scanning sent by the image forming apparatus, and after the terminal device completes steps S201 to S204 or steps S601 to S608, the terminal device sends the obtained processed image to the image forming apparatus, and then the image forming apparatus performs an image forming operation according to the received processed image.

[0090] Among them, the terminal device may be a mobile phone, a tablet computer, a portable personal computer (Personal Computer, abbreviated as PC), etc., and the present application does not make specific limitations thereto.

[0091] Corresponding to the above embodiments, the present application further provides an image forming apparatus.

[0092] See Figure 7 , which is a schematic structural diagram of an image forming apparatus provided by an embodiment of the present application. As Figure 7 shown, the image forming apparatus may include: a color conversion module 701, a color to be erased acquisition module 702, a comparison module 703, and a color processing module 704. These components communicate through one or more buses. Those skilled in the art can understand that the structure of the electronic device shown in the figure does not constitute a limitation to the embodiments of the present application. It may be a bus structure, a star structure, and may also include more or fewer components than those shown in the figure, or combine some components, or have different component arrangements.

[0093] Among them, the color conversion module 701 is configured to convert the color of the scanned image to the HSV color space and obtain the scanned image converted to the HSV color space; The color to be erased acquisition module 702 is configured to acquire the HSV data corresponding to the color to be erased, where the color to be erased is the color that the user desires to erase; The 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; A color processing module 704 is configured to replace the color of the masked area with a preset color to obtain a processed image, and the HSV data corresponding to the color of the pixel points in the masked area is the HSV data corresponding to the color to be erased.

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

[0095] See Figure 8 , which is a schematic structural diagram of an electronic device provided by an embodiment of the present application. As Figure 8 shown, the electronic device 800 may include: a processor 801, a memory 802, and a communication unit 803. These components communicate through one or more buses. Those skilled in the art can understand that the structure of the electronic device shown in the figure does not constitute a limitation on the embodiments of the present application. It can be a bus structure, a star structure, and may also include more or fewer components than shown, or combine certain components, or have different component arrangements.

[0096] Among them, the communication unit 803 is configured to establish a communication channel so that the electronic device can communicate with other devices. Receive user data sent by other devices or send user data to other devices.

[0097] The processor 801 is the control center of the electronic device, connecting various parts of the entire electronic device through various interfaces and lines. By running or executing software programs, instructions, and / or modules stored in the memory 802, and calling the data stored in the memory, it executes various functions of the electronic device and / or processes data. The processor may be composed of an integrated circuit (IC). For example, it may be composed of a single packaged IC, or may be composed of multiple packaged ICs with the same or different functions connected. For example, the processor 801 may only include a central processing unit (CPU). In the embodiment of the present application, the CPU may be a single operation core or may include multiple operation cores.

[0098] The memory 802 is used to store the 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, a magnetic disk, or an optical disk.

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

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

[0101] In a specific implementation, an embodiment of the present application further provides a computer program product. The computer program product includes executable instructions, and when the executable instructions are executed on a computer, the computer is caused to execute some or all of the steps in the embodiments of the simulation scenario generation method provided by the embodiments of the present application.

[0102] In the embodiments of the present application, "at least one" means one or more, and "a plurality" means two or more. "And / or" describes the association relationship of associated objects and indicates that three relationships may exist. For example, A and / or B may represent the case where A exists alone, A and B exist simultaneously, or B exists alone. Where A and B may be singular or plural. The character " / " generally represents an "or" relationship between the associated objects before and after. "At least one of the following" and its similar expressions refer to any combination of these items, including any combination of single items or plural items. For example, at least one of a, b, and c may represent: a, b, c, a - b, a - c, b - c, or a - b - c, where a, b, and c may be single or multiple.

[0103] Those of ordinary skill in the art can realize that the various units and algorithm steps described in the embodiments disclosed herein can be implemented by a combination of electronic hardware, computer software, and electronic hardware. Whether these functions are executed in a hardware or software manner depends on the specific application and design constraints of the technical solution. A professional technician can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the present application.

[0104] Those skilled in the art can 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 foregoing method embodiments and will not be elaborated herein.

[0105] In several embodiments provided by the present 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 such an understanding, the technical solution of the present application, in essence, or the part that contributes to the prior art or a part of this technical solution can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in various embodiments of the present application. The aforementioned storage medium includes: various media that can store program codes, such as USB flash drives, mobile hard disks, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical discs.

[0106] For the same or similar parts among the various embodiments in this specification, reference can be made to each other. In particular, for the device embodiments and the terminal embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and for the relevant parts, reference can be made to the descriptions in the method embodiments.

Claims

1. A color modification method, characterized in that, Including: Convert the color of the scanned image to the HSV color space to obtain the scanned image converted to the HSV color space; Obtain the HSV data corresponding to the color to be erased, where the color to be erased is the color that the user expects to erase; 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; Replace the color of the mask area with a preset color to obtain a processed image, where 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.

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 a preset error range.

3. The method according to claim 2, wherein 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, it further includes: Calculate the hue and saturation gradients in the HSV color space; Use a first processing algorithm for areas where the hue and saturation gradients are lower than the first gradient threshold, and the first processing algorithm is used to enhance the edges; Use a second processing algorithm for areas where the hue and saturation gradients are higher than the second gradient threshold, and the second processing algorithm is used to reduce the sharpening intensity; Wherein, the first gradient threshold is less than the second gradient threshold.

4. The method according to claim 2, wherein Before replacing the color of the mask area with a preset color to obtain a processed image, it further includes: Calculate the color histogram within a preset range around the mask area, and set the color with the highest frequency of occurrence in the color histogram as the preset color.

5. The method according to claim 2, wherein Replacing the color of the mask area with a preset color to obtain a processed image includes: Perform a third processing algorithm on the mask area, where the third processing algorithm is used to repair the edges of the mask area and fill the mask area with a preset color to obtain a processed image.

6. The method according to claim 2, wherein Obtaining the HSV data corresponding to the color to be erased includes: Obtain the main color selected by the user on the hue; Through a fourth processing algorithm, obtain k adjacent colors corresponding to the main color, and use the main color and the k adjacent colors as the color to be erased. The fourth processing algorithm is used to automatically divide the data into several groups.

7. The method according to claim 6, wherein Before 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 color to be erased, it further includes: Determine whether the function of erasing adjacent colors with one key is selected; If it is selected, execute 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 color to be erased; If it is not selected, use the main color as the color to be erased and ignore the execution of 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 color to be erased.

8. The method according to claim 2, wherein Before converting the color of the scanned image to the HSV color space, it further includes: Preprocess the scanned image, and the preprocessing is used to suppress the high-frequency noise of the scanned image.

9. An image forming apparatus, characterized in that, Including: A color conversion module for converting the color of a scanned image to the HSV color space and obtaining the scanned image converted to the HSV color space; An erasure color acquisition module for acquiring the 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 for 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 color processing module for replacing the color of the mask area with a preset color to obtain a processed image, where 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.

10. An electronic device, characterized in that, Comprising: A processor; A memory; And a computer program, where the computer program is stored in the memory, and the computer program includes instructions that, when executed by the processor, cause the electronic device to execute the method according to any one of claims 1 to 8.

11. A computer-readable storage medium, characterized in that, The computer-readable storage medium includes a stored program, where, when the program runs, it controls the device where the computer-readable storage medium is located to execute the method according to any one of claims 1 to 8.

Citation Information

Patent Citations

  • Color replacement method base on HSV space

    CN101764913A

  • Color-based writing trace extraction method, system and device under complex background

    CN110532980A

  • Color replacement method and device

    CN110719382A

  • Image processing method and device, computer readable storage medium and electronic equipment

    CN119110044A

  • System and Method for RAW Image Processing

    US20080088857A1