Image Component Library (ICL)
|
00001 /******************************************************************** 00002 ** Image Component Library (ICL) ** 00003 ** ** 00004 ** Copyright (C) 2006-2013 CITEC, University of Bielefeld ** 00005 ** Neuroinformatics Group ** 00006 ** Website: www.iclcv.org and ** 00007 ** http://opensource.cit-ec.de/projects/icl ** 00008 ** ** 00009 ** File : ICLIO/src/ICLIO/MyrmexDecoder.h ** 00010 ** Module : ICLIO ** 00011 ** Authors: Carsten Schuermann ** 00012 ** ** 00013 ** ** 00014 ** GNU LESSER GENERAL PUBLIC LICENSE ** 00015 ** This file may be used under the terms of the GNU Lesser General ** 00016 ** Public License version 3.0 as published by the ** 00017 ** ** 00018 ** Free Software Foundation and appearing in the file LICENSE.LGPL ** 00019 ** included in the packaging of this file. Please review the ** 00020 ** following information to ensure the license requirements will ** 00021 ** be met: http://www.gnu.org/licenses/lgpl-3.0.txt ** 00022 ** ** 00023 ** The development of this software was supported by the ** 00024 ** Excellence Cluster EXC 277 Cognitive Interaction Technology. ** 00025 ** The Excellence Cluster EXC 277 is a grant of the Deutsche ** 00026 ** Forschungsgemeinschaft (DFG) in the context of the German ** 00027 ** Excellence Initiative. ** 00028 ** ** 00029 ********************************************************************/ 00030 00031 #pragma once 00032 00033 #include <ICLUtils/CompatMacros.h> 00034 #include <ICLCore/Img.h> 00035 00036 #define ERROR_MARK 0xA000 //Top 4 Bits code on last pixel of last frame to mark that an error occurred during readout 00037 //Connections 00038 #define WEST 0 00039 #define EAST 1 00040 #define SOUTH 2 00041 #define NORTH 3 00042 #define NOGATE 4 00043 #define SIDE 1 00044 #define TOP 0 00045 //Viewpoints 00046 #define VIEW_W 0 00047 #define VIEW_3 1 00048 #define VIEW_M 2 00049 #define VIEW_E 3 00050 00051 00052 namespace icl{ 00053 namespace io{ 00054 00055 class MyrmexDecoder { 00056 00057 public: 00058 ICLIO_API MyrmexDecoder(); 00059 ICLIO_API void decode(const icl16s *data, const utils::Size &size, core::ImgBase **dst); 00060 00061 private: 00062 char attachedPosition; //store position of central unit 00063 int bigtarget[16*16]; //table which maps module orientation 00064 std::vector<char> conversionTable; //table which maps usb input texel position to grabber output texel position 00065 std::vector<unsigned int> flat; //table which maps pixel order from per-module style to per-frame-line style 00066 unsigned int image_width; //store converted width 00067 unsigned int image_height; //store converted height 00068 00069 std::vector<char> getConnectionsMeta(const icl16s *data, int size); 00070 int grabMetadata(const icl16s *data, unsigned char metadata[256], int size); 00071 int setCompression(unsigned int i); 00072 int setSpeed(unsigned int i); 00073 unsigned short swap16(unsigned short a); 00074 void parseConnections( std::vector<char> connections, char* attached, int* weite, int* hoehe ); 00075 std::vector<char> makeConversiontable( int width, int height, std::vector<char> connections, char attached, char viewpoint );//generate conversiontable to match real world layout + using our viewpoint 00076 int convertImage(const icl16s *data, icl16s *outputImageData, const utils::Size &size); 00077 void init(const icl16s *data, const utils::Size &size,char viewpoint,unsigned char speed, unsigned char compression); 00078 }; 00079 00080 } // namespace io 00081 } 00082