0
我正在嘗試創建一個OCR應用程序。我需要使用輪廓來定位文本。但是,我的圖像有很多噪音,我想知道是否有辦法將其刪除。OpenCV - 使用Java去除圖像中的噪點
我當前的代碼:
// Input image already converted to a matrix
Imgproc.cvtColor(matrixImage, matrixImage, Imgproc.COLOR_BGR2GRAY);
// Gaussian blur
Imgproc.GaussianBlur(matrixImage, matrixImage, new Size(7,7), 0);
Imgproc.threshold(matrixImage, matrixImage, 125, 255, Imgproc.THRESH_BINARY_INV);
// This is my current approach for removing noise. However, there is still
// a lot of random areas that can be removed.
// Remove specs from image
Mat morphingMatrix = Mat.ones(3,3, CV_8UC1);
Imgproc.morphologyEx(matrixImage, matrixImage, Imgproc.MORPH_OPEN, morphingMatrix);
// Image denoising
Photo.fastNlMeansDenoising(matrixImage, matrixImage);
我的輸入圖像。我允許用戶手動標記角落,以便下面的轉換圖像僅將轉換應用於中間的白色紙張。
怎麼沒改造後的圖像看一下嗎?你可以上傳那張圖片嗎? –
第二張圖片是我轉換後的圖片 –
我明白了,但它是黑/白(二進制)。我想在原始色彩空間(RGB)中轉換圖像, –