The code.ill.fr has been recreated and upgraded with the latest version this weekend, If you encounter any problem please inform the Helpdesk.

Commit ac99776d authored by Locatelli's avatar Locatelli
Browse files

Merge remote-tracking branch 'origin/V3.2_191' into ploty2

parents 0e2239cc b0bc80b2
<module name="dif_s">
<controller class="dif_s::DirectCamera"/>
<include path="$(NOMAD_HOME)/../NomadModules/src"/>
<link path="/opt/baumer-gapi-sdk/lib" lib="bgapi2_genicam"/>
<link lib="opencv_core"/>
<link lib="opencv_calib3d"/>
<link lib="opencv_highgui"/>
<link lib="opencv_core"/>
<link lib="opencv_calib3d"/>
<link lib="opencv_highgui"/>
<include path="/opt/baumer-gapi-sdk/include/bgapi2_genicam"/>
</module>
......@@ -35,7 +35,12 @@ const std::string GenericCamDriver:: MODE[4] = {"Standard", "Average","Summation
/*
* Constructor
*/
*/ // std::cout << "number of captured images: " << camera_control->number_of_captured_images_ << std::endl;
// std::cout << "number of incomplete frames: " << buffer_info->number_of_incomplete_images << std::endl;
// std::cout << "resend requests: " << buffer_info->resend_requests
// << " single: " << buffer_info->resend_requests_single
// << " range: " << buffer_info->resend_requests_range << std::endl;
GenericCamDriver::GenericCamDriver(const string& name):
acquisition::NoTofAcquisitionCommon(name),acquisition::KineticAcquisitionCommon(name),
acquisition::TimeGateCommon(name),
......
......@@ -4,10 +4,10 @@
<link lib="opencv_core"/>
<link lib="opencv_calib3d"/>
<link lib="opencv_highgui"/>
<link path="/opt/pylon/lib" lib="GenApi_gcc_v3_1_Basler_pylon"/>
<link path="/opt/pylon/lib" lib="pylonbase" />
<link path="/opt/pylon/lib" lib="GCBase_gcc_v3_1_Basler_pylon"/>
<link path="/opt/pylon/lib" lib="pylonutility"/>
<!-- <link path="/opt/pylon/lib" lib="GenApi_gcc_v3_1_Basler_pylon"/> -->
<!-- <link path="/opt/pylon/lib" lib="pylonbase" /> -->
<!-- <link path="/opt/pylon/lib" lib="GCBase_gcc_v3_1_Basler_pylon"/> -->
<!-- <link path="/opt/pylon/lib" lib="pylonutility"/> -->
<link lib="opencv_core"/>
<link lib="opencv_calib3d"/>
<link lib="opencv_highgui"/>
......
......@@ -888,159 +888,159 @@ void RealGenericCamDriver::DoCalculation(CCameraControl * camera_control) {
void RealGenericCamDriver::stopLiveAcq(){
cout << "RealGenericCamDriver::stop() " << endl;
owner()->startActivated=false;
camera->StopGrabbing();
// camera->StopGrabbing();
}
void RealGenericCamDriver::startLiveAcq(){
// Namespace for using pylon objects.
using namespace Pylon;
// Namespace for using cout.
using namespace std;
// Number of images to be grabbed.
static const uint32_t c_countOfImagesToGrab = 10000;
// The exit code of the sample application.
int exitCode = 0;
// Before using any pylon methods, the pylon runtime must be initialized.
PylonInitialize();
try
{
Pylon::CTlFactory& tlFactory = Pylon::CTlFactory::GetInstance();
Pylon::DeviceInfoList_t devices;
Pylon::CInstantCameraArray cameras(devices.size());
Pylon::CDeviceInfo info;
bool cameraFind = false;
for (size_t i = 0; i < cameras.GetSize(); ++i)
{
cameras[i].Attach(tlFactory.CreateDevice(devices[i]));
if (cameras[i].GetDeviceInfo().GetFullName() == cameraName_.c_str())
{
info = cameras[i].GetDeviceInfo();
cameraFind = true;
}
}
Pylon::IPylonDevice* pDevice = Pylon::CTlFactory::GetInstance().CreateDevice(info);
camera = new Pylon::CInstantCamera(pDevice);
// Create an instant camera object with the camera device found first.
// camera= new CTlFactory::GetInstance().CreateFirstDevice();
// Print the model name of the camera.
cout << "Using device " << camera->GetDeviceInfo().GetModelName() << endl;
// The parameter MaxNumBuffer can be used to control the count of buffers
// allocated for grabbing. The default value of this parameter is 10.
camera->MaxNumBuffer = 10;
// Start the grabbing of c_countOfImagesToGrab images.
// The camera device is parameterized with a default configuration which
// sets up free-running continuous acquisition.
// camera.StartGrabbing( c_countOfImagesToGrab);
camera->StartGrabbing( c_countOfImagesToGrab, GrabStrategy_LatestImages);
// This smart pointer will receive the grab result data.
CGrabResultPtr ptrGrabResult;
CImageFormatConverter formatConverter;
formatConverter.OutputPixelFormat = PixelType_BGR8packed;
CPylonImage pylonImage;
Mat openCvImage, gray_img;
uint32_t frames;
// Camera.StopGrabbing() is called automatically by the RetrieveResult() method
// when c_countOfImagesToGrab images have been retrieved.
while (( camera->IsGrabbing()) && (owner()->startActivated()==true))
{
// Wait for an image and then retrieve it. A timeout of 5000 ms is used.
camera->RetrieveResult( 5000, ptrGrabResult, TimeoutHandling_ThrowException);
// Image grabbed successfully?
if (ptrGrabResult->GrabSucceeded())
{
// Access the image data.
// cout << "SizeX: " << ptrGrabResult->GetWidth() << endl;
// cout << "SizeY: " << ptrGrabResult->GetHeight() << endl;
const uint8_t *pImageBuffer = (uint8_t *) ptrGrabResult->GetBuffer();
// cout << "Gray value of first pixel: " << (uint32_t) pImageBuffer[0] << endl << endl;
// cout << "Gray value of first pixel: " << (uint32_t) pImageBuffer[1] << endl << endl;
int32 dataSize=ptrGrabResult->GetWidth()* ptrGrabResult->GetHeight();
int32* data = owner()->data();
if (data == nullptr) {
return;
}
formatConverter.Convert(pylonImage, ptrGrabResult);
openCvImage = Mat(ptrGrabResult->GetHeight(), ptrGrabResult->GetWidth(), CV_8UC3, (uint8_t *)pylonImage.GetBuffer());
imshow("Nomad", openCvImage);
if (waitKey(30)>=0) break;
// cout << "OpenCV Display Window: " << endl << endl;
// float64 sum = 0;
// CImg<uint16> total;
// uint16* tmp;
// CImg<uint16> subtotal;
// tmp = (uint16_t *) pImageBuffer;
// CImg<uint16> cam(tmp,ptrGrabResult->GetWidth() , ptrGrabResult->GetHeight());
// // cout << cam._width << endl;
// // cout << cam._height << endl;
// cam.permute_axes("yx");
// // cout << cam._width << endl;
// // cout << cam._height << endl;
// subtotal.append(cam, 'y');
// // cout << subtotal._width << endl;
// // cout << subtotal._height << endl;
//
// total.append(subtotal, 'x');
//
// uint16* buf =total.data();
//
//
//
//
// //uint16* buf =(uint16_t *) pImageBuffer;
// for (int32 j = 0; j < dataSize; ++j) {
// data[j] = buf[j];
// sum += (float64) data[j];
// }
data=(int32 *)pylonImage.GetBuffer();
owner()->data.sendEvent();
owner()->m_SynchroniseReadTerminated = true;
// cout << "owner()->data.sendEvent()" << endl;
usleep(100000);
}
else
{
cout << "Error: " << ptrGrabResult->GetErrorCode() << " " << ptrGrabResult->GetErrorDescription() << endl;
}
}
}
catch (const GenericException &e)
{
// Error handling.
cerr << "An exception occurred." << endl
<< e.GetDescription() << endl;
//exitCode = 1;
}
// Releases all pylon resources.
PylonTerminate();
//
// // Namespace for using pylon objects.
// using namespace Pylon;
//
// // Namespace for using cout.
// using namespace std;
//
// // Number of images to be grabbed.
// static const uint32_t c_countOfImagesToGrab = 10000;
// // The exit code of the sample application.
// int exitCode = 0;
//
// // Before using any pylon methods, the pylon runtime must be initialized.
// PylonInitialize();
//
// try
// {
// Pylon::CTlFactory& tlFactory = Pylon::CTlFactory::GetInstance();
//
// Pylon::DeviceInfoList_t devices;
//
//
// Pylon::CInstantCameraArray cameras(devices.size());
// Pylon::CDeviceInfo info;
//
// bool cameraFind = false;
// for (size_t i = 0; i < cameras.GetSize(); ++i)
// {
// cameras[i].Attach(tlFactory.CreateDevice(devices[i]));
//
// if (cameras[i].GetDeviceInfo().GetFullName() == cameraName_.c_str())
// {
// info = cameras[i].GetDeviceInfo();
// cameraFind = true;
// }
// }
//
//
// Pylon::IPylonDevice* pDevice = Pylon::CTlFactory::GetInstance().CreateDevice(info);
// camera = new Pylon::CInstantCamera(pDevice);
// // Create an instant camera object with the camera device found first.
// // camera= new CTlFactory::GetInstance().CreateFirstDevice();
// // Print the model name of the camera.
// cout << "Using device " << camera->GetDeviceInfo().GetModelName() << endl;
//
// // The parameter MaxNumBuffer can be used to control the count of buffers
// // allocated for grabbing. The default value of this parameter is 10.
// camera->MaxNumBuffer = 10;
//
// // Start the grabbing of c_countOfImagesToGrab images.
// // The camera device is parameterized with a default configuration which
// // sets up free-running continuous acquisition.
// // camera.StartGrabbing( c_countOfImagesToGrab);
// camera->StartGrabbing( c_countOfImagesToGrab, GrabStrategy_LatestImages);
//
// // This smart pointer will receive the grab result data.
// CGrabResultPtr ptrGrabResult;
// CImageFormatConverter formatConverter;
// formatConverter.OutputPixelFormat = PixelType_BGR8packed;
// CPylonImage pylonImage;
// Mat openCvImage, gray_img;
// uint32_t frames;
//
// // Camera.StopGrabbing() is called automatically by the RetrieveResult() method
// // when c_countOfImagesToGrab images have been retrieved.
// while (( camera->IsGrabbing()) && (owner()->startActivated()==true))
// {
// // Wait for an image and then retrieve it. A timeout of 5000 ms is used.
// camera->RetrieveResult( 5000, ptrGrabResult, TimeoutHandling_ThrowException);
//
// // Image grabbed successfully?
// if (ptrGrabResult->GrabSucceeded())
// {
// // Access the image data.
// // cout << "SizeX: " << ptrGrabResult->GetWidth() << endl;
// // cout << "SizeY: " << ptrGrabResult->GetHeight() << endl;
// const uint8_t *pImageBuffer = (uint8_t *) ptrGrabResult->GetBuffer();
// // cout << "Gray value of first pixel: " << (uint32_t) pImageBuffer[0] << endl << endl;
// // cout << "Gray value of first pixel: " << (uint32_t) pImageBuffer[1] << endl << endl;
// int32 dataSize=ptrGrabResult->GetWidth()* ptrGrabResult->GetHeight();
// int32* data = owner()->data();
// if (data == nullptr) {
// return;
// }
//
// formatConverter.Convert(pylonImage, ptrGrabResult);
// openCvImage = Mat(ptrGrabResult->GetHeight(), ptrGrabResult->GetWidth(), CV_8UC3, (uint8_t *)pylonImage.GetBuffer());
//
// imshow("Nomad", openCvImage);
// if (waitKey(30)>=0) break;
//
// // cout << "OpenCV Display Window: " << endl << endl;
//
// // float64 sum = 0;
// // CImg<uint16> total;
// // uint16* tmp;
// // CImg<uint16> subtotal;
// // tmp = (uint16_t *) pImageBuffer;
// // CImg<uint16> cam(tmp,ptrGrabResult->GetWidth() , ptrGrabResult->GetHeight());
// // // cout << cam._width << endl;
// // // cout << cam._height << endl;
// // cam.permute_axes("yx");
// // // cout << cam._width << endl;
// // // cout << cam._height << endl;
// // subtotal.append(cam, 'y');
// // // cout << subtotal._width << endl;
// // // cout << subtotal._height << endl;
// //
// // total.append(subtotal, 'x');
// //
// // uint16* buf =total.data();
// //
// //
// //
// //
// // //uint16* buf =(uint16_t *) pImageBuffer;
// // for (int32 j = 0; j < dataSize; ++j) {
// // data[j] = buf[j];
// // sum += (float64) data[j];
// // }
// data=(int32 *)pylonImage.GetBuffer();
// owner()->data.sendEvent();
// owner()->m_SynchroniseReadTerminated = true;
//
// // cout << "owner()->data.sendEvent()" << endl;
//
// usleep(100000);
//
//
// }
// else
// {
// cout << "Error: " << ptrGrabResult->GetErrorCode() << " " << ptrGrabResult->GetErrorDescription() << endl;
// }
// }
// }
// catch (const GenericException &e)
// {
// // Error handling.
// cerr << "An exception occurred." << endl
// << e.GetDescription() << endl;
// //exitCode = 1;
// }
//
//
// // Releases all pylon resources.
// PylonTerminate();
//
......
......@@ -30,7 +30,7 @@
#include "DoubleBufferHandler.h"
#include "GenericCamDef.h"
#include "GenericCamState.h"
#include </opt/pylon/include/pylon/PylonIncludes.h>
//#include </opt/pylon/include/pylon/PylonIncludes.h>
namespace genericcam {
......@@ -248,7 +248,7 @@ private:
Counter m_TimeCounter;
Pylon::CInstantCamera *camera = nullptr;
// Pylon::CInstantCamera *camera = nullptr;
int64 cameraNum_ = 1; //��ǰ������������ܸ���
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment