Projects
mass
turbina-core-dimm
Log In
Username
Password
We truncated the diff of some files because they were too big. If you want to see the full diff for every file,
click here
.
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
Expand all
Collapse all
Changes of Revision 14
View file
turbina-core-dimm.changes
Changed
@@ -1,4 +1,9 @@ ------------------------------------------------------------------- +Thu Oct 26 08:56:27 UTC 2017 - matwey@sai.msu.ru + +- Version 2.50 + +------------------------------------------------------------------- Mon Jun 19 17:42:40 UTC 2017 - matwey@sai.msu.ru - Add Requires(pre): user(video) to make recent openSUSE happy
View file
turbina-core-dimm.spec
Changed
@@ -39,10 +39,10 @@ %define tarname dimm_tool Summary: DIMM measure daemon -License: GPL-2.0 +License: GPL-2.0+ Group: Productivity/Scientific/Astronomy Name: turbina-core-dimm -Version: 2.49 +Version: 2.50 Release: 0 Url: http://curl.sai.msu.ru/hg/dimm_tool Source: %{tarname}-%{version}.tar.bz2
View file
dimm_tool-2.49.tar.bz2/.hg_archival.txt -> dimm_tool-2.50.tar.bz2/.hg_archival.txt
Changed
@@ -1,4 +1,6 @@ repo: 4c4cf3d013dfac9fc25b77065f15e7168fd8d20b -node: 0619f65025b567dd308ccc1bd9311732a153941f +node: 28401ec3077b6d37ab5c24be6c2c84af3523f892 branch: default -tag: 2.49 +latesttag: 2.50 +latesttagdistance: 1 +changessincelatesttag: 1
View file
dimm_tool-2.49.tar.bz2/.hgtags -> dimm_tool-2.50.tar.bz2/.hgtags
Changed
@@ -5,3 +5,5 @@ e74e8493e61eae4e32bb156c02239ec35a99f120 2.46 fe7c46c297e7d240ff2ec52c6cac52fef0b5a1f8 2.33 f445212f42c0976acae8710fb3509a9d9e2c9fe1 2.48 +0619f65025b567dd308ccc1bd9311732a153941f 2.49 +7bc821804b3a281d3ed2c5d24153bd118776db2b 2.50
View file
dimm_tool-2.49.tar.bz2/Makefile -> dimm_tool-2.50.tar.bz2/Makefile
Changed
@@ -7,10 +7,10 @@ infodir = $(datarootdir)/info DIMM = dimm -DIMM_SOURCES = main.o comms.o dimm.o modes.o find.o frame_proc.o camera.o iidc.o functions.o results.o client_handler.o server.o socket.o astrotime.o configs.o errlog.o +DIMM_SOURCES = main.o comms.o dimm.o modes.o find.o frame_proc.o camera.o iidc.o functions.o results.o client_handler.o server.o socket.o astrotime.o configs.o errlog.o camera_impl.o camera_test.o camera_iidc.o PREAT = preat PREAT_SOURCES = preat.o parameter_set.o processing.o coordinates.o astrotime.o -VERSION = 2.49 +VERSION = 2.50 CXX = g++ INSTALL_PROGRAM = install CXXFLAGS += -std=c++98 -Wall -O2 -DVERSION=\"$(VERSION)\" -I./infras -I./server
View file
dimm_tool-2.49.tar.bz2/camera.cpp -> dimm_tool-2.50.tar.bz2/camera.cpp
Changed
@@ -8,165 +8,67 @@ #include <iostream> #include <iomanip> #include <stdexcept> -#include "iidc/iidc.h" #include "astrotime.h" #include "camera.h" #include "functions.h" -const bool ON = true; -const bool OFF = false; +#include "camera_test.h" +#include "camera_iidc.h" -AstroDateTime utc_cam; - -std::string s("Camera"); -std::string st("Type"); -std::string sp("Parameters"); -std::string op("Operations"); - -Geometry initField( Config *cf ) { - Geometry tmp; - tmp.scale = cf->inp<double>( s, "Geometry", "Scale"); - tmp.field = cf->inp<double>( s, "Geometry", "FieldAperture"); - tmp.separation = cf->inp<double>( s, "Geometry", "Separation"); - tmp.fconst = cf->inp<double>( s, "Geometry", "FocalCoeff"); - std::vector<int> a = cf->inpv<int>( s, "Geometry", "OpticalCenter"); - tmp.optic_axis = point<int>(a.at(0),a.at(1)); - return tmp; -} - -void Fprocess::artific_frame() { - Random::simFrame( m_w, m_fs ); -} - -Camera::Camera( Config& cf, bool tst ): cfg(&cf), test_mode(tst) { - std::vector< IIDC::Camera* > cams; - model = cfg->copy( s, st, "Model"); - ident_no = cfg->inp<unsigned long long int>( s, st, "Identification"); - dig_depth = cfg->inp<int>( s, st, "Digitization"); - std::vector<int> a = cfg->inpv<int>( s, sp, "Format"); - ccd_size = win<int>( 0, 0, a.at(0), a.at(1) ); - gain = cfg->inp<double>( s, sp, "Gain"); - bias = cfg->inp<double>( s, sp, "BiasControl"); - field = initField( cfg ); - try { - ieeecam = std::auto_ptr< IIDC::Camera >( new IIDC::Camera( ident_no ) ); - } catch ( IIDC::Error& e ) { - ErrlogSingl::instance().wthrow( ERR_CAM_INIT, e.what() ); - } - - if( ieeecam.get() ) { - ErrlogSingl::instance().warning( model + " camera is connected" ); - initialSettings(); - } else { - ErrlogSingl::instance().wthrow( ERR_CAM_INIT, "Camera no connected" ); - } -// std::cerr << "ëÏÎÓÔÒÕËÔÏÒ Camera\n"; -} - -Camera::~Camera(void) { -// std::cerr << "äÅÓÔÒÕËÔÏÒ Camera\n"; -} - -Record::Record( Camera* cam, win<int> w ){ - int nbuffs = min( 128, 4000000/(w.xdim()*w.ydim())); - try { - frame = std::auto_ptr<Fprocess>(new Fprocess( w - w.beg() )); - if( (cam->ieeecam).get() ) { - if( !(w == current_win) ) { - (cam->ieeecam)->setFormat7ImageROI( w.xorg(), w.yorg(), w.xdim(), w.ydim() ); - current_win = w; - } - (cam->ieeecam)->setupCapture( nbuffs ); - stream = std::auto_ptr<IIDC::VideoStream<unsigned short> >(new IIDC::VideoStream<unsigned short>( (cam->ieeecam).get(), 2000)); - } - the = cam; - this->getFrame(); //ÐÅÒ×ÙÊ ÐÒÏÂÎÙÊ ÂÒÁËÏ×ÁÎÎÙÊ ËÁÄÒ - } - catch ( IIDC::Error& e ) { - ErrlogSingl::instance().wthrow( ERR_CAM_ERR, e.what() ); - } - catch ( const std::exception& e ) { - throw ErrFat( ERR_ALG, e.what() ); - } +Camera::Camera(Config& cf, bool tst) { + if (tst) { + pimpl_.reset(new CameraImplTest(cf)); + } else { + pimpl_.reset(new CameraImplIIDC(cf)); + } +} +Camera::~Camera() { +} + +Record::Record( Camera* cam, win<int> w ): camera_(*cam) { + int nbuffs = min( 128, 4000000/(w.xdim()*w.ydim())); + try { + frame = std::auto_ptr<Fprocess>(new Fprocess( w - w.beg() )); + cam->setROI(w); + stream.reset(cam->setupCapture(nbuffs)); + this->getFrame(); + } catch ( const std::exception& e ) { + throw ErrFat( ERR_ALG, e.what() ); + } } Record::~Record(){ -// if(ieeecam.get()) ieeecam->switchPowerOff(); //äÌÑ Fire-i?? -// std::cerr << "~Record" << std::endl; + try { + camera_.stopCapture(stream.get()); + } catch(...) {} } const Sframe& Record::getFrame() { - if( the->ieeecam.get() && !the->test_mode ) *stream >> *frame; - if( the->test_mode ) frame->artific_frame(); - return frame->data(); + *stream >> *frame; + return frame->data(); } -// unsigned int exposure2cod( double ms ){ // äÌÑ Fire-i -// if( ms < 2.34 ) return (unsigned int)rint((ms - 0.292)/0.016); -// if( ms < 4.388 ) return (unsigned int)rint((ms - 2.340)/0.032)+128; -// if( ms < 16.676) return (unsigned int)rint((ms - 4.388)/0.064)+192; -// if( ms < 32.06 ) return (unsigned int)rint((ms -16.676)/0.128)+384; -// return 511; -// } - -unsigned int exposure2cod( double ms ){ // äÌÑ Prosilca EC650 - return (unsigned int)rint(10*ms); +double Camera::effFPS( Settings& mode ) { + return pimpl_->effFPS(mode); } - -unsigned int framerate2cod( double fps ){ // äÌÑ Prosilca EC650 - return (unsigned int)rint(10*fps); +double Camera::getGain() { + return pimpl_->gain(); } - -// double Camera::gain2factor( double gn ){ // äÌÑ Prosilca EC650 -// return 2.0/exp10( 0.05*gn ); -// } - -double Camera::effFPS( Settings& mode ){ - double frame_effect = (mode.frame_rate==0)? 1000/mode.exposure : mode.frame_rate; - return frame_effect; +win<int> Camera::ccdFormat() const { + return pimpl_->ccdFormat(); } - -double Camera::getGain() { - return 2.0/exp10( 0.05*gain ); // Prosilica gain = 0, converts 2.02 e/adu +Geometry Camera::getField() { + return pimpl_->field(); } - void Camera::setParameters( Settings& mode ) { - if( ! ieeecam.get() ) return; // ÄÌÑ prosilica EC650 - try { - ieeecam->setFeatureValue(IIDC::Camera::Shutter, exposure2cod(mode.exposure) ); - if( mode.frame_rate ) { - ieeecam->setFeaturePower(IIDC::Camera::FrameRate, ON ); - ieeecam->setFeatureValue(IIDC::Camera::FrameRate, framerate2cod(mode.frame_rate) ); - } else { - ieeecam->setVideoMode( IIDC::Camera::Format70 ); - ieeecam->setFeaturePower(IIDC::Camera::FrameRate, OFF ); - } - } - catch ( IIDC::Error& e ) { - ErrlogSingl::instance().wthrow( ERR_CAM_ERR, e.what() ); - } + pimpl_->setParameters(mode); } - - -void Camera::initialSettings(){ - try { // For Prosilica - ieeecam->setIsoSpeed( IIDC::Camera::IsoSpeed400 ); - ieeecam->setVideoMode( IIDC::Camera::Format70 ); - ieeecam->setFormat7ColorCoding( IIDC::Camera::Mono16 ); - ieeecam->setFeatureMode( IIDC::Camera::Shutter, IIDC::Camera::Manual ); - ieeecam->setFeaturePower(IIDC::Camera::Gain, ON ); - ieeecam->setFeaturePower(IIDC::Camera::Gamma, OFF ); - ieeecam->setFeaturePower(IIDC::Camera::Brightness, OFF ); - ieeecam->setFeatureValue(IIDC::Camera::Gain, (unsigned int)gain ); - } - catch ( IIDC::Error& e ) { - ErrlogSingl::instance().wthrow( ERR_CAM_INIT, e.what() ); - } -/* ieeecam->setExposureManual(); // For Fire-i - ieeecam->setBrightnessManual(); - ieeecam->setGammaManual(); - ieeecam->setGamma(0); - - ieeecam->setShutter(0);
View file
dimm_tool-2.49.tar.bz2/camera.h -> dimm_tool-2.50.tar.bz2/camera.h
Changed
@@ -5,8 +5,8 @@ #include <configs.h> #include <memory> -#include "iidc/iidc.h" #include "deftypes.h" +#include "camera_impl.h" class Fprocess { unsigned short* m_fs; @@ -19,8 +19,6 @@ } ~Fprocess(){ delete m_fs; } const Sframe& data() const { return this_frame; } -// unsigned short* data() const{ return m_fs; } - void artific_frame(); template<class T> void operator()(const Frame<T>& fm){ unsigned int xsize = fm.getWidth(); unsigned int i = 0; @@ -36,36 +34,27 @@ }; class Camera { - Config* cfg; - std::string model; - unsigned long long int ident_no; - win<int> ccd_size; - Geometry field; - int dig_depth; - Sframe overall; - double gain; - double bias; - bool test_mode; - std::auto_ptr<IIDC::Camera> ieeecam; -friend class Record; +public: + typedef BasicCameraImpl::data_type data_type; +private: + std::auto_ptr<BasicCameraImpl> pimpl_; public: Camera( Config&, bool ); ~Camera(); void setParameters( Settings& ); - win<int> ccdFormat() const { return ccd_size; } + win<int> ccdFormat() const; double getGain(); - Geometry getField() { return field; } + Geometry getField(); double effFPS(Settings& ); -private: - void initialSettings(); + void setROI(win<int> roi); + VideoStream<data_type>* setupCapture(unsigned int nbuffs); + void stopCapture(VideoStream<data_type>* stream); }; class Record { - std::auto_ptr<IIDC::VideoStream<unsigned short> > stream; + std::auto_ptr<VideoStream<unsigned short> > stream; std::auto_ptr<Fprocess> frame; - win<int> current_win; - Camera* the; -friend class Camera; + Camera& camera_; public: Record( Camera*, win<int> ); ~Record();
View file
dimm_tool-2.50.tar.bz2/camera_iidc.cpp
Added
@@ -0,0 +1,91 @@ +/* +* camera_iidc.cpp is a part of dimm_tool +* Copyright (C) 2014 Matwey V. Kornilov +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#include "iidc/iidc.h" +#include "camera_iidc.h" + +unsigned int CameraImplIIDC::exposure2cod( double ms ) const { + return (unsigned int)rint(10*ms); +} +unsigned int CameraImplIIDC::framerate2cod( double fps ) const { + return (unsigned int)rint(10*fps); +} +CameraImplIIDC::CameraImplIIDC(Config& cf): + BasicCameraImpl(cf), + camera_(cf.inp<uint64_t>("Camera", "Type", "Identification")) { + + IIDC::Camera::CameraInfo info = camera_.getCameraInfo(); + + ErrlogSingl::instance().warning("Camera is connected"); + ErrlogSingl::instance().warning(std::string(info.m_vendorName) + " " + info.m_deviceName); + + initialSettings(); +} +CameraImplIIDC::~CameraImplIIDC() { +} +void CameraImplIIDC::initialSettings() { + try { + camera_.setIsoSpeed(IIDC::Camera::IsoSpeed400); + camera_.setVideoMode(IIDC::Camera::Format70); + camera_.setFormat7ColorCoding(IIDC::Camera::Mono16); + camera_.setFeatureMode(IIDC::Camera::Shutter, IIDC::Camera::Manual); + camera_.setFeaturePower(IIDC::Camera::Gain, true ); + camera_.setFeaturePower(IIDC::Camera::Gamma, false ); + camera_.setFeaturePower(IIDC::Camera::Brightness, false ); + camera_.setFeatureValue(IIDC::Camera::Gain, (unsigned int)BasicCameraImpl::gain() ); + } catch ( const IIDC::Error& e ) { + ErrlogSingl::instance().wthrow(ERR_CAM_INIT, e.what()); + } +} +void CameraImplIIDC::setParameters(Settings& mode) { + try { + camera_.setFeatureValue(IIDC::Camera::Shutter, exposure2cod(mode.exposure)); + if( mode.frame_rate ) { + camera_.setFeaturePower(IIDC::Camera::FrameRate, true); + camera_.setFeatureValue(IIDC::Camera::FrameRate, framerate2cod(mode.frame_rate)); + } else { + camera_.setVideoMode(IIDC::Camera::Format70); + camera_.setFeaturePower(IIDC::Camera::FrameRate, false); + } + } catch ( const IIDC::Error& e ) { + ErrlogSingl::instance().wthrow( ERR_CAM_ERR, e.what() ); + } +} +double CameraImplIIDC::gain() const { + double g = BasicCameraImpl::gain(); + return 2.0/exp10( 0.05*g ); +} +void CameraImplIIDC::setROI(win<int> roi) { + try { + camera_.setFormat7ImageROI(roi.xorg(), roi.yorg(), roi.xdim(), roi.ydim()); + } catch ( const IIDC::Error& e ) { + ErrlogSingl::instance().wthrow( ERR_CAM_ERR, e.what() ); + } +} +VideoStream<CameraImplIIDC::data_type>* CameraImplIIDC::setupCapture(unsigned int nbuffs) { + try { + camera_.setupCapture(nbuffs); + return new IIDC::VideoStream<CameraImplIIDC::data_type>(&camera_, 2000); + } catch ( const IIDC::Error& e ) { + ErrlogSingl::instance().wthrow( ERR_CAM_ERR, e.what() ); + } + return 0; +} +void CameraImplIIDC::stopCapture(VideoStream<CameraImplIIDC::data_type>* stream) { +}
View file
dimm_tool-2.50.tar.bz2/camera_iidc.h
Added
@@ -0,0 +1,49 @@ +/* +* camera_iidc.h is a part of dimm_tool +* Copyright (C) 2014 Matwey V. Kornilov +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#ifndef _CAMERA_IIDC_H +#define _CAMERA_IIDC_H + +#include "deftypes.h" +#include "camera_impl.h" +#include "iidc/iidc.h" + +class CameraImplIIDC: public BasicCameraImpl { +public: + typedef BasicCameraImpl::data_type data_type; +private: + IIDC::Camera camera_; + + void initialSettings(); + unsigned int exposure2cod( double ms ) const; + unsigned int framerate2cod( double fps ) const; +public: + CameraImplIIDC(Config& cf); + virtual ~CameraImplIIDC(); + + virtual void setParameters(Settings&); + virtual double gain() const; + virtual void setROI(win<int> roi); + + virtual VideoStream<data_type>* setupCapture(unsigned int nbuffs); + virtual void stopCapture(VideoStream<data_type>* stream); +}; + +#endif // _CAMERA_IIDC_H +
View file
dimm_tool-2.50.tar.bz2/camera_impl.cpp
Added
@@ -0,0 +1,58 @@ +/* +* camera_impl.cpp is a part of dimm_tool +* Copyright (C) 2014 Matwey V. Kornilov +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#include <vector> +#include "camera_impl.h" + +namespace { + Geometry initField(Config& cf) { + Geometry tmp; + tmp.scale = cf.inp<double>("Camera", "Geometry", "Scale"); + tmp.field = cf.inp<double>("Camera", "Geometry", "FieldAperture"); + tmp.separation = cf.inp<double>("Camera", "Geometry", "Separation"); + tmp.fconst = cf.inp<double>("Camera", "Geometry", "FocalCoeff"); + std::vector<int> a = cf.inpv<int>("Camera", "Geometry", "OpticalCenter"); + tmp.optic_axis = point<int>(a.at(0),a.at(1)); + return tmp; + } +} + +BasicCameraImpl::BasicCameraImpl(Config& cf) { + std::vector<int> a = cf.inpv<int>("Camera", "Parameters", "Format"); + ccd_format_ = win<int>( 0, 0, a.at(0), a.at(1) ); + gain_ = cf.inp<double>("Camera", "Parameters", "Gain"); + field_ = initField(cf); +} +BasicCameraImpl::~BasicCameraImpl() { +} +win<int> BasicCameraImpl::ccdFormat() const { + return ccd_format_; +} +double BasicCameraImpl::gain() const { + return gain_; +} +Geometry BasicCameraImpl::field() const { + return field_; +} +double BasicCameraImpl::effFPS( Settings& mode ) const { + if(mode.frame_rate) { + return mode.frame_rate; + } + return 1000/mode.exposure; +}
View file
dimm_tool-2.50.tar.bz2/camera_impl.h
Added
@@ -0,0 +1,52 @@ +/* +* camera_impl.h is a part of dimm_tool +* Copyright (C) 2014 Matwey V. Kornilov +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#ifndef _CAMERA_IMPL_H +#define _CAMERA_IMPL_H + +#include <stdint.h> + +#include "configs.h" +#include "deftypes.h" +#include "iidc/videostream.h" + +class BasicCameraImpl { +public: + typedef uint16_t data_type; +private: + win<int> ccd_format_; + double gain_; + Geometry field_; +public: + BasicCameraImpl(Config& cf); + virtual ~BasicCameraImpl() = 0; + + virtual void setParameters(Settings&) = 0; + virtual win<int> ccdFormat() const; + virtual double gain() const; + virtual Geometry field() const; + virtual double effFPS(Settings&) const; + virtual void setROI(win<int> roi) = 0; + + virtual VideoStream<data_type>* setupCapture(unsigned int nbuffs) = 0; + virtual void stopCapture(VideoStream<data_type>* stream) = 0; +}; + +#endif // _CAMERA_IMPL_H +
View file
dimm_tool-2.50.tar.bz2/camera_test.cpp
Added
@@ -0,0 +1,85 @@ +/* +* camera_test.cpp is a part of dimm_tool +* Copyright (C) 2014 Matwey V. Kornilov +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#include "camera_test.h" +#include "functions.h" + +CameraImplTest::CameraImplTest(Config& cf): BasicCameraImpl(cf), roi_(ccdFormat()) { +} +CameraImplTest::~CameraImplTest() { +} +void CameraImplTest::setParameters(Settings&) { +} +double CameraImplTest::getGain() { + return 2.0/exp10( 0.05*getGain() ); +} +void CameraImplTest::setROI(win<int> roi) { + roi_ = roi; +} + +CameraImplTest::VideoStream::VideoStream(win<int> roi): roi_(roi) { +} +CameraImplTest::VideoStream::~VideoStream() { +} +void CameraImplTest::VideoStream::captureFrame( Frame<data_type>& f ) { + class MyFrameImplementation: public BasicFrameImplementation { + private: + data_type* buffer_; + mutable win<int> roi_; + public: + MyFrameImplementation(win<int> roi): buffer_(0), roi_(roi) { + buffer_ = new data_type roi_.xdim()*roi_.ydim(); + try { + Random::simFrame(roi_, buffer_); + } catch (...) { + delete buffer_; + throw; + } + } + virtual BasicFrameImplementation* clone() { + MyFrameImplementation* ret = new MyFrameImplementation(roi_); + buffer_ = 0; + return ret; + } + virtual void destroy() { + if(buffer_) delete buffer_; + buffer_ = 0; + } + virtual ~MyFrameImplementation() { + destroy(); + } + public: + virtual SizeType getWidth() const { return roi_.xdim(); } + virtual SizeType getHeight() const { return roi_.ydim(); } + virtual PtrType data() const { return buffer_; } + }; + class MyFrame: public Frame<data_type> { + public: + MyFrame( BasicFrameImplementation* impl) { + Frame<data_type>::setImpl( impl ); + } + }; + f = MyFrame(new MyFrameImplementation(roi_)); +} +::VideoStream<CameraImplTest::data_type>* CameraImplTest::setupCapture(unsigned int nbuffs) { + return new CameraImplTest::VideoStream(roi_); +} +void CameraImplTest::stopCapture(::VideoStream<CameraImplTest::data_type>* stream) { +} +
View file
dimm_tool-2.50.tar.bz2/camera_test.h
Added
@@ -0,0 +1,58 @@ +/* +* camera_test.h is a part of dimm_tool +* Copyright (C) 2014 Matwey V. Kornilov +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#ifndef _CAMERA_TEST_H +#define _CAMERA_TEST_H + +#include "deftypes.h" +#include "camera_impl.h" + +class CameraImplTest: public BasicCameraImpl { +public: + typedef BasicCameraImpl::data_type data_type; +private: + win<int> roi_; +public: + CameraImplTest(Config& cf); + virtual ~CameraImplTest(); + + virtual void setParameters(Settings&); + virtual double getGain(); + virtual void setROI(win<int> roi); + + virtual ::VideoStream<data_type>* setupCapture(unsigned int nbuffs); + virtual void stopCapture(::VideoStream<data_type>* stream); + +public: + + class VideoStream: public ::VideoStream<data_type> { + private: + win<int> roi_; + protected: + virtual void captureFrame( Frame<data_type>& f ); + public: + VideoStream(win<int> roi); + ~VideoStream(); + }; +}; + + + +#endif // _CAMERA_TEST_H +
View file
dimm_tool-2.49.tar.bz2/iidc/frame.h -> dimm_tool-2.50.tar.bz2/iidc/frame.h
Changed
@@ -21,6 +21,7 @@ #ifndef __FRAME_H_ #define __FRAME_H_ +#include <stdexcept> // std::length_error #include "noncopyable.h" class BasicFrameImplementation:
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.