CN109509237A - The method, apparatus and electronic equipment of filter processing - Google Patents

The method, apparatus and electronic equipment of filter processing Download PDF

Info

Publication number
CN109509237A
CN109509237A CN201710834205.3A CN201710834205A CN109509237A CN 109509237 A CN109509237 A CN 109509237A CN 201710834205 A CN201710834205 A CN 201710834205A CN 109509237 A CN109509237 A CN 109509237A
Authority
CN
China
Prior art keywords
track
processed
color image
image
pixel value
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
CN201710834205.3A
Other languages
Chinese (zh)
Other versions
CN109509237B (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.)
Spreadtrum Communications Shanghai Co Ltd
Original Assignee
Spreadtrum Communications Shanghai 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 Spreadtrum Communications Shanghai Co Ltd filed Critical Spreadtrum Communications Shanghai Co Ltd
Priority to CN201710834205.3A priority Critical patent/CN109509237B/en
Publication of CN109509237A publication Critical patent/CN109509237A/en
Application granted granted Critical
Publication of CN109509237B publication Critical patent/CN109509237B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T11/002D [Two Dimensional] image generation
    • G06T11/20Drawing from basic elements, e.g. lines or circles
    • G06T11/203Drawing of straight lines or curves
    • 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/01Input arrangements or combined input and output arrangements for interaction between user and computer
    • G06F3/048Interaction techniques based on graphical user interfaces [GUI]
    • G06F3/0484Interaction techniques based on graphical user interfaces [GUI] for the control of specific functions or operations, e.g. selecting or manipulating an object, an image or a displayed text element, setting a parameter value or selecting a range
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T11/002D [Two Dimensional] image generation
    • G06T11/001Texturing; Colouring; Generation of texture or colour

Abstract

The present invention provides the method, apparatus and electronic equipment of a kind of filter processing.The described method includes: obtaining the track of user's input;Expansion process is carried out to the track;According to the region that the track is formed after expansion process, filter processing is carried out to color image to be processed.The present invention can increase the diversity and flexibility of filter treatment effect, so as to improve user experience.

Description

