Summary of the invention
The technical problem to be solved in the present invention is, for utilizing LOMO camera to take the higher defect of LOMO photo cost in prior art, provides a kind of image processing method based on electric terminal and device simply, cheaply and easily.
The technical solution adopted for the present invention to solve the technical problems is:
A kind of image processing method based on electric terminal is provided, at R passage, G passage and B passage, pixel is processed respectively, described method comprises: the original value that obtains respectively the pixel in R passage, G passage and B passage, the original value of these pixels is carried out respectively to pixel conversion, and replace the original value of respective pixel by the special efficacy value after pixel conversion, wherein the original value of pixel is carried out respectively to pixel conversion and specifically comprises:
To the pixel (x in B passage
b, y
b) original value B
0(x
b, y
b) carry out passage overlap-add procedure, be specially: judge pixel (x
b, y
b) original value B
0(x
b, y
b) whether be less than or equal to 128, the if so, superposition value S of this pixel
b(x
b, y
b)=B
0(x
b, y
b) the * B passage stack factor/128; If not, the superposition value S of this pixel
b(x
b, y
b)=255-((255-B
0(x
b, y
b)) * (the 255-B passage stack factor)/128)-0.5, wherein the span of the B passage stack factor is 0~255; To this pixel (x
b, y
b) original value and superposition value carry out Alpha hybrid processing and obtain the special efficacy value B of this pixel
1(x
b, y
b), be specially: B
1(x
b, y
b)=B passage hybrid cytokine * S
b(x
b, y
b)+(1-B passage hybrid cytokine) * B
0(x
b, y
b), wherein the span of B passage hybrid cytokine is 0.0~1.0;
To the pixel (x in G passage
g, y
g) original value G
0(x
g, y
g) carry out passage overlap-add procedure, be specially: judge pixel (x
g, y
g) original value G
0(x
g, y
g) whether be less than or equal to 128, the if so, superposition value S of this pixel
g(x
g, y
g)=G
0(x
g, y
g) the * G passage stack factor/128; If not, the superposition value S of this pixel
g(x
g, y
g)=255-((255-G
0(x
g, y
g)) * (the 255-G passage stack factor)/128)-0.5, wherein the span of the G passage stack factor is 0~255; To this pixel (x
g, y
g) original value and superposition value carry out Alpha hybrid processing and obtain the special efficacy value G of this pixel
1(x
g, y
g), be specially: G
1(x
g, y
g)=G passage hybrid cytokine * S
g(x
g, y
g)+(1-G passage hybrid cytokine) * G
0(x
g, y
g), wherein the span of G passage hybrid cytokine is 0.0~1.0;
To the pixel (x in R passage
r, y
r) original value R
0(x
r, y
r) carry out color burn processing, be specially: judge that R passage deepens the factor and whether equal 0, the if so, intensification value S of this pixel
r(x
r, y
r)=R passage is deepened the factor; If not, the intensification value S of this pixel
r(x
r, y
r) be 0 and (255-((255-R
0(x
r, y
r) * 2
8)/R passage is deepened the factor)) in larger one, wherein to deepen the span of the factor be 0~255 to R passage;
To this pixel (x
r, y
r) original value and intensification value carry out Alpha hybrid processing and obtain the special efficacy value R of this pixel
1(x
r, y
r), be specially: R
1(x
r, y
r)=R passage hybrid cytokine * S
r(x
r, y
r)+(1-R passage hybrid cytokine) * R
0(x
r, y
r), wherein the span of R passage hybrid cytokine is 0.0~1.0.
The present invention also provides a kind of picture processing device based on electric terminal, at R passage, G passage and B passage, pixel is processed respectively, described device comprises: for obtaining respectively the original value acquisition module of original value of pixel of R passage, G passage and B passage, for the processes pixel module that the original value of these pixels is carried out respectively to pixel conversion, and realize module by the special efficacy that the special efficacy value after pixel conversion is replaced the original value of respective pixel, wherein said processes pixel module comprises again:
B passage pixel processing unit, for the pixel (x to B passage
b, y
b) original value B
0(x
b, y
b) carry out passage overlap-add procedure, be specially: judge pixel (x
b, y
b) original value B
0(x
b, y
b) whether be less than or equal to 128, the if so, superposition value S of this pixel
b(x
b, y
b)=B
0(x
b, y
b) the * B passage stack factor/128; If not, the superposition value S of this pixel
b(x
b, y
b)=255-((255-B
0(x
b, y
b)) * (the 255-B passage stack factor)/128)-0.5, wherein the span of the B passage stack factor is 0~255; To this pixel (x
b, y
b) original value and superposition value carry out Alpha hybrid processing and obtain the special efficacy value B of this pixel
1(x
b, y
b), be specially: B
1(x
b, y
b)=B passage hybrid cytokine * S
b(x
b, y
b)+(1-B passage hybrid cytokine) * B
0(x
b, y
b), wherein the span of B passage hybrid cytokine is 0.0~1.0;
G passage pixel processing unit, for the pixel (x to G passage
g, y
g) original value G
0(x
g, y
g) carry out passage overlap-add procedure, be specially: judge pixel (x
g, y
g) original value G
0(x
g, y
g) whether be less than or equal to 128, the if so, superposition value S of this pixel
g(x
g, y
g)=G
0(x
g, y
g) the * G passage stack factor/128; If not, the superposition value S of this pixel
g(x
g, y
g)=255-((255-G
0(x
g, y
g)) * (the 255-G passage stack factor)/128)-0.5, wherein the span of the G passage stack factor is 0~255; To this pixel (x
g, y
g) original value and superposition value carry out Alpha hybrid processing and obtain the special efficacy value G of this pixel
1(x
g, y
g), be specially: G
1(x
g, y
g)=G passage hybrid cytokine * S
g(x
g, y
g)+(1-G passage hybrid cytokine) * G
0(x
g, y
g), wherein the span of G passage hybrid cytokine is 0.0~1.0;
R passage pixel processing unit, for the pixel (x to R passage
r, y
r) original value R
0(x
r, y
r) carry out color burn processing, be specially: judge that R passage deepens the factor and whether equal 0, the if so, intensification value S of this pixel
r(x
r, y
r)=R passage is deepened the factor; If not, the intensification value S of this pixel
r(x
r, y
r) be 0 and (255-((255-R
0(x
r, y
r) * 2
8)/R passage is deepened the factor)) in larger one, wherein to deepen the span of the factor be 0~255 to R passage; To this pixel (x
r, y
r) original value and intensification value carry out Alpha hybrid processing and obtain the special efficacy value R of this pixel
1(x
r, y
r), be specially: R
1(x
r, y
r)=R passage hybrid cytokine * S
r(x
r, y
r)+(1-R passage hybrid cytokine) * R
0(x
r, y
r), wherein the span of R passage hybrid cytokine is 0.0~1.0.
A kind of image processing method based on electric terminal of the present invention and the beneficial effect of device are: by respectively to B passage, the pixel of G passage and R passage is carried out pixel conversion, can in real time common picture or video flowing picture processing be called to picture or the video flowing picture with LOMO film special efficacy, make user to shoot or to process the picture or the video that obtain having LOMO cinematic genre by the electronic equipment such as mobile phone or PC, not only simple and convenient, with low cost, can also promote user to the enjoyment of taking and taking pictures, promote user experiences simultaneously, allow the user that has an electronic equipment such as mobile phone or PC be equal to and have LOMO special efficacy camera.
Embodiment
In order to make object of the present invention, technical scheme and advantage clearer, below in conjunction with drawings and Examples, the present invention is further elaborated.Should be appreciated that specific embodiment described herein, only in order to explain the present invention, is not intended to limit the present invention.
Fig. 1 is the process flow diagram of the image processing method based on electric terminal according to an embodiment of the invention.In the present embodiment, the picture under RGB color space or video flowing picture are carried out to LOMO special effect processing, specifically, at R passage, G passage and B passage, pixel is processed respectively.In the present embodiment, the image processing method based on electric terminal is from step S1.
In step S1, obtain respectively the original value of the pixel in R passage, G passage and B passage.
In step S2, respectively the original value of the each pixel in B passage is carried out to pixel conversion, produce corresponding special efficacy value; Respectively the original value of the each pixel in G passage is carried out to pixel conversion, produce corresponding special efficacy value; Respectively the original value of the each pixel in R passage is carried out to pixel conversion, produce corresponding special efficacy value.
In step S3, with the original value of the special efficacy value replacement respective pixel after pixel conversion.
Fig. 2 is the process flow diagram of the method for carrying out pixel conversion in accordance with a preferred embodiment of the present invention.The method of in the present embodiment, carrying out pixel conversion is from step 301.
In step 301, judge pixel (x
b, y
b) original value B
0(x
b, y
b) whether be less than or equal to 128.
If pixel (x
b, y
b) original value B
0(x
b, y
b) be less than or equal to 128, perform step 302.In step 302, determine the superposition value S of this pixel
b(x
b, y
b)=B
0(x
b, y
b) the * B passage stack factor/128.Wherein, the span of the B passage stack factor is 0~255.Preferably, the value of the B passage stack factor is 5.
If pixel (x
b, y
b) original value B
0(x
b, y
b) be greater than 128, perform step 303.In step 303, determine the superposition value S of this pixel
b(x
b, y
b)=255-((255-B
0(x
b, y
b)) * (the 255-B passage stack factor)/128)-0.5.Wherein, the span of the B passage stack factor is 0~255.Preferably, the value of the B passage stack factor is 5.
After step 302 or 303, execution step 304.In step 304, determine pixel (x
b, y
b) special efficacy value B
1(x
b, y
b)=B passage hybrid cytokine * S
b(x
b, y
b)+(1-B passage hybrid cytokine) * B
0(x
b, y
b).Wherein, B passage hybrid cytokine is equivalent to transparency, and its span is 0.0~1.0.Preferably, the value of B passage hybrid cytokine is 0.4.
Next perform step 305, in step 305, judge pixel (x
g, y
g) original value G
0(x
g, y
g) whether be less than or equal to 128.
If pixel (x
g, y
g) original value G
0(x
g, y
g) be less than or equal to 128, perform step 306.In step 306, determine the superposition value S of this pixel
g(x
g, y
g)=G
0(x
g, y
g) the * G passage stack factor/128.Wherein, the span of the G passage stack factor is 0~255.Preferably, the value of the G passage stack factor is 104.
If pixel (x
g, y
g) original value G
0(x
g, y
g) be greater than 128, perform step 307.In step 307, determine the superposition value S of this pixel
g(x
g, y
g)=255-((255-G
0(x
g, y
g)) * (the 255-G passage stack factor)/128)-0.5.Wherein, the span of the G passage stack factor is 0~255.Preferably, the value of the G passage stack factor is 104.
After step 306 or 307, execution step 308.In step 308, determine pixel (x
g, y
g) special efficacy value G
1(x
g, y
g)=G passage hybrid cytokine * S
g(x
g, y
g)+(1-G passage hybrid cytokine) * G
0(x
g, y
g).Wherein, the span of G passage hybrid cytokine is 0.0~1.0.Preferably, the value of G passage hybrid cytokine is 0.4.
In step 309, judge whether the R passage intensification factor equals 0.
Equal 0 if R passage is deepened the factor, perform step 310.In step 310, determine pixel (x
r, y
r) intensification value S
r(x
r, y
r)=R passage is deepened the factor.
Be not equal to 0 if R passage is deepened the factor, perform step 311.In step 311, determine the intensification value S of this pixel
r(x
r, y
r) be 0 and (255-((255-R
0(x
r, y
r) * 2
8)/R passage is deepened the factor)) in larger one.Preferably, the span of the R passage intensification factor is 0~255.Preferably, the value of the R passage intensification factor is 225.
After step 310 or 311, execution step 312.In step 312, determine pixel (x
r, y
r) special efficacy value R
1(x
r, y
r)=R passage hybrid cytokine * S
r(x
r, y
r)+(1-R passage hybrid cytokine) * R
0(x
r, y
r).Wherein, the span of R passage hybrid cytokine is 0.0~1.0.Preferably, the value of R passage hybrid cytokine is 0.4.
In the embodiment shown in Fig. 2 and 3, the order of three Color Channels being carried out respectively to pixel conversion process is not unique; The order that is step S21, step S22 and step S23 is not unique, and the order of step S301, step S305 and step S309 neither be unique.For example, can also carry out pixel conversion process according to the order of R passage, G passage, B passage, can carry out according to order arbitrarily the pixel conversion process of R passage, G passage, B passage, or three Color Channels can also be carried out to pixel conversion process simultaneously.
Fig. 3 is the structural representation of the picture processing device based on electric terminal according to an embodiment of the invention.In the present embodiment, a kind of picture processing device based on electric terminal, can carry out LOMO special effect processing to the picture under RGB color space or video flowing picture, and specifically, this device is processed pixel at R passage, G passage and B passage respectively.
In the present embodiment, the picture processing device based on electric terminal comprises that original value acquisition module 410, processes pixel module 420 and special efficacy realize module 430.
Original value acquisition module 410, can be for obtaining respectively the original value of the pixel in R passage, G passage and B passage.
Processes pixel module 420, can carry out respectively pixel conversion for the original value of the pixel in R passage, G passage and B passage that original value acquisition module 410 is obtained.The method of wherein, carrying out pixel conversion in different color channels is different.
Special efficacy realizes module 430, can replace the original value of respective pixel by the special efficacy value after pixel conversion.
In the embodiment shown in fig. 4, processes pixel module 420 can comprise again B passage pixel processing unit 421, G passage pixel processing unit 422 and R passage pixel processing unit 423.
B passage pixel processing unit 421, can be for the pixel (x in B passage
b, y
b) original value B
0(x
b, y
b) carry out passage overlap-add procedure, obtain the superposition value S of this pixel
b(x
b, y
b), then to this pixel (x
b, y
b) original value and superposition value carry out Alpha hybrid processing and obtain the special efficacy value B of this pixel
1(x
b, y
b).For example, first B passage pixel processing unit 421 can judge pixel (x
b, y
b) original value B
0(x
b, y
b) whether be less than or equal to 128.If pixel (x
b, y
b) original value B
0(x
b, y
b) be less than or equal to 128, B passage pixel processing unit 421 can be determined the superposition value S of this pixel
b(x
b, y
b)=B
0(x
b, y
b) the * B passage stack factor/128; If pixel (x
b, y
b) original value B
0(x
b, y
b) be greater than 128, B passage pixel processing unit 421 can be determined the superposition value S of this pixel
b(x
b, y
b)=255-((255-B
0(x
b, y
b)) * (the 255-B passage stack factor)/128)-0.5, wherein the span of the B passage stack factor is 0~255.Preferably, the value of the B passage stack factor is 5.Then, B passage pixel processing unit 421 can be determined the special efficacy value B of this pixel
1(x
b, y
b)=B passage hybrid cytokine * S
b(x
b, y
b)+(1-B passage hybrid cytokine) * B
0(x
b, y
b), the wherein span 0.0~1.0 of B passage hybrid cytokine.Preferably, the value of B passage hybrid cytokine is 0.4.
G passage pixel processing unit 422, can be for the pixel (x in G passage
g, y
g) original value G
0(x
g, y
g) carry out passage overlap-add procedure, obtain the superposition value S of this pixel
g(x
g, y
g), then to this pixel (x
g, y
g) original value and superposition value carry out Alpha hybrid processing and obtain the special efficacy value G of this pixel
1(x
g, y
g).For example, first G passage pixel processing unit 422 can judge pixel (x
g, y
g) original value G
0(x
g, y
g) whether be less than or equal to 128.If pixel (x
g, y
g) original value G
0(x
g, y
g) be less than or equal to 128, G passage pixel processing unit 422 can be determined the superposition value S of this pixel
g(x
g, y
g)=G
0(x
g, y
g) the * G passage stack factor/128; If pixel (x
g, y
g) original value G
0(x
g, y
g) be greater than 128, G passage pixel processing unit 422 can be determined the superposition value S of this pixel
g(x
g, y
g)=255-((255-G
0(x
g, y
g)) * (the 255-G passage stack factor)/128)-0.5, wherein the span of the G passage stack factor is 0~255.Preferably, the value of the G passage stack factor is 104.Then, G passage pixel processing unit 422 can be determined this pixel (x
g, y
g) special efficacy value G
1(x
g, y
g)=G passage hybrid cytokine * S
g(x
g, y
g)+(1-G passage hybrid cytokine) * G
0(x
g, y
g), wherein the span of G passage hybrid cytokine is 0.0~1.0.Preferably, the value of G passage hybrid cytokine is 0.4.
R passage pixel processing unit 423, can be for the pixel (x in R passage
r, y
r) original value R
0(x
r, y
r) carry out color burn processing, obtain the intensification value S of this pixel
r(x
r, y
r), then to this pixel (x
r, y
r) original value and intensification value carry out Alpha hybrid processing and obtain the special efficacy value R of this pixel
1(x
r, y
r).For example, first R passage pixel processing unit 423 can judge whether the R passage intensification factor equals 0.Equal 0 if R passage is deepened the factor, R passage pixel processing unit 423 can be determined pixel (x
r, y
r) intensification value S
r(x
r, y
r)=R passage is deepened the factor; Be not equal to 0 if R passage is deepened the factor, R passage pixel processing unit 423 can be determined pixel (x
r, y
r) intensification value S
r(x
r, y
r) be 0 and (255-((255-R
0(x
r, y
r) * 2
8)/R passage is deepened the factor)) in larger one.Wherein, the span of the R passage intensification factor is 0~255.Preferably, the value of the R passage intensification factor is 225.Then, R passage pixel processing unit 423 can be determined this pixel (x
r, y
r) special efficacy value R
1(x
r, y
r)=R passage hybrid cytokine * S
r(x
r, y
r)+(1-R passage hybrid cytokine) * R
0(x
r, y
r), wherein the span of R passage hybrid cytokine is 0.0~1.0.Preferably, the value of R passage hybrid cytokine is 0.4.
Various embodiment of the present invention provides a kind of image processing method and device based on electric terminal, by respectively to B passage, the pixel of G passage and R passage is carried out pixel conversion, can in real time common picture or video flowing picture processing be called to picture or the video flowing picture with LOMO film special efficacy, make user to shoot or to process the picture or the video that obtain having LOMO cinematic genre by the electronic equipment such as mobile phone or PC, not only simple and convenient, with low cost, can also promote user to the enjoyment of taking and taking pictures, promote user experiences simultaneously, allow the user that has an electronic equipment such as mobile phone or PC be equal to and have LOMO special efficacy camera.
Although the present invention describes by specific embodiment, it will be appreciated by those skilled in the art that, without departing from the present invention, can also carry out various conversion and be equal to alternative the present invention.In addition, for particular condition or material, can make various modifications to the present invention, and not depart from the scope of the present invention.Therefore, the present invention is not limited to disclosed specific embodiment, and should comprise the whole embodiments that fall within the scope of the claims in the present invention.