Changeset 353 in flair-src for trunk/lib/FlairSensorActuator


Ignore:
Timestamp:
Feb 19, 2020, 5:29:19 PM (5 years ago)
Author:
Sanahuja Guillaume
Message:

cam

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/FlairSensorActuator/src/V4LCamera.cpp

    r352 r353  
    4343void V4LCamera::Run(void) {
    4444  pimpl_->Run();
    45   /*
    46   Time cam_time, new_time, fpsNow, fpsPrev;
    47   int fpsCounter = 0;
    48 
    49   cam_time = GetTime();
    50   fpsPrev = cam_time;
    51 
    52   while (!ToBeStopped()) {
    53     // fps counter
    54     fpsCounter++;
    55     if (fpsCounter == 100) {
    56       fpsNow = GetTime();
    57       fps->SetText("fps: %.1f",
    58        fpsCounter / ((float)(fpsNow - fpsPrev) / 1000000000.));
    59       fpsCounter = 0;
    60       fpsPrev = fpsNow;
    61     }
    62 
    63     // cam properties
    64     if (gain->ValueChanged() == true && autogain->Value() == false)
    65       SetGain(gain->Value());
    66     if (exposure->ValueChanged() == true && autoexposure->Value() == false)
    67       SetExposure(exposure->Value());
    68     if (bright->ValueChanged() == true)
    69       SetBrightness(bright->Value());
    70     if (sat->ValueChanged() == true)
    71       SetSaturation(sat->Value());
    72     if (contrast->ValueChanged() == true)
    73       SetContrast(contrast->Value());
    74     if (hue->ValueChanged() == true)
    75       SetHue(hue->Value());
    76     //if (sharpness->ValueChanged() == true)
    77     //  cvSetCaptureProperty(capture, CV_CAP_PROP_SHARPNESS, sharpness->Value());
    78     if (autogain->ValueChanged() == true) {
    79       if (autogain->Value() == true) {
    80         gain->setEnabled(false);
    81       } else {
    82         gain->setEnabled(true);
    83         SetGain(gain->Value());
    84       }
    85       SetAutoGain(autogain->Value());
    86     }
    87     if (autoexposure->ValueChanged() == true) {
    88       if (autoexposure->Value() == true) {
    89         exposure->setEnabled(false);
    90       } else {
    91         exposure->setEnabled(true);
    92         SetExposure(exposure->Value());
    93       }
    94       SetAutoExposure(autoexposure->Value());
    95     }
    96     //if (awb->ValueChanged() == true)
    97     //  cvSetCaptureProperty(capture, CV_CAP_PROP_AWB, awb->Value());
    98    
    99     // cam pictures
    100     if (!GrabFrame()) {
    101       Printf("Could not grab a frame\n");
    102     }
    103        
    104     //check for ps3eye deconnection in hds uav
    105     new_time = GetTime();
    106     if(new_time-cam_time>100*1000*1000) {
    107       Thread::Warn("delta t trop grand\n");
    108       hasProblems=true;
    109     }
    110 
    111     //select buffer
    112     if(useMemoryUsrPtr) {//buffers are already in CMEM
    113       imageData=(char*)buffers[dQueuedBuffer.index];
    114       //dequeue it latter (buffer used by ProcessUpdate)
    115     } else {//copy to CMEM allocated buffer
    116       memcpy(imageData,(char *)buffers[dQueuedBuffer.index],output->GetDataType().GetSize());
    117       QueueBuffer(&dQueuedBuffer);//we can do it right now
    118     }
    119    
    120     output->GetMutex();
    121     output->buffer=imageData;
    122     output->ReleaseMutex();
    123    
    124     output->SetDataTime(cam_time);
    125     ProcessUpdate(output);
    126     cam_time = new_time;
    127    
    128     if(useMemoryUsrPtr) {
    129       QueueBuffer(&dQueuedBuffer);//now it is possible to dequeue
    130     }
    131   }
    132    */
    13345}
    13446
Note: See TracChangeset for help on using the changeset viewer.