Open shodow opened 5 years ago
Minimal complete reproducer is required (including input data).
@alalek I'm sorry I don't understand what's you mean :(
@shodow, can it be reproduced with the video from here and the 1st bounding box from here ?
(we don't know about your video, and where you clicked in there, so it's better to use something "known")
@berak hi, i use this video and get the same error. the 1st bounding box is 123,87,132,176
OpenCV version? (cv::getBuildInformation()
)
Did you try latest code from 3.4 branch?
@alalek this function(cv::getBuildInformation()) return
i could reproduce it on master:
Thread 1 hit Breakpoint 7, cv::PFSolver::iteration (this=0xb7b92d0) at C:/p/opencv_contrib/modules/tracking/src/PFSolver.hpp:109
109 Mat_<double> maxrow=_particles.row((int)max_element);
(gdb) p (int)max_element
$19 = -4
(gdb) p _particles.rows
$20 = 100
it should better use a fixed seed (for reproducability)
Reproduced with:
bbox = Rect(57, 27, 454, 417);
@alalek you mean use this bbox = Rect(57, 27, 454, 417); as 1st bounding box?
@berak thanks for your help,so what should i do?Should I need to modify the source code?
i modify the source code here
Mat_<double> maxrow=_particles.row((int)max_element);
to
Mat_<double> maxrow=_particles.row((int)-max_element);
it can be run,but the sampleImg return is 0,and running very slow
@nailbiter, maybe you can shed some light on it ?
@shodow , no i don't think, this is the correct answer. ;)
if _logweight
represents a probability, or a loglikelihood for a given particle to be a good seed for the next iteration, then the problem is here:
double max_element;
minMaxLoc(_logweight, 0, &max_element);
Mat_<double> maxrow=_particles.row((int)max_element);
which imho should be:
Point max_pos;
minMaxLoc(_logweight, 0, 0, 0, &max_pos);
Mat_<double> maxrow=_particles.row(max_pos.x);
(there is one weight for each particle, and we want the particle with the strongest weight, so we need the index of it, not the weight itself)
and there might be still more errors lurking in the weights calculation. (the particles look quite ok to me)
btw, we should use a color video, not a grayscale one, for better results here, since it uses HSV histograms to evaluate candidate rects
@shodow @berak Guys, I wrote the code a while ago and haven't touched it since then, so it will take me some time. I will take a look and reply within 24 hours.
I receive the same Error as @berak . Did you check the Code? Also, are there any examples on how to use the Particle Filter?
@Melodeathguy no, there are no usage examples it's also never used internally, and the "factory" here won't allow to create one.
but i tested the code, and the fix mentioned in the comment above did work for me. (i had do adjust to adjust the pertubation params according to the video size, though, to get something halfway stable, e.g. 15 was far too much for the 320x240 test videos. (it's also very slow, like close to a second per iteration)
just curious, what are you trying to do with it ? (it's not a "standalone" tracker)
When i using class TrackerSamplerPF,i get this error: Error: Assertion failed (0 <= _rowRange.start && _rowRange.start <= _rowRange.end && _rowRange.end <= m.rows) this is my code: