Here is code:
#!/usr/bin/python37
#OpenCV 4.3.0, Raspberry pi 3B+/4B, Buster v10.
#Date: 12th April, 2020
import cv2 as cv
import numpy as np
img = cv.imread('printed_circuit4_.jpg')
gray= cv.cvtColor(img, cv.COLOR_BGR2GRAY)
blurred = cv.GaussianBlur(gray, (3, 3), 3)
adapt_thresh = cv.adaptiveThreshold(blurred, 255,
cv.ADAPTIVE_THRESH_MEAN_C,
cv.THRESH_BINARY_INV, 7, -2)
cv.imshow('Image', adapt_thresh)
cv.imwrite('contrast_board.jpg', adapt_thresh)
cv.waitKey(0)
cv.destroyAllWindows()
Output:
Another one for printed circuit board:
#!/usr/bin/python37
#OpenCV 4.3.0, Raspberry pi 3B+/4B, Buster v10.
#Date: 12th April, 2020
import cv2
image = cv2.imread('printed_circuit4_.jpg')
alpha = 3.9 # Contrast control (1.0-3.0)
beta = 0 # Brightness control (0-100)
adjusted = cv2.convertScaleAbs(image, alpha=alpha, beta=beta)
cv2.imwrite('Contrast_board.jpg', adjusted)
cv2.imshow('Contrast Printed Circuit', adjusted)
cv2.waitKey(0)
Output:
Can you post original print circuit board?
updated it
I got the green channel then reversed it
You took picture?
No, its from the internet