Skip to content

Commit fb7aa0f

Browse files
committed
UI improvement
1 parent b36d602 commit fb7aa0f

File tree

2 files changed

+34
-17
lines changed

2 files changed

+34
-17
lines changed

include/gui.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ class MyFrame : public wxFrame {
5151
protected:
5252
bool render_loop_on;
5353
int ETF_kernel;
54+
int ETF_iteration;
55+
int FDoG_iteration;
5456
wxTextCtrl *log; // Show the log
5557
wxButton *start;
5658
wxButton *clean;

src/gui.cpp

Lines changed: 32 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ bool MyApp::OnInit() {
1616
MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
1717
: wxFrame(NULL, wxID_ANY, title, pos, size) {
1818
ETF_kernel = 5;
19+
ETF_iteration = 0;
20+
FDoG_iteration = 0;
1921

2022
#pragma region MenuBar
2123
wxMenu *menuFile = new wxMenu;
@@ -34,26 +36,23 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
3436
menuBar->Append(menuFile, "&File");
3537
menuBar->Append(menuHelp, "&Help");
3638
SetMenuBar(menuBar);
37-
CreateStatusBar(2);
39+
CreateStatusBar(3);
3840
SetStatusText("SrcImg: None", 0);
39-
SetStatusText("flowField: None", 1);
41+
SetStatusText("ETF: None", 1);
42+
SetStatusText("FDoG: None", 2);
4043

4144
#pragma endregion
4245

4346
#pragma region ToolBar: Buttons(Start, Fill Ink, Clean), Combobox(processingBox)
4447
wxToolBar *toolbar1 = new wxToolBar(this, wxID_ANY);
4548
start = new wxButton(toolbar1, BUTTON_Start, _T("Start"), wxDefaultPosition, wxDefaultSize, 0);
46-
4749
clean = new wxButton(toolbar1, BUTTON_Clean, _T("Clean"), wxDefaultPosition, wxDefaultSize, 0);
4850

49-
50-
processingBox = new wxComboBox(toolbar1, COMBOBOX_Processing, "originalImg", wxDefaultPosition, wxDefaultSize, 0);
51-
//processingBox = new wxComboBox(toolbar1, COMBOBOX_Processing, "ETF", wxDefaultPosition, wxDefaultSize, 0);
52-
53-
processingBox->Append("originalImg");
51+
processingBox = new wxComboBox(toolbar1, COMBOBOX_Processing, "Original Image", wxDefaultPosition, wxSize(200, 20), 0);
52+
processingBox->Append("Original Image");
5453
processingBox->Append("ETF");
55-
processingBox->Append("ETF_debug");
56-
processingBox->Append("CLD");
54+
processingBox->Append("ETF-debug");
55+
processingBox->Append("Coherent Line Drawing");
5756
processingBox->Append("Anti-Aliasing");
5857

5958

@@ -95,7 +94,7 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
9594

9695
// wxTextCtrl: http://docs.wxwidgets.org/trunk/classwx_text_ctrl.html
9796
log = new wxTextCtrl(drawpanel, ID_WXEDIT1, wxT(""), wxPoint(91, 43), wxSize(121, 21), wxTE_RICH2 | wxTE_MULTILINE | wxTE_READONLY, wxDefaultValidator, wxT("WxEdit1"));
98-
addlog("Hello CLD!", wxColour(*wxBLACK));
97+
addlog("Hello Coherent Line Drawing!", wxColour(*wxBLACK));
9998

10099
leftside->AddStretchSpacer(3);
101100
leftside->Add(dp, 0, wxCENTER);
@@ -172,8 +171,8 @@ void MyFrame::OnExit(wxCommandEvent& event) {
172171
}
173172
void MyFrame::OnAbout(wxCommandEvent& event) {
174173
wxMessageBox(
175-
"Shu-Hsuan Hsu\n\n National Taiwan University",
176-
"About CLD",
174+
"Coherent Line Drawing\n\nProgram by HSU,SHU-HSUAN(National Taiwan University)\n\nThis is an implementation of 'Coherent Line Drawing' by Kang et al, Proc. NPAR 2007 .",
175+
"About Coherent Line Drawing",
177176
wxOK | wxICON_INFORMATION
178177
);
179178
}
@@ -198,6 +197,9 @@ void MyFrame::OnOpenSrc(wxCommandEvent& event) {
198197

199198
s.Printf("SrcImg: %s", openFileDialog.GetFilename());
200199
SetStatusText(s, 0);
200+
201+
s.Printf("ETF: %d iterations", ETF_iteration);
202+
SetStatusText(s, 1);
201203
}
202204

203205
// proceed loading the file chosen by the user, this can be done with e.g. wxWidgets input streams:
@@ -266,13 +268,21 @@ void MyFrame::OnRefineETF(wxCommandEvent& event) {
266268
addlog("[ETF] Refining ETF...", wxColour(*wxBLUE));
267269
(drawPane->cld).etf.refine_ETF(ETF_kernel);
268270
addlog("[ETF] Done", wxColour(*wxBLUE));
271+
272+
wxString s;
273+
s.Printf("ETF: %d iterations", ++ETF_iteration);
274+
SetStatusText(s, 1);
269275
}
270276

271277
void MyFrame::OnIterativeFDoG(wxCommandEvent& event) {
272278
addlog("[CLD] Iterative FDoG...", wxColour(*wxBLUE));
273279
(drawPane->cld).combineImage();
274280
(drawPane->cld).genCLD();
275281
addlog("[CLD] Done", wxColour(*wxBLUE));
282+
283+
wxString s;
284+
s.Printf("FDoG: %d iterations", ++FDoG_iteration);
285+
SetStatusText(s, 2);
276286
drawPane->paintNow(true);
277287
}
278288

@@ -281,13 +291,18 @@ void MyFrame::OnProcessingBox(wxCommandEvent& event) {
281291
string s = processingBox->GetValue();
282292
drawPane->processingS = s;
283293

284-
if (s == "ETF" || s=="ETF_debug") {
294+
if (s == "ETF" || s=="ETF-debug") {
285295
render_loop_on = true;
286296
} else {
287297
render_loop_on = false;
288298
}
289299

290-
if (s == "CLD") drawPane->cld.genCLD();
300+
if (s == "Coherent Line Drawing") {
301+
drawPane->cld.genCLD();
302+
wxString s;
303+
s.Printf("FDoG: %d iterations", FDoG_iteration);
304+
SetStatusText(s, 2);
305+
}
291306

292307
addlog("[Mode Changed] " + s, wxColour(*wxBLACK));
293308
drawPane->paintNow(true);
@@ -413,10 +428,10 @@ void BasicDrawPane::render(wxDC& dc, bool render_loop_on) {
413428
dis.convertTo(dis, CV_8UC1, 255);
414429
cv::cvtColor(dis, dis, CV_GRAY2BGR);
415430
}
416-
else if (processingS == "ETF_debug") {
431+
else if (processingS == "ETF-debug") {
417432
processing.FlowField(cld.etf.flowField, dis);
418433
}
419-
else if (processingS == "CLD") {
434+
else if (processingS == "Coherent Line Drawing") {
420435
dis = cld.result.clone();
421436
cv::cvtColor(dis, dis, CV_GRAY2BGR);
422437
}

0 commit comments

Comments
 (0)