Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • ped-dyn-emp/petrack
1 result
Show changes
Commits on Source (16)
......@@ -126,7 +126,7 @@ inline double getMedianOf3(double a, double b, double c)
// da obige Fkt manchmal schon existiert:
// d darf keine seiteneffekte haben!!!
// myround genommen, da round manchmal in math.h existiert, aber nicht immer
#define myRound(d) ((int) ((d)<0 ? (d)-.5 : (d)+.5))
#define myRound(d) (static_cast<int>(((d)<0 ? (d)-.5 : (d)+.5)))
#define myClip(d, min, max) (((d) < min) ? (min) : (((d) > max) ? (max) : (d)))
// get image color from 3-channel-images with values 0..255
......
......@@ -29,14 +29,72 @@ class TrackPoint;
class QRect;
class BackgroundFilter;
class Control;
class ImageItem;
// berechnet pixelverschiebung aufgrund von schraegsicht bei einem farbmarker
// Maik Dissertation Seite 138
// boxImageCentre ohne Border
Vec2F autoCorrectColorMarker(Vec2F &boxImageCentre, Control *controlWidget);
namespace reco {
// berechnet pixelverschiebung aufgrund von schraegsicht bei einem farbmarker
// Maik Dissertation Seite 138
// boxImageCentre ohne Border
Vec2F autoCorrectColorMarker(Vec2F &boxImageCentre, Control *controlWidget);
//void getMarkerPos(IplImage *iplImg, QRect roi, QList<TrackPoint> *crossList, int markerBrightness, int borderSize, bool ignoreWithoutMarker, bool autoWB, BackgroundFilter *bgFilter, int recoMethod);
void getMarkerPos(cv::Mat &img, QRect &roi, QList<TrackPoint> *crossList, Control *controlWidget, int borderSize, BackgroundFilter *bgFilter);
void findCodeMarker(cv::Mat &img, QList<TrackPoint> *crossList, Control *controlWidget, Vec2F offsetCropRect2Roi=Vec2F{0,0});
cv::Ptr<cv::aruco::Dictionary> getDictMip36h12();
//void getMarkerPos(IplImage *iplImg, QRect roi, QList<TrackPoint> *crossList, int markerBrightness, int borderSize, bool ignoreWithoutMarker, bool autoWB, BackgroundFilter *bgFilter, int recoMethod);
void getMarkerPos(cv::Mat &img, QRect &roi, QList<TrackPoint> *crossList, Control *controlWidget, int borderSize, BackgroundFilter *bgFilter);
namespace detail {
struct ColorBlob{
cv::RotatedRect box; ///< bounding box
Vec2F imageCenter; ///< Center in whole image (instead of ROI)
QColor color; ///< color of detected blob
std::vector<cv::Point> contour; ///< detected contour
double maxExpansion; ///< length of longer side of bounding rect
};
struct ColorBlobDetectionParams{
QColor fromColor; ///< from color of the colormap
QColor toColor; ///< to color of the colormap
bool invHue = false; ///< flag indicating if hue should be inverted (for red-ish colors)
bool useOpen = true; ///< should open-operation be used
bool useClose = true; ///< should close-operation be used
int radiusOpen = 5; ///< radius of open-kernel
int radiusClose = 5; ///< radius of close-kernel
int minArea = 1000; ///< min area of the contour
int maxArea = 5000; ///< max area of the contour
Vec2F offset; ///< offset of ROI to image
double maxRatio = 2; ///< maximum allowed ratio of sides for bounding rect
cv::Mat img; ///< img in which to detect the blobs
cv::Mat binary; ///< img for the binary mask
};
struct BlackDotOptions
{
int borderSize = 0; ///< size of border from borderFilter
bool restrictPosition =
false; ///< should the position of the black dot be restricted (see restrictPositionBlackDot())
bool ignoreWithoutMarker = true; ///< should markers without dot be ignored?
bool autoCorrect = false; ///< should perspective correction be performed
bool autoCorrectOnlyExport = false; ///< should perspective correction only be performed when exporting trajectories
ImageItem *imageItem = nullptr; ///< used for getAngleToGround and such
QColor midHue; ///< middle hue of the color map
double dotSize = 5; ///< size of the black dot
Control * controlWidget = nullptr; ///< pointer to Control used for autoCorrect
};
struct ArucoOptions
{
Control *controlWidget = nullptr; ///< pointer to Control used for autoCorrect
bool ignoreWithoutMarker = true; ///< should a blob without valid arucoMarker be ignored
bool autoCorrect = false; ///< should perspective correction be performed
bool autoCorrectOnlyExport = false; ///< should perspective correction only be performed when exporting trajectories
};
std::vector<ColorBlob> findColorBlob(const ColorBlobDetectionParams &options);
void restrictPositionBlackDot(ColorBlob& blob, ImageItem *imageItem, int bS, cv::Rect& cropRect);
cv::Mat customBgr2Gray(const cv::Mat& subImg, const QColor& midHue);
void refineWithBlackDot(std::vector<ColorBlob>& blobs, const cv::Mat& img, QList<TrackPoint>& crossList, const BlackDotOptions& options);
void refineWithAruco(std::vector<ColorBlob> &blobs, const cv::Mat& img, QList<TrackPoint> &crossList, ArucoOptions& options);
void findCodeMarker(cv::Mat &img, QList<TrackPoint> *crossList, Control *controlWidget, Vec2F offsetCropRect2Roi=Vec2F{0,0});
cv::Ptr<cv::aruco::Dictionary> getDictMip36h12();
}
}
#endif
......@@ -3789,7 +3789,7 @@ void Petrack::updateImage(bool imageChanged) // default = false (only true for n
// getMarkerPos(mIplImgFiltered, rect, &persList, mControlWidget->markerBrightness->value(),
// getImageBorderSize(), (mControlWidget->markerIgnoreWithout->checkState() == Qt::Checked),
// (mControlWidget->recoAutoWB->checkState() == Qt::Checked), getBackgroundFilter(), recoMethod); //#tempImg
getMarkerPos(mImgFiltered, rect, &persList, mControlWidget, getImageBorderSize(), getBackgroundFilter());
reco::getMarkerPos(mImgFiltered, rect, &persList, mControlWidget, getImageBorderSize(), getBackgroundFilter());
// markerLess = false;
// debout << "Testausgabe persList: [Frame " << frameNum << "] " << endl;
// for (int i = 0; i < persList.size(); ++i)
......
This diff is collapsed.
......@@ -363,7 +363,7 @@ int TrackerReal::calculate(Tracker *tracker, ImageItem *imageItem, ColorPlot *co
Vec2F moveDir(0,0);
if (exportAutoCorrect)
moveDir += autoCorrectColorMarker((*tracker)[i][j], mMainWindow->getControlWidget());
moveDir += reco::autoCorrectColorMarker((*tracker)[i][j], mMainWindow->getControlWidget());
pos = imageItem->getPosReal(((*tracker)[i][j]+moveDir+br).toQPointF(), bestZ);
......@@ -380,7 +380,7 @@ int TrackerReal::calculate(Tracker *tracker, ImageItem *imageItem, ColorPlot *co
{
Vec2F moveDir(0,0);
if (exportAutoCorrect)
moveDir += autoCorrectColorMarker((*tracker)[i][j], mMainWindow->getControlWidget());
moveDir += reco::autoCorrectColorMarker((*tracker)[i][j], mMainWindow->getControlWidget());
pos = imageItem->getPosReal(((*tracker)[i][j]+moveDir+br).toQPointF(), height);
// die frame nummer der animation wird TrackPoint der PersonReal mitgegeben,
......@@ -436,7 +436,7 @@ int TrackerReal::calculate(Tracker *tracker, ImageItem *imageItem, ColorPlot *co
{
Vec2F moveDir(0,0);
if (exportAutoCorrect)
moveDir += autoCorrectColorMarker((*tracker)[i][j], mMainWindow->getControlWidget());
moveDir += reco::autoCorrectColorMarker((*tracker)[i][j], mMainWindow->getControlWidget());
pos2 = (imageItem->getPosReal(((*tracker)[i][j+1]+moveDir+br).toQPointF(), height) - pos)/(anz+1);
for (f = 1; f <= anz; ++f)
......