I'm trying to manipulate an image with MATLAB, I want to flip the image without the function flip, so I found this, If someone knows how does it work can explain me?
img(:,(end:-1:1),:,:);
CodePudding user response:
Try it yourself, see the example below:
A = 1:10
A(end:-1:1)
A =
1 2 3 4 5 6 7 8 9 10
ans =
10 9 8 7 6 5 4 3 2 1
end
is the last element of the array, start:step:end
creates an array starting at start
, ending at end
with step size step
. Setting the step negative flips the array. This can be done across all dimensions of an array, so across the second in your case.