Skip to content

Conversation

@ashleyyli
Copy link

Add function to handle scrolling-related false positives in scene detection

@ashleyyli ashleyyli self-assigned this Oct 28, 2025
@ashleyyli ashleyyli requested a review from angrave October 28, 2025 01:59
@angrave
Copy link
Collaborator

angrave commented Oct 28, 2025

Please can you do a new PR but where these changes are in a new scene detection file e.g. submit your changes as svm_poly3 (or other name of your choice) ?
i.e. I want to be able to be able switch between the current and your new methods.

Copy link
Collaborator

@angrave angrave left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please see my line-based comments - (basically more comments needed to explain why some choices were made)
Also please can you do a new PR but where these changes are in a new scene detection file e.g. submit your changes as svm_poly3 (or other name of your choice) ?
i.e. I want to be able to be able switch between the current and your new methods.

M, inliers = cv2.estimateAffinePartial2D(src_pts, dst_pts, method=cv2.RANSAC)

inlier_ratio = np.sum(inliers) / len(inliers)
# Arbitrary threshold
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some comments would be useful.
Where did this value come from? Are there any links to web resources that would help me/someone tweak this i the future? What is a reasonable range? What happens if it is too large too small?
The value should at least be in a variable to highlight it

if m.distance < 0.7 * n.distance:
good.append(m)

if len(good) < 100:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Arbtirary constant should be in a variable. Documentation... Valid range? Web resources? When should it be increased? decreased?


matches = flann.knnMatch(des1, des2, k=2)

# Ratio test as per Lowe's paper
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please cite e.g. with DOI or web URL so people can find it

# print(f"No descriptors found (des1={des1 is None}, des2={des2 is None}) at index {index}")
return False

# FLANN parameters
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few notes would be useful here, includingwhat these parameters do

# Create target
crop_image = ref[img_y:img_y+img_h, img_x:img_x+img_w]

# Initiate SIFT detector
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A web link would be usesful, plus a comment what this detector does

return result

def find_match(curr, ref, width, height, index):
# Defining region of search
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Explain these choices

@ashleyyli ashleyyli force-pushed the update-scenedetection branch from fea3a5f to 45e0dd8 Compare November 6, 2025 17:26
Copy link
Collaborator

@angrave angrave left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@angrave angrave merged commit a2c951c into staging Nov 7, 2025
1 check passed
@angrave angrave deleted the update-scenedetection branch November 7, 2025 19:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants