I've been trying to create a 2D matrix using the Average of RGB values from each pixel in a 3D matrix.
for i = 1:m for j = 1:n gray(i,j) = double((A(i,j,1) + A(i,j,2) + A(i,j,3))/3); %%gray(i,j) = round(gray(i,j)/255);
endendimshow(gray, []);
This only shows a red image with some greens in it. It is possible that it still is trying to print using RGB values maybe?
IF I uncomment this: "gray(i,j) = round(gray(i,j)/255);" , I get a black image.
All I need is a simple direction. What am I doing wrong? The image should be grayscale form the averages of RGB values.
Best Answer