Changeset 142 in pacpussensors
- Timestamp:
- Mar 30, 2017, 4:18:32 PM (8 years ago)
- Location:
- trunk/Vislab
- Files:
-
- 1 deleted
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Vislab/CMakeLists.txt
r138 r142 2 2 3 3 add_definitions( -DVISLAB_COMPONENT_EXPORTS ) 4 add_definitions( -DVISLAB_VIEWER_COMPONENT_EXPORTS ) 4 5 5 6 set(${PROJECT_NAME}_VERSION_MAJOR 0) … … 21 22 ################################################################################ 22 23 # DIRECTORIES 24 23 25 include_directories( 24 26 ${PROJECT_BINARY_DIR} 25 27 ${QT_INCLUDE_DIR} 28 ${OpenCV_INCLUDE_DIRS} 26 29 ${PACPUS_INCLUDE_DIR} 27 30 ${PACPUS_INCLUDE_DIR}/Pacpus/ 31 "C:/Program Files (x86)/lib3dv/include" 28 32 29 33 ) … … 35 39 link_directories( 36 40 ${PACPUS_LIB_DIR} 41 "C:/Program Files (x86)/lib3dv/lib" 37 42 ) 38 43 … … 47 52 VislabImageProcessor.h 48 53 Outputter.h 54 VislabViewerComponent.hpp 49 55 ) 50 56 set(PROJECT_SRCS … … 56 62 VislabImageProcessor.cpp 57 63 Outputter.cpp 64 VislabViewerComponent.cpp 58 65 ) 59 66 … … 62 69 ${PLUGIN_HDR} 63 70 VislabComponent.hpp 71 VislabViewerComponent.hpp 64 72 Display.h 65 73 ) … … 108 116 ${QT_LIBRARIES} 109 117 ${OpenCV_LIBS} 118 3dv 110 119 111 120 ) 112 #"C:/Program Files (x86)/lib3dv/lib/3dv.lib"113 121 ################################################################################ 114 122 # FOLDERS -
trunk/Vislab/DiskWriter.cpp
r138 r142 2 2 #include "DiskWriter.h" 3 3 #include <iostream> 4 #include <lib3dv -1.2.0/lib3dv/device.h>4 #include <lib3dv/device.h> 5 5 #include <QDir> 6 6 #include <QFile> -
trunk/Vislab/DiskWriter.h
r127 r142 13 13 14 14 // Includes, lib3dv. 15 #include <lib3dv -1.2.0/lib3dv/device.h>15 #include <lib3dv/device.h> 16 16 //#include "20150310_lib3dv-1.2.0/src/DiskWriter.h" 17 17 #include "DiskWriter.h" … … 24 24 #include <boost/thread.hpp> 25 25 26 // Includes, opencv.27 #include <opencv/cv.h>28 #include <opencv/highgui.h>29 26 30 27 using pacpus::DbiteFile; -
trunk/Vislab/Display.cpp
r133 r142 1 1 #include "Display.h" 2 2 #include <iostream> 3 #include <lib3dv -1.2.0/lib3dv/device.h>3 #include <lib3dv/device.h> 4 4 #include <QMetaType> 5 5 #include "VislabImageProcessor.h" -
trunk/Vislab/Display.h
r127 r142 12 12 13 13 // Includes, lib3dv. 14 #include <lib3dv -1.2.0/lib3dv/device.h>14 #include <lib3dv/device.h> 15 15 //#include "20150310_lib3dv-1.2.0/src/disk_writer.h" 16 16 #include "DiskWriter.h" -
trunk/Vislab/Outputter.cpp
r137 r142 1 1 #include "Outputter.h" 2 2 #include <iostream> 3 #include <lib3dv -1.2.0/lib3dv/device.h>3 #include <lib3dv/device.h> 4 4 #include <QMetaType> 5 5 #include "VislabImageProcessor.h" -
trunk/Vislab/Outputter.h
r138 r142 11 11 12 12 // Includes, lib3dv. 13 #include <lib3dv -1.2.0/lib3dv/device.h>13 #include <lib3dv/device.h> 14 14 //#include "20150310_lib3dv-1.2.0/src/disk_writer.h" 15 15 … … 19 19 #include <boost/ref.hpp> 20 20 #include <boost/thread.hpp> 21 22 // Includes, opencv.23 #include <opencv/cv.h>24 #include <opencv/highgui.h>25 21 26 22 namespace pacpus { -
trunk/Vislab/VislabCamera.cpp
r134 r142 10 10 11 11 // Includes lib3dv 12 #include <lib3dv -1.2.0/lib3dv/device.h>12 #include <lib3dv/device.h> 13 13 #include "DiskWriter.h" 14 14 #include "Display.h" … … 43 43 void VislabCamera::open() 44 44 { 45 46 curr_devices = lib3dv::device::enumerate(boost::asio::ip::address_v4::from_string("192.168.0.1"), 1, error); 47 if(error != lib3dv::error::NONE) 48 std::cout << "[EE] 3dv-client: error detected: " << error << std::endl; 45 curr_devices = lib3dv::device::enumerate(boost::asio::ip::address_v4::from_string("192.168.0.2"), 0); 46 if (error != lib3dv::error::NONE) 47 { 48 std::cout << "[EE] 3dv-client: error detected: " << error << std::endl; 49 return; 50 } 49 51 50 52 if(curr_devices.empty()) 51 53 { 52 54 std::cout << "[EE] 3dv-client: no devices found" << std::endl; 55 return; 53 56 //return lib3dv::error::NONE; 54 57 } 55 58 //disk_writer = boost::shared_ptr< ::disk_writer>(new ::disk_writer(paths, data_format, autonumber, params, guid_type, log_level)); 56 curr_devices[0].log_level(2); 57 curr_devices[0].timeout(boost::posix_time::milliseconds(5000)); 58 curr_devices[0].connect_image_callback(boost::function<void(boost::shared_ptr< const lib3dv::image>, unsigned int)>(boost::bind(&::VislabImageProcessor::image_callback, &displayVideo, _1, _2))); 59 curr_devices[0].connect_image_callback(boost::function<void(boost::shared_ptr< const lib3dv::image>, unsigned int)>(boost::bind(&::VislabImageProcessor::image_callback, &displayDisparite, _1, _2))); 60 curr_devices[0].connect_image_callback(boost::function<void(boost::shared_ptr< const lib3dv::image>, unsigned int)>(boost::bind(&::VislabImageProcessor::image_callback, &diskwriterVideo, _1, _2))); 61 curr_devices[0].connect_image_callback(boost::function<void(boost::shared_ptr< const lib3dv::image>, unsigned int)>(boost::bind(&::VislabImageProcessor::image_callback, &diskwriterDisparite, _1, _2))); 62 curr_devices[0].start_transmission(error); 59 60 //curr_devices[0].connect_image_callback(boost::function<void(boost::shared_ptr< const lib3dv::image>)>(boost::bind(&::VislabImageProcessor::image_callback, &displayVideo, _1))); 61 //curr_devices[0].connect_image_callback(boost::function<void(boost::shared_ptr< const lib3dv::image>)>(boost::bind(&::VislabImageProcessor::image_callback, &displayDisparite, _1))); 62 //curr_devices[0].connect_image_callback(boost::function<void(boost::shared_ptr< const lib3dv::image>)>(boost::bind(&::VislabImageProcessor::image_callback, &diskwriterVideo, _1))); 63 //curr_devices[0].connect_image_callback(boost::function<void(boost::shared_ptr< const lib3dv::image>)>(boost::bind(&::VislabImageProcessor::image_callback, &diskwriterDisparite, _1))); 64 curr_devices[0].connect_image_callback(boost::function<void(boost::shared_ptr< const lib3dv::image>)>(boost::bind(&::VislabImageProcessor::image_callback, &outputVideo, _1))); 65 curr_devices[0].connect_image_callback(boost::function<void(boost::shared_ptr< const lib3dv::image>)>(boost::bind(&::VislabImageProcessor::image_callback, &outputDisparite, _1))); 66 curr_devices[0].start_transmission(false); 63 67 if(error != lib3dv::error::NONE) 64 68 std::cout << "[EE] 3dv-client: error detected: " << error << std::endl; … … 69 73 void VislabCamera::close() 70 74 { 71 curr_devices[0].stop_transmission(error); 72 //curr_devices[0].poweroff(error); 75 if (curr_devices.empty()) 76 { 77 std::cout << "[EE] 3dv-client: no devices found" << std::endl; 78 return; 79 //return lib3dv::error::NONE; 80 } 81 else 82 { 83 curr_devices[0].stop_transmission(); 84 } 85 86 //curr_devices[0].poweroff(); 73 87 } 74 88 -
trunk/Vislab/VislabCamera.hpp
r138 r142 13 13 #include <lib3dv/device.h> 14 14 #include <lib3dv/error.h> 15 #include <lib3dv/image.h> 15 16 #include "DiskWriter.h" 16 17 #include "Display.h" … … 55 56 lib3dv::error error; 56 57 unsigned int log_level; 57 lib3dv::image::type imageType;58 lib3dv::image::type::types imageType; 58 59 Outputter outputVideo; 59 60 Outputter outputDisparite; 61 bool broadcast; 60 62 61 63 }; -
trunk/Vislab/VislabComponent.cpp
r138 r142 9 9 #include <Pacpus/kernel/DbiteFileTypes.h> 10 10 #include <Pacpus/kernel/DbiteException.h> 11 #include <lib3dv -1.2.0/lib3dv/device.h>12 #include <20150310_lib3dv-1.2.0/src/display.h>11 #include <lib3dv/device.h> 12 //#include <20150310_lib3dv-1.2.0/src/display.h> 13 13 14 14 // Includes, qt. … … 58 58 try 59 59 { 60 QString filename = name() + ".dbt";61 //mDBTFile.open(filename.toStdString(), WriteMode, FILE_JPEG,MAX_LENGTH_NAME);60 camera.setVideoOutput(getTypedOutput<cv::Mat, VislabComponent>("image")); 61 camera.setDispariteOutput(getTypedOutput<cv::Mat, VislabComponent>("disparity")); 62 62 } 63 63 catch (std::exception const& e) … … 72 72 VislabComponent::configureComponent(XmlComponentConfig config) 73 73 { 74 try75 {76 QDir directory;77 if (!directory.exists(name().toLatin1()) && !directory.mkdir(name().toLatin1()))78 throw std::runtime_error("cannot create the webcam directory");79 80 //mFilenameTemplate = QString("%1/image-%2.jpg").arg(name());81 //LOG_INFO("template filename: " << mFilenameTemplate);82 }83 catch (std::exception const& e)84 {85 LOG_ERROR(e.what());86 return ComponentBase::CONFIGURED_FAILED;87 }88 89 74 return ComponentBase::CONFIGURED_OK; 90 75 } -
trunk/Vislab/VislabComponent.hpp
r138 r142 14 14 15 15 #include <lib3dv/device.h> 16 17 #include <opencv2/opencv.hpp> 18 #include <opencv2/highgui.hpp> 16 19 17 20 #ifdef WIN32 … … 50 53 virtual ComponentBase::COMPONENT_CONFIGURATION configureComponent(XmlComponentConfig config); 51 54 52 53 // Working thread, grabbing frame from a webcam.54 DbiteFile mDBTFile;55 56 55 public: 57 56 virtual void addOutputs(); 58 //device(){}59 57 60 58 private: -
trunk/Vislab/VislabImageProcessor.cpp
r132 r142 1 1 #include "VislabImageProcessor.h" 2 3 #include <opencv2/opencv.hpp> 4 #include <opencv2/highgui.hpp> 2 5 3 6 … … 7 10 } 8 11 9 void VislabImageProcessor::image_callback(boost::shared_ptr< const lib3dv::image> image , unsigned int)12 void VislabImageProcessor::image_callback(boost::shared_ptr< const lib3dv::image> image) 10 13 { 11 if(image-> m_type== mImageType)14 if(image->type() == mImageType) 12 15 { 13 16 /*! Type picture : Mono 8 */ 14 if(image-> m_format== lib3dv::image::format::MONO8)17 if(image->format() == lib3dv::image::format::MONO8) 15 18 { 16 cv::Mat cvimage(image-> m_height, image->m_width, CV_8UC1);17 std::memcpy(cvimage.data,image-> m_buffer.data(),image->m_height*image->m_width);19 cv::Mat cvimage(image->height(), image->width(), CV_8UC1); 20 std::memcpy(cvimage.data,image->data(),image->height()*image->width()); 18 21 /*for(int i=0;i<image->m_height*image->m_width;i++) 19 22 { … … 24 27 25 28 /*! Type picture : Mono 16 */ 26 if(image-> m_format== lib3dv::image::format::MONO16)29 if(image->format() == lib3dv::image::format::MONO16) 27 30 { 28 cv::Mat cvimage(image-> m_height, image->m_width, CV_16UC1);29 std::memcpy(cvimage.data,image-> m_buffer.data(),image->m_height*image->m_width*2);31 cv::Mat cvimage(image->height(), image->width(), CV_16UC1); 32 std::memcpy(cvimage.data,image->data(),image->height()*image->width()*2); 30 33 /**for(int i=0;i<image->m_height*image->m_width*2;i++) 31 34 { -
trunk/Vislab/VislabImageProcessor.h
r131 r142 12 12 #include <QTimer> 13 13 14 // Includes, opencv. 15 #include <opencv/cv.h> 16 #include <opencv/highgui.h> 14 #include <lib3dv/device.h> 17 15 18 #include < lib3dv-1.2.0/lib3dv/device.h>16 #include <opencv2/opencv.hpp> 19 17 20 18 class VislabImageProcessor … … 22 20 public: 23 21 VislabImageProcessor(const QString& name, lib3dv::image::type::types imageType); 24 void image_callback(boost::shared_ptr<const lib3dv::image> , unsigned int);22 void image_callback(boost::shared_ptr<const lib3dv::image>); 25 23 virtual void process(cv::Mat const& frame) = 0; 26 24 QString getName();
Note:
See TracChangeset
for help on using the changeset viewer.