Commit 9a6a5711 authored by Abdelali Elaazzouzi's avatar Abdelali Elaazzouzi
Browse files

remove cout and pylon lib

parent 80ed048d
......@@ -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"/>
......
......@@ -509,12 +509,10 @@ void RealGenericCamDriver::readStatus() {
PrintCameraStatus(*camera_iter);
ret=ret+m_camera_handler.CapturedImages();
// cout << "CapturedImages= " <<ret<< endl;
}
// cout << "m_camera_handler.CapturedImages() = " << m_camera_handler.CapturedImages()
// << " , m_camera_handler.NumberOfCameras() = " << m_camera_handler.NumberOfCameras() << endl;
if (ret == owner()->nbCols()*owner()->nbRows()) {
// cout << "RealGenericCamDriver::readStatus 3 " << endl;
status |= END;
owner()->startActivated = false;
owner()->commandProgression = PROGRESSION_END_DEVICE_CONTAINER;
......@@ -776,11 +774,6 @@ void RealGenericCamDriver::PrintCameraStatus(CCameraControl * camera_control) {
else {
std::cout << "capturing is inactive" << std::endl;
}
// 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;
if (buffer_info->frameid > 0) {
std::cout << "last processed image id: " << buffer_info->frameid << std::endl;
}
......@@ -895,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