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

조회 수: 1 (최근 30일)
Abhishek sadasivan
Abhishek sadasivan 2014년 6월 23일
댓글: Image Analyst 2014년 6월 23일
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
Image Analyst
Image Analyst 2014년 6월 23일
Locations means (row, columns) or (y, x). If you want both of those separately you'll need an array or two vectors. If you want one you'll have to use linear indexing as Dishant showed you.
Abhishek sadasivan
Abhishek sadasivan 2014년 6월 23일
i mean x,y..thanks

댓글을 달려면 로그인하십시오.

답변 (2개)

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

Image Analyst
Image Analyst 2014년 6월 23일
[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
Abhishek sadasivan
Abhishek sadasivan 2014년 6월 23일
I want to extract 15% data radially from the attached image.so I thinking to prepare a radial mask to extract the data from the image ..
Image Analyst
Image Analyst 2014년 6월 23일
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.

댓글을 달려면 로그인하십시오.

Community Treasure Hunt

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

Start Hunting!

Translated by