diff --git a/canny_edge_machine.cpp b/canny_edge_machine.cpp index 19f6c37..ccfbd59 100644 --- a/canny_edge_machine.cpp +++ b/canny_edge_machine.cpp @@ -244,6 +244,21 @@ class CannyEdgeMachine { } }; + void showEdges(void) { + QRgb black = QColor::fromRgb(0, 0, 0).rgb(); + QRgb white = QColor::fromRgb(255, 255, 255).rgb(); + for(int x=0; xwidth; x++) { + for(int y=0; yheight; y++) { + int pixel = this->binary_edge_pixels[y*this->width + x]; + if(pixel > 0) { + this->working_copy->getImage()->setPixel(x, y, white); + } else { + this->working_copy->getImage()->setPixel(x, y, black); + } + } + } + }; + void work() { this->reset(); this->doGaussBlur(); @@ -251,6 +266,7 @@ class CannyEdgeMachine { this->doGradiantMagnitude(); this->filterLocalMaxima(); this->workLocalMaxima(); + this->showEdges(); }; }; diff --git a/imageviewer-qt4.cpp b/imageviewer-qt4.cpp index ee96fb9..b903564 100644 --- a/imageviewer-qt4.cpp +++ b/imageviewer-qt4.cpp @@ -651,7 +651,7 @@ void ImageViewer::applyBasicFilterWithOverflowHandling() { void ImageViewer::runCannyEdge(void) { //TODO CannyEdgeMachine cem = CannyEdgeMachine(original, working_copy); - cem.setThresholdValues(0, 0); //TODO + cem.setThresholdValues(2.5, 3.5); //TODO cem.work(); updateImageDisplay(); }