Example #1
0
def estimateOrientationMode():
    """
    Example of a orientation mode estimation.
    """
    image = VLImage.load(filename=EXAMPLE_O)
    faceEngine = VLFaceEngine()
    orientationModeEstimator = faceEngine.createOrientationModeEstimator()
    #: estimate
    pprint.pprint(orientationModeEstimator.estimate(image))

    image2 = VLImage.load(filename=EXAMPLE_1)
    #: estimate batch
    pprint.pprint(orientationModeEstimator.estimateBatch([image, image2]))
Example #2
0
async def asyncRotateNEstimateImage():
    """
    Async example of image rotation.
    """
    nonRotatedImage = VLImage.load(filename=EXAMPLE_O)
    faceEngine = VLFaceEngine()
    orientationModeEstimator = faceEngine.createOrientationModeEstimator()
    #: rotate & estimate | not rotated
    image = VLImage.rotate(nonRotatedImage, RotationAngle.ANGLE_0)
    orientation = await orientationModeEstimator.estimate(image,
                                                          asyncEstimate=True)
    pprint.pprint(orientation)
    task1 = orientationModeEstimator.estimate(image, asyncEstimate=True)
    task2 = orientationModeEstimator.estimate(image, asyncEstimate=True)
    for task in (task1, task2):
        pprint.pprint(task.get())
Example #3
0
def rotateNEstimateImage():
    """
    Example of image rotation.
    """
    nonRotatedImage = VLImage.load(filename=EXAMPLE_O)
    faceEngine = VLFaceEngine()
    orientationModeEstimator = faceEngine.createOrientationModeEstimator()
    #: rotate & estimate | not rotated
    image = VLImage.rotate(nonRotatedImage, RotationAngle.ANGLE_0)
    pprint.pprint(orientationModeEstimator.estimate(image))
    #: rotate & estimate | left
    image = VLImage.rotate(nonRotatedImage, RotationAngle.ANGLE_90)
    pprint.pprint(orientationModeEstimator.estimate(image))
    #: rotate & estimate | right
    image = VLImage.rotate(nonRotatedImage, RotationAngle.ANGLE_270)
    pprint.pprint(orientationModeEstimator.estimate(image))
    #: rotate & estimate | upside down
    image = VLImage.rotate(nonRotatedImage, RotationAngle.ANGLE_180)
    pprint.pprint(orientationModeEstimator.estimate(image))