2014-10-19 57 views
-5

我很想知道如何從MomentCam等App中的圖片創建漫畫。指針或代碼片段來實現這一點深受讚賞。MomentCam使用Python/Matlab/OpenCV的漫畫

在此先感謝。

+2

downwoted for:沒有自己的研究努力顯示。 – berak 2014-10-19 17:41:21

回答

1

您需要識別臉部的東西。 Here you can find a tutorial including the following code.

import cv2 
import sys 

# Get user supplied values 
imagePath = sys.argv[1] 
cascPath = sys.argv[2] 

# Create the haar cascade 
faceCascade = cv2.CascadeClassifier(cascPath) 

# Read the image 
image = cv2.imread(imagePath) 
gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY) 

# Detect faces in the image 
faces = faceCascade.detectMultiScale(
    gray, 
    scaleFactor=1.1, 
    minNeighbors=5, 
    minSize=(30, 30), 
    flags = cv2.cv.CV_HAAR_SCALE_IMAGE 
) 

print "Found {0} faces!".format(len(faces)) 

# Draw a rectangle around the faces 
for (x, y, w, h) in faces: 
    cv2.rectangle(image, (x, y), (x+w, y+h), (0, 255, 0), 2) 

cv2.imshow("Faces found", image) 
cv2.waitKey(0)