Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Darking image lines using OpenCV

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

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

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

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading