|
@@ -53,10 +53,29 @@ void test_Median() {
|
53
|
53
|
}
|
54
|
54
|
|
55
|
55
|
void test_MedianPixel() {
|
|
56
|
+ vector<QRgb> V;
|
56
|
57
|
|
57
|
|
- // Implement your unit test for median pixel here .....
|
58
|
58
|
|
59
|
|
- messageBox("MedianPixel unit test not yet implemented!!");
|
|
59
|
+ V.push_back(qRgb(10,20,30));
|
|
60
|
+ V.push_back(qRgb(10,30,10));
|
|
61
|
+ V.push_back(qRgb(20, 0,15));
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+ QRgb result = MedianPixel(V);
|
|
65
|
+
|
|
66
|
+ assert(qRed(result) == 10);
|
|
67
|
+ assert(qGreen(result) == 20);
|
|
68
|
+ assert(qBlue(result) == 15);
|
|
69
|
+
|
|
70
|
+ V.push_back(qRgb(0, 10,20));
|
|
71
|
+
|
|
72
|
+ result = MedianPixel(V);
|
|
73
|
+ assert(qRed(result) == 10);
|
|
74
|
+ assert(qGreen(result) == 15);
|
|
75
|
+ assert(qBlue(result) == 17);
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+ cout << "MedianPixel passed the test!!" << endl;
|
60
|
79
|
}
|
61
|
80
|
|
62
|
81
|
|
|
@@ -64,9 +83,9 @@ void test_MedianPixel() {
|
64
|
83
|
|
65
|
84
|
void MainWindow::RemoveNoise(const vector<QImage> & images, QImage & finalImage){
|
66
|
85
|
|
67
|
|
- test_Sort();
|
68
|
|
- test_Median();
|
69
|
|
- test_MedianPixel();
|
|
86
|
+ // test_Sort();
|
|
87
|
+ // test_Median();
|
|
88
|
+ // test_MedianPixel();
|
70
|
89
|
|
71
|
90
|
// Implement the filter here! See the algorithm in the lab
|
72
|
91
|
messageBox("RemoveNoise function not yet implemented!!!");
|