Changeset 142 in pacpussensors for trunk


Ignore:
Timestamp:
Mar 30, 2017, 4:18:32 PM (8 years ago)
Author:
ldecherf
Message:

Ajout de la classe outputter et modification d'openCV

Location:
trunk/Vislab
Files:
1 deleted
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/Vislab/CMakeLists.txt

    r138 r142  
    22
    33add_definitions( -DVISLAB_COMPONENT_EXPORTS )
     4add_definitions( -DVISLAB_VIEWER_COMPONENT_EXPORTS )
    45
    56set(${PROJECT_NAME}_VERSION_MAJOR 0)
     
    2122################################################################################
    2223# DIRECTORIES
     24
    2325include_directories(
    2426    ${PROJECT_BINARY_DIR}
    2527    ${QT_INCLUDE_DIR}
     28        ${OpenCV_INCLUDE_DIRS}
    2629    ${PACPUS_INCLUDE_DIR}
    2730    ${PACPUS_INCLUDE_DIR}/Pacpus/
     31        "C:/Program Files (x86)/lib3dv/include"
    2832
    2933)
     
    3539link_directories(
    3640        ${PACPUS_LIB_DIR}
     41                "C:/Program Files (x86)/lib3dv/lib"
    3742)
    3843
     
    4752    VislabImageProcessor.h
    4853    Outputter.h
     54        VislabViewerComponent.hpp
    4955)
    5056set(PROJECT_SRCS
     
    5662    VislabImageProcessor.cpp
    5763    Outputter.cpp
     64        VislabViewerComponent.cpp
    5865)
    5966
     
    6269    ${PLUGIN_HDR}
    6370    VislabComponent.hpp
     71        VislabViewerComponent.hpp
    6472    Display.h
    6573)
     
    108116                      ${QT_LIBRARIES}
    109117                      ${OpenCV_LIBS}
     118                                          3dv
    110119
    111120                     )
    112 #"C:/Program Files (x86)/lib3dv/lib/3dv.lib"
    113121################################################################################
    114122# FOLDERS
  • trunk/Vislab/DiskWriter.cpp

    r138 r142  
    22#include "DiskWriter.h"
    33#include <iostream>
    4 #include <lib3dv-1.2.0/lib3dv/device.h>
     4#include <lib3dv/device.h>
    55#include <QDir>
    66#include <QFile>
  • trunk/Vislab/DiskWriter.h

    r127 r142  
    1313
    1414// Includes, lib3dv.
    15 #include <lib3dv-1.2.0/lib3dv/device.h>
     15#include <lib3dv/device.h>
    1616//#include "20150310_lib3dv-1.2.0/src/DiskWriter.h"
    1717#include "DiskWriter.h"
     
    2424#include <boost/thread.hpp>
    2525
    26 // Includes, opencv.
    27 #include <opencv/cv.h>
    28 #include <opencv/highgui.h>
    2926
    3027using pacpus::DbiteFile;
  • trunk/Vislab/Display.cpp

    r133 r142  
    11#include "Display.h"
    22#include <iostream>
    3 #include <lib3dv-1.2.0/lib3dv/device.h>
     3#include <lib3dv/device.h>
    44#include <QMetaType>
    55#include "VislabImageProcessor.h"
  • trunk/Vislab/Display.h

    r127 r142  
    1212
    1313// Includes, lib3dv.
    14 #include <lib3dv-1.2.0/lib3dv/device.h>
     14#include <lib3dv/device.h>
    1515//#include "20150310_lib3dv-1.2.0/src/disk_writer.h"
    1616#include "DiskWriter.h"
  • trunk/Vislab/Outputter.cpp

    r137 r142  
    11#include "Outputter.h"
    22#include <iostream>
    3 #include <lib3dv-1.2.0/lib3dv/device.h>
     3#include <lib3dv/device.h>
    44#include <QMetaType>
    55#include "VislabImageProcessor.h"
  • trunk/Vislab/Outputter.h

    r138 r142  
    1111
    1212// Includes, lib3dv.
    13 #include <lib3dv-1.2.0/lib3dv/device.h>
     13#include <lib3dv/device.h>
    1414//#include "20150310_lib3dv-1.2.0/src/disk_writer.h"
    1515
     
    1919#include <boost/ref.hpp>
    2020#include <boost/thread.hpp>
    21 
    22 // Includes, opencv.
    23 #include <opencv/cv.h>
    24 #include <opencv/highgui.h>
    2521
    2622namespace pacpus {
  • trunk/Vislab/VislabCamera.cpp

    r134 r142  
    1010
    1111// Includes lib3dv
    12 #include <lib3dv-1.2.0/lib3dv/device.h>
     12#include <lib3dv/device.h>
    1313#include "DiskWriter.h"
    1414#include "Display.h"
     
    4343void VislabCamera::open()
    4444{
    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        }
    4951
    5052    if(curr_devices.empty())
    5153    {
    5254        std::cout << "[EE] 3dv-client: no devices found" << std::endl;
     55                return;
    5356        //return lib3dv::error::NONE;
    5457    }
    5558      //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);
    6367    if(error != lib3dv::error::NONE)
    6468      std::cout << "[EE] 3dv-client: error detected: " << error << std::endl;
     
    6973void VislabCamera::close()
    7074{
    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();
    7387}
    7488
  • trunk/Vislab/VislabCamera.hpp

    r138 r142  
    1313#include <lib3dv/device.h>
    1414#include <lib3dv/error.h>
     15#include <lib3dv/image.h>
    1516#include "DiskWriter.h"
    1617#include "Display.h"
     
    5556      lib3dv::error error;
    5657      unsigned int log_level;
    57       lib3dv::image::type imageType;
     58      lib3dv::image::type::types imageType;
    5859          Outputter outputVideo;
    5960          Outputter outputDisparite;
     61          bool broadcast;
    6062
    6163  };
  • trunk/Vislab/VislabComponent.cpp

    r138 r142  
    99#include <Pacpus/kernel/DbiteFileTypes.h>
    1010#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>
    1313
    1414// Includes, qt.
     
    5858  try
    5959  {
    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"));
    6262  }
    6363  catch (std::exception const& e)
     
    7272VislabComponent::configureComponent(XmlComponentConfig config)
    7373{
    74   try
    75   {
    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 
    8974  return ComponentBase::CONFIGURED_OK;
    9075}
  • trunk/Vislab/VislabComponent.hpp

    r138 r142  
    1414
    1515#include <lib3dv/device.h>
     16
     17#include <opencv2/opencv.hpp>
     18#include <opencv2/highgui.hpp>
    1619
    1720#ifdef WIN32
     
    5053      virtual ComponentBase::COMPONENT_CONFIGURATION configureComponent(XmlComponentConfig config);
    5154
    52 
    53       // Working thread, grabbing frame from a webcam.
    54       DbiteFile mDBTFile;
    55 
    5655    public:
    5756      virtual void addOutputs();
    58       //device(){}
    5957
    6058      private:
  • trunk/Vislab/VislabImageProcessor.cpp

    r132 r142  
    11#include "VislabImageProcessor.h"
     2
     3#include <opencv2/opencv.hpp>
     4#include <opencv2/highgui.hpp>
    25
    36
     
    710    }
    811
    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)
    1013    {
    11         if(image->m_type == mImageType)
     14        if(image->type() == mImageType)
    1215        {
    1316            /*! Type picture : Mono 8 */
    14             if(image->m_format == lib3dv::image::format::MONO8)
     17            if(image->format() == lib3dv::image::format::MONO8)
    1518            {
    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());
    1821                /*for(int i=0;i<image->m_height*image->m_width;i++)
    1922                {
     
    2427
    2528            /*! Type picture : Mono 16 */
    26             if(image->m_format == lib3dv::image::format::MONO16)
     29            if(image->format() == lib3dv::image::format::MONO16)
    2730            {
    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);
    3033                /**for(int i=0;i<image->m_height*image->m_width*2;i++)
    3134                {
  • trunk/Vislab/VislabImageProcessor.h

    r131 r142  
    1212#include <QTimer>
    1313
    14 // Includes, opencv.
    15 #include <opencv/cv.h>
    16 #include <opencv/highgui.h>
     14#include <lib3dv/device.h>
    1715
    18 #include <lib3dv-1.2.0/lib3dv/device.h>
     16#include <opencv2/opencv.hpp>
    1917
    2018class VislabImageProcessor
     
    2220public:
    2321    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>);
    2523    virtual void process(cv::Mat const& frame) = 0;
    2624    QString getName();
Note: See TracChangeset for help on using the changeset viewer.