0

I decide to run this code http://www.pyimagesearch.com/2017/04/03/facial-landmarks-dlib-opencv-python/

I run this example in terminal

cd /home/mnt/Kernel

python3 facial_landmarks.py --shape-predictor shape_predictor_68_face_landmarks.dat \

--image p.jpg

But you can see screenshot. I don't see any output image. You can see this in screenshot

Error in dlib

My goal is to run this example. I want to see output image (Facial landmarks)

My attempt to find a solution

First attempt

I think that I have problem in dlib.

I run this code:

print("Hello world")

output: Hello world

import cv2
import dlib
import imutils
detector = dlib.get_frontal_face_detector()
image = cv2.imread("/home/mnt/Kernel/p.jpg" )
image = imutils.resize(image, width=500)
gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
rects = detector(gray, 1) 

I can not enter other commands after this. If I run print("Hello world") I will see nothing.

You can see this in screeshot: Error in dlib

I think that this is error in dlib function rects = detector(gray, 1).

But I don't know how to solve this problem.

Second attempt

I wrote a letter to creater dlib but He wrote "I should also point out that you should run the face_detector.py example that comes with dlib. Does that crash or act funny? If not then the problem is almost certainly with some other thing you are doing or have installed, rather than anything related to dlib".

https://github.com/davisking/dlib/issues/620

So I don't know that I can do to solve this problem. If I did something wrong, then what? How can I run this example http://www.pyimagesearch.com/2017/04/03/facial-landmarks-dlib-opencv-python/ ?

vjg
  • 131
  • 1
  • 13
  • How did you install dlib? It looks like installation problem because of library missing during installation. Code works fine in my system – Smit Shilu Nov 07 '17 at 14:34

1 Answers1

1

I think the problem is with x11 display

CaptainZero
  • 1,431
  • 1
  • 19
  • 38
  • I downloaded dlib here: https://github.com/davisking/dlib/ Before compiling dlib, I edited dlib's tools/python/CMakeLists.txt file from: set(USE_SSE4_INSTRUCTIONS ON CACHE BOOL "Use SSE4 instructions") to: set(USE_SSE2_INSTRUCTIONS ON CACHE BOOL "Use SSE2 instructions") Then I run python3 setup.py install And it worked! – vjg Nov 07 '17 at 17:51