matrix of image, imagine processing toolbox

I am beginner in image processing toolbox, i have to use this image
how i create matrix of image, when I need only the points that are black so I could continue to work with the coordinates.
THANKS

댓글 수: 1

Tomas
Tomas 2013년 11월 16일
편집: Walter Roberson 2013년 11월 17일
I = imread('image.png');
imshow(I)
[m n]=size(I)
I = double(I);
i dont know how to get matrix from binary image,

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

 채택된 답변

Image Analyst
Image Analyst 2013년 11월 17일

0 개 추천

If the badly-named I matrix is already a binary image as you said, then you already have the coordinates as the binary image. In the event that I is really a gray scale image and not a binary image, you can turn it into a binary image (class will be "logical") by thresholding:
binaryImage = I < 127; % or whatever value is between black and white.
In the unlikely event that the binary image is not suitable and you really need vectors of rows and columns, you can do this to binaryImage:
[rows, columns] = find(binaryImage);
So rows(k) and columns(k) refer to the same pixel if k is the same. If you want in a single matrix, of (x,y) form, then you can do
xy = [columns, rows];

댓글 수: 13

Tomas
Tomas 2013년 11월 17일
i need basically a simple binary imagine,shows clustering. clustering will only be black places in image, white be background. I want to create matrix from binary image, i dont know how to get matrix coordinates only black colors
Image Analyst
Image Analyst 2013년 11월 17일
My first line of code above showed you how to do that. The image is most likely what you need. If you do need the row and column arrays, then my second line of code shows you how to do that. I guess I'm confused why you're asking again because I'm just giving you the same answer and don't know why you don't understand it.
Tomas
Tomas 2013년 11월 17일
I dont understand the image, so my questions are incomprehensible and my english is quite poor, Thank you for your answers and time
Image Analyst
Image Analyst 2013년 11월 17일
편집: Image Analyst 2013년 11월 17일
Why don't you tell us what your final objective is, rather than the next step in some unspecified multi-step algorithm? The coordinates is not the final step of whatever you want to do - it's only the next step. What do you want to do after that? Then I can see whether the image is fine, or if you really need the coordinates.
Tomas
Tomas 2013년 11월 17일
편집: Tomas 2013년 11월 17일
i have to clustering image, for example this picture
I have to clustering black points on picture I have to use hierarchical clustering(Agglomerative- i have a program ) My output will be the black point in the clusters, by using the clustering methods.
I dont know, how to get matrix to work out a picture
Image Analyst
Image Analyst 2013년 11월 17일
Is that one cluster, or 14 or 15 clusters?
Tomas
Tomas 2013년 11월 17일
at the beginning you can choose how much I want clusters
So use the code I gave you
[rows, columns] = find(binaryImage);
and plug rows and columns into kmeans or something.
Tomas
Tomas 2013년 11월 17일
ok, thanks
Image Analyst
Image Analyst 2013년 11월 17일
You're welcome. If we're done, close out the question by marking as Accepted. Thanks.
Tomas
Tomas 2013년 11월 17일
편집: Walter Roberson 2013년 11월 17일
one more question, how i use [rows, columns] = find(binaryImage); I dont know, how i have to use.
my code is so far
I = imread('image.png');
imshow(I);
[m n]=size(I)
I = double(I);
binaryImage = I < 127
[rows,columns]=find(binaryImage)
[idx,ctrs] = kmeans(X,2,.......)
how create to matrix X with rows and columns ?, maybe stupid question, i dont know :)
Thanks
Walter Roberson
Walter Roberson 2013년 11월 17일
편집: Image Analyst 2013년 11월 17일
X = [rows(:), columns(:)];
Tomas
Tomas 2013년 11월 17일
ok thanks

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

카테고리

질문:

2013년 11월 16일

편집:

2013년 11월 17일

Community Treasure Hunt

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

Start Hunting!

Translated by