kennymckormick / pyskl

A toolbox for skeleton-based action recognition.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

cv2.imshow unable to display image

MooresS opened this issue · comments

The test code is as follows.

import cv2
from pyskl.apis import init_recognizer  # No error will be reported if this line of code is commented.
def main():
    vid = cv2.VideoCapture("rtsp://admin:lgl---616@192.168.61.6:554/media/video2")
    flag, frame = vid.read()

    cv2.imshow("test", frame)
    print("over")
if __name__ == '__main__':
    main()

The error is ‘Process finished with exit code 139(interrupted by signal 11:SIGSEGV)’.
Error is mainly caused by 'from pyskl.apis import init_recognizer'.
I specially created a new environment for testing.

#120 It should be the same question as mine.

You can try the new installation guide to reinstall pyskl and see if the problem has been fixed now.
Sorry for the late fix.

import numpy as np
import cv2

from pyskl.apis import init_recognizer
from pyskl.datasets import GestureDataset
from pyskl.datasets.pipelines import Compose
from pyskl.smp import h2r

arr = np.random.randint(0, 256, (200, 200, 3), dtype=np.uint8)
cv2.imshow('output', arr)
cv2.waitKey(5)
input()

Running this minimal code still causes a segmentation fault when trying to execute cv2.imshow.
The import statements at lines 4 to 7 are the import required in the demo_gesture.py and if I comment them, cv2.imshow works.

I have already tried to install pyskl following the new installation guide.
I also tried to install different versions of opencv.

I'm running this code on Ubuntu 20.04.

Hi, nunziati,
My Windows laptop can run your minimal examples bug-free. This weekend I can have a try with a clean Ubuntu 22.04 linux desktop and I will provide more updates then.

Thank you, I found out that the "import decord" statement in smp.py caused cv2.imshow to stop with a segmentation fault.
For the moment I just commented that line, since it is not strictly required.
I have decord 0.6.0 and I've not tried different versions.

Thank you, I found out that the "import decord" statement in smp.py caused cv2.imshow to stop with a segmentation fault. For the moment I just commented that line, since it is not strictly required. I have decord 0.6.0 and I've not tried different versions.

thanks!!I solved it by your method!