How to use the Output Line of a GigE camera correctly?
9 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I'm trying to synchronize two GigE cameras (Basler acA1300-30gm) by hardware triggering one using the output line of the other camera. At the moment I'm stuck at getting the right signal from the master (triggering) camera.
I tried the following and watched the output line with an oscilloscope:
clear all;
close all;
imaqreset();
n = chooseGigeCam('CameraID');
vid = videoinput('gige', n, 'Mono8');
src = getselectedsource(vid);
triggerconfig(vid, 'manual');
src.ExposureTimeRaw = 100000;
src.Out1LineSource = 'ExposureActive';
vid.FramesPerTrigger = 1;
vid.TriggerRepeat = 3;
start(vid);
for i = 1:3
trigger(vid);
pause(0.2);
end
stop(vid);
delete(vid);
After using many different configurations with MATLAB I ended up trying to do the same in C++ using the pylon API and this time it worked:
#include <pylon/PylonIncludes.h>
#include <pylon/gige/BaslerGigEInstantCamera.h>
using namespace Pylon;
using namespace GenApi;
using namespace Basler_GigECameraParams;
using namespace std;
int main(int argc, char* argv[]) {
int exitCode = 0;
Pylon::PylonAutoInitTerm autoInitTerm;
CGrabResultPtr ptrGrabResult;
try {
CDeviceInfo info;
info.SetDeviceClass("BaslerGigE");
info.SetSerialNumber("CameraID");
CBaslerGigEInstantCamera camera( CTlFactory::GetInstance().CreateFirstDevice(info));
camera.Open();
camera.TriggerSelector.SetValue(TriggerSelector_FrameStart);
camera.TriggerMode.SetValue(TriggerMode_On);
camera.TriggerSource.SetValue(TriggerSource_Software);
camera.ExposureTimeRaw.SetValue(100000);
camera.LineSelector.SetValue(LineSelector_Out1);
camera.LineSource.SetValue(LineSource_ExposureActive);
camera.StartGrabbing();
for(int i = 0; i < 3; i++) {
camera.ExecuteSoftwareTrigger();
Sleep(200);
}
camera.StopGrabbing();
}
catch (GenICam::GenericException &e) {
cerr << "An exception occurred." << endl
<< e.GetDescription() << endl;
exitCode = 1;
}
cerr << endl << "Press Enter to exit." << endl;
while( cin.get() != '\n');
return exitCode;
}
What am I doing wrong in MATLAB? How can I get the correct trigger signal (same as from pylon API)?
P.S.: I tried MATLAB 2013b and 2014a
1 commentaire
Van Khuyen Bui
le 30 Août 2016
Hey, I am a new guy in machine vision. I find your C++ prog is really helpful. I try to run but not successful. The program did not realize my camera. My camera is Basler ac640-90gc and i can use that with other program. Can you tell me why? The error: No device is available or no device contains the provided infor properties. Thank you so much
Réponses (0)
Voir également
Catégories
En savoir plus sur GigE Vision Hardware dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!