2016-01-13 1 views
0

Je suis en train de mettre en œuvre cet algorithme Accentuation que j'ai trouvé à hereOpenCV Accentuation Implémentation Java

Edit: Ceci est l'algorithme.

Mat blurred; double sigma = 1, threshold = 5, amount = 1; 
GaussianBlur(img, blurred, Size(), sigma, sigma); 
Mat lowContrastMask = abs(img - blurred) < threshold; 
Mat sharpened = img*(1+amount) + blurred*(-amount); 
img.copyTo(sharpened, lowContrastMask); 

Je coincé ici:

// Mat lowContrastMask = abs(img - blurred) < threshold; 

    Mat lowContrastMask = new Mat(); 
    Core.absdiff(source, destination, lowContrastMask); 

Je ne sais pas comment mettre en œuvre une partie "< de seuil". J'apprécie toute aide.

+0

Votre lien ne pointe pas à un algorithme, juste OpenCV doc – Miki

+0

mettre à jour la question – bodoroman

Répondre

0

Vous pouvez utiliser threshold:

Imgproc.threshold(lowContrastMask, lowContrastMask, 0, thresh, Imgproc.THRESH_BINARY_INV) 
+0

Il ne donne aucune erreur, mais les résultats ne sont pas si bon. Je suppose qu'il y a plusieurs erreurs dans mon algorithme. – bodoroman