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.GPL ** 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 <ICLCore/Img.h> 00034 00035 #define ERROR_MARK 0xA000 //Top 4 Bits code on last pixel of last frame to mark that an error occurred during readout 00036 //Connections 00037 #define WEST 0 00038 #define EAST 1 00039 #define SOUTH 2 00040 #define NORTH 3 00041 #define NOGATE 4 00042 #define SIDE 1 00043 #define TOP 0 00044 //Viewpoints 00045 #define VIEW_W 0 00046 #define VIEW_3 1 00047 #define VIEW_M 2 00048 #define VIEW_E 3 00049 00050 00051 namespace icl{ 00052 namespace io{ 00053 00054 class MyrmexDecoder { 00055 00056 public: 00057 MyrmexDecoder(); 00058 void decode(const icl16s *data, const utils::Size &size, core::ImgBase **dst); 00059 00060 private: 00061 char attachedPosition; //store position of central unit 00062 int bigtarget[16*16]; //table which maps module orientation 00063 std::vector<char> conversionTable; //table which maps usb input texel position to grabber output texel position 00064 std::vector<unsigned int> flat; //table which maps pixel order from per-module style to per-frame-line style 00065 unsigned int image_width; //store converted width 00066 unsigned int image_height; //store converted height 00067 00068 std::vector<char> getConnectionsMeta(const icl16s *data, int size); 00069 int grabMetadata(const icl16s *data, unsigned char metadata[256], int size); 00070 int setCompression(unsigned int i); 00071 int setSpeed(unsigned int i); 00072 unsigned short swap16(unsigned short a); 00073 void parseConnections( std::vector<char> connections, char* attached, int* weite, int* hoehe ); 00074 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 00075 int convertImage(const icl16s *data, icl16s *outputImageData, const utils::Size &size); 00076 void init(const icl16s *data, const utils::Size &size,char viewpoint,unsigned char speed, unsigned char compression); 00077 }; 00078 00079 } // namespace io 00080 } 00081