I have two images say imageA and imageB as shown below. Now I need to check whether the line present in imageB already exists in image A or not (i.e) line present in imageB should be the subset of line present in imageA. I used image subtraction in open cv but not able to get desired output. I am a newbie to opencv. So someone please provide your inputs.
Note : Can have some threshold for line matching as the line in both images will not match 100% exactly.
ImageA :
ImageB :
Here's an approach:
Take image B, threshold it. Count the non-zero pixels.
Do a bitwise AND of the two images and count how many pixels are white in the result - i.e. common to both images.