CN102855647B - A kind of by the method for image watercolor stylization and image processing system - Google Patents

A kind of by the method for image watercolor stylization and image processing system Download PDF

Info

Publication number
CN102855647B
CN102855647B CN201210253974.1A CN201210253974A CN102855647B CN 102855647 B CN102855647 B CN 102855647B CN 201210253974 A CN201210253974 A CN 201210253974A CN 102855647 B CN102855647 B CN 102855647B
Authority
CN
China
Prior art keywords
window
pixel
value
picture
gray
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.)
Expired - Fee Related
Application number
CN201210253974.1A
Other languages
Chinese (zh)
Other versions
CN102855647A (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.)
Vtron Group Co Ltd
Original Assignee
Vtron Technologies 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 Vtron Technologies Ltd filed Critical Vtron Technologies Ltd
Priority to CN201210253974.1A priority Critical patent/CN102855647B/en
Publication of CN102855647A publication Critical patent/CN102855647A/en
Application granted granted Critical
Publication of CN102855647B publication Critical patent/CN102855647B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Image Processing (AREA)

Abstract

The invention discloses a kind of by the method for image watercolor stylization and image processing system.Technical solution of the present invention adopts to be needed to set window in image to be processed, then by the movement of window with judge between pixel gray-scale value magnitude relationship, by the pixel value of the pixel of maximum gradation value in subrange, and the pixel value of the pixel of minimum gradation value spreads apart, thus the transition pixel values decreased in image, form the imitative watercolor effect with irregular block shape, namely achieve the object of image watercolor stylization; The program realizes simple, and effect is also better.

Description

