summaryrefslogtreecommitdiffstats
path: root/src/cameras
diff options
context:
space:
mode:
authorVolker Kaiser <volker.kaiser@softwareschneiderei.de>2012-06-26 08:53:11 +0200
committerVolker Kaiser <volker.kaiser@softwareschneiderei.de>2012-07-26 15:36:43 +0200
commit9395f3ed8c69c7873c187d8a93b4755b685b3c96 (patch)
tree7fc4f8ad6376800e4aff1bba826fa1ba35292cce /src/cameras
parent38d6d18e83b0c33a18ef6f68c22c161d39abc449 (diff)
downloaduca-9395f3ed8c69c7873c187d8a93b4755b685b3c96.tar.gz
uca-9395f3ed8c69c7873c187d8a93b4755b685b3c96.tar.bz2
uca-9395f3ed8c69c7873c187d8a93b4755b685b3c96.tar.xz
uca-9395f3ed8c69c7873c187d8a93b4755b685b3c96.zip
working on basler
Diffstat (limited to 'src/cameras')
-rw-r--r--src/cameras/pylon_camera.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/cameras/pylon_camera.cpp b/src/cameras/pylon_camera.cpp
index d27b6c4..71aede4 100644
--- a/src/cameras/pylon_camera.cpp
+++ b/src/cameras/pylon_camera.cpp
@@ -13,6 +13,7 @@ namespace {
guint imageCounter = 0;
guint currentImage = 0;
GrabAPI::Image* image = NULL;
+ guint bytesPerPixel = 0;
void handle_image(GrabAPI::Image* newImage)
{
@@ -136,7 +137,6 @@ void pylon_camera_get_sensor_size(guint* width, guint* height, GError** error)
void pylon_camera_get_bit_depth(guint* depth, GError** error)
{
- std::cerr << __func__ << std::endl;
g_assert(pGrabber);
try
{
@@ -153,6 +153,12 @@ void pylon_camera_get_bit_depth(guint* depth, GError** error)
void pylon_camera_start_acquision(GError** error)
{
g_assert(pGrabber);
+ guint bit_depth = 0;
+ pylon_camera_get_bit_depth(&bit_depth, error);
+ bytesPerPixel = 1;
+ if (bit_depth > 8) bytesPerPixel = 2;
+ if (bit_depth > 16) bytesPerPixel = 3;
+ if (bit_depth > 24) bytesPerPixel = 4;
try
{
{
@@ -196,10 +202,10 @@ void pylon_camera_grab(gpointer *data, GError** error)
}
std::cerr << "grab next image " << currentImage << ", " << imageCounter
- << "; width: " << image->width() << ", height: " << image->height() << std::endl;
+ << "; width: " << image->width() / bytesPerPixel << ", height: " << image->height() << std::endl;
g_assert(currentImage < imageCounter);
currentImage = imageCounter;
- memcpy(*data, image->base(), image->width() * image->height() * 2);
+ memcpy(*data, image->base(), image->width() * image->height());
}
catch (const yat::Exception& e)