본문 바로가기

영상 화자 분리/개발

[Opencv4] Stitch error

1. Stitching images

- Stitcher::Stitch err

terminate called after throwing an instance of 'cv::Exception'
  what():  OpenCV(4.0.0) ~/opencv/opencv-4.0.0/modules/flann/src/miniflann.cpp:487: error: (-215:Assertion failed) (size_t)knn <= index_->size() in function 'runKnnSearch_'

knn algorithms do compare between each matrixes. Okay then, I guess that error means 2 for my cases. The one is rack of dataset. The other is mismatching of matrix parameters. The first one I checked has no mean because there are plenty of images about 1,000. So I considered this of Marix problems.

I checked that the matrix parameters acutally were different. It means the 'height and width' in below cases.

size:[87 x 69], total:6003, type:0, depth:0, channels:1
size:[91 x 72], total:6552, type:0, depth:0, channels:1
size:[83 x 67], total:5561, type:0, depth:0, channels:1
size:[86 x 57], total:4902, type:0, depth:0, channels:1
size:[91 x 71], total:6461, type:0, depth:0, channels:1
size:[87 x 69], total:6003, type:0, depth:0, channels:1
size:[87 x 69], total:6003, type:0, depth:0, channels:1
size:[84 x 67], total:5628, type:0, depth:0, channels:1
size:[90 x 71], total:6390, type:0, depth:0, channels:1
size:[84 x 67], total:5628, type:0, depth:0, channels:1
size:[85 x 67], total:5695, type:0, depth:0, channels:1
size:[85 x 67], total:5695, type:0, depth:0, channels:1
size:[78 x 64], total:4992, type:0, depth:0, channels:1
size:[80 x 65], total:5200, type:0, depth:0, channels:1
size:[77 x 63], total:4851, type:0, depth:0, channels:1
size:[81 x 66], total:5346, type:0, depth:0, channels:1
size:[76 x 62], total:4712, type:0, depth:0, channels:1
size:[81 x 65], total:5265, type:0, depth:0, channels:1
size:[80 x 65], total:5200, type:0, depth:0, channels:1
size:[80 x 65], total:5200, type:0, depth:0, channels:1

These are parameter of Mat class from 10 samples. It is enough to be the reason I faced a problems. Although I resized them, however, It doesn't work. (The resizing process is to resize them to max row/col based on my original images)

 

2. So What?

(1) Stitch() operation

Stitcher::stitch() do ORB matching. If  you have no similiar points between the pictures, then the stitch() method returns "the err". So, I made my picture size up then the stitch() can read them by some extent. This is totally my case but, I hope you who has troubles like me to get a little insight. Thanks.