Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 57 additions & 0 deletions InstallScripts/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
FROM python:3.7-slim-buster

MAINTAINER Labhesh Valechha <labheshvalechha@gmail.com>

ARG opencv_version=4.4.0
ARG pythonVersion=3.7
ENV DEBIAN_FRONTEND noninteractive

RUN apt-get update && apt-get install -y --no-install-recommends \
apt-utils \
build-essential \
cmake \
git \
vim \
libgtk2.0-dev \
pkg-config \
libavcodec-dev \
libavformat-dev \
libswscale-dev \
libeigen3-dev \
libgflags-dev \
libgoogle-glog-dev \
libhdf5-dev \
&& pip install numpy \
&& rm -rf /var/lib/apt/lists/*

ENV PYTHONPATH=/usr/local/lib/python"$pythonVersion"/
ENV PYTHONHOME=/usr/local

WORKDIR /home

RUN git clone https://github.com/opencv/opencv_contrib.git \
&& cd opencv_contrib \
&& git checkout $opencv_version \
&& cd .. \
&& git clone https://github.com/opencv/opencv.git \
&& cd opencv \
&& git checkout $opencv_version\
&& mkdir build \
&& cd build \
&& cmake \
-D CMAKE_BUILD_TYPE=Release \
-D CMAKE_INSTALL_PREFIX=/usr/local \
-D BUILD_EXAMPLES=ON \
-D OPENCV_GENERATE_PKGCONFIG=ON \
-D PYTHON3_NUMPY_INCLUDE_DIRS=/usr/local/lib/python"$pythonVersion"/site-packages/numpy/core/include/ \
-D OPENCV_EXTRA_MODULES_PATH=/home/opencv_contrib/modules \
.. \
&& make install/strip \
&& cd /home \
&& rm -rf opencv opencv_contrib

WORKDIR /home

COPY Sample-Code-Cpp-Unix /home/sampleCode

CMD ["bash"]
36 changes: 36 additions & 0 deletions InstallScripts/docker/Sample-Code-Cpp-Unix/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# SPECIFY THE MINIMUM VERSION OF CMAKE REQUIRED
cmake_minimum_required(VERSION 2.8.12)


# SPECIFY YOUR PROJECT NAME
PROJECT(sampleCode)


# Enable C++11
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED TRUE)


SET(OpenCV_DIR /usr/local/lib/cmake/opencv4/)


# MAKE SURE OPENCV IS INSTALLED CORRECTLY
find_package( OpenCV REQUIRED )


# INCLUDE OPENCV DIRECTORIES
include_directories( ${OpenCV_INCLUDE_DIRS})


# MACRO TO COMPILE CPP FILES
# Do Not Edit
MACRO(add_example name)
ADD_EXECUTABLE(${name} ${name}.cpp)
TARGET_LINK_LIBRARIES(${name} ${OpenCV_LIBS} )
ENDMACRO()


# COMPILE CPP FILES USING THIS LINE
######## EDIT THE FILE NAMES ########
add_example(sampleCode)
#add_example(sampleCode2) and so on
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 16 additions & 0 deletions InstallScripts/docker/Sample-Code-Cpp-Unix/sampleCode.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#include <opencv2/core.hpp>
#include <opencv2/imgproc.hpp>
#include <opencv2/opencv.hpp>

using namespace cv;

int main(void) {

// Read image in GrayScale mode
Mat image = imread("boy.jpg",0);

// Save grayscale image
imwrite("boyGray.jpg",image);

return 0;
}