summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/CMakeLists.txt5
-rw-r--r--src/cameras/pylon_camera.cpp12
-rw-r--r--src/scangobj.sh.in2
-rw-r--r--test/CMakeLists.txt7
4 files changed, 16 insertions, 10 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
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index f6ca865..873b85f 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -17,14 +17,10 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/run.py ${CMAKE_CURRENT_BINARY_DIR})
# --- Build targets -----------------------------------------------------------
#add_executable(enum enum.c)
-add_executable(grab grab.c)
-add_executable(grab_pylon grab_pylon.c)
#add_executable(grab-async grab-async.c)
#add_executable(benchmark benchmark.c)
#target_link_libraries(enum uca)
-target_link_libraries(grab uca-gobject ${GLIB2_LIBRARIES} ${GOBJECT2_LIBRARIES})
-target_link_libraries(grab_pylon uca-gobject ${GLIB2_LIBRARIES} ${GOBJECT2_LIBRARIES})
#target_link_libraries(grab-async uca)
#target_link_libraries(benchmark uca)
@@ -43,6 +39,9 @@ add_executable(grab-async grab-async.c)
target_link_libraries(grab uca ${GLIB2_LIBRARIES} ${GOBJECT2_LIBRARIES})
target_link_libraries(grab-async uca ${GLIB2_LIBRARIES} ${GOBJECT2_LIBRARIES})
+add_executable(grab_pylon grab_pylon.c)
+target_link_libraries(grab_pylon uca ${GLIB2_LIBRARIES} ${GOBJECT2_LIBRARIES})
+
if (GTK2_FOUND)
include_directories(${GTK2_INCLUDE_DIRS})