Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Finished example (first version)

  • Loading branch information...
commit 9d3614dd9539d3a72e125c56576c4d51a129cb6b 1 parent 53daba5
Paulo Barcelos authored
16 example/bin/data/uEye.xml
... ... @@ -0,0 +1,16 @@
  1 +<uEye>
  2 + <Is_Live>1</Is_Live>
  3 + <Pixel_Clock>68</Pixel_Clock>
  4 + <FPS>22.5511</FPS>
  5 + <Bad_pixels_correction>1</Bad_pixels_correction>
  6 + <Auto_Exposure>0</Auto_Exposure>
  7 + <Exposure>44.2903</Exposure>
  8 + <Auto_WB>0</Auto_WB>
  9 + <Auto_Gain>0</Auto_Gain>
  10 + <Master_Gain>100</Master_Gain>
  11 + <Red_Gain>11</Red_Gain>
  12 + <Green_Gain>13</Green_Gain>
  13 + <Blue_Gain>45</Blue_Gain>
  14 + <Color_Saturation>131</Color_Saturation>
  15 + <Color_Correction>0</Color_Correction>
  16 +</uEye>
4 example/src/testApp.cpp
@@ -2,8 +2,6 @@
2 2
3 3 //--------------------------------------------------------------
4 4 void testApp::setup(){
5   - ofxXmlSettings test;
6   - test.saveFile("cu");
7 5 ofSetVerticalSync(true);
8 6 ofAddListener(ueye.events.dimensionChanged, this, &testApp::ueyeDimensionChanged);
9 7
@@ -14,7 +12,7 @@ void testApp::setup(){
14 12 {
15 13 //cout << (IS_BINNING_8X_VERTICAL | IS_BINNING_8X_HORIZONTAL) << endl;
16 14 // Get full area of the sensor, but skipping every second pixel
17   - ueye.setBinning(IS_BINNING_4X_VERTICAL | IS_BINNING_4X_HORIZONTAL); // difference from subsamplimg? (apparently same bandwith but smoother image)
  15 + ueye.setBinning(IS_BINNING_2X_VERTICAL | IS_BINNING_2X_HORIZONTAL); // difference from subsamplimg? (apparently same bandwith but smoother image)
18 16
19 17 // smooth the bad pixels (apparently they come from factory with bad pixels...)
20 18 //ueye.enableBadPixelsCorrection();
5 src/ofxUeye.h
@@ -94,8 +94,9 @@ class ofxUeye{
94 94
95 95 // White Balance -----------------------------------------
96 96 void setAutoWhiteBalance(bool value = true){if (value) enableAutoWhiteBalance(); else disableAutoWhiteBalance();};
97   - int enableAutoWhiteBalance(){double e = WB_MODE_AUTO; return is_SetAutoParameter (m_hCam, IS_SET_ENABLE_AUTO_SENSOR_WHITEBALANCE, &e, 0);};
98   - int disableAutoWhiteBalance(){double e = WB_MODE_DISABLE; return is_SetAutoParameter (m_hCam, IS_SET_ENABLE_AUTO_SENSOR_WHITEBALANCE, &e, 0);};
  97 + inline bool isWhiteBalanceAuto(){double e ; is_SetAutoParameter (m_hCam, IS_GET_ENABLE_AUTO_SENSOR_WHITEBALANCE, &e, 0); return (e == 1.0)?true:false;};
  98 + inline int enableAutoWhiteBalance(){double e = WB_MODE_AUTO; return is_SetAutoParameter (m_hCam, IS_SET_ENABLE_AUTO_SENSOR_WHITEBALANCE, &e, 0);};
  99 + inline int disableAutoWhiteBalance(){double e = WB_MODE_DISABLE; return is_SetAutoParameter (m_hCam, IS_SET_ENABLE_AUTO_SENSOR_WHITEBALANCE, &e, 0);};
99 100
100 101 // Gain -------------------------------------------
101 102 void setAutoGain(bool value = true){if (value) enableAutoGain(); else disableAutoGain();};
99 src/ofxUeyeSettings.cpp
@@ -17,13 +17,6 @@ ofxUeyeSettings::ofxUeyeSettings()
17 17 ueye = NULL;
18 18 }
19 19 ///////////////////////////////////////////////////////////////////////////////////
20   -// Destructor --------------------------------------------------------------------
21   -///////////////////////////////////////////////////////////////////////////////////
22   -ofxUeyeSettings::~ofxUeyeSettings()
23   -{
24   - if(ueye != NULL) delete ueye;
25   -}
26   -///////////////////////////////////////////////////////////////////////////////////
27 20 // setup --------------------------------------------------------------------------
28 21 ///////////////////////////////////////////////////////////////////////////////////
29 22 void ofxUeyeSettings::setup(ofxUeye* ueye, int accessKey, string label)
@@ -31,11 +24,11 @@ void ofxUeyeSettings::setup(ofxUeye* ueye, int accessKey, string label)
31 24 this->ueye = ueye;
32 25 settings.setup(accessKey, label);
33 26
34   - /*settings.addMonitor(ueye, &ofxUeye::getBandwidth, "Bandwidth");
  27 + settings.addMonitor(ueye, &ofxUeye::getBandwidth, "Bandwidth");
35 28 settings.addMonitor(ueye, &ofxUeye::getSensorWidth, "Sensor_Width");
36 29 settings.addMonitor(ueye, &ofxUeye::getSensorHeight, "Sensor_Height");
37 30 settings.addMonitor(ueye, &ofxUeye::getWidth, "AOI_Width");
38   - settings.addMonitor(ueye, &ofxUeye::getHeight, "AOI_Height");*/
  31 + settings.addMonitor(ueye, &ofxUeye::getHeight, "AOI_Height");
39 32
40 33 settings.addProperty(ueye, &ofxUeye::isLive,
41 34 ueye, &ofxUeye::setLive,
@@ -62,22 +55,78 @@ void ofxUeyeSettings::setup(ofxUeye* ueye, int accessKey, string label)
62 55 ueye, &ofxUeye::setBadPixelsCorrection,
63 56 "Bad_pixels_correction",
64 57 true);
65   -
66   - /*settings.addProperty(cm, &ColorsOfMovement::getNumStoredFrames,
67   - cm, &ColorsOfMovement::setNumStoredFrames,
68   - "Number_of_stored_frames",
69   - cm, &ColorsOfMovement::getNumStoredFramesMin,
70   - cm, &ColorsOfMovement::getNumStoredFramesMax,
71   - cm, &ColorsOfMovement::getNumStoredFramesStep,
72   - CM_DEFAULT_NUM_STORED_FRAMES);
73   -
74   - settings.addProperty(cm, &ColorsOfMovement::getMode,
75   - cm, &ColorsOfMovement::setMode,
76   - "Mode",
77   - cm, &ColorsOfMovement::getModeMin,
78   - cm, &ColorsOfMovement::getModeMax,
79   - cm, &ColorsOfMovement::getModeStep,
80   - (int)CM_DEFAULT_MODE);*/
  58 +
  59 + settings.addProperty(ueye, &ofxUeye::isExposureTimeAuto,
  60 + ueye, &ofxUeye::setAutoExposureTime,
  61 + "Auto_Exposure",
  62 + false);
  63 +
  64 + settings.addProperty(ueye, &ofxUeye::getExposureTime,
  65 + ueye, &ofxUeye::setExposureTime,
  66 + "Exposure",
  67 + ueye, &ofxUeye::getExposureTimeMin,
  68 + ueye, &ofxUeye::getExposureTimeMax,
  69 + ueye, &ofxUeye::getExposureTimeStep,
  70 + ueye->getFPSMax());
  71 +
  72 + /*settings.addProperty(ueye, &ofxUeye::isWhiteBalanceAuto,
  73 + ueye, &ofxUeye::setAutoWhiteBalance,
  74 + "Auto_WB",
  75 + false);*/
  76 +
  77 + settings.addProperty(ueye, &ofxUeye::isGainAuto,
  78 + ueye, &ofxUeye::setAutoGain,
  79 + "Auto_Gain",
  80 + false);
  81 +
  82 + settings.addProperty(ueye, &ofxUeye::getGainMaster,
  83 + ueye, &ofxUeye::setGainMaster,
  84 + "Master_Gain",
  85 + ueye, &ofxUeye::getGainMasterMin,
  86 + ueye, &ofxUeye::getGainMasterMax,
  87 + ueye, &ofxUeye::getGainMasterStep,
  88 + ueye->getGainMasterMax());
  89 +
  90 + settings.addProperty(ueye, &ofxUeye::getGainRed,
  91 + ueye, &ofxUeye::setGainRed,
  92 + "Red_Gain",
  93 + ueye, &ofxUeye::getGainRedMin,
  94 + ueye, &ofxUeye::getGainRedMax,
  95 + ueye, &ofxUeye::getGainRedStep,
  96 + ueye->getGainRedMax());
  97 +
  98 + settings.addProperty(ueye, &ofxUeye::getGainGreen,
  99 + ueye, &ofxUeye::setGainGreen,
  100 + "Green_Gain",
  101 + ueye, &ofxUeye::getGainGreenMin,
  102 + ueye, &ofxUeye::getGainGreenMax,
  103 + ueye, &ofxUeye::getGainGreenStep,
  104 + ueye->getGainGreenMax());
  105 +
  106 + settings.addProperty(ueye, &ofxUeye::getGainBlue,
  107 + ueye, &ofxUeye::setGainBlue,
  108 + "Blue_Gain",
  109 + ueye, &ofxUeye::getGainBlueMin,
  110 + ueye, &ofxUeye::getGainBlueMax,
  111 + ueye, &ofxUeye::getGainBlueStep,
  112 + ueye->getGainBlueMax());
  113 +
  114 + settings.addProperty(ueye, &ofxUeye::getColorSaturation,
  115 + ueye, &ofxUeye::setColorSaturation,
  116 + "Color_Saturation",
  117 + ueye, &ofxUeye::getColorSaturationMin,
  118 + ueye, &ofxUeye::getColorSaturationMax,
  119 + ueye, &ofxUeye::getColorSaturationStep,
  120 + ueye->getColorSaturationMax());
  121 +
  122 + settings.addProperty(ueye, &ofxUeye::getColorCorrection,
  123 + ueye, &ofxUeye::setColorCorrection,
  124 + "Color_Correction",
  125 + ueye, &ofxUeye::getColorCorrectionMin,
  126 + ueye, &ofxUeye::getColorCorrectionMax,
  127 + ueye, &ofxUeye::getColorCorrectionStep,
  128 + ueye->getColorCorrectionMax());
  129 +
81 130 }
82 131 ///////////////////////////////////////////////////////////////////////////////////
83 132 // keyPressed ---------------------------------------------------------------------
8 src/ofxUeyeSettings.h
@@ -14,6 +14,7 @@
14 14 #include "ofxUeye.h"
15 15 #include "ofxKeyboardSettings.h"
16 16
  17 +
17 18 ////////////////////////////////////////////////////////////
18 19 // CLASS DEFINITION ----------------------------------------
19 20 ////////////////////////////////////////////////////////////
@@ -21,10 +22,9 @@ class ofxUeyeSettings {
21 22
22 23 public:
23 24 ofxUeyeSettings();
24   - ~ofxUeyeSettings();
25   - void setup(ofxUeye* ueye, int accessKey = 'u', string label = "uEye");
26   - void keyPressed(int key);
27   - void draw(float x, float y);
  25 + void setup(ofxUeye* ueye, int accessKey = 'u', string label = "uEye");
  26 + void keyPressed(int key);
  27 + void draw(float x, float y);
28 28
29 29 private:
30 30

0 comments on commit 9d3614d

Please sign in to comment.
Something went wrong with that request. Please try again.