CN109509237B - Filter processing method and device and electronic equipment - Google Patents
Filter processing method and device and electronic equipment Download PDFInfo
- Publication number
- CN109509237B CN109509237B CN201710834205.3A CN201710834205A CN109509237B CN 109509237 B CN109509237 B CN 109509237B CN 201710834205 A CN201710834205 A CN 201710834205A CN 109509237 B CN109509237 B CN 109509237B
- Authority
- CN
- China
- Prior art keywords
- image
- processed
- track
- color image
- 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.)
- Active
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T11/00—2D [Two Dimensional] image generation
- G06T11/20—Drawing from basic elements, e.g. lines or circles
- G06T11/203—Drawing of straight lines or curves
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input 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/01—Input arrangements or combined input and output arrangements for interaction between user and computer
- G06F3/048—Interaction techniques based on graphical user interfaces [GUI]
- G06F3/0484—Interaction 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
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T11/00—2D [Two Dimensional] image generation
- G06T11/001—Texturing; Colouring; Generation of texture or colour
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- Human Computer Interaction (AREA)
- Image Processing (AREA)
Abstract
The invention provides a filter processing method and device and electronic equipment. The method comprises the following steps: acquiring a track input by a user; performing expansion processing on the track; and carrying out filter processing on the color image to be processed according to the area formed by the expansion processing of the track. The invention can increase the diversity and flexibility of filter processing effect, thereby improving user experience.
Description
Technical Field
The present invention relates to the field of image processing technologies, and in particular, to a method and an apparatus for filter processing, and an electronic device.
Background
Along with the popularization of equipment of shooing such as smart mobile phone, the filter of coming to end has had more and more abundant effect, if: black and white, old photographs, candy colors, etc. The use of the filter in image processing is very flexible, and the special representation effect of the image can be realized by skillfully using the filter, so that the representation capability of the image is enhanced.
When the filter is used for processing images at present, a user can only select from a plurality of predefined effects of the filter, the desired effect can not be achieved by modifying according to the needs of the user, and the filter processing effect is relatively fixed, so that the user experience is influenced.
Disclosure of Invention
The filter processing method, the filter processing device and the electronic equipment can increase the diversity and the flexibility of filter processing effects, thereby improving user experience.
In a first aspect, the present invention provides a method of filter processing, comprising:
acquiring a track input by a user;
performing expansion processing on the track;
and performing filter processing on the color image to be processed according to the area formed by the expanded track.
Optionally, the expanding the trajectory includes:
superposing the track to a background image to obtain a track image, wherein the size of the background image is the same as that of the color image to be processed;
and performing expansion processing on the track by using a set template.
Optionally, the pixel value of the track in the track map is 1, and the pixel value of the background map is 0.
Optionally, after the track is dilated, the method further includes:
performing feathering treatment on the edge of the area formed by the expansion treatment on the track;
the filter processing of the color image to be processed according to the area formed by the expansion processing of the track comprises the following steps:
and performing filter processing on the color image to be processed according to the area formed after the feathering processing.
Optionally, the performing, according to the region formed after the feathering, filter processing on the color image to be processed includes:
superposing the eclosion-processed trajectory graph, the color image to be processed and the gray level graph of the color image to be processed to generate an effect image, wherein each pixel point in the effect image satisfies the following relational expression (1), relational expression (2) and relational expression (3):
the relation (1) is R' ═ R w + Gray (1-w),
the relation (2) is G' ═ G × w + Gray (1-w),
the relation (3) is B' ═ B × w + Gray (1-w),
wherein, R ', G ', B ' are pixel values of three RGB color channels of each pixel point in the effect image, R, G, B are pixel values of three RGB color channels of a corresponding pixel point in the color image to be processed, w is a pixel value of a corresponding pixel point in the trajectory image, and Gray is a pixel value of a corresponding pixel point in the grayscale image of the color image to be processed.
In a second aspect, the present invention provides an apparatus for filter processing, comprising:
the acquisition module is used for acquiring a track input by a user;
the expansion module is used for performing expansion processing on the track;
and the processing module is used for carrying out filter processing on the color image to be processed according to the area formed by the expanded track.
Optionally, the expansion module comprises:
the superposition unit is used for superposing the track to a background image to obtain a track image, and the size of the background image is the same as that of the color image to be processed;
and the expansion unit is used for performing expansion processing on the track by using a set template.
Optionally, a pixel value of a track in the track map is 1, and a pixel value of a background map is 0.
Optionally, the apparatus further comprises:
the eclosion module is used for performing eclosion on the edge of the area formed by the expanded trajectory;
and the processing module is used for carrying out filter processing on the color image to be processed according to the region formed after the feathering processing.
Optionally, the processing module is configured to superimpose the locus diagram after the feathering processing, the color image to be processed, and the grayscale diagram of the color image to be processed, so as to generate an effect image, where each pixel in the effect image satisfies the following relational expression (1), relational expression (2), and relational expression (3):
the relation (1) is R' ═ R w + Gray (1-w),
the relation (2) is G' ═ G × w + Gray (1-w),
the relation (3) is B' ═ B × w + Gray (1-w),
wherein, R ', G ', B ' are pixel values of three RGB color channels of each pixel point in the effect image, R, G, B are pixel values of three RGB color channels of a corresponding pixel point in the color image to be processed, w is a pixel value of a corresponding pixel point in the trajectory image, and Gray is a pixel value of a corresponding pixel point in the grayscale image of the color image to be processed.
In a third aspect, the present invention provides an electronic device comprising the above filter processing apparatus.
According to the filter processing method, the filter processing device and the electronic equipment, the area covered by the track can be subjected to filter processing according to the track freely drawn by the user, so that different style effects are respectively presented inside and outside the area covered by the track, images with different effects compared with the conventional filter processing are obtained, and compared with the prior art, the diversity and flexibility of filter processing effects can be improved, and the user experience is improved. Meanwhile, the area processed by the filter is determined through the track freely drawn by the user, the participation degree of the user is increased, and the interactivity and interestingness are stronger.
Drawings
FIG. 1 is a flow chart of a method of filter processing in accordance with one embodiment of the present invention;
FIG. 2 is a flow chart of a method of filter processing in another embodiment of the present invention;
FIG. 3 is a schematic diagram of an apparatus for filter processing according to an embodiment of the present invention;
FIG. 4 is a schematic diagram of the expansion module of FIG. 3;
FIG. 5 is a schematic diagram of a filter processing apparatus according to another embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
An embodiment of the present invention provides a method for filter processing, as shown in fig. 1, the method includes:
and S11, acquiring the track input by the user.
A user can freely draw a track, such as a curve in any shape, and the operation can be performed through a touch screen of user equipment, and the track obtained by the user equipment is a set of a group of points.
And S12, performing expansion processing on the track.
Assuming that the pixel value of the acquired track is 1 (namely white), the track is superimposed on a background image with the pixel value of 0 (namely black), and the size of the background image is the same as that of the color image to be processed, so that a track image in a black-and-white format is obtained.
The trajectories in the trajectory map are processed using morphological dilation operations in order to make this single pixel "line" form an "area" on the image. The basic principle is as follows: a set template is used to cover the points to be processed on the original image, and the effect on the template is left on the image.
And S14, performing filter processing on the color image to be processed according to the area formed by the expansion processing of the track.
And superposing the three pictures of the track map after the expansion processing, the color image to be processed and the gray scale map of the color image to be processed to obtain an image with different effects from the conventional filter processing.
In the embodiment of the present invention, each pixel point in the gray-scale image of the color image to be processed satisfies the following relational expression:
Gray=R*0.299+G*0.587+B*0.114,
wherein Gray is a pixel value of each pixel point in the Gray-scale image of the color image to be processed, and R, G, B are pixel values of three RGB color channels of the corresponding pixel point in the color image to be processed, respectively.
Therefore, the method for filter processing provided by the embodiment of the invention can perform filter processing on the color image to be processed in the region formed after the track expansion processing according to the track freely drawn by the user, so that different style effects are respectively presented inside and outside the region, and images with different effects compared with the conventional filter processing are obtained. Meanwhile, the invention provides a path for the user to re-create the picture, highlights the information which the user wants to express by comparing the internal and external effects of the area formed by the drawing track, increases the participation of the user and has stronger interactivity and interestingness.
Preferably, for the area formed after the track expansion process, the result is visually a harsh switching due to the 0-1 change of the non-black or white at the boundary between the inside and outside of the area. To improve the visual effect to achieve a smooth transition, as shown in fig. 2, the method further comprises:
and S13, performing feathering treatment on the edge of the area formed by the expansion treatment on the track.
The basic principle of the feathering process is: with a certain point as the center of brightness, the brightness is uniformly attenuated outwards until the brightness value is 0, and the maximum range of the radiation is called the feathering radius. In the present embodiment, the feathering radius is 15.
And forming a region with a transition edge after the expansion processing is carried out on the region formed by the track drawn by the user, and the brightness value of the region is between 0 and 1.
Correspondingly, in this case, step S14 is: and performing filter processing on the color image to be processed according to the area formed after the feathering processing. Superposing the three pictures of the locus diagram after the feathering treatment, the color image to be treated and the gray level diagram of the color image to be treated, so as to obtain the image with different effects from the previous filter treatment, wherein each pixel point in the image meets the following 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 pixel values of three RGB color channels of each pixel point in the effect image, R, G, B are pixel values of three RGB color channels of a corresponding pixel point in the color image to be processed, w is a pixel value of a corresponding pixel point in the trajectory image, and Gray is a pixel value of a corresponding pixel point in the grayscale image of the color image to be processed.
An embodiment of the present invention further provides a filter processing apparatus, as shown in fig. 3, the apparatus includes:
an obtaining module 31, configured to obtain a trajectory input by a user;
an expansion module 32, configured to perform expansion processing on the trajectory;
and the processing module 34 is configured to perform filter processing on the color image to be processed according to the region formed after the trajectory is subjected to the expansion processing.
According to the filter processing device provided by the embodiment of the invention, the color image to be processed can be subjected to filter processing in the area formed after the track expansion processing according to the track freely drawn by the user, so that different style effects are respectively presented inside and outside the area, and the image with different effects compared with the conventional filter processing is obtained. Meanwhile, the invention provides a path for the user to re-create the picture, highlights the information which the user wants to express by comparing the internal and external effects of the area formed by the drawing track, increases the participation of the user and has stronger interactivity and interestingness.
Further, as shown in fig. 4, the expansion module 32 includes:
a superimposing unit 321, configured to superimpose the trajectory onto a background image to obtain a trajectory image, where the size of the background image is the same as that of the color image to be processed; in this embodiment, the track map is a black-and-white map, where the pixel value of the track is 1 and the pixel value of the background map is 0.
An expansion unit 322, configured to perform expansion processing on the trajectory using a setting template.
Further, as shown in fig. 5, the apparatus further includes:
an eclosion module 33, configured to perform eclosion on an edge of the region formed after the trajectory is subjected to the expansion processing;
and the processing module 34 is configured to perform filter processing on the color image to be processed according to the region formed after the feathering processing. The processing module 34 is configured to superimpose the three pictures, that is, the trajectory diagram after the feathering processing, the color image to be processed, and the grayscale diagram of the color image to be processed, so as to obtain an image with a different effect from the previous filter processing, where each pixel in the image satisfies the following relation:
R’=R*w+Gray*(1-w),
G’=G*w+Gray*(1-w),
B’=B*w+Gray*(1-w),
wherein, R ', G ', B ' are the pixel values of the three RGB color channels of each pixel point in the effect image, R, G, B are the pixel values of the three RGB color channels of the corresponding pixel point in the color image to be processed, w is the pixel value of the corresponding pixel point in the trajectory graph, and Gray is the pixel value of the corresponding pixel point in the Gray image of the color image to be processed.
The embodiment of the invention also provides electronic equipment which comprises the filter processing device.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by a computer program, which can be stored in a computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. The storage medium may be a magnetic disk, an optical disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), or the like.
The above description is only for the specific embodiment of the present invention, but the scope of the present invention is not limited thereto, and any changes or substitutions that can be easily conceived by those skilled in the art within the technical scope of the present invention are included in the scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.
Claims (9)
1. A method of filter processing, comprising:
acquiring a track input by a user;
superposing the track to a background image to obtain a track image in a black-white format, wherein the size of the background image is the same as that of the color image to be processed;
performing expansion processing on the track by using a set template;
according to the area formed by the expanded track, the color image to be processed is subjected to filter processing, and the implementation method comprises the following steps: and superposing the track graph after the expansion processing, the color image to be processed and the gray scale graph of the color image to be processed to generate an effect image.
2. The method according to claim 1, wherein the track in the track map has a pixel value of 1 and the background map has a pixel value of 0.
3. The method of claim 1, wherein after the dilation processing is performed on the trajectory, the method further comprises:
performing feathering treatment on the edge of the area formed by the expansion treatment on the track;
correspondingly, according to the area formed after the feathering treatment, the color image to be treated is subjected to filter treatment, and the realization method comprises the following steps: and superposing the eclosion processed trajectory graph, the color image to be processed and the gray level graph of the color image to be processed to generate an effect image.
4. The method of claim 3,
each pixel point in the effect image satisfies the following relational expression (1), relational expression (2) and relational expression (3):
the relation (1) is R' = R w + Gray (1-w),
the relation (2) is G' = G w + Gray (1-w),
the relation (3) is B' = B w + Gray (1-w),
wherein, R ', G ', B ' are pixel values of three RGB color channels of each pixel point in the effect image, R, G, B are pixel values of three RGB color channels of a corresponding pixel point in the color image to be processed, w is a pixel value of a corresponding pixel point in the trajectory image, and Gray is a pixel value of a corresponding pixel point in the grayscale image of the color image to be processed.
5. An apparatus for filter processing, comprising:
the acquisition module is used for acquiring a track input by a user;
the expansion module is used for superposing the track to a background image to obtain a track image in a black-white format, wherein the size of the background image is the same as that of the color image to be processed, and then the track is expanded by using a set template;
the processing module is used for carrying out filter processing on the color image to be processed according to the area formed by the expanded track, and the implementation method comprises the following steps: and superposing the expanded track graph, the color image to be processed and the gray scale image of the color image to be processed to generate an effect image.
6. The apparatus according to claim 5, wherein the track in the track map has a pixel value of 1 and the background map has a pixel value of 0.
7. The apparatus of claim 5, further comprising:
the eclosion module is used for performing eclosion on the edge of the area formed by the expanded trajectory;
correspondingly, the processing module is used for performing filter processing on the color image to be processed according to the region formed after the feathering processing, and the implementation method comprises the following steps: and superposing the eclosion processed trajectory graph, the color image to be processed and the gray level graph of the color image to be processed to generate an effect image.
8. The apparatus of claim 7, wherein each pixel point in the effect image satisfies the following relations (1), (2) and (3):
the relation (1) is R' = R w + Gray (1-w),
the relation (2) is G' = G w + Gray (1-w),
the relation (3) is B' = B w + Gray (1-w),
wherein, R ', G ', B ' are pixel values of three RGB color channels of each pixel point in the effect image, R, G, B are pixel values of three RGB color channels of a corresponding pixel point in the color image to be processed, w is a pixel value of a corresponding pixel point in the trajectory image, and Gray is a pixel value of a corresponding pixel point in the grayscale image of the color image to be processed.
9. An electronic device characterized in that it comprises a filter processing apparatus according to any of claims 5 to 8.
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 CN109509237A (en) | 2019-03-22 |
CN109509237B true 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) |
Families Citing this family (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110248242B (en) * | 2019-07-10 | 2021-11-09 | 广州虎牙科技有限公司 | Image processing and live broadcasting method, device, equipment and storage medium |
CN111402111B (en) * | 2020-02-17 | 2023-11-03 | 深圳市商汤科技有限公司 | Image blurring method, device, terminal and computer readable storage medium |
Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106303153A (en) * | 2015-05-29 | 2017-01-04 | 腾讯科技(深圳)有限公司 | A kind of image processing method and device |
Family Cites Families (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US8355566B2 (en) * | 2009-04-03 | 2013-01-15 | Hong Kong Baptist University | Method and device for use in converting a colour image into a grayscale image |
JP6631308B2 (en) * | 2016-02-22 | 2020-01-15 | コニカミノルタ株式会社 | Image forming device |
-
2017
- 2017-09-15 CN CN201710834205.3A patent/CN109509237B/en active Active
Patent Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106303153A (en) * | 2015-05-29 | 2017-01-04 | 腾讯科技(深圳)有限公司 | A kind of image processing method and device |
Also Published As
Publication number | Publication date |
---|---|
CN109509237A (en) | 2019-03-22 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN111275034B (en) | Method, device, equipment and storage medium for extracting text region from image | |
CN112541867B (en) | Image processing method, device, electronic equipment and computer readable storage medium | |
CN112602088B (en) | Method, system and computer readable medium for improving quality of low light images | |
CN106485720A (en) | Image processing method and device | |
KR101531966B1 (en) | Image Processing Device, Image Processing Program, Computer-Readable Recording Medium Storing Image Processing Program, and Image Processing Method | |
CN110298812B (en) | Image fusion processing method and device | |
CN113596573B (en) | Image processing method, image processing device, electronic equipment and computer readable storage medium | |
KR101624801B1 (en) | Matting method for extracting object of foreground and apparatus for performing the matting method | |
CN107424137B (en) | Text enhancement method and device, computer device and readable storage medium | |
CN104966092A (en) | Image processing method and device | |
CN106530265A (en) | Adaptive image fusion method based on chromaticity coordinates | |
CN112837251B (en) | Image processing method and device | |
CN115578294B (en) | Image enhancement method, device, equipment and storage medium | |
CN110969046A (en) | Face recognition method, face recognition device and computer-readable storage medium | |
CN108230269B (en) | Grid removing method, device and equipment based on depth residual error network and storage medium | |
CN109509237B (en) | Filter processing method and device and electronic equipment | |
CN107564085B (en) | Image warping processing method and device, computing equipment and computer storage medium | |
CN110689478B (en) | Image stylization processing method and device, electronic equipment and readable medium | |
CN115471413A (en) | Image processing method and device, computer readable storage medium and electronic device | |
CN115294055A (en) | Image processing method, image processing device, electronic equipment and readable storage medium | |
CN110545414B (en) | Image sharpening method | |
CN117911444A (en) | Edge processing-based matting method and system | |
CN110533020A (en) | A kind of recognition methods of text information, device and storage medium | |
CN113538304A (en) | Training method and device of image enhancement model, and image enhancement method and device | |
JP2011076302A (en) | Device, contour extraction method program, and contour extraction |
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 |