I have search for a moment but only find this Answer similar. So I make a question here. I want to scale a image by track bar, my code as below show:
import cv2
import numpy as np
img = cv2.imread('../data/logo.png')
cv2.namedWindow('scaleFactor')
cv2.namedWindow('image')
def nothing(x):
print 'x--->', x
cv2.createTrackbar('scale','scaleFactor', 0 , 5, nothing)
while(1):
rows, cols = img.shape[:2]
cv2.imshow('image', img)
scaleFactor = cv2.getTrackbarPos('scale','scaleFactor') or 1
scaleFactor = scaleFactor if scaleFactor > 0 else 1
img = cv2.resize(img, (int(rows * scaleFactor), int(cols * scaleFactor)), interpolation=cv2.INTER_LINEAR)
k =cv2.waitKey(10)
if k == 27:
break
print 'scaleFactor -->', scaleFactor
cv2.destroyAllWindows()
Just simple show me a very long error information:
scaleFactor --> 2
python(26953,0x7fffa5a033c0) malloc: *** mach_vm_map(size=4872572928) failed (error code=4)
*** error: can't allocate region
*** set a breakpoint in malloc_error_break to debug
Is there anyone have meet this error before?