diff --git a/Dockerfile b/Dockerfile index 4893b14..1df083e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,6 +9,10 @@ ENV PATH="$PATH:/root/julia-1.8.5/bin" # Uncomment to install shotwell, an image utility. Not required. #RUN apt-get update && apt-get install shotwell --no-install-recommends -y -RUN julia -e "using Pkg; Pkg.instantiate()" +# RUN julia -e "using Pkg; Pkg.instantiate()" + +RUN apt-get update && apt-get install vim -y + +RUN julia -e "using Pkg; Pkg.add(\"PythonCall\")" CMD "/bin/bash" diff --git a/README.md b/README.md index ddd81d0..eccf4f4 100644 --- a/README.md +++ b/README.md @@ -22,16 +22,26 @@ cd /root/src You are now ready to execute code! -## Julia Setup -From inside the docker container +## Running the example +``` +LD_PRELOAD="/usr/lib/x86_64-linux-gnu/libcurl.so.4" julia sift.jl ``` -julia -# Activate the environment -] activate . -# Install the packages -] instantiate -``` +## OLD: + + +# ## Julia Setup +# +# From inside the docker container +# ``` +# julia +# +# # Activate the environment +# ] activate . +# +# # Install the packages +# ] instantiate +# ``` diff --git a/src/frb.jpg b/src/frb.jpg new file mode 100644 index 0000000..cc240d7 Binary files /dev/null and b/src/frb.jpg differ diff --git a/src/sift.jl b/src/sift.jl new file mode 100644 index 0000000..1e200d0 --- /dev/null +++ b/src/sift.jl @@ -0,0 +1,22 @@ +# make sure it uses the system-instaled python backend +ENV["JULIA_CONDAPKG_BACKEND"] = "Null" +ENV["JULIA_PYTHONCALL_EXE"] = "/usr/bin/python3" + +using PythonCall + +# import opencv + +cv = pyimport("cv2") + +# run the sift commands + +img = cv.imread("frb.jpg") +gray = cv.cvtColor(img, cv.COLOR_BGR2GRAY) + +sift = cv.SIFT_create() + +kp = sift.detect(gray, pybuiltins.None) + +img = cv.drawKeypoints(gray, kp, img) + +cv.imwrite("sift_keypoints_julia.jpg", img) diff --git a/src/sift.py b/src/sift.py new file mode 100644 index 0000000..a18ca0e --- /dev/null +++ b/src/sift.py @@ -0,0 +1,12 @@ +import numpy as np +import cv2 as cv + +img = cv.imread("frb.jpg") +gray = cv.cvtColor(img, cv.COLOR_BGR2GRAY) + +sift = cv.SIFT_create() +kp = sift.detect(gray, None) + +img = cv.drawKeypoints(gray, kp, img) + +cv.imwrite('sift_keypoints.jpg', img) diff --git a/src/sift_keypoints.jpg b/src/sift_keypoints.jpg new file mode 100644 index 0000000..ceff0f1 Binary files /dev/null and b/src/sift_keypoints.jpg differ