Skip to content

How to combine coordinates and pixel values #2

@deeptho

Description

@deeptho

I have been experimenting with your code, with nice results.

However, one thing I am really struggling with is how to implement
operations that need both the coordinates of pixels and the pixel values
themselves. Although my use case needs something more complex, here
is a simple (artificial) program in pseuode code

double input[100]={1,3,100,50, ...} ; //an array containing input data, e.g. grey values
double output[100]; //an array for storing output

double fn(int x, double v)
{
return x/(100.)+v;
}

for(int x =0; x<100; ++x)
  output[i] = fn(x, input[x]);

How is one supposed to handle this in zimt?
E.g., transform does not work in this case as it operates either on coordinates or on values,
but ot both.

Maybe a solution could be to store a reference to the input array in the
unary functor, use the coordinates version of transform and then index "input"
in the functor? This seems quite involved and perhaps not efficient. Also my real code
is m ore complex and uses a 2D linspace, but the solution would not allow to use it (as the functor
needs to receive the coordinates to index the stored references array.

What is added to v in fn is of course the result of a linspace. I could store the result
in a temporary array, combine it with input using a join, but that seems inefficient as well.

What seems to be missing is some functionality to allow, e.g., linspace or get_crd to be passed in combination with array views as the input to transform or process. In essence all of these produce "data at some coordinates", one by generating the data and the other by loading it from disk

Maybe I am missing something?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions