[TASK] Finish up very first working version of canny edge algorithm.

This commit is contained in:
Jan Philipp Timme 2015-12-20 17:13:58 +01:00
parent e7fb9cdbb1
commit 000a2be162
2 changed files with 17 additions and 1 deletions

View File

@ -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; x<this->width; x++) {
for(int y=0; y<this->height; 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();
};
};

View File

@ -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();
}