#pragma once #include #include #include #include #include #include #include "Calibration.h" #include "MinMaxAvg.h" using ARToolKitPlus::TrackerMultiMarker; #pragma comment (lib, "ARToolKitPlus.lib") class MyMakerInfo { public: int id; ARFloat confidence; ARFloat x; ARFloat y; int area; int dir; ARFloat prev_matrix[3][4]; int absent; // count of marker absence if > 10 ==> remove double time; }; class ARAnalyse { public: ARAnalyse(); ~ARAnalyse(); bool InitialiseTracker( int width, int height, int sample_size); void Transform( unsigned char * cameraBuffer, int size, bool moyen ); void Analyse( double SampleTime, const unsigned char * cameraBuffer, int size ); bool Calibrate(); void SaveCalibration(); void RestoreCalibration(); bool IsCalibrationEnabled() { return m_calibration_enabled; } bool IsCalibrated() { return m_calibrated; } void IvyInit(const char *domain); typedef std::map MarkersMap; MarkersMap markers; ARToolKitPlus::ARMarkerInfo getDetectedMarker(int i) { return m_tracker->getDetectedMarker(i); } const ARFloat* getModelViewMatrix() const { return m_tracker->getModelViewMatrix(); } const ARFloat* getProjectionMatrix() const { return m_tracker->getProjectionMatrix(); } bool ToggleAutoThreshold(); void setThreshold( int thr ) { if ( ! m_tracker->isAutoThresholdActivated() ) m_tracker->setThreshold( thr ); } int getThreshold() { return m_tracker->getThreshold(); } bool IsCalibrationID( int id ); MinMaxAvg confidence; MinMaxAvg frame_per_seconds; MinMaxAvg frame_delay; int DownSample; int BlurPass; typedef enum { GrayScale, Blur, Diff, Threshold, Moyen } DisplayType; typedef enum { FMoyen, FLaplacien4, FLaplacien8, FLaplaciend, FSobel, FPrewitt, FGaussian } FilterType; DisplayType Display; FilterType filter; protected: // Ivy; Ivy* bus; char * camera; // For calibration Process std::set m_calibration_ids; std::map m_IdToCorner; Calibration *m_calibration; bool m_calibrated; bool m_calibration_enabled; bool first_calibration_done; TrackerMultiMarker *m_tracker; // Manages ARToolkit tracker int m_width, m_height; // image size int nb_pixel; typedef float pixel_type; typedef float value_type; pixel_type *m_gray; pixel_type *m_blur0; pixel_type *m_blur1; pixel_type *m_filter_v; pixel_type *m_filter_h; // filtre moyen sur plusieurs images void CalcMoyen(); void DisplayGrayScale(unsigned char * cameraBuffer, pixel_type * dest); void DisplayBlur(unsigned char * cameraBuffer, pixel_type * dest); void DisplayDiff(unsigned char * cameraBuffer, pixel_type * dest); void DisplayThreshold(unsigned char * cameraBuffer, pixel_type * dest); void DisplayMoyen(unsigned char * cameraBuffer, pixel_type * dest); void Filter ( const float *k, int k_size, pixel_type *src, pixel_type *dst ); void CombineFilter ( pixel_type *src_h, pixel_type *src_v, pixel_type *dst ); float *m_sum; pixel_type **m_images; int m_first_image; int m_last_image; int nb_images; long FrameCount; double MarkerWidth; ARToolKitPlus::MARKER_MODE MarkerType; std::string CameraParameterFile; std::string MarkerSetConfigFile; std::string CalibrationFile; double MarkerMoveThreshold; int MarkerSeekingThreshold; float MarkerBorderPercentage; int MarkerAbsenceCount; };