프로그램/python

python numpy init - high speed

mulderu 2017. 2. 22. 18:33


초고속 메모리카피


http://opencvpython.blogspot.kr/2012/06/fast-array-manipulation-in-numpy.html


numpy data copy


 

x = np.random.randint(0,5,(2000,2000))

 

green = [0,255,0]

blue = [255,0,0]

red = [0,0,255]

white = [255,255,255]

black = [0,0,0]


color = [green,blue,red,white,black]

    color = np.array(color,np.uint8)

    y = color[x]




mulder@~/Project/mulder/ml$ python "/Users/mulder/Project/mulder/ml/OpenCV-Python/mulder/base01.py"

makeSimple S:18:28:40

makeSimple E:18:28:44

makeByPallete S:18:28:44

makeByPallete E:18:28:44

ms:58

mulder@~/Project/mulder/ml$