Bringing OpenCV to Xojo (again)

Glad you got it straightened out!

My objective is just to see the Webcam flow at about 25im/s in my Xojo app.

  1. “videoStream = openCV.CVCVideoCapture.Create()” seems to freeze the code for about 5 seconds at the first call. Is this normal ?

  2. Each “videoStream.read(frame)” call seems to be quite slow (as my Webcam flow is about 5 im/s max on my very fast M2max Mac), but I’m not sure about the reason.

Here is the code in case you can help me.

#tag Event
	Sub Action()

	  if CheckBox_Camera.Value then
	    If (videoStream = Nil) or (Not videoStream.isOpened) Then
	      videoStream = openCV.CVCVideoCapture.Create()
	      Return
	    End If
	    
	    Var frame As New openCV.CVCMat
	    
	    // 4Ticks, this slows the video 
	    If videoStream.read(frame) Then
	      current_Video_Picture = frame.image // the Picture will be Painted in the Canvas
	    End If
	    
	  End If
	End Sub
#tag EndEvent

Sorry I really know nothing about how the video stuff works. We use OpenCV entirely on still images, so I’ve never really had occasion to work with the video functionality. Perhaps someone who has more experience with that can chime in.

-perry