Advertisement
Guest User

Untitled

a guest
Jan 16th, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. // Input image already converted to a matrix
  2. Imgproc.cvtColor(matrixImage, matrixImage, Imgproc.COLOR_BGR2GRAY);
  3.  
  4. // Gaussian blur
  5. Imgproc.GaussianBlur(matrixImage, matrixImage, new Size(7,7), 0);
  6.  
  7. Imgproc.threshold(matrixImage, matrixImage, 125, 255, Imgproc.THRESH_BINARY_INV);
  8.  
  9. // This is my current approach for removing noise. However, there is still
  10. // a lot of random areas that can be removed.
  11.  
  12. // Remove specs from image
  13. Mat morphingMatrix = Mat.ones(3,3, CV_8UC1);
  14. Imgproc.morphologyEx(matrixImage, matrixImage, Imgproc.MORPH_OPEN, morphingMatrix);
  15.  
  16. // Image denoising
  17. Photo.fastNlMeansDenoising(matrixImage, matrixImage);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement