Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

OpenCV feed keeps getting crash #967

Open
Labels
@ghost

Description

Python kernel keeps getting dead.
When I open the CV2 feed. It keeps getting crashed (not responding window).

Inthiscode :cap=cv2.VideoCapture(0)# Set mediapipe modelwithmp_holistic.Holistic(min_detection_confidence=0.5,min_tracking_confidence=0.5)asholistic:whilecap.isOpened():# Read feedret,frame=cap.read()# Make detectionsimage,results=mediapipe_detection(frame,holistic)print(results)# Draw landmarksdraw_styled_landmarks(image,results)# Show to screencv2.imshow('OpenCV Feed',image)# Break gracefullyifcv2.waitKey(10)&0xFF==ord('q'):breakcap.release()cv2.destroyAllWindows()```->It'sworkingfinebutinthiscode:```pythoncap=cv2.VideoCapture(0)withmp_holistic.Holistic(min_detection_confidence=0.5,min_tracking_confidence=0.5)asholistic:foractioninactions:forsequenceinrange(start_folder,start_folder+no_sequences):forframe_numinrange(sequence_length):ret,frame=cap.read()image,results=mediapipe_detection(frame,holistic)draw_styled_landmarks(image,results)ifframe_num==0:cv2.putText(image,'STARTING COLLECTION', (120,200),cv2.FONT_HERSHEY_SIMPLEX,1, (0,255,0),4,cv2.LINE_AA)cv2.putText(image,'Collecting frames for {} Video Number {}'.format(action,sequence), (15,12),cv2.FONT_HERSHEY_SIMPLEX,0.5, (0,0,255),1,cv2.LINE_AA)cv2.imshow('OpenCV Feed',image)cv2.waitKey(500)else:cv2.putText(image,'Collecting frames for {} Video Number {}'.format(action,sequence), (15,12),cv2.FONT_HERSHEY_SIMPLEX,0.5, (0,0,255),1,cv2.LINE_AA)cv2.imshow('OpenCV Feed',image)keypoints=extract_keypoints(results)npy_path=os.path.join(DATA_PATH,action,str(sequence),str(frame_num))np.save(npy_path,keypoints)ifcv2.waitKey(10)&0xFF==ord('q'):breakcap.release()cv2.destroyAllWindows()

It's getting crashed.
It just open the CV2 feed window and freeze.
This code worked just fine a month ago.
I'm using Python 3.11.5 because it's the highest version that is compatible with TensorFlow.
I updated all the outdated library.
Use the environment approach.
While running my task manager show python task for few second.
There is no change in CPU usage, but memory usage increases by 900 MB to 1 GB.

I don't know what causes the problem?
Tried updating BIOS,system, libraries, pip, environment approach.
I also use cv2 windowthread method.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp