react-native-opencv icon indicating copy to clipboard operation
react-native-opencv copied to clipboard

how do i add cv2.dnn.readNetFromCaffe('model.txt', 'face_detection.caffemodel') this function in rnopencv in react native.

Open HamzaFunavry opened this issue 6 years ago • 0 comments

def detectFace(image, net): image = cv2.imread(image) (h, w) = image.shape[:2] blob = cv2.dnn.blobFromImage(cv2.resize(image, (300, 300)), 1.0, (300, 300), (104.0, 177.0, 123.0)) net.setInput(blob) detections = net.forward() print(len(detections)) flag = False for i in range(0, detections.shape[2]): confidence = detections[0, 0, i, 2]

    # if confidence > args["confidence"]:
    if confidence > 0.9:
        flag = True

return flag

net = cv2.dnn.readNetFromCaffe('model.txt', 'face_detection.caffemodel') image="./sarmad.jpg" flag=detectFace(image, net) if (flag): print(flag) else: print(flag)

HamzaFunavry avatar Dec 23 '19 07:12 HamzaFunavry