-2

How can the gridlines in the image below be blackened using OpenCV so that they are more prominent? I tried thresholding but it washes out the gridlines.

enter image description here

user840
  • 134
  • 1
  • 13
  • you can use [Thresholding](https://docs.opencv.org/3.4/d7/d4d/tutorial_py_thresholding.html) – Bilal Jan 07 '22 at 07:27

1 Answers1

2

You need to use Adaptive Gaussian Thresholding

import cv2 

image1 = cv2.imread('Naw6P.png') 
img = cv2.cvtColor(image1, cv2.COLOR_BGR2GRAY)

thresh = cv2.adaptiveThreshold(img, 255, cv2.ADAPTIVE_THRESH_GAUSSIAN_C,
                                          cv2.THRESH_BINARY, 51, 5)
cv2.imshow('Adaptive Gaussian', thresh)
cv2.waitKey(0)

output after adaptive gaussian thresholding

Ishan
  • 270
  • 1
  • 8