The method, apparatus and electronic equipment of filter processing
Technical field
The method, apparatus and electronic equipment handled the present invention relates to technical field of image processing more particularly to a kind of filter.
Background technique
With popularizing for the photographing devices such as smart phone, the filter to come into being has more and more abundant effect, such as: black White, older picture, candy color etc..Use of the filter in image procossing is very flexibly, expertly to use filter can be real The special representing effect of existing image, enhances the expressive ability of image.
When at present using filter processing image, user can only select from several effects that filter pre-defines, It cannot modify according to their own needs to achieve the effect that oneself to want, filter treatment effect is relatively fixed, to influence User experience.
Summary of the invention
The method, apparatus and electronic equipment of filter processing provided by the invention, can increase the multiplicity of filter treatment effect Property and flexibility, so as to improve user experience.
In a first aspect, the present invention provides a kind of method of filter processing, comprising:
Obtain the track of user's input;
Expansion process is carried out to the track;
According to the region that the track is formed after expansion process, filter processing is carried out to color image to be processed.
Optionally, described to include: to track progress expansion process
The track is added to Background, trajectory diagram, the size of the Background and the cromogram to be processed are obtained The size of picture is identical;
Expansion process is carried out to the track using setting template.
Optionally, the pixel value of the track in the trajectory diagram is 1, and the pixel value of Background is 0.
Optionally, after carrying out expansion process to the track, the method also includes:
Emergence processing is carried out to the edge in the region that the track is formed after expansion process;
The region formed after expansion process according to the track carries out filter processing to color image to be processed Include:
The region formed after being handled according to emergence carries out filter processing to color image to be processed.
Optionally, it is described handled according to emergence after the region that is formed, carrying out filter processing to color image to be processed includes:
By the grayscale image of treated trajectory diagram and the color image to be processed and the color image to be processed of sprouting wings It is overlapped, generates effect image, each pixel meets following relationship (1), relational expression (2) and closes in the effect image It is formula (3):
Relational expression (1) is R '=R*w+Gray* (1-w),
Relational expression (2) is G '=G*w+Gray* (1-w),
Relational expression (3) is B '=B*w+Gray* (1-w),
Wherein, R ', G ', B ' are respectively the pixel value of tri- Color Channels of RGB of each pixel in the effect image, R, G, B are respectively the pixel value of tri- Color Channels of RGB of corresponding pixel points in the color image to be processed, and w is the rail The pixel value of corresponding pixel points in mark figure, Gray are the pixel of corresponding pixel points in the grayscale image of the color image to be processed Value.
Second aspect, the present invention provide a kind of device of filter processing, comprising:
Module is obtained, for obtaining the track of user's input;
Expansion module, for carrying out expansion process to the track;
Processing module, the region for being formed after expansion process according to the track, to color image to be processed into The processing of row filter.
Optionally, the expansion module includes:
Superpositing unit obtains trajectory diagram for the track to be added to Background, the size of the Background with it is described The size of color image to be processed is identical;
Expansion cell, for carrying out expansion process to the track using setting template.
Optionally, the pixel value of the track in the trajectory diagram is 1, and the pixel value of Background is 0.
Optionally, described device further include:
The edge of emergence module, the region for being formed after expansion process to the track carries out emergence processing;
The processing module, the region for being formed after being handled according to emergence carry out at filter color image to be processed Reason.
Optionally, the processing module is for the trajectory diagram that will sprout wings that treated and the color image to be processed and described The grayscale image of color image to be processed is overlapped, and generates effect image, each pixel meets following in the effect image Relational expression (1), relational expression (2) and relational expression (3):
Relational expression (1) is R '=R*w+Gray* (1-w),
Relational expression (2) is G '=G*w+Gray* (1-w),
Relational expression (3) is B '=B*w+Gray* (1-w),
Wherein, R ', G ', B ' are respectively the pixel value of tri- Color Channels of RGB of each pixel in the effect image, R, G, B are respectively the pixel value of tri- Color Channels of RGB of corresponding pixel points in the color image to be processed, and w is the rail The pixel value of corresponding pixel points in mark figure, Gray are the pixel of corresponding pixel points in the grayscale image of the color image to be processed Value.
The third aspect, the present invention provide a kind of electronic equipment, and the electronic equipment includes the device of above-mentioned filter processing.
The method, apparatus and electronic equipment of filter processing provided by the invention, one for capable of freely being drawn according to user Track, the region covered to the track carries out filter processing, to show respectively inside and outside the region that the track is covered Different stylistic effects, the image for obtaining handling different-effect with previous filter can increase at filter compared with prior art The diversity and flexibility of effect are managed, so as to improve user experience.Filter is determined by track that user freely draws simultaneously The region of processing, increases the participation of user, and interactivity and interest are stronger.
Detailed description of the invention
Fig. 1 is a kind of flow chart of the method for filter processing in one embodiment of the invention;
Fig. 2 is a kind of flow chart of the method for filter processing in another embodiment of the present invention;
Fig. 3 is a kind of structural schematic diagram of the device of filter processing in one embodiment of the invention;
Fig. 4 is the structural schematic diagram of expansion module in Fig. 3;
Fig. 5 is a kind of structural schematic diagram of the device of filter processing in another embodiment of the present invention.
Specific embodiment
In order to make the object, technical scheme and advantages of the embodiment of the invention clearer, below in conjunction with the embodiment of the present invention In attached drawing, technical scheme in the embodiment of the invention is clearly and completely described, it is clear that described embodiment is only It is only a part of the embodiment of the present invention, instead of all the embodiments.Based on the embodiments of the present invention, ordinary skill Personnel's every other embodiment obtained without making creative work, shall fall within the protection scope of the present invention.
The embodiment of the present invention provides a kind of method of filter processing, as shown in Figure 1, which comprises
S11, the track for obtaining user's input.
User freely draws a track, such as the curve of an arbitrary shape, can by the touch screen of user equipment into Row operation, the track that user equipment is got is the set of one group of point.
S12, expansion process is carried out to track.
Assuming that the pixel value of the track got is 1 (i.e. white), track is added to the back that pixel value is 0 (i.e. black) Jing Tu, the size of Background is identical as the size of color image to be processed, has thus obtained the trajectory diagram of a black and white format.
Using morphologic expansive working, the track in trajectory diagram is handled, it is therefore an objective to make " the line of this single pixel Item " forms one " region " on the image.The basic principle is that: point to be processed in covering original image is removed with a setting template, Effect in template is stayed on the diagram.
S14, the region formed after expansion process according to track carry out filter processing to color image to be processed.
By this three figures of grayscale image of trajectory diagram, color image to be processed and color image to be processed after expansion process Piece is overlapped, so that it may obtain the image that different-effect is handled with previous filter.
In embodiments of the present invention, each pixel meets following relationship in the grayscale image of the color image to be processed Formula:
Gray=R*0.299+G*0.587+B*0.114,
Wherein, Gray is the pixel value of each pixel in the grayscale image of the color image to be processed, and R, G, B are respectively The pixel value of tri- Color Channels of RGB of corresponding pixel points in the color image to be processed.
Therefore, the method for filter processing provided in an embodiment of the present invention, the track that can be freely drawn according to user, The region formed after the track expansion process carries out filter processing to color image to be processed, to be in respectively inside and outside region Reveal different stylistic effects, the image for obtaining handling different-effect with previous filter can increase filter compared with prior art The diversity and flexibility of mirror treatment effect, so as to improve user experience.The present invention, which is equivalent to, simultaneously provide the user one To the approach that picture is created again, the comparison of effect inside and outside the region formed by track drafting wants table to highlight oneself The information reached, increases the participation of user, and interactivity and interest are stronger.
Preferably for the region formed after the expansion process of track, since intersection is non-black i.e. white inside and outside the region 0-1 variation, it is exactly to switch in visual effect stiffly that such result, which is embodied in,.Smoothly mistake is realized in order to improve visual effect It crosses, as shown in Fig. 2, the method also includes:
S13, emergence processing is carried out to the edge in the region that track is formed after expansion process.
The basic principle handled of sprouting wings is: using certain point as brightness center, its brightness of outside Uniform attenuation, until brightness value It is 0, the maximum magnitude of radiation is known as Feather Radius.In embodiments of the present invention, Feather Radius 15.
After the region that the track that user draws is formed after expansion process is handled using emergence, forms one and had The region at edge is crossed, brightness value is between 0 to 1, and for artwork master, the brightness value of each pixel is exactly the pixel The pixel value of point.
Accordingly, step S14 at this time are as follows: color image to be processed is filtered in the region formed after being handled according to emergence Mirror processing.By this three figures of grayscale image for treated the trajectory diagram, color image to be processed and color image to be processed of sprouting wings Piece is overlapped, so that it may obtain the image that different-effect is handled with previous filter, each pixel meets following in the image Relational expression:
R '=R*w+Gray* (1-w),
G '=G*w+Gray* (1-w),
B '=B*w+Gray* (1-w),
Wherein, R ', G ', B ' are respectively the pixel value of tri- Color Channels of RGB of each pixel in the effect image, R, G, B are respectively the pixel value of tri- Color Channels of RGB of corresponding pixel points in the color image to be processed, and w is the rail The pixel value of corresponding pixel points in mark figure, Gray are the pixel of corresponding pixel points in the grayscale image of the color image to be processed Value.
The embodiment of the present invention also provides a kind of device of filter processing, as shown in figure 3, described device includes:
Module 31 is obtained, for obtaining the track of user's input;
Expansion module 32, for carrying out expansion process to the track;
Processing module 34, the region for being formed after expansion process according to the track, to color image to be processed Carry out filter processing.
The device of filter processing provided in an embodiment of the present invention, the track that can be freely drawn according to user, at this The region formed after the expansion process of track carries out filter processing to color image to be processed, to show respectively inside and outside region Different stylistic effects, the image for obtaining handling different-effect with previous filter can increase at filter compared with prior art The diversity and flexibility of effect are managed, so as to improve user experience.The present invention, which is equivalent to, simultaneously provide the user one to figure The approach that piece is created again, the comparison of effect, is intended by highlighting oneself inside and outside the region formed by track drafting Information, increases the participation of user, and interactivity and interest are stronger.
Further, as shown in figure 4, the expansion module 32 includes:
Superpositing unit 321 obtains trajectory diagram for the track to be added to Background, the size of the Background with The size of the color image to be processed is identical;In the present embodiment, the trajectory diagram is artwork master, the pixel of track therein Value is 1, and the pixel value of Background is 0.
Expansion cell 322, for carrying out expansion process to the track using setting template.
Further, as shown in figure 5, described device further include:
The edge of emergence module 33, the region for being formed after expansion process to the track carries out emergence processing;
The processing module 34, the region for being formed after being handled according to emergence carry out filter to color image to be processed Processing.The processing module 34 is for will sprout wings that treated trajectory diagram, color image to be processed and color image to be processed Grayscale image this three picture be overlapped, so that it may obtain the image that different-effect is handled with previous filter, it is every in the image A pixel meets following relationship:
R '=R*w+Gray* (1-w),
G '=G*w+Gray* (1-w),
B '=B*w+Gray* (1-w),
Wherein, R ', G ', B ' are respectively the pixel value of tri- Color Channels of RGB of each pixel in the effect image, R, G, B are respectively the pixel value of tri- Color Channels of RGB of corresponding pixel points in the color image to be processed, and w is the rail The pixel value of corresponding pixel points in mark figure, Gray are the pixel of corresponding pixel points in the grayscale image of the color image to be processed Value.
The embodiment of the present invention also provides a kind of electronic equipment, and the electronic equipment includes the device of above-mentioned filter processing.
Those of ordinary skill in the art will appreciate that realizing all or part of the process in above-described embodiment method, being can be with Relevant hardware is instructed to complete by computer program, the program can be stored in a computer-readable storage medium In, the program is when being executed, it may include such as the process of the embodiment of above-mentioned each method.Wherein, the storage medium can be magnetic Dish, CD, read-only memory (Read-Only Memory, ROM) or random access memory (Random Access Memory, RAM) etc..
The above description is merely a specific embodiment, but scope of protection of the present invention is not limited thereto, any In the technical scope disclosed by the present invention, any changes or substitutions that can be easily thought of by those familiar with the art, all answers It is included within the scope of the present invention.Therefore, protection scope of the present invention should be subject to the protection scope in claims.

