mirror of
https://github.com/YutaItoh/3D-Eye-Tracker.git
synced 2025-11-04 15:39:41 +08:00
Bug fix for model reset. Filter optimizations.
This commit is contained in:
parent
239cb8a6bd
commit
cbf5176606
@ -324,6 +324,10 @@ int main(int argc, char *argv[]){
|
|||||||
switch (kKEY) {
|
switch (kKEY) {
|
||||||
case 'r':
|
case 'r':
|
||||||
eye_model_updaters[cam]->reset();
|
eye_model_updaters[cam]->reset();
|
||||||
|
while (eyes[cam].size() > 1) {
|
||||||
|
eyes[cam].erase(eyes[cam].begin());
|
||||||
|
}
|
||||||
|
originalSet[cam] = false;
|
||||||
break;
|
break;
|
||||||
case 'd':
|
case 'd':
|
||||||
pupilFitter.setDebug(true);
|
pupilFitter.setDebug(true);
|
||||||
@ -382,13 +386,18 @@ int main(int argc, char *argv[]){
|
|||||||
eye_model_updaters[cam]->add_observation(img_grey, el, inlier_pts, false);
|
eye_model_updaters[cam]->add_observation(img_grey, el, inlier_pts, false);
|
||||||
eye_model_updaters[cam]->force_rebuild_model();
|
eye_model_updaters[cam]->force_rebuild_model();
|
||||||
|
|
||||||
if (eyes[cam].size() > medianTotal * .8 && originalSet[cam] == false) {
|
if (eyes[cam].size() == medianTotal && originalSet[cam] == false) {
|
||||||
// happens once when model is built for the first time to establish eye-box
|
// happens once when model is built for the first time to establish eye-box
|
||||||
originalModels[cam] = eye_model_updaters[cam]->getEye();
|
originalModels[cam] = eye_model_updaters[cam]->getEye();
|
||||||
originalEyeSizes[cam] = eye_tracker::toImgCoord(singleeyefitter::toRotatedRect(
|
originalEyeSizes[cam] = eye_tracker::toImgCoord(singleeyefitter::toRotatedRect(
|
||||||
singleeyefitter::project(eye_model_updaters[cam]->getEye(), focal_length)), img, 1.0f).size.height;
|
singleeyefitter::project(eye_model_updaters[cam]->getEye(), focal_length)), img, 1.0f).size.height;
|
||||||
originalSet[cam] = true;
|
originalSet[cam] = true;
|
||||||
|
cout << "setting original for cam " << cam << endl;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
//cout << "eyes[" << cam << "].size() was " << eyes[cam].size() << endl;
|
||||||
|
//cout << "medianTotal * .8 was " << medianTotal * .8 << endl;
|
||||||
|
//cout << "originalSet[cam] was " << originalSet[cam] << endl;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
is_added = eye_model_updaters[cam]->add_observation(img_grey, el, inlier_pts, force_add);
|
is_added = eye_model_updaters[cam]->add_observation(img_grey, el, inlier_pts, force_add);
|
||||||
@ -441,7 +450,11 @@ int main(int argc, char *argv[]){
|
|||||||
singleeyefitter::project(tempCircle, focal_length)), img, 1.0f); //projection of new 3D radius into 2D coordinates
|
singleeyefitter::project(tempCircle, focal_length)), img, 1.0f); //projection of new 3D radius into 2D coordinates
|
||||||
|
|
||||||
//note: radius of 0 returned from filter if model was bad
|
//note: radius of 0 returned from filter if model was bad
|
||||||
if (eyes[cam].size() > 0 && tempCircle.radius != 0 && std::abs(originalRadius.size.height - newRadius.size.height) < 40){
|
if (eyes[cam].size() > 0 &&
|
||||||
|
tempCircle.radius != 0 &&
|
||||||
|
std::abs(originalRadius.size.height - newRadius.size.height) < 40 &&
|
||||||
|
std::abs(originalRadius.center.x - newRadius.center.x) < 50 &&
|
||||||
|
std::abs(originalRadius.center.y - newRadius.center.y) < 50){
|
||||||
//2D projections of radii were non-zero and did not differ significantly from originals
|
//2D projections of radii were non-zero and did not differ significantly from originals
|
||||||
medianCircle = tempCircle; //pass on for model update
|
medianCircle = tempCircle; //pass on for model update
|
||||||
lastGoodEyes[cam] = tempCircle; //update last good eye (for possible use in next frame)
|
lastGoodEyes[cam] = tempCircle; //update last good eye (for possible use in next frame)
|
||||||
@ -514,6 +527,7 @@ int main(int argc, char *argv[]){
|
|||||||
myfile.close();
|
myfile.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Compute FPS
|
// Compute FPS
|
||||||
//frame_rate_counter.count();
|
//frame_rate_counter.count();
|
||||||
//// Print current frame data
|
//// Print current frame data
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user