A kind of by the method for image watercolor stylization and image processing system
Technical field
The present invention relates to technical field of image processing, be specifically related to a kind of by the method for image watercolor stylization and image processing system.
Background technology
Image procossing, refers to and utilizes computing machine to analyze image, to reach the technology of results needed.Also known as image processing; Its basic index word image procossing, wherein, digital picture refers to the two-dimensional array that of obtaining through over-sampling and digitizing with the equipment such as digital camera, scanner is large, and the element of this array is called pixel, and its value is an integer, is called gray-scale value.
Along with the development of computer technology, the various technology about image procossing are also more and more diversified, are exactly wherein a kind of by the stylization of image watercolor.What propose watercolor analogy method the earliest is that the cellular automaton (Cellular Automata) of Small in 1991 is theoretical, be used for simulating the reciprocation of pigment and water, obtain watercolor simulate effect comparatively true to nature, on this basis, Curtis proposes a classical watercolor modeling, this system is by using three layer model, and namely shoaling layer model, pigmentation layer model and capillary action layer model simulate the flowing of fluid and the diffusion of pigment.After this, prior art also been proposed several by the method for image watercolor stylization, such as, the method for drafting carrying out Simulated Water colour painting effect based on simple spatial filtering proposed by Lei and Chang, the effect of the method by using Sobel (Sobel) wave filter to produce edge darkening; The method mainly comprises appointment and the painted two benches of watercolor of color belt, wherein the appointment of color belt can be that each object in scene specifies a color belt by user, simulate the effects such as pigment flowing and pigment reversion, watercolor tinting stage is then used for simulating edge darkening effect, granules of pigments separating effect, paper texture effect and further pigment flow effect etc.
To in the research and practice process of prior art, the present inventor finds, existing these are all too complicated by the method for image watercolor stylization, such as needs Modling model or the process etc. through multiple stage, not only not easily realize, and need to consume larger computing cost.
Summary of the invention
The embodiment of the present invention provides a kind of by the method for image watercolor stylization and image processing system, and not only realize simple, computing cost is little, and effect is better.
By a method for image watercolor stylization, comprising:
Obtain and need picture to be processed, and set window on described picture;
Described window is moved according to preset pixel size;
Obtain gray-scale value and first value of center pixel in mobile rear hatch, described first value is that the average of the gray-scale value of all pixels in mobile rear hatch is multiplied by weighted value;
Determine whether the gray-scale value of described center pixel is greater than described first value;
If so, then by the rgb value of pixel corresponding before this window moves for pixel maximum for gray-scale value in mobile rear hatch, as the rgb value of described center pixel, and execution is returned by the step of described window according to preset pixel size movement;
If not, then by the rgb value of pixel corresponding before this window moves for pixel minimum for gray-scale value in mobile rear hatch, as the rgb value of described center pixel, and return execution by the step of described window according to preset pixel size movement.
Optionally, wherein, described picture sets window to be specifically as follows: at the upper left corner of described picture setting window;
Then now, described movement according to preset pixel size by described window is specifically as follows: from the upper left corner of described picture, from left to right move line by line according to preset pixel size; Or, from the upper left corner of described picture, move by column from top to bottom according to preset pixel size.
Or optionally, the described window that sets on described picture also can be specifically: at the upper right corner of described picture setting window;
Then now, described movement according to preset pixel size by described window is specially: from the upper right corner of described picture, move line by line from right to left according to preset pixel size; Or, from the upper right corner of described picture, move by column from top to bottom according to preset pixel size.
Or, optionally, describedly on described picture, set window be specially: at the lower left corner of described picture setting window;
Then now, described movement according to preset pixel size by described window also can be specifically: from the lower left corner of described picture, from left to right move line by line according to preset pixel size; Or, from the lower left corner of described picture, move by column from top to bottom according to preset pixel size.
Or optionally, the described window that sets on described picture can also be specifically: at the lower right corner of described picture setting window;
Then now, described movement according to preset pixel size by described window is specially: from the lower right corner of described picture, move line by line from right to left according to preset pixel size; Or, from the lower right corner of described picture, move by column from top to bottom according to preset pixel size.
Optionally, wherein, described setting window is specifically as follows: the setting shape of window and size, and described shape comprises rhombus, square or circular.
Optionally, in the mobile rear hatch of described acquisition, the gray-scale value of center pixel and the first value can comprise:
Obtain the gray-scale value of center pixel in mobile rear hatch; And, obtain the gray-scale value of all pixels in mobile rear hatch, calculate the average of the gray-scale value of all pixels in described mobile rear hatch, described average is multiplied by weighted value, obtain the first value.
Accordingly, the embodiment of the present invention also provides a kind of image processing system, comprises initialization unit, mobile unit, gray-scale value acquiring unit, judging unit, the first processing unit and the second processing unit;
Initialization unit, needs picture to be processed for obtaining, and set window on described picture;
Mobile unit, moves according to preset pixel size for window initialization unit set;
Gray-scale value acquiring unit, for obtaining gray-scale value and first value of center pixel in mobile rear hatch, described first value is that the average of the gray-scale value of all pixels in mobile rear hatch is multiplied by weighted value;
Judging unit, for determining whether the gray-scale value of described center pixel is greater than described average;
First processing unit, during for determining that the gray-scale value of described center pixel is greater than described first value at judging unit, by the rgb value of pixel corresponding before this window moves for pixel maximum for gray-scale value in mobile rear hatch, as the rgb value of described center pixel, and trigger mobile unit execution by the operation of described window according to preset pixel size movement;
Second processing unit, during for determining that the gray-scale value of described center pixel is less than or equal to described first value at judging unit, by the rgb value of pixel corresponding before this window moves for pixel minimum for gray-scale value in mobile rear hatch, as the rgb value of described center pixel, and trigger mobile unit execution by the operation of described window according to preset pixel size movement.
Optionally, described initialization unit, specifically may be used at the upper left corner of described picture setting window;
Then now, described mobile unit, specifically for the upper left corner from described picture, from left to right moves line by line according to preset pixel size; Or, from the upper left corner of described picture, move by column from top to bottom according to preset pixel size.
Or optionally, described initialization unit, specifically may be used at the upper right corner of described picture setting window;
Then now, described mobile unit, specifically may be used for, from the upper right corner of described picture, moving line by line from right to left according to preset pixel size; Or, from the upper right corner of described picture, move by column from top to bottom according to preset pixel size.
Or optionally, described initialization unit, specifically may be used at the lower left corner of described picture setting window;
Then now, described mobile unit, specifically may be used for, from the lower left corner of described picture, from left to right moving line by line according to preset pixel size; Or, from the lower left corner of described picture, move by column from top to bottom according to preset pixel size.
Or optionally, described initialization unit, specifically may be used at the lower right corner of described picture setting window;
Then now, described mobile unit, specifically may be used for, from the lower right corner of described picture, moving line by line from right to left according to preset pixel size; Or, from the lower right corner of described picture, move by column from top to bottom according to preset pixel size.
Further, described gray-scale value acquiring unit can comprise the first acquisition subelement and second and obtain subelement, as follows:
First obtains subelement, for obtaining the gray-scale value of center pixel in mobile rear hatch;
Second obtains subelement, for obtaining the gray-scale value of all pixels in mobile rear hatch, calculating the average of the gray-scale value of all pixels in described mobile rear hatch, described average is multiplied by weighted value, obtaining the first value.
The embodiment of the present invention adopts to be needed to set window in image to be processed, then by the movement of window with judge between pixel gray-scale value magnitude relationship, by the pixel value of the pixel of maximum gradation value in subrange, and the pixel value of the pixel of minimum gradation value spreads apart, thus the transition pixel values decreased in image, form the imitative watercolor effect with irregular block shape, namely achieve the object of image watercolor stylization; The program, without the need to Modling model or the process through multiple stage, realize comparatively simple, and effect is also comparatively obvious.
Accompanying drawing explanation
In order to be illustrated more clearly in the technical scheme in the embodiment of the present invention, below the accompanying drawing used required in describing embodiment is briefly described, apparently, accompanying drawing in the following describes is only some embodiments of the present invention, for those skilled in the art, under the prerequisite not paying creative work, other accompanying drawing can also be obtained according to these accompanying drawings.
Fig. 1 be the embodiment of the present invention provide by the process flow diagram of the method for image watercolor stylization;
Fig. 2 be the embodiment of the present invention provide by the another process flow diagram of the method for image watercolor stylization;
Fig. 3 a is the schematic diagram of moving window first;
Fig. 3 b is the schematic diagram of second time moving window;
Fig. 3 c is after third time moving window, the relation schematic diagram of current window and window reference position;
Fig. 3 d is that the window of the second row pixel moves schematic diagram;
Fig. 4 be the embodiment of the present invention provide the structural drawing of image processing system.
Embodiment
Below in conjunction with the accompanying drawing in the embodiment of the present invention, be clearly and completely described the technical scheme in the embodiment of the present invention, obviously, described embodiment is only the present invention's part embodiment, instead of whole embodiments.Based on the embodiment in the present invention, those skilled in the art, not making the every other embodiment obtained under creative work prerequisite, belong to the scope of protection of the invention.
The embodiment of the present invention provides a kind of by the method for image watercolor stylization and image processing system.Below be described in detail respectively.
Embodiment one,
Angle from image processing system is described by the present embodiment, and this image processing system specifically can be integrated in terminal, in such as mobile phone, notebook computer or panel computer etc.
By a method for image watercolor stylization, comprising: obtain and need picture to be processed, picture sets window; This window is moved according to preset pixel size; Obtain gray-scale value and first value of center pixel in mobile rear hatch, described first value is that the average of the gray-scale value of all pixels in mobile rear hatch is multiplied by weighted value; Determine whether the gray-scale value of this center pixel is greater than this first value; If so, then by the rgb value of pixel corresponding before this window moves for pixel maximum for gray-scale value in mobile rear hatch, as the rgb value of this center pixel, and execution is returned by the step of this window according to preset pixel size movement; If not, then by the rgb value of pixel corresponding before this window moves for pixel minimum for gray-scale value in mobile rear hatch, as the rgb value of this center pixel, and return execution by the step of this window according to preset pixel size movement.
As shown in Figure 1, idiographic flow can be as follows:
101, acquisition needs picture to be processed, and sets window on this picture.
Such as, specifically can set window in the places such as the upper left corner of this picture, the upper right corner, the lower left corner or the lower right corner, such as set shape and the size of window, wherein, the shape of window can comprise rhombus, the shape such as square or circular; The size of window can be arranged according to the demand of practical application.
102, the window of setting in step 101 is moved according to preset pixel size.
Optionally, in order to reach better watercolor stylize effect, the pixel of whole pictures can be allowed as far as possible to traverse, and keep window to move and be continuous print and have certain directivity as far as possible, such as, specifically can be as follows:
(1) if step 101 is at the upper left corner of picture setting window, then now, this window is moved according to preset pixel size and is specially:
From the upper left corner of this picture, from left to right move line by line according to preset pixel size; Or,
From the upper left corner of this picture, move by column from top to bottom according to preset pixel size.
That is, can from the upper left corner of this picture (i.e. first pixel of the first row, also be first pixel of first row) start, from left to right move according to preset pixel size, until traveled through all pixels of the first row, then again from first pixel of the second row of this picture, from left to right move according to preset pixel size, until traveled through all pixels of the second row, moreover, in the same way the pixel of the third line is processed again, by that analogy, until travel through all pixels of complete pictures.Or,
Can from the upper left corner of this picture (first pixel of first row, also be first pixel of the first row) start, move from top to bottom according to preset pixel size, until traveled through all pixels of first row, then again from first pixel of the secondary series of this picture, move from top to bottom according to preset pixel size, until traveled through all pixels of secondary series, moreover, process in the same way again and tertial pixel is processed, by that analogy, until travel through all pixels of complete pictures.
(2) if step 101 is at the upper right corner of picture setting window, then now, this window is moved according to preset pixel size and is specially:
From the upper right corner of this picture, move line by line from right to left according to preset pixel size; Or,
From the upper right corner of this picture, move by column from top to bottom according to preset pixel size.
That is, can from the upper right corner of this picture (i.e. last pixel of the first row, also be first pixel of last row) start, move from right to left according to preset pixel size, until traveled through all pixels of the first row, then again from last pixel of the second row of this picture, move from right to left according to preset pixel size, until traveled through all pixels of the second row, moreover, in the same way the pixel of the third line is processed again, by that analogy, until travel through all pixels of complete pictures.Or,
Can from the upper right corner of this picture (first pixel of last row, also be last pixel of the first row) start, move from top to bottom according to preset pixel size, until traveled through all pixels of this last first row, then again from first pixel of the row second from the bottom of this picture, move from top to bottom according to preset pixel size, until traveled through all pixels of these row second from the bottom, moreover, process in the same way again and the pixel of row third from the bottom is processed, by that analogy, until travel through all pixels of complete pictures.
(3) if step 101 is at the lower left corner of picture setting window, then now, this window is moved according to preset pixel size and is specially:
From the lower left corner of this picture, from left to right move line by line according to preset pixel size; Or,
From the lower left corner of this picture, move by column from top to bottom according to preset pixel size.
That is, can from the lower left corner of this picture (i.e. first pixel of last the first row, also be last pixel of first row) start, from left to right move according to preset pixel size, until traveled through all pixels of this last the first row, then again from first pixel of the row second from the bottom of this picture, from left to right move according to preset pixel size, until traveled through all pixels of band row second from the bottom, moreover, in the same way the pixel of countdown line 3 is processed again, by that analogy, until travel through all pixels of complete pictures.Or,
Can from the lower left corner of this picture (last pixel of first row, also be first pixel of last the first row) start, move from top to bottom according to preset pixel size, until traveled through all pixels of first row, then again from last pixel of the secondary series of this picture, move from Xia Dao road according to preset pixel size, until traveled through all pixels of secondary series, moreover, process in the same way again and tertial pixel is processed, by that analogy, until travel through all pixels of complete pictures.
(4) if step 101 is at the lower right corner of picture setting window, then now, this window is moved according to preset pixel size and is specially:
From the lower right corner of this picture, move line by line from right to left according to preset pixel size; Or,
From the lower right corner of this picture, move by column from top to bottom according to preset pixel size.
That is, can from the lower right corner of this picture (i.e. last pixel of last column, also be last pixel of last row) start, move from right to left according to preset pixel size, until traveled through all pixels of last column, then again from last pixel of the row second from the bottom of this picture, move from right to left according to preset pixel size, until traveled through all pixels of this row second from the bottom, moreover, in the same way the pixel of countdown line 3 is processed again, by that analogy, until travel through all pixels of complete pictures.Or,
Can from the lower right corner of this picture (last pixel of last row, also be last pixel of last column) start, move from top to bottom according to preset pixel size, until traveled through all pixels of this last first row, then again from last pixel of the row second from the bottom of this picture, move from top to bottom according to preset pixel size, until traveled through all pixels of these row second from the bottom, moreover, process in the same way again and the pixel of row third from the bottom is processed, by that analogy, until travel through all pixels of complete pictures.
Wherein, the pixel size (i.e. the distance size of movement) of movement each time can be arranged according to the demand of practical application, such as, can set a mobile pixel each time, or move two pixels each time, by that analogy, etc.
103, obtain the gray-scale value of center pixel in mobile rear hatch, and obtain the first value, this first value is that the average of the gray-scale value of all pixels in mobile rear hatch is multiplied by weighted value; Such as, specifically can be as follows:
Obtain the gray-scale value of center pixel in mobile rear hatch; And
Obtain the gray-scale value of all pixels in mobile rear hatch, then calculate the average that this moves the gray-scale value of all pixels in rear hatch, this average is multiplied by weighted value.
Wherein, the value of weighted value can be arranged according to the demand of practical application, such as, this weighted value can be set to 1, then now the first value is the average of the gray-scale value of all pixels " in the mobile rear hatch ", and in order to reach better watercolor effect, this weighted value generally can be set to 0.95; Certainly, this weighted value also can be set to other values, does not repeat them here.
104, in the mobile rear hatch got in determining step 103, whether the gray-scale value of center pixel is greater than the first value (average namely moving the gray-scale value of all pixels in rear hatch is multiplied by weighted value), if so, then performs step 105, if not, then performs step 106.
If the gray-scale value of center pixel is greater than the first value (average namely moving the gray-scale value of all pixels in rear hatch is multiplied by weighted value) in 105 mobile rear hatches, then by the rgb value of pixel corresponding before this window moves for pixel maximum for gray-scale value in mobile rear hatch, the rgb value of center pixel in rear hatch is moved as this, and return execution step 102, namely circulation performs step 102 ~ 106, until whole pictures is disposed.
Wherein, the embodiment of the present invention said " pixel that the pixel that in mobile rear hatch, gray-scale value is maximum is corresponding before this window moves " refers to the pixel being positioned at same position with " pixel that in mobile rear hatch, gray-scale value is maximum " in this window, such as, the center pixel that " pixel that in mobile rear hatch, gray-scale value is maximum " is this window current, then " pixel that in mobile rear hatch, gray-scale value is maximum before this window moves corresponding pixel " what refer to is exactly the center pixel of this window before this moves.
If the gray-scale value of center pixel is less than or equal to the first value (average namely moving the gray-scale value of all pixels in rear hatch is multiplied by weighted value) in 106 mobile rear hatches, then by the rgb value of pixel corresponding before this window moves for pixel minimum for gray-scale value in mobile rear hatch, the rgb value of center pixel in rear hatch is moved as this, and return execution step 102, namely circulation performs step 102 ~ 106, until whole pictures is disposed.
Wherein, the embodiment of the present invention said " pixel that the pixel that in mobile rear hatch, gray-scale value is minimum is corresponding before this window moves " refers to the pixel being positioned at same position with " pixel that in mobile rear hatch, gray-scale value is minimum " in this window, such as, the center pixel that " pixel that in mobile rear hatch, gray-scale value is minimum " is this window current, then " pixel that in mobile rear hatch, gray-scale value is minimum before this window moves corresponding pixel " what refer to is exactly the center pixel of this window before this moves.
As from the foregoing, the present embodiment adopts to be needed to set window in image to be processed, then by the movement of window with judge between pixel gray-scale value magnitude relationship, by the pixel value of the pixel of maximum gradation value in subrange, and the pixel value of the pixel of minimum gradation value spreads apart, thus the transition pixel values decreased in image, form the imitative watercolor effect with irregular block shape, namely achieve the object of image watercolor stylization; The program, without the need to Modling model or the process through multiple stage, realize comparatively simple, and effect is also comparatively obvious.
Embodiment two,
According to the method described by embodiment one, below citing is described in further detail.
As shown in Figure 2, idiographic flow can be as follows:
201, image processing system obtains needs picture to be processed, and sets window on this picture.
Such as, specifically can set window in the places such as the upper left corner of this picture, the upper right corner, the lower left corner or the lower right corner, such as set shape and the size of window, wherein, the shape of window can comprise rhombus, the shape such as square or circular, and the shape of window and size all can set according to the demand of practical application.For convenience, in the present embodiment, be described to set window in the upper left corner of this picture.
It should be noted that, wherein, this image processing system specifically can be integrated in terminal, is such as integrated in the terminals such as mobile phone, notebook computer or panel computer.
202, the window of setting moves according to preset pixel size by image processing system, wherein, pixel size (the i.e. size of movement of movement each time, the distance of movement in other words) can arrange according to the demand of practical application, such as, window can be set and can move a pixel size, two pixel sizes or three pixel sizes etc. each time, by that analogy.
For convenience, the present embodiment will be 2 pixels with the length of window, and wide is 1 pixel, and each mobile pixel size is from left to right that example is described.
See Fig. 3 a, when moving first, image processing system is from the upper left corner of this picture, and move right the window of setting a pixel, wherein, empty wire frame representation this move the position of front window, solid box represents that this moves the position of rear hatch.See Fig. 3 b, this figure is the schematic diagram of image processing system second time moving window, same, empty wire frame representation this move the position of front window, solid box represents that this moves the position of rear hatch.Fig. 3 c is after third time moving window, the relation schematic diagram (owing to moving a pixel at every turn, so after moving for the third time, window differs 3 pixels with reference position) of current window and window reference position.And Fig. 3 d, be then that the window of the second row pixel moves schematic diagram, namely image processing system is after processing all pixels of the first row, and the window starting to process the second row pixel moves schematic diagram.
It should be noted that, the present embodiment is only 2 pixels with the length of window, wide is 1 pixel, and each mobile pixel size is from left to right that example is described, should be understood that, also can realize with other window sizes and with other move mode, its implementation is similar, does not repeat them here.
203, window often moves once, and image processing system obtains the gray-scale value of center pixel in mobile rear hatch, and obtains the first value, and then perform step 204, wherein, the average that the first value is specially the gray-scale value of all pixels in mobile rear hatch is multiplied by weighted value.Such as, specifically can be as follows:
Obtain the gray-scale value of center pixel in mobile rear hatch, and obtain the gray-scale value of all pixels in mobile rear hatch, then calculate the gray-scale value that this moves all pixels in rear hatch.Such as, if (x 0, y 0) be center pixel coordinate figure, (x, y) is the coordinate figure of pixel in window, then the gray-scale value of this center pixel can be expressed as GRAY(x 0, y 0); In window, the gray-scale value of pixel can be expressed as GRAY(x, y), so, this moves the average of the gray-scale value of all pixels in rear hatch, then can be expressed as AVE_GRAY(x, y), this average is multiplied by weighted value then can be expressed as AVE_GRAY(x, y) * coff, wherein, coff is weighted value, the value of coff can be arranged according to the demand of practical application, such as, in order to reach better watercolor effect, coff default value can be set to 0.95, etc.Or the value of coff also can be set to 1, when the value of coff is set to 1, the first value is the average of the gray-scale value of all pixels " in the mobile rear hatch "; Certainly, the value of this coff also can be set to other values.
204, image processing system determines whether the gray-scale value of center pixel in the mobile rear hatch that gets is greater than the first value (average namely moving the gray-scale value of all pixels in rear hatch is multiplied by weighted value), if, then perform step 205, if not, then perform step 206.By GRAY(x 0, y 0) and AVE_GRAY(x, y) * coff compares, if GRAY(x 0, y 0) be greater than AVE_GRAY(x, y) * coff, then perform step 205, if GRAY(x 0, y 0) be less than or equal to AVE_GRAY(x, y) * coff, then perform step 206.
If the gray-scale value of center pixel is greater than the first value (average namely moving the gray-scale value of all pixels in rear hatch is multiplied by weighted value) in 205 mobile rear hatches, then image processing system is by the rgb value of pixel corresponding before this window moves for pixel maximum for gray-scale value in mobile rear hatch, moves the rgb value of center pixel in rear hatch as this.
Such as, if the words of moving window first, then this is moved the rgb value of the pixel of the maximum pixel of gray-scale value in rear hatch before this window moves corresponding to (i.e. the initial position of window) by image processing system, moves the rgb value of center pixel in rear hatch as this window.
Again such as, if third time moving window words, then the rgb value of the pixel of image processing system by pixel maximum for gray-scale value in mobile for this third time rear hatch before third time, window moved corresponding to (after namely second time window moves), moves the rgb value of center pixel in rear hatch as third time window.
By that analogy, etc., namely processing each time all can with reference to the result after last time process.
It should be noted that, the rgb value of the pixel before window moves can obtain and preserve before window moves prerequisite, also can after window moves by determine window move before the position of corresponding pixel obtain, do not repeat them here.
If the gray-scale value of center pixel is less than or equal to the first value (average namely moving the gray-scale value of all pixels in rear hatch is multiplied by weighted value) in 206 mobile rear hatches, then image processing system is by the rgb value of pixel corresponding before this window moves for pixel minimum for gray-scale value in mobile rear hatch, moves the rgb value of center pixel in rear hatch as this.
Such as, if the words of moving window first, then this is moved the rgb value of the pixel of the minimum pixel of gray-scale value in rear hatch before this window moves corresponding to (i.e. the initial position of window) by image processing system, moves the rgb value of center pixel in rear hatch as this window.
Again such as, if third time moving window words, then the rgb value of the pixel of image processing system by pixel minimum for gray-scale value in mobile for this third time rear hatch before third time, window moved corresponding to (after namely second time window moves), moves the rgb value of center pixel in rear hatch as third time window.
By that analogy, etc., namely processing each time all can with reference to the result after last time process.
Circulation performs step 202 ~ 206, until whole pictures is disposed.
As from the foregoing, the present embodiment adopts to be needed to set window in image to be processed, then by the movement of window and judge gray-scale value magnitude relationship between pixel (and, result after each process all can process with reference to the last time), by the pixel value of the pixel of maximum gradation value in subrange, and the pixel value of the pixel of minimum gradation value spreads apart, thus the transition pixel values decreased in image, form the imitative watercolor effect with irregular block shape, namely achieve the object of image watercolor stylization; The program, without the need to Modling model or the process through multiple stage, realize comparatively simple, and effect is also comparatively obvious.
Embodiment three,
In order to implement above method better, the embodiment of the present invention also provides a kind of image processing system, as shown in Figure 4, this image processing system can comprise initialization unit 301, mobile unit 302, gray-scale value acquiring unit 303, judging unit 304, first processing unit 305 and the second processing unit 306.
Initialization unit 301, needs picture to be processed for obtaining, and set window on this picture;
Such as, specifically can set shape and the size of window on this picture, wherein, the shape of window can comprise rhombus, the shape such as square or circular.The shape of window and the size of window all can set according to the demand of practical application
Mobile unit 302, moves according to preset pixel size for window initialization unit 301 set;
Gray-scale value acquiring unit 303, for obtaining gray-scale value and first value of center pixel in mobile rear hatch, wherein, the first value is that the average of the gray-scale value of all pixels in mobile rear hatch is multiplied by weighted value;
Judging unit 304, for determining whether the gray-scale value of center pixel in mobile rear hatch is greater than the first value;
First processing unit 305, during for determining that the gray-scale value of center pixel in mobile rear hatch is greater than the first value at judging unit, by the rgb value of pixel corresponding before this window moves for pixel maximum for gray-scale value in mobile rear hatch, move the rgb value of center pixel in rear hatch as this, and trigger mobile unit 302 and perform the operation of this window according to preset pixel size movement;
Second processing unit 306, during for determining that the gray-scale value of center pixel in mobile rear hatch is less than or equal to the first value at judging unit, by the rgb value of pixel corresponding before this window moves for pixel minimum for gray-scale value in mobile rear hatch, move the rgb value of center pixel in rear hatch as this, and trigger mobile unit 302 and perform the operation of this window according to preset pixel size movement.
Wherein, gray-scale value acquiring unit 303 can comprise the first acquisition subelement and the second acquisition subelement;
First obtains subelement, for obtaining the gray-scale value of center pixel in mobile rear hatch;
Second obtains subelement, for obtaining the gray-scale value of all pixels in mobile rear hatch, calculating the average that this moves the gray-scale value of all pixels in rear hatch, this average is multiplied by weighted value, obtaining the first value.
Such as, if (x 0, y 0) be center pixel coordinate figure, (x, y) is the coordinate figure of pixel in window, then the gray-scale value of this center pixel can be expressed as GRAY(x 0, y 0); In window, the gray-scale value of pixel can be expressed as GRAY(x, y), so, this moves the average of the gray-scale value of all pixels in rear hatch, then can be expressed as AVE_GRAY(x, y), this average is multiplied by weighted value then can be expressed as AVE_GRAY(x, y) * coff, wherein, coff is weighted value, the value of coff can be arranged according to the demand of practical application, such as, in order to reach better watercolor effect, coff default value can be set to 0.95, etc.Or the value of coff also can be set to 1, when the value of coff is set to 1, the first value is the average of the gray-scale value of all pixels " in the mobile rear hatch "; Certainly, the value of this coff also can be set to other values.
Optionally, when picture sets window and moving window, in order to reach better watercolor stylize effect, the pixel of whole pictures can be allowed as far as possible to traverse, and keep window to move and be continuous print and have certain directivity as far as possible, such as, specifically window can be set in the places such as the upper left corner of this picture, the upper right corner, the lower left corner or the lower right corner
(1) at the upper left corner of picture setting window;
Initialization unit 301, specifically for setting window in the upper left corner of this picture;
Then mobile unit 302, specifically for from the upper left corner of this picture, from left to right moves line by line according to preset pixel size; Or,
Mobile unit 302, specifically for from the upper left corner of this picture, moves from top to bottom by column according to preset pixel size.
That is, mobile unit 302 specifically can from the upper left corner of this picture (i.e. first pixel of the first row, also be first pixel of first row) start, from left to right move according to preset pixel size, until traveled through all pixels of the first row, then again from first pixel of the second row of this picture, from left to right move according to preset pixel size, until traveled through all pixels of the second row, moreover, in the same way the pixel of the third line is processed again, by that analogy, until travel through all pixels of complete pictures.Or,
Mobile unit 302 specifically can from the upper left corner of this picture (first pixel of first row, also be first pixel of the first row) start, move from top to bottom according to preset pixel size, until traveled through all pixels of first row, then again from first pixel of the secondary series of this picture, move from top to bottom according to preset pixel size, until traveled through all pixels of secondary series, moreover, process in the same way again and tertial pixel is processed, by that analogy, until travel through all pixels of complete pictures.
(2) at the upper right corner of picture setting window;
Initialization unit 301, specifically for setting window in the upper right corner of this picture;
Then mobile unit 302, specifically for from the upper right corner of this picture, moves from right to left line by line according to preset pixel size; Or,
Mobile unit 302, specifically for from the upper right corner of this picture, moves from top to bottom by column according to preset pixel size.
That is, mobile unit 302 specifically can from the upper right corner of this picture (i.e. last pixel of the first row, also be first pixel of last row) start, move from right to left according to preset pixel size, until traveled through all pixels of the first row, then again from last pixel of the second row of this picture, move from right to left according to preset pixel size, until traveled through all pixels of the second row, moreover, in the same way the pixel of the third line is processed again, by that analogy, until travel through all pixels of complete pictures.Or,
Mobile unit 302 specifically can from the upper right corner of this picture (first pixel of last row, also be last pixel of the first row) start, move from top to bottom according to preset pixel size, until traveled through all pixels of this last first row, then again from first pixel of the row second from the bottom of this picture, move from top to bottom according to preset pixel size, until traveled through all pixels of these row second from the bottom, moreover, process in the same way again and the pixel of row third from the bottom is processed, by that analogy, until travel through all pixels of complete pictures.
(3) at the lower left corner of picture setting window;
Initialization unit 301, specifically for setting window in the lower left corner of this picture;
Then mobile unit 302, specifically for from the lower left corner of this picture, from left to right moves line by line according to preset pixel size; Or,
Mobile unit 302, specifically for from the lower left corner of this picture, moves from top to bottom by column according to preset pixel size.
That is, mobile unit 302 specifically can from the lower left corner of this picture (i.e. first pixel of last the first row, also be last pixel of first row) start, from left to right move according to preset pixel size, until traveled through all pixels of this last the first row, then again from first pixel of the row second from the bottom of this picture, from left to right move according to preset pixel size, until traveled through all pixels of band row second from the bottom, moreover, in the same way the pixel of countdown line 3 is processed again, by that analogy, until travel through all pixels of complete pictures.Or,
Mobile unit 302 specifically can from the lower left corner of this picture (last pixel of first row, also be first pixel of last the first row) start, move from top to bottom according to preset pixel size, until traveled through all pixels of first row, then again from last pixel of the secondary series of this picture, move from Xia Dao road according to preset pixel size, until traveled through all pixels of secondary series, moreover, process in the same way again and tertial pixel is processed, by that analogy, until travel through all pixels of complete pictures.
(4) at the lower right corner of picture setting window;
Initialization unit 301, specifically for setting window in the lower right corner of this picture;
Then mobile unit 302, specifically for from the lower right corner of this picture, moves from right to left line by line according to preset pixel size; Or,
Mobile unit 302, specifically for from the lower right corner of this picture, moves from top to bottom by column according to preset pixel size.
That is, mobile unit 302 specifically can from the lower right corner of this picture (i.e. last pixel of last column, also be last pixel of last row) start, move from right to left according to preset pixel size, until traveled through all pixels of last column, then again from last pixel of the row second from the bottom of this picture, move from right to left according to preset pixel size, until traveled through all pixels of this row second from the bottom, moreover, in the same way the pixel of countdown line 3 is processed again, by that analogy, until travel through all pixels of complete pictures.Or,
Mobile unit 302 specifically can from the lower right corner of this picture (last pixel of last row, also be last pixel of last column) start, move from top to bottom according to preset pixel size, until traveled through all pixels of this last first row, then again from last pixel of the row second from the bottom of this picture, move from top to bottom according to preset pixel size, until traveled through all pixels of these row second from the bottom, moreover, process in the same way again and the pixel of row third from the bottom is processed, by that analogy, until travel through all pixels of complete pictures.
Wherein, the pixel size (i.e. the distance size of movement) of movement each time can be arranged according to the demand of practical application, such as, can set a mobile pixel each time, or move two pixels each time, by that analogy, etc.
During concrete enforcement, above unit can as independently entity realization, and can carry out combination in any yet, realize as same or several entities, the enforcement of above unit specifically see embodiment of the method above, can not repeat them here.
This image processing system specifically can be integrated in terminal, such as specifically can be integrated in the terminals such as mobile phone, notebook computer or panel computer.
As from the foregoing, the initialization unit 301 of the picture processing system of the embodiment of the present invention adopts and is needing to set window in image to be processed, then the gray-scale value magnitude relationship between pixel is judged by the movement of mobile unit 302 pairs of windows and judging unit 304, by the first processing unit 305, the pixel value of the pixel of maximum gradation value in subrange is spread apart, and spread apart by the pixel value of the pixel of the second processing unit 306 minimum gradation value, thus the transition pixel values decreased in image, form the imitative watercolor effect with irregular block shape, namely achieve the object of image watercolor stylization, the program, without the need to Modling model or the process through multiple stage, realize comparatively simple, and effect is also comparatively obvious.
One of ordinary skill in the art will appreciate that all or part of step in the various methods of above-described embodiment is that the hardware that can carry out instruction relevant by program has come, this program can be stored in a computer-readable recording medium, storage medium can comprise: ROM (read-only memory) (ROM, Read Only Memory), random access memory (RAM, Random Access Memory), disk or CD etc.
What provide the embodiment of the present invention above is a kind ofly described in detail the method for image watercolor stylization and image processing system, apply specific case herein to set forth principle of the present invention and embodiment, the explanation of above embodiment just understands method of the present invention and core concept thereof for helping; Meanwhile, for those skilled in the art, according to thought of the present invention, all will change in specific embodiments and applications, in sum, this description should not be construed as limitation of the present invention.

