I encountered an error that happened during Flann feature matching. The reason is one of the feature descriptors for one specific image has all nan values. After further investigation, the problem is caused by the raw feature descriptor being all zeros, based on how root_feature is calculated, there will be a zero division and cause nan value.
https://github.com/OpenDroneMap/OpenSfM/blob/2211a497bcec551bc97dda4921c5ddefa84f9b63/opensfm/features.py#L282-L288
This happens rarely and mostly probably due to a feature point having all 0 intensity pixels around it, here is an example dumped in the middle of the feature extraction (the problematic feature point is at the under-exposed dark area at the left side). It can be reproduced by reading the raw gray image and using the below function call to reproduce
from opensfm import features
import cv2
image = cv2.imread("path_to_image", 0) # read gray image
features.extract_features_sift(image, {'sift_edge_threshold':10.0, 'sift_peak_threshold':0.066, 'feature_root':True}, 16000)
I guess the solution is adding an epsilon value or checking if s is zero. But I'm not sure if keeping all-zero features is reasonable, maybe discarding them is better.
I encountered an error that happened during Flann feature matching. The reason is one of the feature descriptors for one specific image has all nan values. After further investigation, the problem is caused by the raw feature descriptor being all zeros, based on how root_feature is calculated, there will be a zero division and cause nan value. https://github.com/OpenDroneMap/OpenSfM/blob/2211a497bcec551bc97dda4921c5ddefa84f9b63/opensfm/features.py#L282-L288
This happens rarely and mostly probably due to a feature point having all 0 intensity pixels around it, here is an example dumped in the middle of the feature extraction (the problematic feature point is at the under-exposed dark area at the left side). It can be reproduced by reading the raw gray image and using the below function call to reproduce
I guess the solution is adding an epsilon value or checking if
s
is zero. But I'm not sure if keeping all-zero features is reasonable, maybe discarding them is better.