MATLAB: I use function size(a), 1200*1920*3. what 3 means in this rgb imagesize(a) where a is my image matrix, i got result as 1200*1920*3. what 3 means in this? Best Answer It means there are 3 color channels. If you use only 2 outputs, then the second one is hte number of columns time the number of color channels. See Steve's blog for more info: http://blogs.mathworks.com/steve/2011/03/29/even-more-information-about-the-size-function/[rows, columns, numberOfColorChannels= = size(rgbImage); Related SolutionsMATLAB: How do you turn a 30x30x24 matrix into a 24×900 matrix Well, you couldreshape(YourMatrix, size(YourMatrix,3), [])but it is quite unlikely that is what you want. You probably wantreshape(permute(YourMatrix, [3 1 2]), size(YourMatrix,3), [])This would take each original 30 x 30 plane of numbers and make it into a row. MATLAB: Read three different RGB band and Swap the Band Try this:% Extract the individual red, green, and blue color channels.redChannel = rgbImage(:, :, 1);greenChannel = rgbImage(:, :, 2);blueChannel = rgbImage(:, :, 3);% Now swap around in any way you want.newRedChannel = greenChannel;newGreenChannel = blueChannel; newBlueChannel = redChannel;% Recombine separate color channels into a single, true color RGB image.NewRgbImage = cat(3, newRedChannel, newGreenChannel, newBlueChannel); Related QuestionEuclidean distance explanation for a matrixWhat does this do r = img1(:,:,1); % red channel g = img1(:,:,2); % green b = img1(:,:,3);Lab recombination for channel processing4-D uint8 , what does it meanAbout size function -Syntax : [m,n] = size(X)
Best Answer