__init__.py 889 Bytes
__author__ = 'chunk'

from ..common import *

import numpy as np
from PIL import Image
# import cv2

__all__ = ['FeatureBase']

timer = ctimer()


def PILtest(image):
    img = Image.open(image).convert('RGB')
    print img
    img.save('res/tmp.jpg', format='JPEG')


def RGBtest():
    img = np.arange(256 * 256 * 3).reshape((256, 256, 3)) % 255
    # img.fill(122)
    img = img.astype(np.uint8)
    print type(img), img.dtype, img.shape
    print img

    img = np.array(img)
    img = Image.fromarray(img)
    img.save('res/tmp.jpg', format='JPEG')

    img2 = np.array([[[255, 0, 0]]], dtype=np.uint8)
    img2 = img2.repeat(128, axis=1).repeat(128, axis=0)
    print type(img2), img2.dtype, img2.shape
    print img2

    # cv2.imshow('test img', img2)
    # cv2.waitKey(0)


class FeatureBase(object):
    def __init__(self):
        pass

    def feat(self, image):
        pass