The primary differences between the two files are
Code:
centerX = reports->at(highParticle).center_mass_x_normalized;
and
Code:
for (unsigned int i = 0; i < reports->size(); i++)
{
if(reports->at(i).center_mass_y > reports->at(highParticle).center_mass_y)
{
highParticle = i;
}
}
for (unsigned int i = 0; i < reports->size(); i++)
{
if(reports->at(i).center_mass_y < reports->at(lowParticle).center_mass_y)
{
lowParticle = i;
}
}
Also, your assumption is correct. The working one does not stop while the other, (with the above changes), does after working briefly.
I commented out these lines and the code began to work again.
I also tried to make particle analysis report pointers like in the other file to compare results but that works in a similar fashion with the exception that when the code stops working instead of the CPU usage flat-lining it spikes and does not come down and the code stops as with the other way.
I apologize for any distracting extraneous code or any bugs in the 'working' version. It is a save from when I got the camera to work as I intended (my lesson learned- this being the second time)
Once again, thankyou.