[TASK] Finish up very first working version of canny edge algorithm.
This commit is contained in:
parent
e7fb9cdbb1
commit
000a2be162
|
@ -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();
|
||||
};
|
||||
|
||||
};
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue