Skip to content

Commit 1a8fcc9

Browse files
author
Hauke Jürgen Mönck
committed
Fixed issues with loss of precision in BST when loading and saving again
1 parent 20a07b5 commit 1a8fcc9

2 files changed

Lines changed: 11 additions & 3 deletions

File tree

BioTracker/CoreApp/BioTracker/Model/DataExporters/DataExporterCSV.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,10 @@ std::string DataExporterCSV::writeComponentCSV(IModelTrackedComponent* comp, int
8282
if (!comp->metaObject()->property(i).isStored()) {
8383
continue;
8484
}
85+
if (!comp->getValid()) {
86+
ss << _separator;
87+
continue;
88+
}
8589
std::string str = comp->metaObject()->property(i).name();
8690
QVariant v = comp->metaObject()->property(i).read(comp);
8791
std::string val = v.toString().toStdString();

BioTracker/Plugin/BackgroundSubtraction/Model/TrackedComponents/TrackedElement.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,12 @@ void TrackedElement::setTime(qint64 t) {
5555
_time = t;
5656
std::string::size_type sz = 0;
5757
long long ll = t / 1000;
58+
long long remainder = t % 1000;
5859
std::time_t tm(ll);
59-
_timeSysclck = std::chrono::system_clock::from_time_t(tm);
60+
61+
_timeSysclck = std::chrono::system_clock::from_time_t(tm);
62+
std::chrono::duration<long long, std::milli> dur(remainder);
63+
_timeSysclck += dur;
6064
};
6165

6266
qint64 TrackedElement::getTime() {
@@ -79,15 +83,15 @@ FishPose TrackedElement::getFishPose()
7983

8084
void TrackedElement::setX(float val) {
8185
_x = val;
82-
FishPose pnew(cv::Point(_x, _pose.position_cm().y), cv::Point(-1, -1), _rad, _deg, _pose.width(), _pose.height(), _pose.getScore());
86+
FishPose pnew(cv::Point2f(_x, _pose.position_cm().y), cv::Point2f(-1, -1), _rad, _deg, _pose.width(), _pose.height(), _pose.getScore());
8387
_ypx = _pose.position_px().y;
8488
_xpx = _pose.position_px().x;
8589
_pose = pnew;
8690
};
8791

8892
void TrackedElement::setY(float val) {
8993
_y = val;
90-
FishPose pnew(cv::Point(_pose.position_cm().x, _y), cv::Point(-1, -1), _rad, _deg, _pose.width(), _pose.height(), _pose.getScore());
94+
FishPose pnew(cv::Point2f(_pose.position_cm().x, _y), cv::Point2f(-1, -1), _rad, _deg, _pose.width(), _pose.height(), _pose.getScore());
9195
_ypx = _pose.position_px().y;
9296
_xpx = _pose.position_px().x;
9397
_pose = pnew;

0 commit comments

Comments
 (0)