Function Repository Resource:

BugOutEffect

Source Notebook

Apply a bulging-eye special effect to faces

Contributed by: Michael Sollami and Jesse Friedman

ResourceFunction["BugOutEffect"][image]

applies a special effect to faces in the given image.

Details and Options

ResourceFunction["BugOutEffect"] depends on FacialFeatures and inherits those limitations.
ResourceFunction["BugOutEffect"] warps eyes with a compiled ImageForwardTransformation function, and so the first time it is called it will take longer.
ResourceFunction["BugOutEffect"] is inspired by the PhotoBooth.app system application in macOS, with it's 9 filters:

Examples

Basic Examples (3) 

Apply the "bug out" effect to an image of a face:

In[1]:=
i = Image[ResourceData["Sample Image: Girl on a Blue Background"], ImageSize -> 250];
Row@{i, ResourceFunction["BugOutEffect"]@i}
Out[2]=

Apply the "bug out" effect to an image of an animal face:

In[3]:=
(* Evaluate this cell to get the example input *) CloudGet["https://www.wolframcloud.com/obj/483db11d-575d-4c05-9f8d-5fe5c9e66a4b"]
Out[4]=

BugOutEffect will apply its affect to all faces detected:

In[5]:=
(* Evaluate this cell to get the example input *) CloudGet["https://www.wolframcloud.com/obj/1c6691e7-ce0c-4506-94e2-678ac83021ce"]
Out[5]=

Options (1) 

Change the strength of the effect with an option:

In[6]:=
(* Evaluate this cell to get the example input *) CloudGet["https://www.wolframcloud.com/obj/6b508a88-3c8f-4add-8e8e-56c5544afa44"]
Out[6]=

Possible Issues (3) 

BugOutEffect uses FacialFeatures to find the positions of left and right eyes, and thus inherits its limitations:

In[7]:=
(* Evaluate this cell to get the example input *) CloudGet["https://www.wolframcloud.com/obj/27b39d13-aeed-4d7b-a134-bf90477f57bd"]
In[8]:=
FindFaces[img]
Out[8]=
In[9]:=
ResourceFunction["BugOutEffect"][img]
Out[9]=

BugOutEffect assumes both eyes are visible and thus may not work as expected for profile images or for those with less than two eyes per face:

In[10]:=
ResourceFunction["BugOutEffect"]@ExampleData[{"TestImage", "Man"}]
Out[10]=

If no faces are found, a message is issued and the image is returned unaltered:

In[11]:=
(* Evaluate this cell to get the example input *) CloudGet["https://www.wolframcloud.com/obj/bcf26f1a-4d2a-4908-92b3-5bc21b9626bc"]

Neat Examples (1) 

Apply BugOutEffect to the current image:

In[12]:=
Dynamic[ResourceFunction["BugOutEffect"][CurrentImage[]]]
Out[12]=

Publisher

Michael Sollami

Version History

  • 1.0.0 – 11 December 2020

Related Resources

Author Notes

BugOutEffect should be implemented with opengl whenever this is possible in Mathematica.

License Information