Claims (10)

1. by a method for image watercolor stylization, it is characterized in that, comprising:
Obtain and need picture to be processed, and set window on described picture;
Described window is moved according to preset pixel size;
Obtain gray-scale value and first value of center pixel in mobile rear hatch, described first value is that the average of the gray-scale value of all pixels in mobile rear hatch is multiplied by weighted value;
Determine whether the gray-scale value of described center pixel is greater than described first value;
If so, then by the rgb value of pixel corresponding before this window moves for pixel maximum for gray-scale value in mobile rear hatch, as the rgb value of described center pixel, and execution is returned by the step of described window according to preset pixel size movement;
If not, then by the rgb value of pixel corresponding before this window moves for pixel minimum for gray-scale value in mobile rear hatch, as the rgb value of described center pixel, and return execution by the step of described window according to preset pixel size movement.
2. method according to claim 1, is characterized in that, describedly on described picture, sets window be specially:
At the upper left corner of described picture setting window;
Then described movement according to preset pixel size by described window is specially: from the upper left corner of described picture, from left to right move line by line according to preset pixel size; Or, from the upper left corner of described picture, move by column from top to bottom according to preset pixel size.
3. method according to claim 1, is characterized in that, describedly on described picture, sets window be specially:
At the upper right corner of described picture setting window;
Then described movement according to preset pixel size by described window is specially: from the upper right corner of described picture, move line by line from right to left according to preset pixel size; Or, from the upper right corner of described picture, move by column from top to bottom according to preset pixel size.
4. method according to claim 1, is characterized in that, describedly on described picture, sets window be specially:
At the lower left corner of described picture setting window;
Then described movement according to preset pixel size by described window is specially: from the lower left corner of described picture, from left to right move line by line according to preset pixel size; Or, from the lower left corner of described picture, move by column from top to bottom according to preset pixel size.
5. method according to claim 1, is characterized in that, describedly on described picture, sets window be specially:
At the lower right corner of described picture setting window;
Then described movement according to preset pixel size by described window is specially: from the lower right corner of described picture, move line by line from right to left according to preset pixel size; Or, from the lower right corner of described picture, move by column from top to bottom according to preset pixel size.
6. an image processing system, is characterized in that, comprising:
Initialization unit, needs picture to be processed for obtaining, and set window on described picture;
Mobile unit, moves according to preset pixel size for window initialization unit set;
Gray-scale value acquiring unit, for obtaining gray-scale value and first value of center pixel in mobile rear hatch, described first value is that the average of the gray-scale value of all pixels in mobile rear hatch is multiplied by weighted value;
Judging unit, for determining whether the gray-scale value of described center pixel is greater than described first value;
First processing unit, during for determining that the gray-scale value of described center pixel is greater than described first value at judging unit, by the rgb value of pixel corresponding before this window moves for pixel maximum for gray-scale value in mobile rear hatch, as the rgb value of described center pixel, and trigger mobile unit execution by the operation of described window according to preset pixel size movement;
Second processing unit, during for determining that the gray-scale value of described center pixel is less than or equal to described first value at judging unit, by the rgb value of pixel corresponding before this window moves for pixel minimum for gray-scale value in mobile rear hatch, as the rgb value of described center pixel, and trigger mobile unit execution by the operation of described window according to preset pixel size movement.
7. image processing system according to claim 6, is characterized in that,
Described initialization unit, specifically for setting window in the upper left corner of described picture;
Then described mobile unit, specifically for the upper left corner from described picture, from left to right moves line by line according to preset pixel size; Or, from the upper left corner of described picture, move by column from top to bottom according to preset pixel size.
8. image processing system according to claim 6, is characterized in that,
Described initialization unit, specifically for setting window in the upper right corner of described picture;
Then described mobile unit, specifically for the upper right corner from described picture, moves from right to left line by line according to preset pixel size; Or, from the upper right corner of described picture, move by column from top to bottom according to preset pixel size.
9. image processing system according to claim 6, is characterized in that,
Described initialization unit, specifically for setting window in the lower left corner of described picture;
Then described mobile unit, specifically for the lower left corner from described picture, from left to right moves line by line according to preset pixel size; Or, from the lower left corner of described picture, move by column from top to bottom according to preset pixel size.
10. image processing system according to claim 6, is characterized in that,
Described initialization unit, specifically for setting window in the lower right corner of described picture;
Then described mobile unit, specifically for the lower right corner from described picture, moves from right to left line by line according to preset pixel size; Or, from the lower right corner of described picture, move by column from top to bottom according to preset pixel size.
CN201210253974.1A 2012-07-20 2012-07-20 A kind of by the method for image watercolor stylization and image processing system Expired - Fee Related CN102855647B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201210253974.1A CN102855647B (en) 2012-07-20 2012-07-20 A kind of by the method for image watercolor stylization and image processing system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201210253974.1A CN102855647B (en) 2012-07-20 2012-07-20 A kind of by the method for image watercolor stylization and image processing system

