Convert indexed image to Text that give the exact position of the pixel

1 Ansicht (letzte 30 Tage)
PAIKOK (2).png indexed Image
motif 1.JPG Graph showing pixel position
Text formate showing position of pixel horizontaly... how can save image like this in given below formate? from paint or other media?
  1. 45,46,47
  2. 44,45,46,47,48
  3. 44,45,46,48
  4. 44,45,47,48
  5. 44,46,47,48,50
  6. 45,46,47,48,50,51
  7. 25,26,27,44,45,46,47,48,50,51,52,58,59,62,63,64,69,70,71
  8. 25,26,27,44,45,46,47,50,51,58,59,61,62,63,64,65,68,69,70,71,72
  9. 26,27,28,29,44,45,46,48,50,52,58,59,60,61,62,64,65,66,67,68,69,71,72,73,74
  10. 25,27,28,29,30,31,44,45,47,48,51,52,54,55,56,58,59,60,61,65,66,67,68,72,73,74,75
  11. 25,26,30,31,32,33,41,42,44,46,47,48,50,51,52,54,55,56,58,59,60,66,67,73,74,75,88
  12. 25,26,27,32,33,34,35,36,38,39,40,41,42,45,46,47,48,50,51,52,54,55,58,59,60,61,65,66,67,68,72,73,74,75,87,88,89
  13. 15,16,25,26,27,34,35,36,37,39,40,41,42,44,45,46,47,48,50,51,52,54,56,58,59,60,61,62,64,65,66,67,68,69,71,72,73,74,75,86,87,88,89,90
  14. 14,15,16,17,36,37,38,40,41,42,44,45,46,47,50,51,55,56,58,59,62,63,64,65,68,69,70,71,74,75,85,86,87,89,90,91
  15. 13,14,15,17,18,37,38,39,41,42,44,45,46,48,50,52,54,55,56,58,60,61,63,64,66,67,69,70,72,73,75,84,85,86,90,91,92
  16. 4,12,13,14,16,17,18,20,21,22,23,25,26,27,36,38,39,40,42,44,45,47,48,51,52,54,55,56,58,59,62,63,64,65,68,69,70,71,74,75,83,84,85,91,92,93
  17. 3,4,5,11,12,13,15,17,18,20,21,22,23,25,26,27,29,31,32,33,34,36,37,39,40,41,44,46,47,48,50,51,52,54,55,58,59,60,61,62,64,65,66,67,68,69,71,72,73,74,75,82,83,84,92,93,94
  18. 2,3,4,5,6,10,11,12,14,15,16,18,20,21,22,23,25,26,27,29,30,32,33,34,36,37,38,40,41,42,45,46,47,50,51,54,56,58,59,60,61,65,66,67,68,72,73,74,75,81,82,83,93,94,95
  19. 1,2,3,5,6,7,9,10,11,13,14,15,16,17,20,21,22,23,25,26,27,29,30,31,33,34,36,37,38,39,41,42,44,45,46,48,50,52,55,56,58,59,60,66,67,73,74,75,80,81,82,94,95,96
  20. 2,3,4,5,6,10,11,12,14,15,16,18,20,21,22,23,25,26,27,29,30,32,33,34,36,37,38,40,41,42,45,46,47,50,51,54,56,58,59,60,61,65,66,67,68,72,73,74,75,81,82,83,93,94,95
  21. 3,4,5,11,12,13,15,17,18,20,21,22,23,25,26,27,29,31,32,33,34,36,37,39,40,41,44,46,47,48,50,51,52,54,55,58,59,60,61,62,64,65,66,67,68,69,71,72,73,74,75,82,83,84,92,93,94
  22. 4,12,13,14,16,17,18,20,21,22,23,25,26,27,36,38,39,40,42,44,45,47,48,51,52,54,55,56,58,59,62,63,64,65,68,69,70,71,74,75,83,84,85,91,92,93
  23. 13,14,15,17,18,37,38,39,41,42,44,45,46,48,50,52,54,55,56,58,60,61,63,64,66,67,69,70,72,73,75,84,85,86,90,91,92
  24. 14,15,16,17,36,37,38,40,41,42,44,45,46,47,50,51,55,56,58,59,62,63,64,65,68,69,70,71,74,75,85,86,87,89,90,91
  25. 15,16,25,26,27,34,35,36,37,39,40,41,42,44,45,46,47,48,50,51,52,54,56,58,59,60,61,62,64,65,66,67,68,69,71,72,73,74,75,86,87,88,89,90
  26. 25,26,27,32,33,34,35,36,38,39,40,41,42,45,46,47,48,50,51,52,54,55,58,59,60,61,65,66,67,68,72,73,74,75,87,88,89
  27. 25,26,30,31,32,33,41,42,44,46,47,48,50,51,52,54,55,56,58,59,60,66,67,73,74,75,88
  28. 25,27,28,29,30,31,44,45,47,48,51,52,54,55,56,58,59,60,61,65,66,67,68,72,73,74,75
  29. 26,27,28,29,44,45,46,48,50,52,58,59,60,61,62,64,65,66,67,68,69,71,72,73,74
  30. 25,26,27,44,45,46,47,50,51,58,59,61,62,63,64,65,68,69,70,71,72
  31. 25,26,27,44,45,46,47,48,50,51,52,58,59,62,63,64,69,70,71
  32. 45,46,47,48,50,51
  33. 44,46,47,48,50
  34. 44,45,47,48
  35. 44,45,46,48
  36. 44,45,46,47,48
  37. 45,46,47

Akzeptierte Antwort

KALYAN ACHARJYA
KALYAN ACHARJYA am 25 Aug. 2019
Bearbeitet: KALYAN ACHARJYA am 25 Aug. 2019
Gamosa Neki?
Please note you can assign the rows number at the begining of the array. I way to store the all indexing (rows,colm) of non white pixels.
im_test=imread('PAIKOK.png');
[idx1,idx2]=find(im_test==1);
Here idx1 and idx2 store the all color pixel location of the indexed image. Afterwards you can retrive the image by having same size and assign the same color on those idx1 and idx2 position.
Here I have use the for loop just try to display as per your requiremnets. Same the individual column locations in cell array and retrive when it required.
Is this?
im_test=imread('PAIKOK.png');
[rows colm]=size(im_test);
for i=1:rows
[i,idx2]=find(im_test(i,:)==1);
disp(idx2);
end
Partial results:
Hope it gives you sufficient hints!
  3 Kommentare
KALYAN ACHARJYA
KALYAN ACHARJYA am 25 Aug. 2019
Bearbeitet: KALYAN ACHARJYA am 25 Aug. 2019
im_test=imread('PAIKOK.png');
[rows colm]=size(im_test);
diary on;
for i=1:rows
[i,idx2]=find(im_test(i,:)==1);
disp(idx2);
end
diary off;
It automatically save the diary text file in current working directory.
Open it with Note pad/word text
Image Analyst
Image Analyst am 25 Aug. 2019
Or you can just use fopen(), fprintf(), and fclose(), which is what I'd have done.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by