6 Replies Latest reply on Aug 10, 2016 2:50 PM by DBarranca

    face detection? photoshop script

    mahendrak15024337

      Hello,

       

      I'm exploring possibility of auto face detection and selection using photoshop script. Has anyone tried something similar? Please guide me in right direction.

      I need to find and select face(with head) automatically and move in different layer.

       

      http://facedetection.jaysalvat.com/  This website has Jquery. But wanted to do this with photoshop script.

      faces.JPG

        • 1. Re: face detection? photoshop script
          JJMack Most Valuable Participant

          A couple of Photoshop features use face detection.  However there is no select faces feature that I know of.

          • 2. Re: face detection? photoshop script
            mahendrak15024337 Level 1

            Thanks JJMack!

             

            Let's say if we take out face selection. But is there any photoshop script command/method that detect whether the layer/image has face(s) on it or not?

             

            Thanks again!

            • 3. Re: face detection? photoshop script
              JJMack Most Valuable Participant

              mahendrak15024337 wrote:

               

              Thanks JJMack!

               

              Let's say if we take out face selection. But is there any photoshop script command/method that detect whether the layer/image has face(s) on it or not?

               

              Thanks again!

              If you leave out face detection how would one know if there is a face or not in a layer.  Even Adobe Face detection does not detect all faces in images.  The new Face Detection in CC 2015.5 liquify had no problem finding all 8 faces in your example.  Yet I have seen portrait images it has failed to identify a face in.  CC 2015.5 has so many issues I do not use it.   Older versions of Photoshop starting with CS6  have face detection in color range to help select skin.

               

              Capture.jpg

              • 4. Re: face detection? photoshop script
                mahendrak15024337 Level 1

                Thanks JJMack for helping! This actually gives us direction.

                • 5. Re: face detection? photoshop script
                  Stephen_A_Marsh Adobe Community Professional

                  Forgetting Photoshop detecting faces for this example, however if this metadata was in the image from another product (Apple Photos, Google Picasa etc) then one could potentially do something with the face metadata from Bridge or Photoshop.

                   

                  Here is some metadata exported from Apple Photos, the image is width is 2448 and the height is 3264:

                   

                  <mwg-rs:Type>Face</mwg-rs:Type>
                  <mwg-rs:Area rdf:parseType="Resource">
                  <stArea:y>0.493500</stArea:y>
                  <stArea:w>0.178000</stArea:w>
                  <stArea:x>0.454000</stArea:x>
                  <stArea:h>0.237000</stArea:h>
                  <stArea:unit>normalized</stArea:unit>

                   

                  Off hand I am not sure how one would translate the normalized X/Y/W/H coordinates back into pixels.

                  1 person found this helpful
                  • 6. Re: face detection? photoshop script
                    DBarranca Level 4

                    Hi,

                    you can definitely build such a tool – a PS face detection HTML panel – but due to technology constraints the steps are a little bit convoluted.

                    You'd need to:

                     

                    1. Write an Adobe Generator plugin to extract the Active Document composite as PNG/JPG (or alternative make your Panel save it programmatically)

                    2. Load the JPG/PNG into an HTML Panel in PS

                    3. Use the jQuery plugin in there

                     

                    The result is an array of coordinates in your Javascript – from that point onwards, you can do whatever you want via scripting, like make a selection duplicate each face in its own layer, etc.

                    Hope this helps,

                     

                    Davide Barranca

                    ---

                    http://htmlpanelsbook.com

                    2 people found this helpful