Publications (2)

Publication Number Publication Date
CN102855647A CN102855647A (en) 2013-01-02
CN102855647B true CN102855647B (en) 2015-07-29

Family

ID=47402208

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201210253974.1A Expired - Fee Related CN102855647B (en) 2012-07-20 2012-07-20 A kind of by the method for image watercolor stylization and image processing system

Country Status (1)

Country Link
CN (1) CN102855647B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103236070B (en) * 2013-04-24 2020-07-10 中云开源数据技术(上海)有限公司 Method for generating weaving effect picture
US10008011B1 (en) 2014-11-26 2018-06-26 John Balestrieri Methods for creating a simulated watercolor-painted image from a source image
CN109697707B (en) * 2018-12-29 2020-09-18 深圳美图创新科技有限公司 Hand-drawn watercolor style drawing method and device

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101588438A (en) * 2009-06-10 2009-11-25 拓维信息系统股份有限公司 Mobile phone animation creation method for converting digitalized coloured picture into pictures of different styles

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6727906B2 (en) * 1997-08-29 2004-04-27 Canon Kabushiki Kaisha Methods and apparatus for generating images

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101588438A (en) * 2009-06-10 2009-11-25 拓维信息系统股份有限公司 Mobile phone animation creation method for converting digitalized coloured picture into pictures of different styles

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
Representation of Watercolor Based on Regions;Yuhong Sun;《2011 International Conference on Image Analysis and Signal Processing》;20111021;第496-500页 *
一种绘画效果生成算法;卢盛荣等;《计算机工程与应用》;20100911;第46卷(第26期);第166-169页 *

