Skip to content

Commit

Permalink
Adding GigEVision camera support (requires Aravis)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ross Newman committed Mar 1, 2017
1 parent 49b35e6 commit 039c2b6
Show file tree
Hide file tree
Showing 12 changed files with 626 additions and 43 deletions.
10 changes: 6 additions & 4 deletions CMakeLists.txt
Expand Up @@ -34,7 +34,7 @@ message("-- Detected ${CMAKE_SYSTEM_PROCESSOR} assumint TK1")
set(
CUDA_NVCC_FLAGS
${CUDA_NVCC_FLAGS};
-O3 -gencode arch=compute_32,code=sm_32, -std=c++11 -Xcompiler -D__CORRECT_ISO_CPP11_MATH_H_PROTO
-O3 -gencode arch=compute_32,code=sm_32, -std=c++11 -Xcompiler -D__CORRECT_ISO_CPP11_MATH_H_PROTO
)
else()
message("-- Detected ${CMAKE_SYSTEM_PROCESSOR} assumint TX1")
Expand All @@ -45,6 +45,8 @@ set(
)
endif()

# Aravis setup
include_directories(/usr/local/include/aravis-0.6)

# setup project output paths
set(PROJECT_OUTPUT_DIR ${PROJECT_BINARY_DIR}/${CMAKE_SYSTEM_PROCESSOR})
Expand All @@ -69,7 +71,7 @@ file(GLOB inferenceSources *.cpp *.cu camera/*.cpp cuda/*.cu display/*.cpp)
file(GLOB inferenceIncludes *.h camera/*.h cuda/*.h display/*.h)

cuda_add_library(jetson-inference SHARED ${inferenceSources})
target_link_libraries(jetson-inference nvcaffe_parser nvinfer Qt4::QtGui GL GLEW gstreamer-1.0 gstapp-1.0) # gstreamer-0.10 gstbase-0.10 gstapp-0.10
target_link_libraries(jetson-inference nvcaffe_parser nvinfer Qt4::QtGui GL GLEW gstreamer-1.0 gstapp-1.0 aravis-0.6) # gstreamer-0.10 gstbase-0.10 gstapp-0.10


# transfer all headers to the include directory
Expand All @@ -90,10 +92,10 @@ endforeach()


# build samples & tools
add_subdirectory(imagenet-console)
#add_subdirectory(imagenet-console)
add_subdirectory(imagenet-camera)

add_subdirectory(detectnet-console)
#add_subdirectory(detectnet-console)
add_subdirectory(detectnet-camera)

#add_subdirectory(camera/gst-camera)
Expand Down
2 changes: 2 additions & 0 deletions camera/camera.h
Expand Up @@ -5,6 +5,8 @@
#ifndef __CAMERA_H__
#define __CAMERA_H__
#include <climits>
#include <stdint.h>

class camera
{
public:
Expand Down
5 changes: 4 additions & 1 deletion camera/gstCamera.cpp
Expand Up @@ -115,14 +115,17 @@ bool gstCamera::ConvertRGBtoRGBA( void* input, void** output )
{
if( CUDA_FAILED(cudaMalloc(&mRGBA, mWidth * mHeight * sizeof(float4))) )
{
printf(LOG_CUDA "gstCamera -- failed to allocate memory for %ux%u RGBA texture\n", mWidth, mHeight);
printf(LOG_CUDA "gvCamera -- failed to allocate memory for %ux%u RGBA texture\n", mWidth, mHeight);
return false;
}
}

// USB webcam is RGB
if( CUDA_FAILED(cudaRGBToRGBAf((uint8_t*)input, (float4*)mRGBA, mWidth, mHeight)) )
{
printf(LOG_CUDA "gvCamera -- conversion cudaRGBToRGBAf failed\n");
return false;
}

*output = mRGBA;
return true;
Expand Down
2 changes: 1 addition & 1 deletion camera/gstUtility.cpp
Expand Up @@ -200,7 +200,7 @@ gboolean gst_message_print(GstBus* bus, GstMessage* message, gpointer user_data)
#ifdef gst_tag_list_to_string
gchar* txt = gst_tag_list_to_string(tags);
#else
gchar* txt = "missing gst_tag_list_to_string()";
gchar* txt = (gchar*)"missing gst_tag_list_to_string()";
#endif

debug_print(LOG_GSTREAMER "gstreamer %s %s\n", GST_OBJECT_NAME(message->src), txt);
Expand Down

0 comments on commit 039c2b6

Please sign in to comment.