Changeset 99 in pacpussensors for trunk/Ladybug/LadybugComponent.cpp


Ignore:
Timestamp:
10/15/15 14:47:01 (9 years ago)
Author:
nguyenhu
Message:

compilation under linux with 0.2.X framework

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ladybug/LadybugComponent.cpp

    r98 r99  
    3232// Construct the factory
    3333static ComponentFactory<LadybugComponent> sFactory("LadybugComponent");
    34 static const size_t kMaxFilepathLength = 128;
    3534
    3635/* *Constructor*/
     
    5756        lbTotalNumberOfImagesWritten = 0;
    5857        lbNumOfFrames = 0;
    59 
    60         if (lbSaveJPGImages)
    61         {
    62                 try
    63                 {
    64                         QString dbtFileName_ = "Camera_1.dbt";
    65                         mDbtImage1.open(dbtFileName_.toStdString(), WriteMode, FILE_DBT_UNKNOWN, kMaxFilepathLength);
    66                 } catch (DbiteException & e) {
    67                         LOG_ERROR("error opening dbt file: " << e.what());
    68                 }
    69 
    70                 try
    71                 {
    72                         QString dbtFileName_ = "Camera_2.dbt";
    73                         mDbtImage1.open(dbtFileName_.toStdString(), WriteMode, FILE_DBT_UNKNOWN, kMaxFilepathLength);
    74                 } catch (DbiteException & e) {
    75                         LOG_ERROR("error opening dbt file: " << e.what());
    76                 }
    77 
    78                 try
    79                 {
    80                         QString dbtFileName_ = "Camera_3.dbt";
    81                         mDbtImage1.open(dbtFileName_.toStdString(), WriteMode, FILE_DBT_UNKNOWN, kMaxFilepathLength);
    82                 } catch (DbiteException & e) {
    83                         LOG_ERROR("error opening dbt file: " << e.what());
    84                 }
    85 
    86                 try
    87                 {
    88                         QString dbtFileName_ = "Camera_4.dbt";
    89                         mDbtImage1.open(dbtFileName_.toStdString(), WriteMode, FILE_DBT_UNKNOWN, kMaxFilepathLength);
    90                 } catch (DbiteException & e) {
    91                         LOG_ERROR("error opening dbt file: " << e.what());
    92                 }
    93 
    94                 try
    95                 {
    96                         QString dbtFileName_ = "Camera_5.dbt";
    97                         mDbtImage1.open(dbtFileName_.toStdString(), WriteMode, FILE_DBT_UNKNOWN, kMaxFilepathLength);
    98                 } catch (DbiteException & e) {
    99                         LOG_ERROR("error opening dbt file: " << e.what());
    100                 }
    101 
    102                 try
    103                 {
    104                         QString dbtFileName_ = "Camera_6.dbt";
    105                         mDbtImage1.open(dbtFileName_.toStdString(), WriteMode, FILE_DBT_UNKNOWN, kMaxFilepathLength);
    106                 } catch (DbiteException & e) {
    107                         LOG_ERROR("error opening dbt file: " << e.what());
    108                 }
    109     }
    110 
    111         if (lbSavePanoImage)
    112         {
    113                 try
    114                 {
    115                         QString dbtFileName_ = "CameraPano.dbt";
    116                         mDbtImage1.open(dbtFileName_.toStdString(), WriteMode, FILE_DBT_UNKNOWN, kMaxFilepathLength);
    117                 } catch (DbiteException & e) {
    118                         LOG_ERROR("error opening dbt file: " << e.what());
    119                 }
    120     }
    121 
    12258        THREAD_ALIVE = true;
    12359        start();
     
    13066        printf (" \n*** Stopping Activity ***\n");
    13167        LadybugError error;
    132 
    133             // Close DBT files
    134     if (lbSaveJPGImages) {
    135                 mDbtImage1.close();
    136                 mDbtImage2.close();
    137                 mDbtImage3.close();
    138                 mDbtImage4.close();
    139                 mDbtImage5.close();
    140                 mDbtImage6.close();
    141     }
    142 
    143         if (lbSavePanoImage) {
    144                 mDbtImagePano.close();
    145         }
    14668
    14769        lbIsRecording = false;
     
    222144        CreateImageBuffers();
    223145
    224         // Timestamp
    225     road_time_t timestamp = 0;
    226     road_timerange_t tr = 0;
    227 
    228146        while (THREAD_ALIVE)
    229147        {
    230 
    231148                lbCurrentTime = GetTickCount(); // road_time_t timestamp = road_time(); // ui64 ; unit microsec ; Orig 01/01/1970 00:00
    232149                lbFrameCount++;
     
    241158
    242159                error = ladybugGrabImage( lbContext, &image );
    243                 timestamp = road_time(); // timestamp
     160                // t = road_time(); // timestamp
    244161                HandleError(error);
    245162
     
    328245        HandleError(error);
    329246
    330 
    331         // Use it to trigger the camera with the gps signal
    332247        /*// Initialize Trigger
    333248        error = ladybugGetTriggerModeInfo( lbContext, &triggerModeInfo );
     
    441356                HandleError(error);
    442357
    443         if (uiCamera == 0)
    444                 {
    445                         try {
    446                                 mDbtImage1.writeRecord(time, tr, (char *) processedImage.pData, kMaxFilepathLength);
    447                         } catch (DbiteException & e) {
    448                                 LOG_ERROR("error writing data: " << e.what());
    449                         }
    450                 } else if (uiCamera == 1) {
    451                         try {
    452                                 mDbtImage2.writeRecord(time, tr, (char *) processedImage.pData, kMaxFilepathLength);
    453                         } catch (DbiteException & e) {
    454                                 LOG_ERROR("error writing data: " << e.what());
    455                         }
    456                 }else if (uiCamera == 2) {
    457                         try {
    458                                 mDbtImage3.writeRecord(time, tr, (char *) processedImage.pData, kMaxFilepathLength);
    459                         } catch (DbiteException & e) {
    460                                 LOG_ERROR("error writing data: " << e.what());
    461                         }
    462                 }else if (uiCamera == 3) {
    463                         try {
    464                                 mDbtImage4.writeRecord(time, tr, (char *) processedImage.pData, kMaxFilepathLength);
    465                         } catch (DbiteException & e) {
    466                                 LOG_ERROR("error writing data: " << e.what());
    467                         }
    468                 }else if (uiCamera == 4) {
    469                         try {
    470                                 mDbtImage5.writeRecord(time, tr, (char *) processedImage.pData, kMaxFilepathLength);
    471                         } catch (DbiteException & e) {
    472                                 LOG_ERROR("error writing data: " << e.what());
    473                         }
    474                 }else if (uiCamera == 5) {
    475                         try {
    476                                 mDbtImage6.writeRecord(time, tr, (char *) processedImage.pData, kMaxFilepathLength);
    477                         } catch (DbiteException & e) {
    478                                 LOG_ERROR("error writing data: " << e.what());
    479                         }
    480                 }
    481 
    482358                //printf("Saved camera %u image to %s.\n", uiCamera, pszOutputFilePath);
    483359
     
    525401        error = ladybugSaveImage(lbContext, &processedImage, pszOutputFilePath, LADYBUG_FILEFORMAT_JPG);
    526402        HandleError(error);
    527 
    528         try {
    529                 mDbtImagePano.writeRecord(time, tr, (char *) processedImage.pData, kMaxFilepathLength);
    530         } catch (DbiteException & e) {
    531                 LOG_ERROR("error writing data: " << e.what());
    532         }
    533403
    534404}
Note: See TracChangeset for help on using the changeset viewer.