[ create a new paste ] login | about

Link: http://codepad.org/Bvxwkqwm    [ raw code | output | fork ]

C++, pasted on Apr 17:
double getSum(vector<double> &theMatrix)
{
    double sum = 0;
    
    for(int i=0; (i < theMatrix.size()); i++)
    {
        sum += theMatrix[i];
    }
    return sum;
}

int main()
{
    Binary one(1024, 768);
    Binary two(36, 49);
    Matrix m;
    
    int MatrixSize = 1024;
    int SubSize = 36;
    int SubSize2 = 49;
    
    if(!one.ReadMatrix("repositry/2/Cluttered_scene_bi.txt"))
    {
    }
    if(!two.ReadMatrix("repositry/2/Wally_bi.txt"))
    {
    }
    
    vector<double> matrix1 = one.returnMatrix();
    vector<double> matrix2 = two.returnMatrix();
    
    vector<iniMatrix> theBlocks1 = m.subMatrix(matrix1, MatrixSize, MatrixSize, SubSize, SubSize2);
    
    int wally_sum = getSum(matrix2);
    int result = 0;
    int corrVal = 0;
    
    for(int i=0; (i < theBlocks1.size()); i++)
    {
        int blocks_sum = getSum(theBlocks1[i]);
        
        if(wally_sum >= blocks_sum)
        {
            double currentCorr = m.Correlation(theBlocks1[i], matrix2, SubSize, SubSize2);
            if(currentCorr >= corrVal)
            {
                result = i;
            }
        }
    }    
    cout << m.Correlation(theBlocks1[result], matrix2, SubSize, SubSize);
    
    printMatrix(theBlocks1[result], SubSize, SubSize2);
    return EXIT_SUCCESS;
}


Output:
1
2
3
4
5
6
cc1plus: warnings being treated as errors
In function 'double getSum(__gnu_debug_def::vector<double, std::allocator<double> >&)':
Line 5: warning: comparison between signed and unsigned integer expressions
In function 'int main()':
Line 14: error: 'Binary' was not declared in this scope
compilation terminated due to -Wfatal-errors.


Create a new paste based on this one


Comments: