This program will:
- Get images from GIPHY API using passed in query
- Try and detect faces on them, if found, draw a box
- Post results to Slack
I think it's neat because mvn package
will actually build the JAR into a
Java 12 Docker image (see Dockerfile) that can then be used anywhere. Portability yay!
You should think this is neat because some dependencies are super painful. Like building OpenCV for your platform.
You can also get images from Oracle object storage as well.
Example of face detection:
- Create a .env file with GIPHY_TOKEN and SLACK_TOKEN
- Specify your Docker image in pom.xml under properties (ie
<docker.image>carimura/jtrack</docker.image>
)
Only once! (Then each time you change Maven dependencies):
./libs.sh
mvn clean package
docker run -e "QUERY=happy" -e "NUM=3" --env-file=.env <your_docker_name>/jtrack:<version>
- QUERY [string] (ie "excited") -- Query string
- NUM [int] (ie "5") -- Number of images to pull
- PREVIEW [bool] (ie "false") -- If set to true, a smaller image will be pulled from Giphy.
You can change the runtime by using jlink as follows:
jlink --no-header-files --no-man-pages --compress=2 --strip-debug \
--module-path /Users/chad/lib/jdk-14-loom-linux.jdk/jmods \
--add-modules java.base,java.compiler,java.desktop,java.instrument,java.management,java.naming,java.sql,jdk.attach,jdk.jdi,jdk.unsupported \
--output java-runtime
- illegal reflective access message for bouncy castle required by OCI stuff