Claims (11)

1. a kind of method of filter processing characterized by comprising
Obtain the track of user's input;
Expansion process is carried out to the track;
According to the region that the track is formed after expansion process, filter processing is carried out to color image to be processed.
2. the method according to claim 1, wherein described include: to track progress expansion process
The track is added to Background, obtains trajectory diagram, the size of the Background and the color image to be processed Size is identical;
Expansion process is carried out to the track using setting template.
3. according to the method described in claim 2, it is characterized in that, the pixel value of the track in the trajectory diagram be 1, Background Pixel value be 0.
4. according to the method described in claim 3, it is characterized in that, to the track carry out expansion process after, the method Further include:
Emergence processing is carried out to the edge in the region that the track is formed after expansion process;
The region formed after expansion process according to the track carries out filter processing packet to color image to be processed It includes:
The region formed after being handled according to emergence carries out filter processing to color image to be processed.
5. according to the method described in claim 4, it is characterized in that, it is described handled according to emergence after the region that is formed, treat place Reason color image carries out filter processing
The grayscale image of treated trajectory diagram and the color image to be processed and the color image to be processed of sprouting wings carries out Superposition generates effect image, and each pixel meets following relationship (1), relational expression (2) and relational expression in the effect image (3):
Relational expression (1) is R '=R*w+Gray* (1-w),
Relational expression (2) is G '=G*w+Gray* (1-w),
Relational expression (3) is B '=B*w+Gray* (1-w),
Wherein, R ', G ', B ' are respectively the pixel value of tri- Color Channels of RGB of each pixel in the effect image, R, G, B is respectively the pixel value of tri- Color Channels of RGB of corresponding pixel points in the color image to be processed, and w is the trajectory diagram The pixel value of middle corresponding pixel points, Gray are the pixel value of corresponding pixel points in the grayscale image of the color image to be processed.
6. a kind of device of filter processing characterized by comprising
Module is obtained, for obtaining the track of user's input;
Expansion module, for carrying out expansion process to the track;
Processing module, the region for being formed after expansion process according to the track, filters color image to be processed Mirror processing.
7. device according to claim 6, which is characterized in that the expansion module includes:
Superpositing unit obtains trajectory diagram, the size of the Background is with described wait locate for the track to be added to Background The size for managing color image is identical;
Expansion cell, for carrying out expansion process to the track using setting template.
8. device according to claim 7, which is characterized in that the pixel value of the track in the trajectory diagram is 1, Background Pixel value be 0.
9. device according to claim 8, which is characterized in that described device further include:
The edge of emergence module, the region for being formed after expansion process to the track carries out emergence processing;
The processing module, the region for being formed after being handled according to emergence carry out filter processing to color image to be processed.
10. device according to claim 9, which is characterized in that the processing module is for the track that will sprout wings that treated Scheme to be overlapped with the grayscale image of the color image to be processed and the color image to be processed, generates effect image, it is described Each pixel meets following relationship (1), relational expression (2) and relational expression (3) in effect image:
Relational expression (1) is R '=R*w+Gray* (1-w),
Relational expression (2) is G '=G*w+Gray* (1-w),
Relational expression (3) is B '=B*w+Gray* (1-w),
Wherein, R ', G ', B ' are respectively the pixel value of tri- Color Channels of RGB of each pixel in the effect image, R, G, B is respectively the pixel value of tri- Color Channels of RGB of corresponding pixel points in the color image to be processed, and w is the trajectory diagram The pixel value of middle corresponding pixel points, Gray are the pixel value of corresponding pixel points in the grayscale image of the color image to be processed.
11. a kind of electronic equipment, which is characterized in that the electronic equipment includes as described in any one of claim 6 to 10 The device of filter processing.
CN201710834205.3A 2017-09-15 2017-09-15 Filter processing method and device and electronic equipment Active CN109509237B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710834205.3A CN109509237B (en) 2017-09-15 2017-09-15 Filter processing method and device and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710834205.3A CN109509237B (en) 2017-09-15 2017-09-15 Filter processing method and device and electronic equipment

