コード例 #1
0
ファイル: cardUtils.py プロジェクト: IOIOB/leitner
import database
from card import Card


def listCards(fileName):
    db = database.loadDatabase(fileName)
    cards = database.loadAllCards(db=db)
    for card in cards:
        print(str(card))


if __name__ == "__main__":
    db = database.loadDatabase("box.db")
    print("You can list/add/modify/delete")
    command = input("What to do: ").lower()
    if command == "list":
        print("Listing...")
        listCards("box.db")
    elif command == "add":
        question = input("Question: ")
        answer = input("answer: ")
        colour = input("colour: ")
        image = input("image: ")
        card = Card(None, question, answer, colour, image, 1, 0)
        database.insertCard(db, card)
    elif command == "modify":
        cardId = input("Id of card to replace: ")
        card = database.loadCard(db, cardId)
        property_ = input("Property to modify: ").lower()
        value = input("New value: ")
        if property_ == "question":
コード例 #2
0
ファイル: cardUtils.py プロジェクト: IOIOB/leitner
def listCards(fileName):
    db = database.loadDatabase(fileName)
    cards = database.loadAllCards(db=db)
    for card in cards:
        print(str(card))
コード例 #3
0
    if args.output_file:
        output_file = args.output_file
        video_writer = cv2.VideoWriter(output_file, int(video.get(6)),
                                       video.get(5),
                                       (int(video.get(3)), int(video.get(4))))
        if not video_writer.isOpened():
            raise Exception("Cannot write to file %s" % output_file)
        write_output = True
    else:
        write_output = False

    detector_and_tracker = FaceDetectorAndTracker()
    descriptor = initDescriptor(
        descriptor_type, database_name,
        detector_and_tracker.alignment_with_face_detector.getReferenceShape())
    database = loadDatabase(desc=descriptor_type, db=database_name)
    filters = []

    if "jb" in descriptor_type:
        similarity = jointBayesianDistance
    else:
        similarity = np.inner

    cv2.namedWindow("Alignment demo")

    fps = video.get(5)
    print "Video running at %0.2f fps" % fps

    n = 0
    face_detector_freq = int(fps / 2)
    shapes = []