Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Compound Members | File Members

LocateSystem.cc

Go to the documentation of this file.
00001 /*
00002 
00003     Result combining of locate matrixes
00004     Copyright (C) 2000-2001 Jussi Laako
00005 
00006     This program is free software; you can redistribute it and/or modify
00007     it under the terms of the GNU General Public License as published by
00008     the Free Software Foundation; either version 2 of the License, or
00009     (at your option) any later version.
00010 
00011     This program is distributed in the hope that it will be useful,
00012     but WITHOUT ANY WARRANTY; without even the implied warranty of
00013     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014     GNU General Public License for more details.
00015 
00016     You should have received a copy of the GNU General Public License
00017     along with this program; if not, write to the Free Software
00018     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00019 
00020 */
00021 
00022 
00023 #include <math.h>
00024 #include <float.h>
00025 
00026 #include "LocateSystem.hh"
00027 
00028 
00029 clLocateSystem::clLocateSystem ()
00030 {
00031 }
00032 
00033 
00034 clLocateSystem::~clLocateSystem ()
00035 {
00036 }
00037 
00038 
00039 bool clLocateSystem::Initialize (long lW, long lH, GDT fCoeff)
00040 {
00041     lWidth = lW;
00042     lHeight = lH;
00043     fWeight = fCoeff;
00044     lPointCount = lWidth * lHeight;
00045     try
00046     {
00047         fpResults = (GDT *) Results.Size(lPointCount * sizeof(GDT));
00048         fpFinal = (GDT *) Final.Size(lPointCount * sizeof(GDT));
00049     }
00050     catch (...)
00051     {
00052         return false;
00053     }
00054     DSP.Zero(fpResults, lPointCount);
00055     DSP.Zero(fpFinal, lPointCount);
00056     lResultCount = 0;
00057     return true;
00058 }
00059 
00060 
00061 void clLocateSystem::Add (const GDT *fpSubRes)
00062 {
00063     DSP.Add(fpResults, fpSubRes, lPointCount);
00064     lResultCount++;
00065 }
00066 
00067 
00068 void clLocateSystem::Process ()
00069 {
00070     GDT fScale = (GDT) 1 / lResultCount;
00071 
00072     DSP.Mul(fpFinal, (GDT) 1 - fWeight, lPointCount);
00073     DSP.Mul(fpResults, fScale * fWeight, lPointCount);
00074     DSP.Add(fpFinal, fpResults, lPointCount);
00075     //DSP.Copy(fpFinal, fpResults, lPointCount);
00076     
00077     DSP.Zero(fpResults, lPointCount);
00078     lResultCount = 0;
00079 }
00080 
00081 
00082 void clLocateSystem::GetResults (GDT *fpDest)
00083 {
00084     DSP.Scale01(fpDest, fpFinal, lPointCount);
00085 }
00086 

Generated on Sun Oct 26 19:11:21 2003 for HASAS by doxygen 1.3.3