From 403d88d441f253448341e44f289310a101a7dde6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jan=20Bedna=C5=99=C3=ADk?= <jan.bednarik@gmail.com>
Date: Wed, 6 May 2020 02:24:28 +0200
Subject: [PATCH] majak: Setup feature detection in images using OpenCV

---
 Dockerfile             | 4 ++--
 majak/settings/base.py | 2 ++
 requirements/base.in   | 1 +
 requirements/base.txt  | 2 ++
 4 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/Dockerfile b/Dockerfile
index 65237693..1ac125ed 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,7 +1,7 @@
-FROM python:3.7-slim
+FROM python:3.7
 
-# requirements to build python-ldap
 RUN apt-get update && apt-get install -y \
+    # requirements to build python-ldap
     build-essential python3-dev libldap2-dev libsasl2-dev \
     && rm -rf /var/lib/apt/lists/*
 
diff --git a/majak/settings/base.py b/majak/settings/base.py
index 3f546ac7..ac9510a4 100644
--- a/majak/settings/base.py
+++ b/majak/settings/base.py
@@ -174,6 +174,8 @@ WAGTAIL_USER_TIME_ZONES = ["Europe/Prague"]
 
 WAGTAILADMIN_NOTIFICATION_INCLUDE_SUPERUSERS = False
 
+WAGTAILIMAGES_FEATURE_DETECTION_ENABLED = True
+
 # disable editing of user details synced from SSO
 WAGTAIL_USER_EDIT_FORM = "users.forms.CustomUserEditForm"
 WAGTAIL_USER_CREATION_FORM = "users.forms.CustomUserCreationForm"
diff --git a/requirements/base.in b/requirements/base.in
index 29e83430..5bb5818a 100644
--- a/requirements/base.in
+++ b/requirements/base.in
@@ -5,3 +5,4 @@ django-extensions
 psycopg2-binary
 pirates<=0.4
 whitenoise
+opencv-python
diff --git a/requirements/base.txt b/requirements/base.txt
index 80fdc30a..b0220791 100644
--- a/requirements/base.txt
+++ b/requirements/base.txt
@@ -24,6 +24,8 @@ idna==2.9                 # via requests
 josepy==1.3.0             # via mozilla-django-oidc
 l18n==2018.5              # via wagtail
 mozilla-django-oidc==1.2.3  # via pirates
+numpy==1.18.4             # via opencv-python
+opencv-python==4.2.0.34   # via -r base.in
 pillow==7.1.2             # via wagtail
 pirates==0.3.1            # via -r base.in
 psycopg2-binary==2.8.5    # via -r base.in
-- 
GitLab