videoinput versus videodevice for realtime processing

4 ビュー (過去 30 日間)
Quentin 2014 年 2 月 4 日
Hello all,
I have written a simple machine vision script in my lab to detect objects moving around in a pre-recorded video. It works really well and I am happy with its performance. I would now like to move it into real time tracking and I am looking for a little guidance on the best way to handle this. We are using a new i7 PC running Matlab R2013b with a solid state hard drive. We have a pointgrey gige blackfly camera. I'm hoping this should be a fast enough set up. Our algorithm basically just takes a lot of frames initially to get a "mean frame". This is then subtracted from each frame of the video so that only the objects moving are now visible. So basically, we would take a single frame, process it, then take another single frame, and repeat.
There are two main points which I'm not sure of. The first is whether I should use videoinput and trigger each frame individually between processing of if we should use videodevice, since it is designed for single frames. The issues with videodevice is that I could not figure out how to get a timestamp for each frame (we would like millisecond precision ideally). Next is the issue of collecting many frames. Is there an easy way to have matlab stream this information to the hard drive so that we could collect tens of minutes of processed video data?
Any tips would be greatly appreciated. Ciao, Quentin
  2 件のコメント
William Chamberlain
William Chamberlain 2016 年 8 月 19 日
Glad to hear that you resolved your issues, because I have almost exactly the same requirements!
Could you post code snippets for your configuration, or a list of properties & values to set, or links to any code that you have released?
Thanks, Will


回答 (3 件)

Quentin 2014 年 2 月 10 日
編集済み: Walter Roberson 2015 年 9 月 9 日
Thank you for the help on this Sean. I've rewritten the code so that the camera can simply be triggered by an external device. The idea would be to have this trigger the device at a steady 30 fps and then matlab could perform the computations in between. The issue that I'm having now is that I can't get Matlab to configure the camera for the triggering. I'm using,
vid = imaq.VideoDevice('gige', 1);
set(vid, 'ROI', [1 1 640 240]); %[x y width height] use 640 240
set(vid, 'HardwareTriggering', 'On');
set(vid.DeviceProperties, 'FrameStartTriggerActivation', 'RisingEdge');
All of this works loads and returns no errors. However, when I now run
I get the error
Error using imaq.VideoDevice/start (line 478)
Invalid use of START method on VideoDevice System object. Use the
STEP method to acquire a frame.
If I use frame = step(vid);
I get the error,
Warning: The videoinput object is configured for hardware
trigger, however, no TriggerMode properties have been set to
'On'. The most likely result of this will be immediate
What I am trying to do is just have it collect a single frame per trigger to continue my while loop. I cannot figure out how to set a specific TriggerMode. I know the camera is capable of "Mode 0" but if I look get(vid), I just get
Device: 'Blackfly BFLY-PGE-13E4M (gige-1)'
VideoFormat: 'Mono8'
DeviceFile: ''
ROI: [1 1 640 240]
HardwareTriggering: 'on'
TriggerConfiguration: 'DeviceSpecific/DeviceSpecific'
ReturnedColorSpace: 'grayscale'
BayerSensorAlignment: 'grbg'
ReturnedDataType: 'single'
DeviceProperties: [1x1 imaq.internal.DeviceProperties]
So I'm not sure how to work with the DeviceSpefic setting. The camera is a new Pointgrey blackfly.
Any help is greatly appreciated.
  1 件のコメント
Andrew Davies
Andrew Davies 2015 年 9 月 9 日
Did you ever solve this problem? I am also having trouble getting my camera to take an external trigger when using VideoDevice rather then videoinput.


Sean de Wolski
Sean de Wolski 2014 年 2 月 5 日
Use the 'TimerPeriod' option in the videoinput object.
imaqhelp videoinput

Shankar Subramanian
Shankar Subramanian 2015 年 10 月 13 日
Hi Quentin and Andy,
While using VideoDevice System Object with gige cameras, you need to use the "DeviceProperties" field which consists of device specific properties (in this case Pointgrey blackfly) to specify the hardware triggering mode/condition.
deviceSpecificProps = vid.DeviceProperties
Browse through deviceSpecificProps and you will find the specific trigger properties that need to be set. An example from a display from another camera used through gige interface is shown below.
FrameStartTriggerActivation = RisingEdge
FrameStartTriggerDelayAbs = 0
FrameStartTriggerMode = Off
FrameStartTriggerSource = Line1

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by