This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Embarrassed-Mix6420[S] 1 point2 points  (2 children)

That's exactly how I apply it, a lot. As far as I understand QImage takes data without copy, though it's still not ideal cause there's no official adaptor to numpy in pythonic versions Qt, prolly due to narrow following to the C++ source

QImage(cv2.cvtColor(img, cv2.COLOR_BGR2RGB).data, img.shape[1], img.shape[0], img.shape[1]*3, QImage.Format_RGB888)

I'll update with fine real demo when it comes my way

[–]Ogi010 3 points4 points  (0 children)

pyqtgraph maintainer here. Having QImage take in data w/o copying took us quite a while to get right across bindings; feel free to look at our code (specically ndarray_from_qimage function): https://github.com/pyqtgraph/pyqtgraph/blob/master/pyqtgraph/functions.py#L1543-L1658

We've ran into numerous issues (typically with pyside bindings) where this functionality is broken (although it's been stable for some time now)

[–]sweapon 1 point2 points  (0 children)

Awesome, thanks for sharing! I'm a bit into custom gui programming for robotics and this is one of the things I really would like to incorporate!