khaled
September 10, 2021, 4:19pm
1
Hello everybody I’m trying to make a panorama view for a lot number to image but unfortunately the code working for the small number but when I USE IT for my dataset I faced this problem:
error, stitched_img = imageStitcher.stitch(images)
cv2.error: OpenCV(4.5.3) /private/var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/pip-req-build-8g_88acj/opencv/modules/
flann/src/miniflann.cpp:521: error: (-215:Assertion failed) (size_t)knn <= index
Help please,
you should present your code. prepare a minimal reproducible example, i.e. only code that is required.
the assertion comes from
template<typename Distance, typename IndexType>
void runKnnSearch_(void* index, const Mat& query, Mat& indices, Mat& dists,
int knn, const SearchParams& params)
{
typedef typename Distance::ElementType ElementType;
typedef typename Distance::ResultType DistanceType;
int type = DataType<ElementType>::type;
int dtype = DataType<DistanceType>::type;
IndexType* index_ = (IndexType*)index;
CV_Assert((size_t)knn <= index_->size());
CV_Assert(query.type() == type && indices.type() == CV_32S && dists.type() == dtype);
CV_Assert(query.isContinuous() && indices.isContinuous() && dists.isContinuous());
::cvflann::Matrix<ElementType> _query((ElementType*)query.data, query.rows, query.cols);
::cvflann::Matrix<int> _indices(indices.ptr<int>(), indices.rows, indices.cols);
::cvflann::Matrix<DistanceType> _dists(dists.ptr<DistanceType>(), dists.rows, dists.cols);
index_->knnSearch(_query, _indices, _dists, knn,
(const ::cvflann::SearchParams&)get_params(params));
}