Publications (2)

Publication Number Publication Date
CN109509237A true CN109509237A (en) 2019-03-22
CN109509237B CN109509237B (en) 2022-09-20

Family

ID=65745056

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710834205.3A Active CN109509237B (en) 2017-09-15 2017-09-15 Filter processing method and device and electronic equipment

Country Status (1)

Country Link
CN (1) CN109509237B (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110248242A (en) * 2019-07-10 2019-09-17 广州虎牙科技有限公司 A kind of image procossing and live broadcasting method, device, equipment and storage medium
CN111402111A (en) * 2020-02-17 2020-07-10 深圳市商汤科技有限公司 Image blurring method, device, terminal and computer readable storage medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100254601A1 (en) * 2009-04-03 2010-10-07 Hong Kong Baptist University Method and device for use in converting a colour image into a grayscale image
CN106303153A (en) * 2015-05-29 2017-01-04 腾讯科技(深圳)有限公司 A kind of image processing method and device
US20170242383A1 (en) * 2016-02-22 2017-08-24 Konica Minolta, Inc. Image forming apparatus

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100254601A1 (en) * 2009-04-03 2010-10-07 Hong Kong Baptist University Method and device for use in converting a colour image into a grayscale image
CN106303153A (en) * 2015-05-29 2017-01-04 腾讯科技(深圳)有限公司 A kind of image processing method and device
US20170242383A1 (en) * 2016-02-22 2017-08-24 Konica Minolta, Inc. Image forming apparatus

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110248242A (en) * 2019-07-10 2019-09-17 广州虎牙科技有限公司 A kind of image procossing and live broadcasting method, device, equipment and storage medium
CN110248242B (en) * 2019-07-10 2021-11-09 广州虎牙科技有限公司 Image processing and live broadcasting method, device, equipment and storage medium
CN111402111A (en) * 2020-02-17 2020-07-10 深圳市商汤科技有限公司 Image blurring method, device, terminal and computer readable storage medium
CN111402111B (en) * 2020-02-17 2023-11-03 深圳市商汤科技有限公司 Image blurring method, device, terminal and computer readable storage medium

Also Published As

Publication number Publication date
CN109509237B (en) 2022-09-20

Similar Documents

Publication Publication Date Title
CN105184249B (en) Method and apparatus for face image processing
CN107204034B (en) A kind of image processing method and terminal
CN107730457B (en) Image completion method and device, electronic equipment and storage medium
CN104933679B (en) A kind of method and its correspondence system of enlarged drawing
CN106030665A (en) Creating a realistic color for a virtual object in an augmented reality environment
CN107977946A (en) Method and apparatus for handling image
CN105809644B (en) Image border fake color inhibition method and device
CN109509237A (en) The method, apparatus and electronic equipment of filter processing
CN104580883A (en) Image processing device and image processing method
CN106097261B (en) Image processing method, device, storage medium and terminal device
CN104463782A (en) Image processing method, device and electronic apparatus
CN104580918A (en) Image processing method and device and electronic device
CN106067167A (en) Image processing method and device
CN106296683A (en) A kind of generation method of virtual screen curtain wall and terminal
CN103871014A (en) Image color changing method and device
CN108776800A (en) A kind of image processing method, mobile terminal and computer readable storage medium
CN106101796A (en) Method and device is appreciated in beating of a kind of net cast
CN104952093B (en) Virtual hair colouring methods and device
CN104113682A (en) Image acquisition method and electronic equipment
CN107133981A (en) Image processing method and device
CN105530425A (en) Automatic continuous shooting system
CN110111347A (en) Logos extracting method, device and storage medium
CN106488106A (en) A kind of image processing method and device
CN108805095A (en) image processing method, device, mobile terminal and computer readable storage medium
CN105590294B (en) A kind of image processing method and electronic equipment

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