diff options
author | Volker Kaiser <volker.kaiser@softwareschneiderei.de> | 2012-06-26 08:53:11 +0200 |
---|---|---|
committer | Volker Kaiser <volker.kaiser@softwareschneiderei.de> | 2012-07-26 15:36:43 +0200 |
commit | 9395f3ed8c69c7873c187d8a93b4755b685b3c96 (patch) | |
tree | 7fc4f8ad6376800e4aff1bba826fa1ba35292cce /src | |
parent | 38d6d18e83b0c33a18ef6f68c22c161d39abc449 (diff) | |
download | libuca-9395f3ed8c69c7873c187d8a93b4755b685b3c96.tar.gz libuca-9395f3ed8c69c7873c187d8a93b4755b685b3c96.tar.bz2 libuca-9395f3ed8c69c7873c187d8a93b4755b685b3c96.tar.xz libuca-9395f3ed8c69c7873c187d8a93b4755b685b3c96.zip |
working on basler
Diffstat (limited to 'src')
-rw-r--r-- | src/CMakeLists.txt | 5 | ||||
-rw-r--r-- | src/cameras/pylon_camera.cpp | 12 | ||||
-rw-r--r-- | src/scangobj.sh.in | 2 |
3 files changed, 13 insertions, 6 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 9630a72..46bcfb2 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -15,7 +15,7 @@ set(cameras) set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake) # --- Find camera interfaces -find_package(PCO) +#find_package(PCO) find_package(PF) find_package(IPE) find_package(Pylon) @@ -99,6 +99,7 @@ if (PYLON_FOUND) set(uca_SRCS ${uca_SRCS} cameras/uca-pylon-camera.c cameras/pylon_camera.cpp) set(uca_HDRS ${uca_HDRS} cameras/uca-pylon-camera.h) set(uca_LIBS ${uca_LIBS} ${PYLON_LIBS}) + #list(APPEND cameras "Pylon") include_directories(${PYLON_INCLUDE_DIRS}) link_directories(/opt/pylon/lib64) @@ -241,7 +242,7 @@ if(GTK_DOC_FOUND) DEPENDS ${docs_out}/sgml.stamp ${docs_out}/uca-docs.xml WORKING_DIRECTORY ${docs_out}) - add_custom_target(reference ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/html.stamp) + add_custom_target(reference DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/html.stamp) install(FILES ${reference_files} DESTINATION share/gtk-doc/html/uca) endif() 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) diff --git a/src/scangobj.sh.in b/src/scangobj.sh.in index 4a4e330..65766b6 100644 --- a/src/scangobj.sh.in +++ b/src/scangobj.sh.in @@ -1 +1 @@ -LD_LIBRARY_PATH=${CMAKE_CURRENT_BINARY_DIR} CC=gcc CFLAGS="${GTK_DOC_CFLAGS}" LDFLAGS="${GTK_DOC_LDFLAGS} -L${CMAKE_CURRENT_BINARY_DIR} -L${CMAKE_CURRENT_BINARY_DIR} -luca `pkg-config --libs gtk+-2.0`" gtkdoc-scangobj --module=uca +LD_LIBRARY_PATH=${CMAKE_CURRENT_BINARY_DIR}:/opt/pylon/lib64:/opt/pylon/genicam/bin/Linux64_x64 CC=gcc CFLAGS="${GTK_DOC_CFLAGS}" LDFLAGS="${GTK_DOC_LDFLAGS} -L${CMAKE_CURRENT_BINARY_DIR} -L${CMAKE_CURRENT_BINARY_DIR} -luca `pkg-config --libs gtk+-2.0`" gtkdoc-scangobj --module=uca |