Also Published As

Publication number Publication date
CN102855647A (en) 2013-01-02

Similar Documents

Publication Publication Date Title
CN105374007B (en) Merge the pencil drawing generation method and device of skeleton stroke and textural characteristics
CN105303514A (en) Image processing method and apparatus
CN104067311B (en) Digital makeup
US8289342B2 (en) Image processing apparatus and storage medium having stored therein an image processing program
US10489970B2 (en) 2D image processing for extrusion into 3D objects
US9626751B2 (en) Method and system for analog/digital image simplification and stylization
CN105007422B (en) A kind of phase focusing method and user terminal
CN104574495B (en) A kind of image rendering method and device
AU2013273784B2 (en) Method, system and apparatus for updating a scene model
CN106504220A (en) A kind of image processing method and device
Bi et al. A dynamic mode decomposition based edge detection method for art images
WO2013106984A1 (en) Learning painting styles for painterly rendering
CN104866755B (en) Setting method and device for background picture of application program unlocking interface and electronic equipment
US10204447B2 (en) 2D image processing for extrusion into 3D objects
CN102254307B (en) Color translation processing method and device
CN102855647B (en) A kind of by the method for image watercolor stylization and image processing system
CN104851122A (en) Method and device for generating shadow special effect graph
CN107871303A (en) A kind of image processing method and device
CN108428215A (en) A kind of image processing method, device and equipment
CN107507225A (en) Moving target detecting method, device, medium and computing device
CN104658030A (en) Secondary image mixing method and apparatus
CN105763768A (en) Image processing method, device and system
CN109920018A (en) Black-and-white photograph color recovery method, device and storage medium neural network based
WO2022132289A1 (en) Method and system for digital coloring or segmenting of multi-color graphics
CN116168091A (en) Image processing method, apparatus, computer device and computer program product

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
CP03 Change of name, title or address

Address after: Kezhu road high tech Industrial Development Zone, Guangzhou city of Guangdong Province, No. 233 510670

Patentee after: VTRON GROUP Co.,Ltd.

Address before: 510663 Guangzhou province high tech Industrial Development Zone, Guangdong, Cai road, No. 6, No.

Patentee before: VTRON TECHNOLOGIES Ltd.

CP03 Change of name, title or address
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20150729

Termination date: 20210720

CF01 Termination of patent right due to non-payment of annual fee