コード例 #1
0
ファイル: QCamVestaK2.cpp プロジェクト: thx8411/qastrocam-g2
bool QCamVesta::updateFrame() {
   static int tmp;
   if (skippedFrame_ < multiplicateur_-1) {
      if (skippedFrame_ >= multiplicateur_ -3) {
         stopAccumulation();
      }
      if (QCamV4L2::dropFrame()) {
         skippedFrame_++;
         exposureTimeLeft_->setValue(skippedFrame_);
         tmp=0;
      }
      return false;
   } else {
      if (QCamV4L2::updateFrame()) {
         skippedFrame_=0;
         if (multiplicateur_ > 1) {
            startAccumulation();
            if (guiBuild()) exposureTimeLeft_->reset();
         }
         int tmpVal;
         setProperty("Gain",tmpVal=getGain(),false);
         emit gainChange(tmpVal);
         //emit exposureChange(getExposure());
         //setProperty("Gama",tmpVal=getGama());
         //emit gamaChange(tmpVal);
         //emit compressionChange(getCompression());
         /*
           setProperty("NoiseRemoval",tmpVal=getNoiseRemoval());
           emit noiseRemovalChange(tmpVal);
           setProperty("Sharpness",tmpVal=getSharpness());
           emit sharpnessChange(tmpVal);
         */
         setProperty("FrameRateSecond",(tmpVal=getFrameRate())/(double)multiplicateur_);
         emit frameRateChange(tmpVal);
         if (liveWhiteBalance_ || refreshGui_) {
            getWhiteBalance();
         }
         if (SCmodCtrl_) {
            setProperty("ExposureTime",multiplicateur_/(double)getFrameRate());
            emit frameRateMultiplicateurChange(multiplicateur_);
            emit exposureTime(multiplicateur_/(double)getFrameRate());
         } else {
            setProperty("ExposureTime",1/(double)getFrameRate());
         }
         refreshGui_=false;
         return true;
      } else {
         refreshGui_=false;
         return false;
      }
   }
}
コード例 #2
0
    void CrwMap::extract0x102a(const CiffComponent& ciffComponent,
                               const CrwMapInfo* crwMapInfo,
                               Image& image,
                               ByteOrder byteOrder)
    {
        if (ciffComponent.typeId() != unsignedShort) {
            return extractBasic(ciffComponent, crwMapInfo, image, byteOrder);
        }

        long aperture = 0;
        long shutterSpeed = 0;

        std::string ifdItem(ExifTags::ifdItem(canonCs2IfdId));
        uint16_t c = 1;
        while (uint32_t(c)*2 < ciffComponent.size()) {
            uint16_t n = 1;
            ExifKey key(c, ifdItem);
            UShortValue value;
            value.read(ciffComponent.pData() + c*2, n*2, byteOrder);
            image.exifData().add(key, &value);
            if (c == 21) aperture = value.toLong();
            if (c == 22) shutterSpeed = value.toLong();
            c += n;
        }

        // Exif.Photo.FNumber
        float f = fnumber(canonEv(aperture));
        // Beware: primitive conversion algorithm
        uint32_t den = 1000000;
        uint32_t nom = static_cast<uint32_t>(f * den);
        uint32_t g = gcd(nom, den);
        URational ur(nom/g, den/g);
        URationalValue fn;
        fn.value_.push_back(ur);
        image.exifData().add(ExifKey("Exif.Photo.FNumber"), &fn);

        // Exif.Photo.ExposureTime
        ur = exposureTime(canonEv(shutterSpeed));
        URationalValue et;
        et.value_.push_back(ur);
        image.exifData().add(ExifKey("Exif.Photo.ExposureTime"), &et);

    } // CrwMap::extract0x102a
コード例 #3
0
ファイル: QCamVestaK2.cpp プロジェクト: thx8411/qastrocam-g2
void QCamVesta::setFrameRateMultiplicateur(int val) {
   if (SCmodCtrl_==NULL) { return;}
   if (multiplicateur_ == 1 && val>1) {
      SCmodCtrl_->enterLongPoseMode();
      if (guiBuild()) exposureTimeLeft_->show();
      //emit(sharpnessChange(0));
      //emit(noiseRemovalChange(2));
      startAccumulation();
   } else if (multiplicateur_ > 1 && val==1) {
      SCmodCtrl_->leaveLongPoseMode();
      if (guiBuild()) exposureTimeLeft_->hide();
      stopAccumulation();
   }
   multiplicateur_=val;
   if (guiBuild()) {
      remoteCTRLexposure_->setDisabled(multiplicateur_>1);
      exposureTimeLeft_->setMinimum(0);
      exposureTimeLeft_->setMaximum(multiplicateur_-1);
   }
   emit exposureTime(multiplicateur_/(double)getFrameRate());
}
コード例 #4
0
ファイル: QCamVestaK2.cpp プロジェクト: thx8411/qastrocam-g2
void QCamVesta::setFrameRate(int value) {
   int res;
   // update the window_
   if(ioctl(device_,VIDIOCGWIN, &window_))
      perror("ioctl (VIDIOCGWIN)");
   window_.flags = (window_.flags & ~PWC_FPS_MASK) | ((value << PWC_FPS_SHIFT) & PWC_FPS_FRMASK);
   res=ioctl(device_, VIDIOCSWIN, &window_);
   if (res!=0) {
      QMessageBox::information(0,"Qastrocam-g2","Frame rate is to high for low compression");
      // looking for the nearest supported framerate
      while((value!=0)&&(res!=0)) {
         value--;
         window_.flags = (window_.flags & ~PWC_FPS_MASK) | ((value << PWC_FPS_SHIFT) & PWC_FPS_FRMASK);
         res=ioctl(device_, VIDIOCSWIN, &window_);
      }
      remoteCTRLframeRate2_->update(value);
      perror("setFrameRate");
   } else {
      ioctl(device_, VIDIOCGWIN, &window_);
      setProperty("FrameRateSecond",value/(double)multiplicateur_);
      emit exposureTime(multiplicateur_/(double)getFrameRate());
   }
}