summaryrefslogtreecommitdiff
path: root/ARMFCaptureD3D/ARAnalyse.h
diff options
context:
space:
mode:
authorfcolin2011-11-18 12:14:12 +0000
committerfcolin2011-11-18 12:14:12 +0000
commit6bcf419d2e8f739b432d4790d1ba9d48ab65365b (patch)
tree92815e16f189c8e328dff4fcfa38ebe1d0217fdd /ARMFCaptureD3D/ARAnalyse.h
parent487e963b081d7ffe2ddf489e11d927982c9101a6 (diff)
downloadamilis-6bcf419d2e8f739b432d4790d1ba9d48ab65365b.zip
amilis-6bcf419d2e8f739b432d4790d1ba9d48ab65365b.tar.gz
amilis-6bcf419d2e8f739b432d4790d1ba9d48ab65365b.tar.bz2
amilis-6bcf419d2e8f739b432d4790d1ba9d48ab65365b.tar.xz
Diffstat (limited to 'ARMFCaptureD3D/ARAnalyse.h')
-rw-r--r--ARMFCaptureD3D/ARAnalyse.h143
1 files changed, 143 insertions, 0 deletions
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 <cstdio>
+#include <map>
+#include <vector>
+#include <set>
+#include <ARToolKitPlus/TrackerMultiMarker.h>
+#include <Ivy.h>
+#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<int, MyMakerInfo> 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<int> m_calibration_ids;
+ std::map<int,Calibration::Corners> 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