Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- image = imread('SantaBarbara.jpg');
- imshow(image);
- %%
- %find max and min for each color. min finds min of each row and turn it
- %into an array. use twice to find min of min arrays.
- %Red
- minR = min(min(image(:,:,1)));
- maxR = max(max(image(:,:,1)));
- meanR = mean(mean(image(:,:,1)));
- %Green
- minG = min(min(image(:,:,2)));
- maxG = max(max(image(:,:,2)));
- meanG = mean(mean(image(:,:,2)));
- %Blue
- minB = min(min(image(:,:,3)));
- maxB = max(max(image(:,:,3)));
- meanB = mean(mean(image(:,:,3)));
- %%
- %display image size
- [row,col,dim] = size(image);
- X = ['Image size: ', num2str(row), ' x ', num2str(col)];
- disp(X);
- %%
- %displaying color info
- %display Red
- X = ['Min, max R values: ', num2str(minR), ' ', num2str(maxR)];
- disp(X);
- %display Green
- X = ['Min, max G values: ', num2str(minG), ' ', num2str(maxG)];
- disp(X);
- %display Blue
- X = ['Min, max B values: ', num2str(minB), ' ', num2str(maxB)];
- disp(X);
- %display Avg
- X = ['Averages: ', num2str(meanR), ' ', num2str(meanG), ' ', num2str(meanB)];
- disp(X);
- %%
- %create rgb jpeg of intensities for each color
- imwrite(image(:,:,1), 'TestRed.jpg');
- imwrite(image(:,:,2), 'TestGreen.jpg');
- imwrite(image(:,:,3), 'TestBlue.jpg');
- %%
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement