I have these kind of photos as attached file. I Would like to extract exact position of ID card inside image. Is it possible using OpenCV? I tried following (code is in opencv4nodejs, but I can work with python also:
const src = cv.imread('./970f5b45-9f24-41d5-91f0-ef3f8b9d8914.jpeg');
let src2 = src.cvtColor(cv.COLOR_BGR2GRAY)
let dst = src2.adaptiveThreshold(255, cv.ADAPTIVE_THRESH_GAUSSIAN_C, cv.THRESH_BINARY, 12, 2);
let dst2 = dst.morphologyEx(cv.MORPH_OPEN)
After that I have binarized file, and then I applied contours finding using:
contours = dst.findContours(cv.RETR_TREE,cv.CHAIN_APPROX_SIMPLE)
But result is thousants of really small countours, nothing I can work with. Is possible to somehow extract specific position of card in image? Best would be if I can extract x/y positions of corners, so I can follow/normalize card then. Or if there is another technique in nodejs/python, Iˇm free to learn.