From 6bcf419d2e8f739b432d4790d1ba9d48ab65365b Mon Sep 17 00:00:00 2001 From: fcolin Date: Fri, 18 Nov 2011 12:14:12 +0000 Subject: --- ARMFCaptureD3D/ARAnalyse.h | 143 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 143 insertions(+) create mode 100644 ARMFCaptureD3D/ARAnalyse.h (limited to 'ARMFCaptureD3D/ARAnalyse.h') diff --git a/ARMFCaptureD3D/ARAnalyse.h b/ARMFCaptureD3D/ARAnalyse.h new file mode 100644 index 0000000..0d8a61b --- /dev/null +++ b/ARMFCaptureD3D/ARAnalyse.h @@ -0,0 +1,143 @@ + +#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; + + +}; \ No newline at end of file -- cgit v1.1