how to save all pixel co-ordinate locations as a vector ??

3 views (last 30 days)
Whether it is possible to save the pixel locations of an image in a vector ? which comment to save the pixel locations ..could any one help me out ...
  2 Comments

Sign in to comment.

Answers (2)

Dishant Arora
Dishant Arora on 23 Jun 2014
% Use Linear Indexing/Vector Indexing
ind = 1:M*N; % For an image of dimension MxN

Image Analyst
Image Analyst on 23 Jun 2014
[rows, columns, numberOfColorChannels] = size(yourImage);
[X, Y] = meshgrid(1:columns, 1:rows);
xy = [X(:), Y(:)];
I really highly doubt you'd ever need this. Explain to me why you think you need this and I'll explain why you probably don't.
  2 Comments
Image Analyst
Image Analyst on 23 Jun 2014
Yeah, like I thought, you don't want what you asked for. Even if you did you'd use
elementsToTake = randperm(numel(grayImage), 0.15*numel(grayImage));
But that's going to take random pixels, not random rays from your ultrasound image.

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by