Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
147 views
in Technique[技术] by (71.8m points)

python - How to find the same feature points within an image after print-scan process?

I'm trying to find the same feature points within an image, before and after the print-scan process. To do this, I used cv2.goodFeaturesToTrack method:

import numpy as np
import matplotlib.pyplot as plt
from PIL import Image
from skimage import color, transform
import cv2

# Read image as Numpy array
image = np.array(Image.open('images/stairway512.jpg'))

# Blur image
imageBlurred = cv2.blur(image, (10, 10))

# Find 5 feature points in cropped & blurred image
points = cv2.goodFeaturesToTrack(imageBlurred, 5, 0.01, 10)

The points I get are these:

Original image

array([[[ 62., 186.]],

       [[298., 398.]],

       [[ 47., 185.]],

       [[298.,  68.]],

       [[195., 135.]]], dtype=float32)

I used blur because I assumed it would minimize the impact of the print-scan process (because I can then blur the scanned image the same way), but I end up with different feature points for the scanned image. However, when I use the same code for the scanned image, I get these points:

enter image description here

array([[[297., 403.]],

       [[297., 359.]],

       [[268., 359.]],

       [[268., 396.]],

       [[308.,  65.]]], dtype=float32)

Any ideas on how to make these points the same?

question from:https://stackoverflow.com/questions/65901717/how-to-find-the-same-feature-points-within-an-image-after-print-scan-process

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

As a rule, feature points are unstable and will vary in position and score when you modify the image.

Take more feature points (say 100, 5 is by far too small) and associate them in pairs by the nearest neighbor rule. This will given more insight in what you can achieve with this detector.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...