__init__.py
889 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
__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