Multi Threading for Optical Flow (14.9 KB)

Hey Guys,

i want to use multi threading to calculate optical flow efficient while frames of camera are updating. For communication back and forth between main and second thread i use ofThreadChannel.

now the attached version works kinda nice —with 2400 frames lol …however if i raise the resolution then:

  1. the program crashes hard
  2. or shows optical flow heavily detailed

i assume that the way i use ofThreadchannel isnt safe and does not lock the data. However im not sure how this is related to the time the optical flow needs.

The attached example of my problem is melted of ofxcv example and threadchannel example.

If anyone could point me in the right direction - would be a crazy help. Have been away for some years from OF - so please apologize if my question seems to easy.