how can i save every pixel of image as a row of new matrix?

2 Ansichten (letzte 30 Tage)
nadia naji
nadia naji am 27 Okt. 2012
i have an image in lab space i want to save the value of l,a, b of every pixel as a row of new matrix for example if i have 2*3 matrix i want to make 6*3 matrix that every row of this matrix show the pixel and every column of every row is the value of l,a and b channel is there any way to do this without using for loop i want to do this very fast? thanks in advance
  1 Kommentar
Image Analyst
Image Analyst am 27 Okt. 2012
I'm having a hard time visualizing. Can you provide an example. Because an lab image is a 3 dimensional image not a 2D (2*3) image, at least it is if you're starting with a 2D color image, so I don't know what the 2*3 refers to. Do you mean 2 rows by 3 columns by 3 color channels? And then I don't know what "show the pixel" means. I also don't know what show "every column of every row is the value of l,a and b channel" means. Do you mean that you want to just have all the values listed like this in a numerical array
row1 column1 lValue1 aValue1 bValue1
row1 column2 lValue2 aValue2 bValue2
etc.

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Matt J
Matt J am 27 Okt. 2012
Bearbeitet: Matt J am 27 Okt. 2012
result = reshape(Image,[],3);
  1 Kommentar
nadia naji
nadia naji am 27 Okt. 2012
thanks for your answer before i separate different channel and then use etc target(:,1)=l(:), target(:,2)=a(:),target(:,3)=b(:) but in this war i dont need do this thanks a lot

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (1)

nadia naji
nadia naji am 27 Okt. 2012
the answer by Matt solve my problem before that i separate different channel and then use etc target(:,1)=l(:), target(:,2)=a(:),target(:,3)=b(:) 2*3 was an example for size of matrix and i know that the image is 2d but with 3 channels thanks for your answers and excuse me for my bad tag

Kategorien

Mehr zu Images finden Sie in Help Center und File Exchange

Tags

Noch keine Tags eingegeben.

Community Treasure Hunt

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

Start Hunting!

Translated by