Tip:
Highlight text to annotate it
X
Hello every body !
My name is Thái,
Today, i will demo face-detection application.
and explain it's code.
First. I will demo this application.
You see that picture.
Let's we see how application do ?.
This write out : Found 1 face and
Writing to file ...
and we had 1 new picture at this url.
let see
it detect where the faces are in this picture.
Alright. it's was a demo.
Next i will explain this's code.
First we have 2 variables.
Application name
and max result.
This variable used to limit numbers of faces can
be detected .
Next we come to main class.
there are 2 variables ( inputPath & outputPath)
there are used to determine where input is file and where will contain output file. And
This will check that it this your output url end with jpg
if not. it will exit.
next we come to getVisionService.
this used to Connects to the Vision
API using Application Default Credentials.
It is contain in pom.xml file and a file which end with .json .
next it come to detectFaces.
This Class send request to API service
with what types of
requests
and some variables.
After that, it will be received the response
from API services.
It created a request.
send them
and received response.
and this class will return a list of faces which has detected.
Alright we comeback to main class.
After that it will write out numbers of face has detected
and url of output image file which was
delegated at outputPath variable
after that it will export jpg file to disk.
by writeWithFaces method.
this method reads the image
and writes it again
with outlined.
and this outline draw by annotateWithFaces method.
it's determine the color of outlined.
and this determine thick of your outline.
That's all the application do.
thanks for patience !
Goodbye and see you again !