0
votes

I have a problem like that;

points (size = 65,2) is a variable that has pixel coordinates of an image. In the first column, there are x coordinates, and in the second y coordinates and I want to take the magnitude values of a matrix (size = 256,256,6) from those pixel coordinates of only one channel eg. 3 (three).

I couldn't succeed that.

intensities = images(points(:,2), points(:,1), 3); 

makes a matrix 65x65.

Thanks

Jimenez

1
Your question isn't clear enough for me to give you an answer. If images is your 256x256x6 matrix, intensities is now the values in channel 3 from your points. abs(intensities) gives you the magnitude of these values, but then what do you want to do from there? - Geodesic

1 Answers

1
votes

You can convert your x,y indices to linear indices to get values you want from your image:

% some sample data    
list = round(256*rand(65,2));
im = rand(256,256);
% calculate linear indices
ind = sub2ind([256,256],list(:,1),list(:,2));
intensities = im(ind);

This results in an intensities matrix that is 65x1 where each element corresponds to the x,y pair from your list.