text: import os
  os.add_dll_directory(os.path.join(os.environ['CUDA_PATH'], 'bin'))
  
  import dlib
  import cv2
  import numpy as np
  
  
  from .core import Core
  class FaceDetectDlib(Core):
      
      def __init__(self, source, path, method):
          super().__init__(source = source, path = path)
          self.face = []
          self.bbox = []
          self.method = method
          self.pose_predictor = dlib.shape_predictor(r"../helper/dat/shape_predictor_68_face_landmarks.dat")
          
          if 0 == method:
              self.detector = dlib.get_frontal_face_detector()
          elif 1 == method:
              self.detector = dlib.cnn_face_detection_model_v1(r"../helper/dat/mmod_human_face_detector.dat")
          
      #end
  
      def faceDetect(self, img = np.zeros([10,10])):
          gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
          rects = self.detector(gray,1)
          self.face = []
          self.bbox = []
          for rect in rects:
              if self.method == 0:
                  left=rect.left()
                  top=rect.top()
                  right=rect.right()
                  bottom=rect.bottom()
              else:
                  left=rect.rect.left()
                  top=rect.rect.top()
                  right=rect.rect.right()
                  bottom=rect.rect.bottom()
  
              #img_crop=img[top:top+height,left:left+width]
              #(x1, y1), (w, h)
              cv2.rectangle(img, (left, top), (right, bottom), (255, 0, 255), 2)
  
              # Oluşan çerçeveyi ekrana yansıt
              
              bbox = (left,top,right,bottom)
              self.bbox.append(bbox)
              #self.bbox.append((0,0,0,0))
                     
          for box in self.bbox:
              gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
              rec = dlib.rectangle(box[0],box[1],box[2],box[3])
              landmark = self.pose_predictor(gray, rec)
              for n in range(0,68):
                  xx = landmark.part(n).x
                  yy = landmark.part(n).y
                  cv2.circle(img, (xx, yy), 2, (255, 0, 255), 1)
          
          self.face = np.array(img) #fullface
          return self.bbox, self.face
      
      
      def run(self):
          while True:
              success, frame = self.vc.read()
              a,face = self.faceDetect(frame)
              if face == []:
                  face = frame
                  
              print(face)
              cv2.imshow("Ekran", face)
              if cv2.waitKey(1) & 0xFF == ord('q'):
                  break
  
          cv2.destroyAllWindows()
          self.vc.release()
      #end
      
  #end::cl