|
"Toni " <annihilaatio@yahoo.com> wrote in message <i8g284$cf3$1@fred.mathworks.com>...
> Hello!
>
> Just wandering if there exists a command or such, which takes an input 1d array
> inp = zeros(10,1);
> inp(5,1) = 5;
>
> then it takes another array, which contains the individual shifts to be applied:
>
> shift = zeros(10,1);
> %shift = ones(10,1)
> shift(5,1) = -2;
>
> Then the result would be, when using the shift array to shift the pixels in the inp array,
> all zeros except result(3,1) = 5
>
> So in the shift array in pixel location 5 with a value -2, means that the pixel in inp array at location 5 should be shifted -2 pixels and so on...!
>
>
> And all this should be subpixel, so interpolation is needed. And the arrays are going to be quite large and complex.
>
> I tried to do this with:
>
> result = interp1(in,xx'+shift,'nearest');
>
> but without any luck. also imtransform with TFORM does not seem to apply here...
>
> Many thanks for any help and suggestions!
I think you need to explain a few details a little further:
-If nothing replaces a point that has been shifted away it becomes 0, always?
-The new point is moved to a subpixel location, how do you interpolate that? Do you want the two adjacent points of that basin to be reassigned with the interpolation including the new central point?
-Will there ever be two shifts to the same basin or point? such as:
shift = [ 0 1.1 0 0 -1.8 0 1 0 -1]?
-If so how do you want to handle it?
There is no stock MATLAB function to my knowledge that does this. However, it should be doable with a loop one shift at a time once you figure out the hierarchy of shifts etc.
|