Ask Your Question

urielka's profile - activity

2016-12-14 07:37:41 -0600 commented question OpenCV slow on retina screen vs external screen

any recommended alternative? :)

2016-12-14 02:25:21 -0600 commented question OpenCV slow on retina screen vs external screen

Yeha but that much? I mean I can only push 10 fps and in the other screen I can push well over 30 fps... I would assume the GPU would take care of it, maybe the UI facilities in mac aren't accelerated?

2016-12-13 03:59:12 -0600 asked a question OpenCV slow on retina screen vs external screen

I have noticed a really weird behaivor of OpenCV on my Macbook 12 retina (Early 2015 model). I am using OpenCV 3.1.0 and Python 3.5.1 on Mac OSX El Capitan 10.11.2

When I put a window in the external screen (27" 1920x1080) the code runs fast but when I take the same window and move it to the builtin screen(12" 2304 × 1440 on the default settings) the code runs alot slower.

Here is a minimal code that shows the problem:

import cv2
import numpy as np
from time import time, sleep


sum_time = 0
samples = 1000

i = 0

while i < samples:
  zeros = np.zeros((640,480,3), dtype=np.uint8)
  cv2.imshow("Frame", zeros)
  t = time()
  cv2.waitKey(1)
  sum_time += (time() - t)
  i+=1

print("Avg time for  took: %f" % (sum_time / samples))

When running on the external screen I get:

Avg time for  took: 0.015225

When running the exact same code on the retina screen (i.e. the window is being rendered there):

Avg time for  took: 0.033613

I tried it a bunch of times and the results are consistent, any idea what might cause this?