CN108304147A - Two tone image generation method and device - Google Patents

Two tone image generation method and device Download PDF

Info

Publication number
CN108304147A
CN108304147A CN201810088380.7A CN201810088380A CN108304147A CN 108304147 A CN108304147 A CN 108304147A CN 201810088380 A CN201810088380 A CN 201810088380A CN 108304147 A CN108304147 A CN 108304147A
Authority
CN
China
Prior art keywords
color
values
value
initial luma
designated
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201810088380.7A
Other languages
Chinese (zh)
Other versions
CN108304147B (en
Inventor
马杨晓
胡东成
陈盈贵
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Zhuhai Pantum Electronics Co Ltd
Original Assignee
Zhuhai Pantum Electronics Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Zhuhai Pantum Electronics Co Ltd filed Critical Zhuhai Pantum Electronics Co Ltd
Priority to CN201810088380.7A priority Critical patent/CN108304147B/en
Publication of CN108304147A publication Critical patent/CN108304147A/en
Application granted granted Critical
Publication of CN108304147B publication Critical patent/CN108304147B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/12Digital output to print unit, e.g. line printer, chain printer
    • G06F3/1201Dedicated interfaces to print systems
    • G06F3/1202Dedicated interfaces to print systems specifically adapted to achieve a particular effect
    • G06F3/1203Improving or facilitating administration, e.g. print management
    • G06F3/1208Improving or facilitating administration, e.g. print management resulting in improved quality of the output result, e.g. print layout, colours, workflows, print preview
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N1/00Scanning, transmission or reproduction of documents or the like, e.g. facsimile transmission; Details thereof
    • H04N1/00002Diagnosis, testing or measuring; Detecting, analysing or monitoring not otherwise provided for
    • H04N1/00005Diagnosis, testing or measuring; Detecting, analysing or monitoring not otherwise provided for relating to image data
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N1/00Scanning, transmission or reproduction of documents or the like, e.g. facsimile transmission; Details thereof
    • H04N1/00127Connection or combination of a still picture apparatus with another apparatus, e.g. for storage, processing or transmission of still picture signals or of information associated with a still picture
    • H04N1/00278Connection or combination of a still picture apparatus with another apparatus, e.g. for storage, processing or transmission of still picture signals or of information associated with a still picture with a printing apparatus, e.g. a laser beam printer

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Theoretical Computer Science (AREA)
  • Signal Processing (AREA)
  • Quality & Reliability (AREA)
  • General Health & Medical Sciences (AREA)
  • Health & Medical Sciences (AREA)
  • Human Computer Interaction (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Biomedical Technology (AREA)
  • Image Processing (AREA)
  • Facsimile Image Signal Circuits (AREA)

Abstract

A kind of two tone image generation method of present invention offer and device.Two tone image generation method of the present invention, including:Obtain the initial luma values of each pixel in coloured image.According to the type of coloured image, the brightness value of the brightness value and the second designated color of the first designated color is determined.According to each initial luma values, the brightness value of the brightness value of the first designated color and the second designated color, color replacement processing is carried out to each initial luma values, obtains each target brightness value of two tone image.The present invention can set the color of two tone image according to the color that user specifies, moreover it is possible to promote the quality of double-colored conversion process.

Description

Two tone image generation method and device
Technical field
The present invention relates to printing technique field more particularly to a kind of two tone image generation method and devices.
Background technology
Multicolor printer can carry out graphics process to the coloured image that input data is formed, and obtain colour print document. For most of printed materials, completing double-colored printing just can complete actual demand.
In existing two tone image generation method, coloured image by being divided by multicolor printer according to the depth difference of color Two different colors generate two tone image document.However, light color easily generates white in existing two tone image generation method, it is deep Color easily generates black, and then the two tone image document generated will appear phenomena such as color reduction is inaccurate.
Invention content
A kind of two tone image generation method of present invention offer and device, to solve existing two tone image generation method due to root The problem that coloured image is substituted for two tone image according to shade difference and causes color reduction inaccurate.
In a first aspect, the present invention provides a kind of two tone image generation method, including:
Take the initial luma values of each pixel in coloured image;
According to the type of the coloured image, the brightness of the brightness value and the second designated color of the first designated color is determined Value;
According to the brightness of each initial luma values, the brightness value of first designated color and second designated color Value carries out color replacement processing to each initial luma values, obtains each target brightness value of two tone image.
Optionally, described to be specified according to each initial luma values, the brightness value of first designated color and described second The brightness value of color carries out color replacement processing to each initial luma values, obtains each target brightness value of two tone image, including:
According to each initial luma values and the brightness value of first designated color, alternatively, according to each initial luma values with And the brightness value of second designated color, color region division is carried out to each initial luma values, obtains the first designated color area Domain and the second designated color region;
Respectively each initial luma values to first designated color region and second designated color region it is each just Beginning brightness value carries out color replacement processing, obtains each target brightness value of two tone image.
Optionally, when the corresponding Color Channel of first designated color be 1 when, it is described according to each initial luma values with And the brightness value of first designated color, color region division is carried out to each initial luma values, obtains the first designated color area Domain and the second designated color region, including:
Color channel values corresponding with first designated color and remaining color channel values in the initial luma values The sum of difference when meeting the first preset range, determine that the corresponding pixel of the initial luma values belongs to the described first specified face Color region;
Color channel values corresponding with first designated color and remaining color channel values in the initial luma values The sum of difference when being unsatisfactory for first preset range, determine that the corresponding pixel of the initial luma values belongs to described second Designated color region;
It is described according to each initial luma values and described when the corresponding Color Channel of first designated color is 1 The brightness value of second designated color carries out color region division to each initial luma values, obtains the first designated color region and the Two designated color regions, including:
Color channel values corresponding with second designated color and remaining color channel values in the initial luma values The sum of difference when being unsatisfactory for the second preset range, it is specified to determine that the corresponding pixel of the initial luma values belongs to described first Color region;
Color channel values corresponding with second designated color and remaining color channel values in the initial luma values The sum of difference when meeting second preset range, it is specified to determine that the corresponding pixel of the initial pixel belongs to described second Color region.
Optionally, described according to each first when the corresponding Color Channel of first designated color is 2 or more than 2 The brightness value of beginning brightness value and first designated color carries out color region division to each initial luma values, obtains first Designated color region and the second designated color region further include:
In each color channel values and the corresponding each Color Channel of first designated color of the initial luma values When the sum of difference of value meets third preset range, it is specified to determine that the corresponding pixel of the initial luma values belongs to described first Color region;
In each color channel values and the corresponding each Color Channel of first designated color of the initial luma values When the sum of difference of value is unsatisfactory for third preset range, determine that the corresponding pixel of the initial luma values belongs to described second and refers to Determine color region;
It is described according to each initial luma values when the corresponding Color Channel of second designated color is 2 or is more than 2 And the brightness value of second designated color, color region division is carried out to each initial luma values, obtains the first designated color Region and the second designated color region, including:
In each color channel values and the corresponding each Color Channel of second designated color of the initial luma values When the sum of difference of value is unsatisfactory for four preset ranges, determine that the corresponding pixel of the initial luma values belongs to described first and refers to Determine color region;
In each color channel values and the corresponding each Color Channel of second designated color of the initial luma values When the sum of difference of value meets four preset ranges, it is specified to determine that the corresponding pixel of the initial luma values belongs to described second Color region.
Optionally, each initial luma values to first designated color region respectively and second designated color Each initial luma values in region carry out color replacement processing, obtain each target brightness value of two tone image, including:
When first designated color is colored, by the initial luma values in first designated color region with it is described The corresponding color channel values of first designated color are set as maximum color channel value, and will be at the beginning of first designated color region Remaining color channel values is disposed as the first pre-set color channel value in beginning brightness value, obtains the object brightness of the two tone image Value;
When second designated color is colored, by the initial luma values in second designated color region with it is described The corresponding color channel values of second designated color are set as maximum color channel value, and will be at the beginning of second designated color region Remaining color channel values is disposed as the second pre-set color channel value in beginning brightness value, obtains the object brightness of the two tone image Value;Alternatively,
When second designated color is achromaticity, will own in the initial luma values in second designated color region Color channel values are disposed as third pre-set color channel value, obtain the target brightness value of the two tone image.
Optionally, the first pre-set color channel value, the second pre-set color channel value are the initial luma values Any in the maximum value of middle all colours channel value, minimum value and average value, the third pre-set color channel value is described The minimum value or average value of all colours channel value in initial luma values.
Optionally, the method further includes:
Meet the target brightness value of preset condition in the two tone image acquired, wherein the preset condition is All colours channel value in the target brightness value is the extreme value of color channel values, and the target brightness value is corresponding just All colours channel value in beginning brightness value is not all equal;
Color correct processing is carried out to the target brightness value, the target brightness value is replaced with into revised brightness Value.
Optionally, described that color correct processing is carried out to each target brightness value, including:
Color channel values corresponding with first designated color in the target brightness value are set to maximum color to lead to Road value, remaining color channel values are disposed as the 4th pre-set color channel value;Or
Color channel values corresponding with second designated color in the target brightness value are set to maximum color to lead to Road value, remaining color channel values are disposed as the 5th pre-set color channel value.
Optionally, the 4th pre-set color channel value is to own in initial luma values corresponding with the target brightness value The minimum value or average value of color channel values.
Second aspect, the present invention provide a kind of two tone image generating means, including:
Acquisition module, the initial luma values for obtaining each pixel in coloured image;
Determining module, for the type according to the coloured image, the brightness value and second that determine the first designated color refer to Determine the brightness value of color;
Processing module, for being referred to according to the brightness value of each initial luma values, first designated color and described second The brightness value for determining color carries out color replacement processing to each initial luma values, obtains each target brightness value of two tone image.
Optionally, the processing module includes:Division unit and replacement unit;
The division unit, for the brightness value according to each initial luma values and first designated color, alternatively, root According to each initial luma values and the brightness value of second designated color, color region division is carried out to each initial luma values, is obtained To the first designated color region and the second designated color region;
The replacement unit refers to for each initial luma values to first designated color region respectively and described second Each initial luma values for determining color region carry out color replacement processing, obtain each target brightness value of two tone image.
Optionally, the division unit is specifically used for when the corresponding Color Channel of first designated color is 1, In the initial luma values with the difference of the corresponding color channel values of the first designated color and remaining color channel values it When with meeting the first preset range, determine that the corresponding pixel of the initial luma values belongs to first designated color region;
Color channel values corresponding with first designated color and remaining color channel values in the initial luma values The sum of difference when being unsatisfactory for first preset range, determine that the corresponding pixel of the initial luma values belongs to described second Designated color region;
When the corresponding Color Channel of second designated color is 1, with described second in the initial luma values When the sum of the difference of the corresponding color channel values of designated color and remaining color channel values is unsatisfactory for the second preset range, institute is determined It states the corresponding pixel of initial luma values and belongs to first designated color region;
Color channel values corresponding with second designated color and remaining color channel values in the initial luma values The sum of difference when meeting second preset range, it is specified to determine that the corresponding pixel of the initial pixel belongs to described second Color region.
Optionally, the division unit, be specifically additionally operable to when the corresponding Color Channel of first designated color be 2 or It is logical in each color channel values and the corresponding each color of first designated color of the initial luma values when more than 2 When the sum of the difference of road value meets third preset range, determine that the corresponding pixel of the initial luma values belongs to described first and refers to Determine color region;
In each color channel values and the corresponding each Color Channel of first designated color of the initial luma values When the sum of difference of value is unsatisfactory for third preset range, determine that the corresponding pixel of the initial luma values belongs to described second and refers to Determine color region;
When the corresponding Color Channel of second designated color is 2 or is more than 2, in each of the initial luma values The sum of the difference of a color channel values and the corresponding each color channel values of second designated color is unsatisfactory for the 4th default model When enclosing, determine that the corresponding pixel of the initial luma values belongs to first designated color region;
In each color channel values and the corresponding each Color Channel of second designated color of the initial luma values When the sum of difference of value meets four preset ranges, it is specified to determine that the corresponding pixel of the initial luma values belongs to described second Color region.
Optionally, the replacement unit is specifically used for, when first designated color is colored, described first being specified Color channel values corresponding with first designated color are set as maximum color channel value in the initial luma values of color region, And remaining color channel values in the initial luma values in first designated color region are disposed as the first pre-set color channel Value, obtains the target brightness value of the two tone image;
When second designated color is colored, by the initial luma values in second designated color region with it is described The corresponding color channel values of second designated color are set as maximum color channel value, and will be at the beginning of second designated color region Remaining color channel values is disposed as the second pre-set color channel value in beginning brightness value, obtains the object brightness of the two tone image Value;Alternatively,
When second designated color is achromaticity, will own in the initial luma values in second designated color region Color channel values are disposed as third pre-set color channel value, obtain the target brightness value of the two tone image.
Optionally, the first pre-set color channel value, the second pre-set color channel value are the initial luma values Any in the maximum value of middle all colours channel value, minimum value and average value, the third pre-set color channel value is described The minimum value or average value of all colours channel value in initial luma values.
Optionally, the method further includes:
The acquisition module is additionally operable to meet the target brightness value of preset condition in the two tone image acquired, Wherein, the preset condition is the extreme value that all colours channel value in the target brightness value is color channel values, and institute The all colours channel value stated in the corresponding initial luma values of target brightness value is not all equal;
Correcting module replaces with the target brightness value for carrying out color correct processing to the target brightness value Revised brightness value.
Optionally, the correcting module, being specifically used for will be corresponding with first designated color in the target brightness value Color channel values be set as maximum color channel value, remaining color channel values is disposed as the 4th pre-set color channel value;Or Person,
Color channel values corresponding with second designated color in the target brightness value are set to maximum color to lead to Road value, remaining color channel values are disposed as the 5th pre-set color channel value.
Optionally, the 4th pre-set color channel value is to own in initial luma values corresponding with the target brightness value The minimum value or average value of color channel values.
The third aspect, the present invention provide a kind of computer readable storage medium, are stored thereon with computer program, the meter The two tone image generation method described in first aspect is realized when calculation machine program is executed by processor.
Fourth aspect, the present invention provide a kind of two tone image generating means, including:
Processor;And
Memory, the executable instruction for storing the processor;
Wherein, the processor is configured to execute the bicolorable graph described in first aspect via the executable instruction is executed As generation method.
Two tone image generation method provided by the invention and device, by obtaining the initial of each pixel in coloured image Brightness value determines the brightness value of the first designated color or the brightness value of the second designated color according to the type of coloured image.Again According to each initial luma values, the brightness value of the brightness value of the first designated color and the second designated color, to each initial luma values Color replacement processing is carried out, each target brightness value of two tone image is obtained.The present invention solves existing two tone image generation method It, can be according to user's reality since colour is substituted for problem that is double-colored and causing color reduction inaccurate according to shade difference Border demand specifies the color of two tone image, carries out region division to coloured image and color replacement is handled, realize to cromogram The double-colored conversion process of picture, and improve the quality of double-colored conversion.
Description of the drawings
Fig. 1 is the flow chart one of two tone image generation method provided by the invention;
Fig. 2 is the flowchart 2 of two tone image generation method provided by the invention;
Fig. 3 is the flow chart 3 of two tone image generation method provided by the invention;
Fig. 4 is the structural schematic diagram one of two tone image generating means provided by the invention;
Fig. 5 is the structural schematic diagram two of two tone image generating means provided by the invention;
Fig. 6 is the structural schematic diagram three of two tone image generating means provided by the invention.
Specific implementation mode
Fig. 1 is the flow chart one of two tone image generation method provided by the invention, as shown in Figure 1, the present embodiment is double-colored Image generating method may include:
S101, the initial luma values for obtaining each pixel in coloured image.
Specifically, coloured image can be that user obtains corresponding cromogram by user interface input data in the present embodiment Picture, user interface can be the operation panel of the image forming apparatus of such as printer, driving interface, webpage webpage, other answer With any in the interfaces program app.The present embodiment does not limit this.
Further, the present embodiment also needs the brightness value of each pixel on certain coloured image, and the present embodiment is to colour The type of image does not limit.Optionally, the type of coloured image is according to including RGB image or CMYK images.For example, when colour The type of image is RGB image, then the brightness value of each pixel is rgb value (r, g, b) on coloured image.When coloured image Type is CMYK images, then the brightness value of each pixel is CMYK values (c, m, y, k) on coloured image.
The specific initial luma values for determining each pixel in coloured image are the routine techniques of those skilled in the art, Herein without redundant.
S102, the type according to coloured image determine the brightness of the brightness value and the second designated color of the first designated color Value.
Specifically, two tone image is user circle in the image forming apparatus of such as printer based on user in the present embodiment The two kinds of colors specified on face are formed by, and specifically, the color of two tone image includes the first designated color and the second specified face Color.And it is colour that the present embodiment, which can select the first designated color, is not limited the second designated color, wherein colour is non-black Color either non-grey color achromaticity be black or grey.For example, it is the first designated color that user, which can set red, it is black Color is the second designated color, alternatively, it is the first designated color that user, which can set red, blue is the second designated color.This implementation Example does not limit the specific color of the first designated color and the second designated color.
Further, it is double-colored by the document for printing formation in this present embodiment, therefore, by cromogram in the present embodiment As replaced printing document only has the first designated color and the second designated color both colors, and then the present embodiment can basis The type of coloured image determines the brightness value of the first designated color or the brightness value of the second designated color.The present embodiment pair The specific implementation form of the brightness value of the brightness value of one designated color and the second designated color does not limit.
For example, when the type of coloured image is RGB image, if selected red for the first designated color or the second specified face Color, then red brightness value is rgb value (255,0,0), wherein 255 be the maximum value of color channel values;If selected black is the One designated color or the second designated color, then the brightness value of black is rgb value (0,0,0);If selected blue is the first specified face Color or the second designated color, blue brightness value are rgb value (0,0,255).
For another example, when the type of coloured image is CMYK images, if selected red is that the first designated color or second are specified Color, then red brightness value is CMYK values (0,100,100,0), wherein 100 be the maximum value of color channel values;If selected black Color is the first designated color or the second designated color, then the brightness value of black is CMYK values (0,0,0,100);If selected blue is First designated color or the second designated color, then blue brightness value is CMYK values (100,100,0,0).
S103, according to each initial luma values, the brightness value of the brightness value of the first designated color and the second designated color, it is right Each initial luma values carry out color replacement processing, obtain each target brightness value of two tone image.
Specifically, each initial luma values can be according to the brightness value of the first designated color and the second specified face in the present embodiment The brightness value of color carries out color replacement processing so that each initial luma values respectively become each target brightness value.
Two tone image generation method provided in this embodiment, by the original intensity for obtaining each pixel in coloured image Value, according to the type of coloured image, determines the brightness value of the first designated color or the brightness value of the second designated color.Further according to The brightness value of each initial luma values, the brightness value of the first designated color and the second designated color carries out each initial luma values Color replacement is handled, and obtains each target brightness value of two tone image.The present embodiment solve existing two tone image generation method by It, can be according to user's reality in colour is substituted for problem that is double-colored and causing color reduction inaccurate according to shade difference Demand specifies the color of two tone image, carries out color replacement processing to coloured image, realizes the double-colored conversion to coloured image Processing, and improve the quality of double-colored conversion.
On the basis of the above embodiments, the technical solution of two tone image generation method in the present embodiment is carried out detailed Explanation.
First, color replacement processing is carried out to each initial luma values in the present embodiment, each target for obtaining two tone image is bright The specific implementation of angle value does not limit.For convenience of description, with reference to Fig. 2, the two tone image of the present embodiment is generated The specific implementation of method is described in detail.
Fig. 2 is the flowchart 2 of two tone image generation method provided by the invention, as shown in Fig. 2, the present embodiment is double-colored Image generating method includes:
S201, the initial luma values for obtaining each pixel in coloured image.
S202, the type according to coloured image determine the brightness of the brightness value and the second designated color of the first designated color Value.
Wherein, S201, S202 are similar with the realization method of S101, S102 in Fig. 1 embodiments respectively, and the present embodiment is herein It repeats no more.
S203, according to each initial luma values and the brightness value of the first designated color, alternatively, according to each initial luma values with And second designated color brightness value, to each initial luma values carry out color region division, obtain the first designated color region and Second designated color region.
S204, respectively each initial luma values to the first designated color region and the second designated color region it is each initial bright Angle value carries out color replacement processing, obtains each target brightness value of two tone image.
Specifically, the pixel in coloured image can be divided into two regions, the respectively first specified face by the present embodiment Color region and the second designated color region.For any pixel point on coloured image, the present embodiment can be by according to One designated color and the initial luma values, to judge whether the corresponding pixel of the initial luma values is the first designated color area Domain.For example, when the first designated color is red, need to judge whether each pixel on coloured image belongs to red area. Wherein, the specific size of the first preset range of the present embodiment pair and concrete form neither limit.
Further, when one part of pixel point belongs to the first designated color region, the pixel of remainder belongs to Two designated color regions;When one part of pixel point is not belonging to the first designated color region, this partial pixel point belongs to the second finger Determine color region, the pixel of remainder belongs to the first designated color region.
Accordingly, for any pixel point on coloured image, the present embodiment can also be by judging the original intensity Value and the second designated color, to judge whether the corresponding pixel of the brightness value belongs to the second designated color region.For example, when the When two designated colors are blue, need to judge whether each pixel on coloured image belongs to blue region.Wherein, the present embodiment Specific size and concrete form to the first preset range neither limit.
Further, when the initial pixel point of a part belongs to the second designated color region, the initial picture of remainder Vegetarian refreshments belongs to the first designated color region;When the initial pixel point of a part is not belonging to the second designated color region, this part Initial pixel point belong to the first designated color region, the initial pixel point of remainder belongs to the second designated color region.
Further, since each pixel on coloured image can be divided into the first designated color region and by the present embodiment Two designated color regions, in this way, brightness value and each initial luma values that the present embodiment can be according to the first designated color, to Each initial pixel point in one designated color region carries out the replacement processing of the first designated color, can also be according to the second designated color Brightness value and each initial luma values carry out each initial pixel point in the second designated color region the replacement of the second designated color Processing so that the corresponding brightness value of any pixel point on coloured image belongs to the first designated color region or the second designated color Transfer process of the coloured image to two tone image is realized in region.
Two tone image generation method provided in this embodiment, by the original intensity for obtaining each pixel in coloured image Value, according to the type of coloured image, determines the brightness value of the first designated color or the brightness value of the second designated color.Further according to The brightness value of each initial luma values and the first designated color, alternatively, according to each initial luma values and the second designated color Brightness value carries out color region division to each initial luma values, obtains the first designated color region and the second designated color region. Then, each initial luma values to the first designated color region and each initial luma values in the second designated color region carry out respectively Color replacement is handled, and obtains each target brightness value of two tone image.The present embodiment solve existing two tone image generation method by It, can be according to user's reality in colour is substituted for problem that is double-colored and causing color reduction inaccurate according to shade difference Demand specifies the color of two tone image, and according to the color region of each pixel in coloured image, corresponding to each pixel each Brightness value carries out color replacement processing, realizes transfer process of the coloured image to two tone image, improves the quality of double-colored conversion, And the present embodiment is first to carry out color region differentiation based on the color that user specifies, then carry out color replacement, improves color The accuracy rate of conversion.
It secondly, can be according to each initial luma values, the brightness value of the first designated color and second in the present embodiment S203 The corresponding pixel of each initial luma values in coloured image is carried out the division of color region, obtained by the brightness value of designated color Each initial luma values of each initial luma values in the first designated color region and the second designated color region.To each in the present embodiment The concrete mode that pixel carries out color region division includes a variety of, and the present embodiment does not limit this.
Specifically, when the corresponding Color Channel of the first designated color is 1, following two realization can be used in the present embodiment The detailed process that mode carries out each pixel color region division is described in detail.
A kind of feasible realization method, in initial luma values color channel values corresponding with the first designated color and remaining When the sum of difference of color channel values meets the first preset range, it is specified to determine that the corresponding pixel of initial luma values belongs to first Color region.
In initial luma values the difference of color channel values corresponding with the first designated color and remaining color channel values it When with being unsatisfactory for the first preset range, determine that the corresponding pixel of initial luma values belongs to the second designated color region.
Specifically, for any initial luma values in coloured image, which includes multiple color channel values, Multiple color channel values are corresponding respectively and different colors, and there are a color channel values or multiple color channel values and first Designated color corresponds to, and there is also a color channel values or multiple color channel values are corresponding with the second designated color.For example, RGB Any initial luma values include three color channel values in image, and any initial luma values include that four colors are logical in CMYK images Road value.
Further, when the corresponding Color Channel of a color is 1, the present embodiment can will be with the first designated color pair It is poor that the color channel values answered are made with remaining color channel values, whether default first obtains the sum of the sum of difference, then determining difference Range illustrates that the initial luma values belong to the first designated color region, instead if the sum of its difference meets the first preset range It, which belongs to the second designated color region.Wherein, the value range of the first preset range of the present embodiment pair can root It is set according to actual conditions, the present embodiment does not limit this.
Another feasible realization method, in initial luma values color channel values corresponding with the second designated color and its When the sum of the difference of remaining color channel values is unsatisfactory for the second preset range, determine that the corresponding pixel of initial luma values belongs to first Designated color region.
In initial luma values the difference of color channel values corresponding with the second designated color and remaining color channel values it When with meeting the second preset range, determine that the corresponding pixel of initial pixel belongs to the second designated color region.
Accordingly, the present embodiment can also make color channel values corresponding with the second designated color with remaining color channel values Difference obtains the sum of the sum of difference, then determining difference whether in the second preset range, if the sum of its difference meets the second default model It encloses, then illustrates that the initial luma values belong to the second designated color region, conversely, the initial luma values belong to the first designated color area Domain.Wherein, the value range of the second preset range of the present embodiment pair can be set according to actual conditions, and in the present embodiment Two preset ranges and the first preset range can be equal, can not also wait, the present embodiment does not limit this.
Herein it should be noted that difference took in the present embodiment is difference after absolute value, i.e., the sum of difference is general More than or equal to 0, the description subsequently with respect to difference is satisfied by this condition, follow-up no longer redundant later.
Be the first designated color for example, selected red, and red brightness value is (255,0,0), the first preset range and Second preset range be taken as be more than 160 when, if the initial luma values of a certain pixel be (238,58,140), then (238-58)+ (238-140)=278 meets the first preset range, and the pixel in this way belongs to the first designated color region.If a certain pixel Initial luma values be (0,14,39), then (14-0)+(39-0)=53,53 are unsatisfactory for the first preset range, in this way the pixel Belong to the second designated color region.Similarly, it is that the second designated color also can be according to aforesaid way completion color region to select red Division.
Further, when the corresponding Color Channel of the first designated color is 2 or more than 2, the present embodiment can be used The detailed process that following two realization method carries out each pixel color region division is described in detail.
A kind of feasible realization method, it is corresponding each in each color channel values of initial luma values and the first designated color When the sum of the difference of a color channel values meets third preset range, determine that the corresponding pixel of initial luma values belongs to the first finger Determine color region;
In the difference of each color channel values of initial luma values and the corresponding each color channel values of the first designated color The sum of when being unsatisfactory for third preset range, determine that the corresponding pixel of initial luma values belongs to the second designated color region.
Specifically, when the corresponding Color Channel of a color is multiple, the present embodiment can be by each of initial luma values The sum of it is poor that color channel values each color channel values corresponding with the first designated color are made, obtain the sum of difference, then determine difference Whether in third preset range, if the sum of its difference meets third preset range, illustrate that the initial luma values belong to the first finger Color region is determined, conversely, the initial luma values belong to the second designated color region.Wherein, the present embodiment is to third preset range Value range can be set according to actual conditions, the present embodiment does not limit this.
Another feasible embodiment, it is corresponding in each color channel values of initial luma values and the second designated color When the sum of the difference of each color channel values is unsatisfactory for four preset ranges, determine that the corresponding pixel of initial luma values belongs to One designated color region;
In the difference of each color channel values of initial luma values and the corresponding each color channel values of the second designated color The sum of meet four preset ranges when, determine that the corresponding pixel of initial luma values belongs to the second designated color region,
Accordingly, when the corresponding Color Channel of a color is multiple, the present embodiment can be by each of initial luma values The sum of it is poor that color channel values each color channel values corresponding with the second designated color are made, obtain the sum of difference, then determine difference Whether in the 4th preset range, if the sum of its difference the 4th preset range of satisfaction, illustrates that the initial luma values belong to the second finger Color region is determined, conversely, the initial luma values belong to the first designated color region.Wherein, the 4th preset range of the present embodiment pair Value range can be set according to actual conditions, the present embodiment does not limit this.
For example, selected purple is the first designated color, and the brightness value of purple is (255,0,255), the first preset range When being taken as being more than 160 with the second preset range, if the initial luma values of a certain pixel are (238,58,140), then (255- 238)+(58-0)+(255-140)=190 meets the first preset range, and the pixel in this way belongs to the first designated color region. If the initial luma values of a certain pixel are (255,14,201), then (255-255)+(14-0)+(255-201)=68 is unsatisfactory for First preset range, the in this way pixel belong to the second designated color region.Similarly, it is that the second designated color also may be used to select purple The division of color region is completed according to aforesaid way.
Further, in this embodiment the corresponding Color Channel of the first designated color has 1, and the second designated color corresponds to Color Channel have 2 or 2 or more can also complete to each pixel carry out color region division.Similarly, second is specified The corresponding Color Channel of color has 1, and the corresponding Color Channel of the first designated color has 2 or 2 or more can also complete Color region division is carried out to each pixel.The first designated color and the corresponding face of the second designated color are not limited in the present embodiment The number of chrominance channel.
Then, color replacement processing is carried out to each initial luma values in the present embodiment S204, obtains each mesh of two tone image There are many specific implementations for marking brightness value, and the present embodiment does not limit this.It will be understood by those skilled in the art that first Kind situation, when the first designated color is colored, the second designated color can be colored or achromaticity.Situation in second, when When second designated color is colored, the first designated color can be colored or achromaticity.The present embodiment is with the first situation Example, is described in detail to obtaining the concrete mode of each target brightness value of two tone image.
On the one hand, when the first designated color is colored, by the initial luma values in the first designated color region with first The corresponding color channel values of designated color are set as maximum color channel value, and by the initial luma values in the first designated color region In remaining color channel values be disposed as the first pre-set color channel value, obtain the target brightness value of two tone image.
Specifically, when the type of coloured image is RGB image, however, it is determined that the corresponding pixel of initial luma values belongs to the One designated color region, and the first designated color is red, it is logical for the color of r with each color channel values in red brightness value Road value is the color channel values of 255, g and the color channel values of b are for 0, then the corresponding target pixel value of initial luma values In, the color channel values of color channel values and b that the color channel values of r are 255, g are the first pre-set color channel value, in this way, Just color replacement is carried out to the initial luma values of the pixel so that the corresponding pixel of the target brightness value belongs to red color area Domain.
Further, when the type of coloured image is CMYK images, however, it is determined that the corresponding pixel category of initial luma values In the first designated color region, and the first designated color is selected as red, is c's with each color channel values in red brightness value The color channel values of color channel values and k are the color channel values of 0, m and the color channel values of y are for 100, then initially Brightness value corresponds in target brightness value, and the color channel values of m and the color channel values of y are the color channel values and k of 100, c Color channel values are the first pre-set color channel value, in this way, just carrying out color replacement to the initial luma values of the pixel so that The corresponding pixel of the target brightness value just belongs to red area.
On the other hand, when the second designated color is colored, by the initial luma values in the second designated color region with the The corresponding color channel values of two designated colors are set as maximum color channel value, and by the original intensity in the second designated color region Remaining color channel values is disposed as the second pre-set color channel value in value, obtains the target brightness value of two tone image.
When the second designated color is achromaticity, by all colours channel in the initial luma values in the second designated color region Value is disposed as third pre-set color channel value, obtains the target brightness value of two tone image.
Specifically, when the type of coloured image is RGB image, however, it is determined that the corresponding pixel of initial luma values belongs to the Two designated color regions, and the second designated color is blue, it is logical for the color of r with each color channel values in the brightness value of blue The color channel values of road value and g be 0, b color channel values be 255 for, then in initial luma values, the color channel values of b It is the second pre-set color channel value for the color channel values of 255, r and the color channel values of g, in this way, just to the pixel Initial luma values carry out color replacement so that the corresponding pixel of the target brightness value belongs to blue region.
Further, when the type of coloured image is CMYK images, however, it is determined that the corresponding pixel category of initial luma values In the second designated color region, and the second designated color is selected as blue, is c's with each color channel values in the brightness value of blue The color channel values of color channel values and m are the color channel values of 100, y and the color channel values of k are for 0, then initially In brightness value, the color channel values of the color channel values of c and color channel values and k that the color channel values of m are 100, y are second Pre-set color channel value, in this way, just carrying out color replacement to the initial luma values of the pixel so that the target brightness value corresponds to Pixel belong to blue region.
Further, when the type of coloured image is RGB image, however, it is determined that the corresponding pixel of initial luma values belongs to Second designated color region, and the second designated color is black, then in initial luma values, the color channel values of r, the color of b are logical The color channel values of road value and g are third pre-set color channel value, in this way, just carrying out face to the initial luma values of the pixel Color is replaced so that the corresponding pixel of the target brightness value belongs to black region.
Further, when the type of coloured image is CMYK images, however, it is determined that the corresponding pixel category of initial luma values In the second designated color region, and the second designated color is selected as black, then in initial luma values, the color channel values of c, the face of m The color channel values of chrominance channel value, the color channel values of y and k are third pre-set color channel value, in this way, just to the pixel Initial luma values carry out color replacement so that the corresponding pixel of the target brightness value belongs to black region.
Wherein, the first pre-set color of the present embodiment pair channel value, the second pre-set color channel value and third pre-set color are logical The specific implementation and size of road value do not limit.Optionally, the first pre-set color channel value, the second pre-set color channel value For any in the maximum value of all colours channel value, minimum value and average value in initial luma values, third pre-set color channel Value is the minimum value or average value of all colours channel value in initial luma values.
Finally, it is replaced during obtaining two tone image using above-mentioned color, in the corresponding pixel of each target brightness value It is possible that the white area of some mistakes, i.e., when the brightness value of initial pixel point in coloured image is shallower, by color It after replacement processing, is easy to be replaced with white pixel point, loses so as to cause picture material, make troubles to user, therefore, In order to improve the accuracy rate of color reduction, with reference to Fig. 3, specific implementation of the present embodiment to two tone image generation method It is described in detail.
Fig. 3 is the flow chart 3 of two tone image generation method provided by the invention, as shown in figure 3, the present embodiment is double-colored Image generating method may include:
S301, the initial luma values for obtaining each pixel in coloured image.
S302, the type according to coloured image determine the brightness of the brightness value and the second designated color of the first designated color Value.
S303, according to each initial luma values, the brightness value of the brightness value of the first designated color and the second designated color, it is right Each initial luma values carry out color replacement processing, obtain each target brightness value of two tone image.
Wherein, S301, S302 and S303 are similar with the realization method of S101, S102 and S103 in Fig. 1 embodiments respectively, Details are not described herein again for the present embodiment.
Further, in this embodiment color correct processing is carried out to the corresponding initial luma values of target brightness value, and will Target brightness value replace with revised initial luma values specific implementation have it is a variety of, the present embodiment does not limit this It is fixed.
Meet the target brightness value of preset condition in S304, the two tone image acquired, wherein preset condition is target All colours channel value in brightness value is the extreme value of color channel values, and in the corresponding initial luma values of target brightness value All colours channel value is not all equal.
S305, color correct processing is carried out to target brightness value, target brightness value is replaced with into revised brightness value.
Specifically, the extreme value of color channel values does not limit in the present embodiment.When color image type is RGB, preset Condition is the maximum value that all colours channel value in target brightness value is color channel values, and target pixel value is corresponding initial All colours channel value in pixel value is not all equal;When image type is CMYK, preset condition is in target brightness value All colours channel value is the minimum value of color channel values, and all colours in the corresponding original pixel values of target pixel value are logical Road value is not all equal.
Further, in obtained two tone image, it is color that the present embodiment, which can obtain all colours channel value, The extreme value of channel value, and the not all equal corresponding target of all colours channel value in the corresponding initial luma values of target pixel value Brightness value, i.e. these pixels become white pixel point after color replacement processing, and therefore, the present embodiment can be to these mesh It marks brightness value and carries out color correct processing, and target brightness value is replaced with into revised brightness value so that these pixel energy It is enough to be shown in two tone image, to solve the problems, such as the contents lost of coloured image.
Optionally, color channel values corresponding with the first designated color in target brightness value are set to maximum color channel Value, remaining color channel values are disposed as the 4th pre-set color channel value;Alternatively,
Set color channel values corresponding with the second designated color in target brightness value to maximum color channel value, remaining Color channel values are disposed as the 5th pre-set color channel value.
For example, when coloured image type is RGB, when the first designated color is red, processing is replaced by color The pixel value of pixel is (255,255,255), but the pixel value of corresponding initial pixel point is (0,255,255), due to (255-0)+(255-0)=510,510 meet the first preset range (such as larger than 160), i.e., corresponding initial pixel point belongs to red Color region, after color is replaced, which is that (255,255,255) are full white pixel Point is not belonging to the first color region, picture material loss occurs, specifically, will therefore, it is necessary to carry out color correct processing The pixel value (255,255,255) of target pixel points is modified to (255,0,0), so that the pixel after color correct Belong to same color region with corresponding initial pixel point.
Further, when coloured image type is CMYK, when the first designated color is red, red corresponding CMYK Value is (0,100,100,0), the pixel value of the pixel of processing is replaced by color as (0,0,0,0), but corresponding initial picture The pixel value of vegetarian refreshments is (0,0,100,100), since (0-0)+(100-0)+(100-100)+(100-0)=200,200 meets First preset range (such as larger than 160), i.e., corresponding initial pixel point belongs to red area, and after color is replaced, this is initial The corresponding target pixel points of pixel are that (0,0,0,0) is full white pixel point, are not belonging to the first color region, occur in image Hold and lose, therefore, it is necessary to carry out color correct processing, specifically, the pixel value (0,0,0,0) of target pixel points is modified to (0,100,100,0), so that the pixel after color correct belongs to same color area with corresponding initial pixel point Domain.
Wherein, the specific implementation of the 4th pre-set color channel value of the present embodiment pair and the 5th pre-set color channel value is not It limits.Optionally, the 4th pre-set color channel value and the 5th pre-set color channel value are corresponding with target brightness value initial The minimum value or average value of all colours channel value in brightness value.
Further, the present embodiment can effectively by two tone image it is possible that the corresponding figure of wrong white area As being modified so that each target brightness value is more accurate, improves the portrait quality of two tone image, avoids color loss Phenomenon.
In a specific embodiment, using coloured image as RGB image, red and black is respectively the first designated color With the second designated color, whether the first preset range is met according to the difference of each initial luma values and red brightness value, and the It is each that one preset range and the second preset range, which take more than 160, first pre-set color channels and the second pre-set color channel, In initial luma values for the maximum value of all colours channel value, the two tone image generation method in the present embodiment is carried out detailed Explanation.
1, the initial luma values for obtaining each pixel in RGB image, for such as only taking three pixels, the first pixel Initial luma values are that the initial luma values of rgb value (238,48,167) and the second pixel are rgb value (92,72,38) and The initial luma values of three pixels are rgb value (72,118,255).
2, according to the type of RGB image, determine that red brightness value is rgb value (255,0,0), the brightness value of black is Rgb value (0,0,0).
3, the initial luma values for calculating the first pixel are Color Channel corresponding with red in rgb value (238,48,167) The sum of value and the difference of remaining Color Channel are (238-48)+(238-167)=261>160, meet the first preset range, then the One pixel belongs to red area.
Calculate color channel values corresponding with red and remaining face in the initial luma values (92,72,38) of the second pixel The sum of difference of chrominance channel is (92-72)+(92-38)=74<160, it is unsatisfactory for the first preset range, then the second pixel belongs to Black region.
Calculate in the initial luma values (72,118,255) of third pixel with red corresponding color channel values and remaining The sum of difference of Color Channel is (118-72)+(255-72)=229,229>160, meet the first preset range, then third picture Vegetarian refreshments belongs to red area.
4, the color channel values of the r in the initial luma values (238,48,167) of the first pixel are set as 255, g's The color channel values of color channel values and b are 167, then the target brightness value of the first pixel is (255,167,167).
By in the initial luma values (92,72,38) of the second pixel the color channel values of r, the color channel values of g and The color channel values of b are set as 92, then the target brightness value of the second pixel is (92,92,92).
The color channel values of r in the initial luma values (72,118,255) of third pixel are set as 255, by g's The color channel values of color channel values and d setting be 255, then the target brightness value of third pixel be (255,255, 255)。
5, remaining initial luma values in coloured image in the way of step 3 and 4 are subjected to region division and color is replaced Processing, obtains each target brightness value in two tone image.
6, therefore the target brightness value of third pixel, which is identified as white brightness value, also needs the mesh to third pixel It marks brightness value and carries out color correct processing, by the Color Channel of the r in the initial luma values (72,118,255) of third pixel The color channel values for the color channel values and b that value is set as 255, g are set as minimum value 118, then third target brightness value is (255,118,118), belong to red area.
The embodiment of the present invention provides a kind of computer readable storage medium, including:Readable storage medium storing program for executing and computer program, The computer program is for realizing the technical solution of the above-mentioned each method embodiment of the present invention, implementing principle and technical effect class Seemingly, details are not described herein again.
Fig. 4 is the structural schematic diagram one of two tone image generating means provided by the invention, as shown in figure 4, the present embodiment Two tone image generating means may include:
Acquisition module 11, the initial luma values for obtaining each pixel in coloured image;
Determining module 12 determines the brightness value and second of the first designated color for the type according to the coloured image The brightness value of designated color;
Processing module 13, for according to each initial luma values, the brightness value of first designated color and described second The brightness value of designated color carries out color replacement processing to each initial luma values, obtains each target brightness value of two tone image.
Optionally, the processing module 13 includes:Division unit 131 and replacement unit 132;
The division unit 131, for the brightness value according to each initial luma values and first designated color, or Person carries out color region to each initial luma values and draws according to each initial luma values and the brightness value of second designated color Point, obtain the first designated color region and the second designated color region;
The replacement unit 132, for each initial luma values to first designated color region respectively and described the Each initial luma values in two designated color regions carry out color replacement processing, obtain each target brightness value of two tone image.
Optionally, the division unit 131 is specifically used for when the corresponding Color Channel of first designated color being 1 When, in the initial luma values with the difference of the first designated color corresponding color channel values and remaining color channel values The sum of meet the first preset range when, determine that the corresponding pixel of the initial luma values belongs to first designated color area Domain;
Color channel values corresponding with first designated color and remaining color channel values in the initial luma values The sum of difference when being unsatisfactory for first preset range, determine that the corresponding pixel of the initial luma values belongs to described second Designated color region;
When the corresponding Color Channel of second designated color is 1, with described second in the initial luma values When the sum of the difference of the corresponding color channel values of designated color and remaining color channel values is unsatisfactory for the second preset range, institute is determined It states the corresponding pixel of initial luma values and belongs to first designated color region;
Color channel values corresponding with second designated color and remaining color channel values in the initial luma values The sum of difference when meeting second preset range, it is specified to determine that the corresponding pixel of the initial pixel belongs to described second Color region.
Optionally, the division unit 131 is specifically additionally operable to when the corresponding Color Channel of first designated color be 2 It is a or more than 2 when, in each color channel values and the corresponding each face of first designated color of the initial luma values When the sum of the difference of chrominance channel value meets third preset range, determine that the corresponding pixel of the initial luma values belongs to described One designated color region;
In each color channel values and the corresponding each Color Channel of first designated color of the initial luma values When the sum of difference of value is unsatisfactory for third preset range, determine that the corresponding pixel of the initial luma values belongs to described second and refers to Determine color region;
When the corresponding Color Channel of second designated color is 2 or is more than 2, in each of the initial luma values The sum of the difference of a color channel values and the corresponding each color channel values of second designated color is unsatisfactory for the 4th default model When enclosing, determine that the corresponding pixel of the initial luma values belongs to first designated color region;
In each color channel values and the corresponding each Color Channel of second designated color of the initial luma values When the sum of difference of value meets four preset ranges, it is specified to determine that the corresponding pixel of the initial luma values belongs to described second Color region.
Optionally, the replacement unit 132 is specifically used for when first designated color is colored, by described first It is logical to be set as maximum color for color channel values corresponding with first designated color in the initial luma values in designated color region Road value, and remaining color channel values in the initial luma values in first designated color region are disposed as the first pre-set color Channel value obtains the target brightness value of the two tone image;
When second designated color is colored, by the initial luma values in second designated color region with it is described The corresponding color channel values of second designated color are set as maximum color channel value, and will be at the beginning of second designated color region Remaining color channel values is disposed as the second pre-set color channel value in beginning brightness value, obtains the object brightness of the two tone image Value;Alternatively,
When second designated color is achromaticity, will own in the initial luma values in second designated color region Color channel values are disposed as third pre-set color channel value, obtain the target brightness value of the two tone image.
Optionally, the first pre-set color channel value, the second pre-set color channel value are the initial luma values Any in the maximum value of middle all colours channel value, minimum value and average value, the third pre-set color channel value is described The minimum value or average value of all colours channel value in initial luma values.
Fig. 5 is the structural schematic diagram two of two tone image generating means provided by the invention, as shown in figure 5, the present embodiment On the basis of two tone image generating means apparatus structure shown in Fig. 4, further include:
The acquisition module 11 is additionally operable to meet the object brightness of preset condition in the two tone image acquired Value, wherein the preset condition is the extreme value that all colours channel value in the target brightness value is color channel values, and All colours channel value in the corresponding initial luma values of the target brightness value is not all equal;
Correcting module 14 replaces the target brightness value for carrying out color correct processing to the target brightness value For revised brightness value.
Optionally, the correcting module 14, be specifically used for by the target brightness value with first designated color pair The color channel values answered are set as maximum color channel value, remaining color channel values is disposed as the 4th pre-set color channel value; Alternatively,
It, will be corresponding with second designated color in the target brightness value when second designated color is colored Color channel values are set as maximum color channel value, remaining color channel values is disposed as the 5th pre-set color channel value.
Optionally, the 4th pre-set color channel value and the 5th pre-set color channel value are and the object brightness It is worth the minimum value or average value of all colours channel value in corresponding initial luma values.
The two tone image generating means of the present embodiment can be used for executing the skill of above-mentioned two tone image generation method embodiment Art scheme, implementing principle and technical effect are similar, and details are not described herein again.
According to the above method example two tone image generating means can be carried out with the division of function module, example in the present invention Such as, each function can be corresponded to and divide each function module, two or more functions can also be integrated at one It manages in module.The form that hardware had both may be used in above-mentioned integrated module is realized, the form of software function module can also be used It realizes.It should be noted that being schematical to the division of module in various embodiments of the present invention, only a kind of logic function is drawn Point, formula that in actual implementation, there may be another division manner.
Fig. 6 is the structural schematic diagram three of two tone image generating means provided by the invention, as shown in fig. 6, the present embodiment Two tone image generating means may include:
Processor 21;And
Memory 22, the executable instruction for storing the processor 21;
Wherein, the processor 21 is configured to execute two tone image described above via the executable instruction is executed Generation method.
One of ordinary skill in the art will appreciate that:Realize that all or part of step of above-mentioned each method embodiment can lead to The relevant hardware of program instruction is crossed to complete.Program above-mentioned can be stored in a computer read/write memory medium.The journey When being executed, execution includes the steps that above-mentioned each method embodiment to sequence;And storage medium above-mentioned includes:ROM, RAM, magnetic disc or The various media that can store program code such as person's CD.
Finally it should be noted that:The above embodiments are only used to illustrate the technical solution of the present invention., rather than its limitations;To the greatest extent Present invention has been described in detail with reference to the aforementioned embodiments for pipe, it will be understood by those of ordinary skill in the art that:Its according to So can with technical scheme described in the above embodiments is modified, either to which part or all technical features into Row equivalent replacement;And these modifications or replacements, various embodiments of the present invention technology that it does not separate the essence of the corresponding technical solution The range of scheme.

Claims (12)

1. a kind of two tone image generation method, which is characterized in that including:
Obtain the initial luma values of each pixel in coloured image;
According to the type of the coloured image, the brightness value of the brightness value and the second designated color of the first designated color is determined;
It is right according to each initial luma values, the brightness value of the brightness value of first designated color and second designated color Each initial luma values carry out color replacement processing, obtain each target brightness value of two tone image.
2. according to the method described in claim 1, it is characterized in that, it is described according to each initial luma values, the first specified face The brightness value of the brightness value of color and second designated color carries out color replacement processing to each initial luma values, obtains double Each target brightness value of color image, including:
According to each initial luma values and the brightness value of first designated color, alternatively, according to each initial luma values and institute The brightness value for stating the second designated color, to each initial luma values carry out color region division, obtain the first designated color region and Second designated color region;
Each initial luma values to first designated color region and second designated color region is each initial bright respectively Angle value carries out color replacement processing, obtains each target brightness value of two tone image.
3. according to the method described in claim 2, it is characterized in that, when the corresponding Color Channel of first designated color is 1 It is described according to each initial luma values and the brightness value of first designated color when a, color is carried out to each initial luma values Region division obtains the first designated color region and the second designated color region, including:
In the initial luma values with the difference of the first designated color corresponding color channel values and remaining color channel values When the sum of value meets the first preset range, determine that the corresponding pixel of the initial luma values belongs to first designated color area Domain;
In the initial luma values with the difference of the first designated color corresponding color channel values and remaining color channel values When the sum of value is unsatisfactory for first preset range, it is specified to determine that the corresponding pixel of the initial luma values belongs to described second Color region;
It is described according to each initial luma values and described second when the corresponding Color Channel of second designated color is 1 The brightness value of designated color carries out color region division to each initial luma values, obtains the first designated color region and second and refers to Determine color region, including:
In the initial luma values with the difference of the second designated color corresponding color channel values and remaining color channel values When the sum of value is unsatisfactory for the second preset range, determine that the corresponding pixel of the initial luma values belongs to first designated color Region;
In the initial luma values with the difference of the second designated color corresponding color channel values and remaining color channel values When the sum of value meets the second preset range, determine that the corresponding pixel of the initial luma values belongs to second designated color area Domain.
4. according to the method described in claim 2, it is characterized in that, when the corresponding Color Channel of first designated color is 2 It is a or when more than 2, it is described according to each initial luma values and the brightness value of first designated color, to each initial luma values Color region division is carried out, the first designated color region and the second designated color region is obtained, further includes:
In each color channel values and first designated color corresponding each color channel values of the initial luma values When the sum of difference meets third preset range, determine that the corresponding pixel of the initial luma values belongs to first designated color Region;
In each color channel values and first designated color corresponding each color channel values of the initial luma values When the sum of difference is unsatisfactory for third preset range, determine that the corresponding pixel of the initial luma values belongs to the described second specified face Color region;
When the corresponding Color Channel of second designated color is 2 or when more than 2, it is described according to each initial luma values and The brightness value of second designated color carries out color region division to each initial luma values, obtains the first designated color region With the second designated color region, including:
In each color channel values and second designated color corresponding each color channel values of the initial luma values When the sum of difference is unsatisfactory for four preset ranges, determine that the corresponding pixel of the initial luma values belongs to the described first specified face Color region;
In each color channel values and second designated color corresponding each color channel values of the initial luma values When the sum of difference meets four preset ranges, determine that the corresponding pixel of the initial luma values belongs to second designated color Region.
5. according to the method described in claim 2, it is characterized in that, described respectively to each first of first designated color region Beginning brightness value and each initial luma values in second designated color region carry out color replacement processing, obtain each of two tone image Target brightness value, including:
When first designated color is colored, by the initial luma values in first designated color region with described first The corresponding color channel values of designated color are set as maximum color channel value, and by the initial bright of first designated color region Remaining color channel values is disposed as the first pre-set color channel value in angle value, obtains the target brightness value of the two tone image;
When second designated color is colored, by the initial luma values in second designated color region with described second The corresponding color channel values of designated color are set as maximum color channel value, and by the initial bright of second designated color region Remaining color channel values is disposed as the second pre-set color channel value in angle value, obtains the target brightness value of the two tone image; Alternatively,
When second designated color is achromaticity, by all colours in the initial luma values in second designated color region Channel value is disposed as third pre-set color channel value, obtains the target brightness value of the two tone image.
6. according to the method described in claim 5, it is characterized in that, the first pre-set color channel value, described second default Color channel values are any in the maximum value of all colours channel value, minimum value and average value, institute in the initial luma values State the minimum value or average value that third pre-set color channel value is all colours channel value in the initial luma values.
7. according to the method described in claim 1, it is characterized in that, the method further includes:
Meet the target brightness value of preset condition in the two tone image acquired, wherein the preset condition is described All colours channel value in target brightness value is the extreme value of color channel values, and the target brightness value is corresponding initial bright All colours channel value in angle value is not all equal;
Color correct processing is carried out to the target brightness value, the target brightness value is replaced with into revised brightness value.
8. the method according to the description of claim 7 is characterized in that it is described to each target brightness value carry out color correct processing, Including:
Set color channel values corresponding with first designated color in the target brightness value to maximum color channel value, Remaining color channel values is disposed as the 4th pre-set color channel value;Alternatively,
Set color channel values corresponding with second designated color in the target brightness value to maximum color channel value, Remaining color channel values is disposed as the 5th pre-set color channel value.
9. according to the method described in claim 8, it is characterized in that, the 4th pre-set color channel value is bright with the target The minimum value or average value of all colours channel value in the corresponding initial luma values of angle value.
10. a kind of two tone image generating means, which is characterized in that including:
Acquisition module, the initial luma values for obtaining each pixel in coloured image;
Determining module determines the brightness value and the second specified face of the first designated color for the type according to the coloured image The brightness value of color;
Replacement module, for according to each initial luma values, the brightness value of first designated color and the second specified face The brightness value of color carries out color replacement processing to each initial luma values, obtains each target brightness value of two tone image.
11. a kind of computer readable storage medium, is stored thereon with computer program, which is characterized in that the computer program Claim 1-9 any one of them two tone image generation methods are realized when being executed by processor.
12. a kind of two tone image generating means, which is characterized in that including:
Processor;And
Memory, the executable instruction for storing the processor;
Wherein, the processor is configured to carry out perform claim requirement 1-9 any one of them via the execution executable instruction Two tone image generation method.
CN201810088380.7A 2018-01-30 2018-01-30 Method and apparatus for generating a bi-color image Active CN108304147B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810088380.7A CN108304147B (en) 2018-01-30 2018-01-30 Method and apparatus for generating a bi-color image

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810088380.7A CN108304147B (en) 2018-01-30 2018-01-30 Method and apparatus for generating a bi-color image

Publications (2)

Publication Number Publication Date
CN108304147A true CN108304147A (en) 2018-07-20
CN108304147B CN108304147B (en) 2021-02-19

Family

ID=62867216

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810088380.7A Active CN108304147B (en) 2018-01-30 2018-01-30 Method and apparatus for generating a bi-color image

Country Status (1)

Country Link
CN (1) CN108304147B (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110473282A (en) * 2019-08-22 2019-11-19 腾讯科技(深圳)有限公司 Dyeing treatment, device, computer equipment and the storage medium of object model
WO2022150968A1 (en) * 2021-01-12 2022-07-21 深圳市艾比森光电股份有限公司 Marker display method and relevant product

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101150653A (en) * 2006-09-20 2008-03-26 村田机械株式会社 Image processing apparatus and image processing method
CN102055882A (en) * 2009-10-30 2011-05-11 夏普株式会社 Image processing apparatus, image forming apparatus, image processing method, and computer-readable recording medium on which image processing program is recorded
CN102710888A (en) * 2011-03-28 2012-10-03 富士施乐株式会社 Bi-color -image-signal generating apparatus, image forming system, bi-color -image-signal generation method, and computer-readable medium
US9324010B2 (en) * 2014-07-15 2016-04-26 Canon Kabushiki Kaisha Image forming apparatus
CN205249321U (en) * 2015-09-28 2016-05-18 天津光电通信技术有限公司 Print data system
CN106340025A (en) * 2016-08-28 2017-01-18 张朝阳 Background replacement visual communication method based on chromatic adaptation transformation
CN107580158A (en) * 2017-10-17 2018-01-12 珠海奔图电子有限公司 Image color edge minimizing technology and device

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101150653A (en) * 2006-09-20 2008-03-26 村田机械株式会社 Image processing apparatus and image processing method
CN102055882A (en) * 2009-10-30 2011-05-11 夏普株式会社 Image processing apparatus, image forming apparatus, image processing method, and computer-readable recording medium on which image processing program is recorded
CN102710888A (en) * 2011-03-28 2012-10-03 富士施乐株式会社 Bi-color -image-signal generating apparatus, image forming system, bi-color -image-signal generation method, and computer-readable medium
US9324010B2 (en) * 2014-07-15 2016-04-26 Canon Kabushiki Kaisha Image forming apparatus
CN205249321U (en) * 2015-09-28 2016-05-18 天津光电通信技术有限公司 Print data system
CN106340025A (en) * 2016-08-28 2017-01-18 张朝阳 Background replacement visual communication method based on chromatic adaptation transformation
CN107580158A (en) * 2017-10-17 2018-01-12 珠海奔图电子有限公司 Image color edge minimizing technology and device

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110473282A (en) * 2019-08-22 2019-11-19 腾讯科技(深圳)有限公司 Dyeing treatment, device, computer equipment and the storage medium of object model
WO2022150968A1 (en) * 2021-01-12 2022-07-21 深圳市艾比森光电股份有限公司 Marker display method and relevant product

Also Published As

Publication number Publication date
CN108304147B (en) 2021-02-19

Similar Documents

Publication Publication Date Title
WO2021047383A1 (en) Image processing method and apparatus for electronic ink screen, and electronic ink screen
CN103325351B (en) Image processing apparatus and image processing method
JP3095818B2 (en) Method and apparatus for mapping a color image to a black and white image
CN105574918B (en) A kind of material adding method, device and the terminal of 3D models
CN107945729A (en) Conversion method and circuit, display device and driving method and circuit, storage medium
TWI597708B (en) Electronic display
WO2022057495A1 (en) Grayscale data determination method and apparatus, and device and screen drive board
CN104811676B (en) Gamut mapping method and gamut mapping device
CN113314079B (en) Picture display method and device, electronic equipment and storage medium
CN114489608B (en) Display screen icon control method and device, terminal equipment and storage medium
CN108304147A (en) Two tone image generation method and device
JP2015523593A5 (en)
JP2006081151A (en) Graphical user interface for keyer
CN115909980B (en) Text display optimization method, device, equipment and storage medium
CN103259961B (en) Image processing apparatus and image processing method
CN116597789B (en) Picture display method, device and equipment of color ink screen and storage medium
JP4174133B2 (en) Image generation method
TWI356394B (en) Image data generating device, image data generatin
CN107919103A (en) Multiple bases conversion method, driving method, readable storage medium storing program for executing and display device
JP2019205103A (en) Information processing apparatus, information processing method, and program
CN111338627B (en) Front-end webpage theme color adjustment method and device
CN106325665B (en) Display control method and electronic equipment
CN117894269B (en) Data processing method, processing device and chip
CN104977748B (en) Color membrane substrates and preparation method thereof, display device and its display methods
CN115576517B (en) Text display method, text display device, text display equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant