Changeset 64 in pacpussensors


Ignore:
Timestamp:
09/04/14 11:19:05 (10 years ago)
Author:
phudelai
Message:

Programme détection d'obstacles amélioré

Location:
trunk
Files:
4 deleted
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/PacpusSocket/PacpusSocket.cpp

    r38 r64  
    5454{
    5555
    56         socketType_ = param.getProperty("typeSocket");
     56        socketType_ = config.getProperty("typeSocket");
    5757       
    5858        if (socketType_ == "client" || socketType_ == "Client")
    5959        {
    60             address2send_.setAddress(param.getProperty("address"));
    61             port2send_ = param.getProperty("port").toUInt();
     60            address2send_.setAddress(config.getProperty("address"));
     61            port2send_ = config.getProperty("port").toUInt();
    6262            socketType_ = "client";             
    6363        }
    6464        else if (socketType_ == "server" || socketType_ == "Server")
    6565        {
    66             port2bind_ = param.getProperty("port").toUInt();
     66            port2bind_ = config.getProperty("port").toUInt();
    6767            socketType_ = "server";
    6868        }
     
    7070        {
    7171            qDebug("typeSocket incorrect, become client");
    72             address2send_.setAddress(param.getProperty("address"));
    73             port2send_ = param.getProperty("port").toUInt();
     72            address2send_.setAddress(config.getProperty("address"));
     73            port2send_ = config.getProperty("port").toUInt();
    7474            socketType_ = "client";
    7575        }
  • trunk/PtGreyCameras/CMakeLists.txt

    r51 r64  
    130130                FILES_TO_MOC
    131131                Flea3Component.h
    132                 #Flea3Grabber.h
     132                Flea3Grabber.h
    133133        )       
    134134endif()
  • trunk/PtGreyCameras/Flea3Grabber.cpp

    r56 r64  
    4343        this->nbrCamera_ = 1;
    4444        this->masterCamera_ = 0;
     45        this->img2send_ = 0;
    4546}
    4647
     
    951952                        //++imageCount;
    952953                }
    953 
    954                 // Has to change
    955                 this->img_sending_->write((void*)correctedImg[0].data, settings_[0].mMaxImageOutputSize);
    956         }
     954               
     955                switch (img2send_)
     956                {
     957                case 0:
     958                        this->img_sending_->write((void*)convertedImage[0].GetData(), settings_[0].mMaxImageOutputSize);
     959                        break;
     960                case 1:
     961                        this->img_sending_->write((void*)correctedImg[0].data, settings_[0].mMaxImageOutputSize);
     962                        break;
     963                case 2:
     964                        this->img_sending_->write((void*)convertedImage[1].GetData(), settings_[0].mMaxImageOutputSize);
     965                        break;
     966                case 3:
     967                        this->img_sending_->write((void*)correctedImg[1].data, settings_[0].mMaxImageOutputSize);
     968                        break;
     969                default:
     970                        // Should not happen
     971                        break;
     972                }
     973        }
    957974               
    958975        for (int i = 0; i < this->nbrCamera_; i++)
     
    9891006        }
    9901007}
     1008
     1009
     1010////////////////////////////////////////////////////////////////////////////////
     1011/// Slot to change the image
     1012////////////////////////////////////////////////////////////////////////////////
     1013void Flea3Grabber::changeImage()
     1014{
     1015        img2send_ = ++img2send_ & 0x03;
     1016}
  • trunk/PtGreyCameras/Flea3Grabber.h

    r56 r64  
    1515
    1616#include <QThread>
    17 #include <QMutex>
    1817#include <QDir>
    1918
     
    3231#include <string>
    3332#include <vector>
    34 #include "../../StdDbtPlayerComponents/ImageBaseStructure.h"
     33#include "../../../Pacpussensors/trunk/StdDbtPlayerComponents/ImageBaseStructure.h"
    3534
    3635namespace pacpus {
     
    102101                                                                                public ComponentBase
    103102{
     103        Q_OBJECT
    104104public:
    105105        //============================= DEFAULT ELEMENTS ===============================================
     
    113113    virtual ComponentBase::COMPONENT_CONFIGURATION configureComponent(XmlComponentConfig config);
    114114        //==============================================================================================
    115                
     115
     116        /**
     117        * Initialize default values
     118        */
     119        void InitDefault(int indice);
     120
     121        int img2send_; 
     122
    116123protected:
    117124
     
    123130        bool THREAD_ALIVE;
    124131
    125 public:
    126 
    127         /**
    128         * Initialize default values
    129         */
    130         void InitDefault(int indice);
    131132
    132133private:
     
    139140        std::vector<camSetting> settings_;
    140141        std::vector<ShMem*> shmem_images_;
     142
     143public Q_SLOTS:
     144        void changeImage();
    141145};
    142146
  • trunk/StereoVisionDisparity/CMakeLists.txt

    r53 r64  
    5252set(
    5353        PROJECT_SRCS
    54         VDisparity.cpp   
    55         VDisparity.h
    56         UDisparity.cpp   
    57         UDisparity.h
    5854        DisparityMap.cpp
    5955        DisparityMap.h
     
    6965set(
    7066        FILES_TO_MOC
    71         VDisparity.h
    72         UDisparity.h   
    7367        DisparityMap.h
    7468        ObstacleDetectionComponent.h
  • trunk/StereoVisionDisparity/DisparityMap.h

    r57 r64  
    3131
    3232#include <QThread>
    33 #include <QMutex>
    3433
    3534namespace pacpus {
  • trunk/StereoVisionDisparity/ObstacleDetectionComponent.cpp

    r56 r64  
    504504                                cv::waitKey(1);
    505505                        }
    506 
     506               
    507507                        // Remap the v-disparity point in the original image and create binary masks
    508508                        //std::pair<cv::Mat, cv::Mat> masks = this->MaskSurface2(Disp_map, color_v_disp_map1, color_uv_disp_map.first, this->min_disp, this->max_disp, 1);
     
    599599                                cv::imshow("ObstacleDetectionComponent - Final Classification", reference);
    600600                        }
     601
    601602                        //---------------------------------------------------------------------------
    602603
     
    622623                cvDestroyAllWindows();
    623624}
     625
     626/*      PointTriangulate
     627Description:
     628Calculate the point triangulation in the world
     629Parameters:
     630row,col = row and column in the image
     631x,y,z = world coordinates
     632disparity = disparity value
     633
     634bool ObstacleDetectionComponent::PointTriangulate(int row, int col, double &x, double &y, double &z, double disparity)
     635{
     636                bool valid_point = false;
     637
     638        if(disparity > 0.0 && disparity < 255.0)
     639        {
     640                z = this->cam_width * this->cam_fx * this->cam_baseline / disparity;
     641                double u = col / (this->cam_width - 1.0) - this->cam_cx;
     642                double v = row / (this->cam_height - 1.0) - this->cam_cy;
     643
     644                x = u * z / this->cam_fx;
     645
     646                y = v * z / this->cam_fy;
     647
     648                valid_point = true;
     649        }
     650
     651        return valid_point;
     652}*/
     653
    624654
    625655// Function to calculate the U/V disparity map
  • trunk/StereoVisionDisparity/ObstacleDetectionComponent.h

    r56 r64  
    3131
    3232#include <QThread>
    33 #include <QMutex>
    3433
    3534namespace pacpus {
     
    7170        int cam_height;                 // image height
    7271        int cam_channels;               // number of channels
     72        double cam_ref_cx;              // cx camera divide by x image size
     73        double cam_ref_cy;              // cy camera divide by y image size
     74        double cam_ref_fx;              // fx camera divide by x image size
     75        double cam_ref_fy;              // fy camera divide by y image size
    7376        bool showdebug;                 // Show frame acquired
    7477        int min_disp;                   // Minimum disparity value to detect obstacles in the u/v-disp map
     
    191194        A CalcMedian(std::vector<A> vetor) const;
    192195
     196        //bool PointTriangulate(int row, int col, double &x, double &y, double &z, double disparity);
    193197};
    194198
Note: See TracChangeset for help on using the changeset viewer.