Commit a6a0b939 authored by Luis Peñaranda's avatar Luis Peñaranda
Browse files

added sliders to change fov and fov_max

parent 05a8962f
Loading
Loading
Loading
Loading
+29 −8
Original line number Diff line number Diff line
@@ -69,16 +69,38 @@ void OpenGLCanvas::change_fov(double f){

//    scale = 0.3f;

    fprintf(stderr,"scale=%f\nfov_max=%f\n",scale,fov_max);
    fprintf(stderr,"change fov=%f, fov_max=%f\n",fov,fov_max);
    emit fov_changed((int)fov);

    updateGL();

}

void OpenGLCanvas::change_fov_max(double new_fov_max){
    fov_max=new_fov_max;
    // TODO: change also the scale
    fprintf(stderr,"scale=%f\nfov_max=%f\n",scale,fov_max);
void OpenGLCanvas::change_fov(int new_fov){
    change_fov((double)new_fov);
}

void OpenGLCanvas::change_fov_max(int new_fov_max){
    fov_max=(double)new_fov_max;
    if (fov<=fov_max)
        scale=1.f;
    else if (fov>295.f)
        scale = 0.02f; // TODO: check this value wrt fov_max
    else {
        if (fov_scale_relation == "Naive")
            scale=fov_max/fov;
        else if (fov_scale_relation == "Square Root")
            scale=sqrt((360.f-fov_max-fov)/(360.-2*fov_max));
        else if (fov_scale_relation == "Linear")
            scale=(360.f-fov_max-fov)/(360.-2*fov_max);
        else if (fov_scale_relation == "Square Power")
            scale=powf((360.f-fov_max-fov)/(360.-2*fov_max),2);
        else if (fov_scale_relation == "Cubic Power")
            scale=powf((360.f-fov_max-fov)/(360.-2*fov_max),3);
        else if (fov_scale_relation == "Logarithm")
            scale=log(exp(1.f)+(1.f-exp(1.f))*(fov-fov_max)/(360.-2*fov_max));
    }
    fprintf(stderr,"change fov_max=%f, new scale=%f\n",fov_max,scale);
    updateGL();
}

@@ -126,7 +148,7 @@ void OpenGLCanvas::change_fov_scale_relation(QString name){
       else if (fov_scale_relation == "Logarithm")
           scale=log(exp(1.f)+(1.f-exp(1.f))*(fov-fov_max)/(360.-2*fov_max));
   }
   fprintf(stderr,"scale=%f\nfov_max=%f\n",scale,fov_max);
   fprintf(stderr,"changed scale relation, scale=%f, fov_max=%f\n",scale,fov_max);
   updateGL();

}
@@ -646,8 +668,7 @@ void OpenGLCanvas::mouseMoveEvent(QMouseEvent *event){

void OpenGLCanvas::wheelEvent(QWheelEvent *event){
    if(event->orientation()==Qt::Vertical){
        fov+=((double)event->delta())/60;
        updateGL();
        change_fov(fov+((double)event->delta())/60);
    }
}

+3 −1
Original line number Diff line number Diff line
@@ -61,10 +61,12 @@ protected:

signals:
    void fps(QString newFPS);
    void fov_changed(int new_fov);

public slots:
    void change_fov(double f);
    void change_fov_max(double new_fov_max);
    void change_fov(int new_fov);
    void change_fov_max(int new_fov_max);
//    void change_scale(double s);
    void change_center_lambda(double lambda);
    void change_center_phi(double phi);
+161 −110
Original line number Diff line number Diff line
@@ -14,113 +14,175 @@
   <string>PanoWindow1</string>
  </property>
  <layout class="QGridLayout" name="gridLayout">
   <item row="0" column="0" rowspan="12">
    <widget class="OpenGLCanvas" name="GLCanvas" native="true"/>
   <item row="6" column="2">
    <widget class="QDoubleSpinBox" name="doubleSpinBox_4">
     <property name="maximumSize">
      <size>
       <width>61</width>
       <height>25</height>
      </size>
     </property>
     <property name="minimum">
      <double>-1.570000000000000</double>
     </property>
     <property name="maximum">
      <double>1.570000000000000</double>
     </property>
     <property name="singleStep">
      <double>0.010000000000000</double>
     </property>
    </widget>
   </item>
   <item row="0" column="1" colspan="2">
    <widget class="QLabel" name="label">
   <item row="7" column="1" colspan="2">
    <widget class="QPushButton" name="chooseFile">
     <property name="text">
      <string>FOV-Scale Relation</string>
      <string>Input Image</string>
     </property>
    </widget>
   </item>
   <item row="1" column="1" colspan="2">
    <widget class="QComboBox" name="comboBox">
     <property name="editable">
      <bool>false</bool>
   <item row="8" column="2" alignment="Qt::AlignHCenter">
    <widget class="QSlider" name="changefov">
     <property name="minimum">
      <number>1</number>
     </property>
     <property name="modelColumn">
      <number>0</number>
     <property name="maximum">
      <number>359</number>
     </property>
     <item>
     <property name="value">
      <number>60</number>
     </property>
     <property name="orientation">
      <enum>Qt::Vertical</enum>
     </property>
    </widget>
   </item>
   <item row="2" column="1" colspan="2">
    <widget class="QLabel" name="label_3">
     <property name="text">
       <string>Square Root</string>
      <string>Visualization</string>
     </property>
    </widget>
   </item>
   <item row="3" column="1" colspan="2">
    <widget class="QComboBox" name="comboBox_2">
     <item>
      <property name="text">
       <string>Naive</string>
       <string>Perspective</string>
      </property>
     </item>
     <item>
      <property name="text">
       <string>Linear</string>
       <string>3D Sphere</string>
      </property>
     </item>
     <item>
      <property name="text">
       <string>Square Power</string>
       <string>Equi-Rectangular</string>
      </property>
     </item>
     <item>
    </widget>
   </item>
   <item row="8" column="1" alignment="Qt::AlignHCenter">
    <widget class="QSlider" name="changefovmax">
     <property name="minimum">
      <number>10</number>
     </property>
     <property name="maximum">
      <number>180</number>
     </property>
     <property name="sliderPosition">
      <number>60</number>
     </property>
     <property name="orientation">
      <enum>Qt::Vertical</enum>
     </property>
     <property name="tickPosition">
      <enum>QSlider::NoTicks</enum>
     </property>
     <property name="tickInterval">
      <number>10</number>
     </property>
    </widget>
   </item>
   <item row="0" column="1" colspan="2">
    <widget class="QLabel" name="label">
     <property name="text">
       <string>Cubic Power</string>
      <string>FOV-Scale Relation</string>
     </property>
    </widget>
   </item>
     <item>
   <item row="10" column="1" colspan="2">
    <widget class="QPushButton" name="pushButton">
     <property name="text">
       <string>Logarithm</string>
      <string>Close</string>
     </property>
    </widget>
   </item>
   <item row="9" column="1" alignment="Qt::AlignHCenter">
    <widget class="QLabel" name="label_5">
     <property name="text">
      <string>FOV max</string>
     </property>
    </widget>
   </item>
   <item row="2" column="1" colspan="2">
    <widget class="QLabel" name="label_3">
   <item row="9" column="2" alignment="Qt::AlignHCenter">
    <widget class="QLabel" name="label_6">
     <property name="text">
      <string>Visualization</string>
      <string>FOV</string>
     </property>
    </widget>
   </item>
   <item row="3" column="1" colspan="2">
    <widget class="QComboBox" name="comboBox_2">
   <item row="0" column="0" rowspan="11">
    <widget class="OpenGLCanvas" name="GLCanvas" native="true"/>
   </item>
   <item row="1" column="1" colspan="2">
    <widget class="QComboBox" name="comboBox">
     <property name="editable">
      <bool>false</bool>
     </property>
     <property name="modelColumn">
      <number>0</number>
     </property>
     <item>
      <property name="text">
       <string>Perspective</string>
       <string>Square Root</string>
      </property>
     </item>
     <item>
      <property name="text">
       <string>3D Sphere</string>
       <string>Naive</string>
      </property>
     </item>
     <item>
      <property name="text">
       <string>Equi-Rectangular</string>
       <string>Linear</string>
      </property>
     </item>
    </widget>
   </item>
   <item row="4" column="1" colspan="2">
    <widget class="QLabel" name="label_2">
     <item>
      <property name="text">
      <string>Field of View</string>
       <string>Square Power</string>
      </property>
    </widget>
     </item>
   <item row="5" column="1" colspan="2">
    <widget class="QDoubleSpinBox" name="doubleSpinBox">
     <property name="minimum">
      <double>1.000000000000000</double>
     </property>
     <property name="maximum">
      <double>360.000000000000000</double>
     </property>
     <property name="singleStep">
      <double>2.000000000000000</double>
     <item>
      <property name="text">
       <string>Cubic Power</string>
      </property>
     <property name="value">
      <double>60.000000000000000</double>
     </item>
     <item>
      <property name="text">
       <string>Logarithm</string>
      </property>
     </item>
    </widget>
   </item>
   <item row="6" column="1" colspan="2">
   <item row="4" column="1" colspan="2">
    <widget class="QLabel" name="label_4">
     <property name="text">
      <string>Center Point</string>
     </property>
    </widget>
   </item>
   <item row="8" column="1">
   <item row="6" column="1">
    <widget class="QDoubleSpinBox" name="doubleSpinBox_3">
     <property name="maximumSize">
      <size>
@@ -139,52 +201,6 @@
     </property>
    </widget>
   </item>
   <item row="8" column="2">
    <widget class="QDoubleSpinBox" name="doubleSpinBox_4">
     <property name="maximumSize">
      <size>
       <width>61</width>
       <height>25</height>
      </size>
     </property>
     <property name="minimum">
      <double>-1.570000000000000</double>
     </property>
     <property name="maximum">
      <double>1.570000000000000</double>
     </property>
     <property name="singleStep">
      <double>0.010000000000000</double>
     </property>
    </widget>
   </item>
   <item row="9" column="1" colspan="2">
    <widget class="QPushButton" name="chooseFile">
     <property name="text">
      <string>Input Image</string>
     </property>
    </widget>
   </item>
   <item row="10" column="2">
    <spacer name="verticalSpacer">
     <property name="orientation">
      <enum>Qt::Vertical</enum>
     </property>
     <property name="sizeHint" stdset="0">
      <size>
       <width>20</width>
       <height>145</height>
      </size>
     </property>
    </spacer>
   </item>
   <item row="11" column="1" colspan="2">
    <widget class="QPushButton" name="pushButton">
     <property name="text">
      <string>Close</string>
     </property>
    </widget>
   </item>
  </layout>
 </widget>
 <layoutdefault spacing="6" margin="11"/>
@@ -195,6 +211,7 @@
   <header location="global">openglcanvas.h</header>
   <container>1</container>
   <slots>
    <signal>fov_changed(int)</signal>
    <slot>change_fov(double)</slot>
    <slot>change_scale(double)</slot>
    <slot>change_center_lambda(double)</slot>
@@ -202,6 +219,8 @@
    <slot>change_fov_scale_relation(QString)</slot>
    <slot>change_visualization(QString)</slot>
    <slot>change_input_image()</slot>
    <slot>change_fov_max(int)</slot>
    <slot>change_fov(int)</slot>
   </slots>
  </customwidget>
 </customwidgets>
@@ -223,22 +242,6 @@
    </hint>
   </hints>
  </connection>
  <connection>
   <sender>doubleSpinBox</sender>
   <signal>valueChanged(double)</signal>
   <receiver>GLCanvas</receiver>
   <slot>change_fov(double)</slot>
   <hints>
    <hint type="sourcelabel">
     <x>592</x>
     <y>174</y>
    </hint>
    <hint type="destinationlabel">
     <x>507</x>
     <y>252</y>
    </hint>
   </hints>
  </connection>
  <connection>
   <sender>doubleSpinBox_3</sender>
   <signal>valueChanged(double)</signal>
@@ -319,5 +322,53 @@
    </hint>
   </hints>
  </connection>
  <connection>
   <sender>changefovmax</sender>
   <signal>sliderMoved(int)</signal>
   <receiver>GLCanvas</receiver>
   <slot>change_fov_max(int)</slot>
   <hints>
    <hint type="sourcelabel">
     <x>512</x>
     <y>363</y>
    </hint>
    <hint type="destinationlabel">
     <x>250</x>
     <y>249</y>
    </hint>
   </hints>
  </connection>
  <connection>
   <sender>changefov</sender>
   <signal>sliderMoved(int)</signal>
   <receiver>GLCanvas</receiver>
   <slot>change_fov(int)</slot>
   <hints>
    <hint type="sourcelabel">
     <x>607</x>
     <y>352</y>
    </hint>
    <hint type="destinationlabel">
     <x>250</x>
     <y>249</y>
    </hint>
   </hints>
  </connection>
  <connection>
   <sender>GLCanvas</sender>
   <signal>fov_changed(int)</signal>
   <receiver>changefov</receiver>
   <slot>setValue(int)</slot>
   <hints>
    <hint type="sourcelabel">
     <x>250</x>
     <y>249</y>
    </hint>
    <hint type="destinationlabel">
     <x>607</x>
     <y>324</y>
    </hint>
   </hints>
  </connection>
 </connections>
</ui>