views:

193

answers:

1

I'm trying to find/write a function that would perform the same operation as imlincomb(). However, I am having trouble finding such functions in C++ without using any Matlab API functions other than Intel Performance Primitiives library, and I don't really want to purchase a license for it unless my application really has to take advantage of it. What would be any easy method of implementing it, or perhaps if there are any standard functions that make the job a lot easier?

Thanks in advance.

+2  A: 

There's definitely nothing of the sort in any standard C++ package. You might be able to use something in LAPACK, but I think you'd be better off writing your own. It's a fairly simple function: each output pixel is independent and depends only on the input pixels at the same coordinates. In pseudocode:

for each row y in [0, height-1]
    for each column x in [0, width-1]
        for each color channel c in (R, G, B)
            output[y][x][c] = 0
            for each input i
                output[y][x][c] += weight[i] * input[i][y][x][c]

Of course, the exact formulation depends on how exactly your images are stored (3D array, 2D array, or 1D array, and be careful about the order of your dimensions!).

Adam Rosenfield
The images are stored in a flat 1D array, mapped with a hash table. It was originally stored in a 5D array, with each element of the array being an image segment of 350 x 80 pixels.
stanigator