Sorting points of image

4 ビュー (過去 30 日間)
JRose
JRose 2019 年 5 月 15 日
コメント済み: JRose 2019 年 5 月 24 日
I have an image with white curves on black background. How to Sort the white pixels in an array? the pixel array is attached.Thanks in advance. curves.png
  10 件のコメント
Jan
Jan 2019 年 5 月 17 日
編集済み: Jan 2019 年 5 月 17 日
@JRose: I do not understand, what "if we plot the lines it matches excatly" means. "a line profile along these edges of the coordinate" is not clear to me also.
You do not answer my question, what exactly your inputs are. A screenshot in the memory, a saved image, a text file of coordinates? You have posted the file array.txt and show an image, but which of them is the data you want to process? You mention "the white pixels in an array", but arrays do not have pixels, and in the image, the drawn line has a certain width of about 8 pixels and it is not clear, which of these many pixels you consider as "start" and how you want to treat this area (which is not a 2D line).
JRose
JRose 2019 年 5 月 24 日
@Jan: The input image is provided which is binarized and skelotonized. after that i saved the points in an array. This array is provided in the text file. You said tht it is already sorted. My question is: if i trace through the line from one end to the other, i will get certain cordinates. whether i can save these coordinates in an array as i trace through the line. when i go through the points in the array, its not ordered from one end of the skeletonized image to the other end.

サインインしてコメントする。

回答 (2 件)

KSSV
KSSV 2019 年 5 月 16 日
I = imread('curves.png');
I1 = rgb2gray(I);
[y,x] = find(I1) ;
imshow(I)
hold on
plot(x,y,'r')
You see the lines are in order...that's why I am able to join them by a line, which lie exactly on the white region.
untitled.bmp
  5 件のコメント
KSSV
KSSV 2019 年 5 月 17 日
They are already in orderly fashion.
comet(x,y)
JRose
JRose 2019 年 5 月 24 日
Thank you for you answers.

サインインしてコメントする。


Sulaymon Eshkabilov
Sulaymon Eshkabilov 2019 年 5 月 16 日
Hi,
What you are trying to find out where the white pixels are residing, right?!
% This locates all white pixels accurately
AA = imread('curves.png');
A1 = AA(:,:,1);
A2 = AA(:,:,2);
A3 = AA(:,:,3);
Index1 = find(A1>0);
Index2 = find(A2>0);
Index3 = find(A3>0);
B1 = A1(Index1);
B2 = A2(Index2);
B3 = A3(Index3);
DATA = [B1, B2, B3];
imshow(DATA), shg
%% Given coordinates: don't seem to correct at all
array = load('array.txt');
AA = imread('curves.png');
A1 = AA(:,:,1);
A2 = AA(:,:,2);
A3 = AA(:,:,3);
B1 = A1(array(:,:));
B2 = A2(array(:,:));
B3 = A3(array(:,:));
DATA = [B1, B2, B3];
imshow(DATA), shg
Good luck.

カテゴリ

Help Center および File ExchangeGeometric Transformation and Image Registration についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by