00001 00021 #ifndef VIEW_CREATOR_DIALOG_H_ 00022 #define VIEW_CREATOR_DIALOG_H_ 00023 00024 #include "View_Creator_Dialog_Base.h" 00025 #include <wx/wx.h> 00026 #include <ros/ros.h> 00027 #include <sensor_msgs/Image.h> 00028 #include <HalconCpp.h> 00029 #include "View_Params_Wrapper.h" 00030 #include <boost/thread.hpp> 00031 00035 class ViewCreatorDialog : public ViewCreatorDialogBase 00036 { 00037 00038 private: 00039 00041 ros::NodeHandle nh; 00042 00044 ros::Subscriber image_model_sub; 00045 00047 ros::Subscriber image_test_sub; 00048 00050 HalconCpp::HImage fixedImage; 00051 00053 ViewParamsWrapper *params; 00054 00056 bool fixed_image_available; 00057 00059 bool desc_model_available; 00060 00062 bool test_running; 00063 00065 int frame_counter; 00066 00068 double score_sum; 00069 00071 double feature_sum; 00072 00074 double time_sum; 00075 00077 wxTimer* update_timer; 00078 00080 HalconCpp::HDescriptorModel desc_model; 00081 00082 00083 00084 00085 00087 boost::thread paint_thread; 00088 00090 int update_counter; 00091 00095 void onUpdate(wxTimerEvent& evt); 00096 00102 void onModelCameraImage(const sensor_msgs::Image::ConstPtr& msg); 00103 00110 void onTestCameraImage(const sensor_msgs::Image::ConstPtr& msg, bool use_file); 00111 00117 void enableGuiElements(bool enable = true); 00118 00124 void enableGuiElementsTest(bool enable = true); 00125 00129 void updateImageOnCrop(); 00130 00136 void paint_test_image(HalconCpp::HImage img); 00137 00138 00139 00140 00141 protected: 00142 00146 void OnDialogClose(wxCloseEvent &event); 00147 void onChoiceImageSource( wxCommandEvent& event ); 00148 void onChoiceImage( wxCommandEvent& event ); 00149 void onChoiceTestImageSource(wxCommandEvent &event); 00150 void onChoiceTestImage( wxCommandEvent& event ); 00151 void onButtonCancelClicked( wxCommandEvent& event ); 00152 void onButtonSaveClicked( wxCommandEvent& event ); 00153 void onButtonStartTestClicked(wxCommandEvent &event); 00154 void onButtonEndTestClicked(wxCommandEvent &event); 00155 void onCheckUseCurrentImage(wxCommandEvent &event); 00156 00157 void onEditTextUpperLeftRow(wxFocusEvent &event); 00158 void onEditTextUpperLeftColumn(wxFocusEvent& event); 00159 void onEditTextLowerRightRow(wxFocusEvent& event); 00160 void onEditTextLowerRightColumn(wxFocusEvent& event); 00161 00162 void onSlideUpperLeftRow(wxScrollEvent &event); 00163 void onSlideUpperLeftColumn(wxScrollEvent &event); 00164 void onSlideLowerRightRow(wxScrollEvent &event); 00165 void onSlideLowerRightColumn(wxScrollEvent &event); 00166 00167 void onEditTextUpperLeftRowEnter(wxCommandEvent &event); 00168 void onEditTextUpperLeftColumnEnter(wxCommandEvent &event); 00169 void onEditTextLowerRightRowEnter(wxCommandEvent &event); 00170 void onEditTextLowerRightColumnEnter(wxCommandEvent &event); 00171 00172 void onEditTextOrientationX(wxFocusEvent &event); 00173 void onEditTextOrientationY(wxFocusEvent &event); 00174 void onEditTextOrientationZ(wxFocusEvent &event); 00175 void onEditTextScore(wxFocusEvent &event); 00176 void onEditTextVerticalOffset(wxFocusEvent &event); 00177 void onEditTextHorizontalOffset(wxFocusEvent &event); 00178 void onEditTextDepth(wxFocusEvent &event); 00179 void onEditTextFernNumber(wxFocusEvent &event); 00180 void onEditTextPatchSize(wxFocusEvent &event); 00181 void onEditTextMinScale(wxFocusEvent &event); 00182 void onEditTextMaxScale(wxFocusEvent &event); 00183 00184 void onEditTextOrientationXEnter(wxCommandEvent &event); 00185 void onEditTextOrientationYEnter(wxCommandEvent &event); 00186 void onEditTextOrientationZEnter(wxCommandEvent &event); 00187 void onEditTextScoreEnter(wxCommandEvent &event); 00188 void onEditTextVerticalOffsetEnter(wxCommandEvent &event); 00189 void onEditTextHorizontalOffsetEnter(wxCommandEvent &event); 00190 void onEditTextDepthEnter(wxCommandEvent &event); 00191 void onEditTextFernNumberEnter(wxCommandEvent &event); 00192 void onEditTextPatchSizeEnter(wxCommandEvent &event); 00193 void onEditTextMinScaleEnter(wxCommandEvent &event); 00194 void onEditTextMaxScaleEnter(wxCommandEvent &event); 00195 00196 void onEditTextAxis1X(wxFocusEvent &event); 00197 void onEditTextAxis1Y(wxFocusEvent &event); 00198 void onEditTextAxis1Z(wxFocusEvent &event); 00199 void onEditTextAxis1Angle(wxFocusEvent &event); 00200 void onEditTextAxis2X(wxFocusEvent &event); 00201 void onEditTextAxis2Y(wxFocusEvent &event); 00202 void onEditTextAxis2Z(wxFocusEvent &event); 00203 void onEditTextAxis2Angle(wxFocusEvent &event); 00204 00205 void onEditTextAxis1XEnter(wxCommandEvent &event); 00206 void onEditTextAxis1YEnter(wxCommandEvent &event); 00207 void onEditTextAxis1ZEnter(wxCommandEvent &event); 00208 void onEditTextAxis1AngleEnter(wxCommandEvent &event); 00209 void onEditTextAxis2XEnter(wxCommandEvent &event); 00210 void onEditTextAxis2YEnter(wxCommandEvent &event); 00211 void onEditTextAxis2ZEnter(wxCommandEvent &event); 00212 void onEditTextAxis2AngleEnter(wxCommandEvent &event); 00213 00214 void onCheckUpsideDown(wxCommandEvent &event); 00215 void onCheckUseColor(wxCommandEvent &event); 00216 00217 00218 public: 00225 ViewCreatorDialog(wxWindow* parent, ViewParamsWrapper* params); 00226 }; 00227 00228 00229 #endif //DESC_MODELS_DIALOG_H_ 00230 00231 00232 00233