Question: Question 10 (12 points). The following MATLAB code increases the brightness of a gray image by adding 50 to each image pixel. Update this code
Question 10 (12 points). The following MATLAB code increases the brightness of a gray image by adding 50 to each image pixel. Update this code without using the for-loop (i.e., you can just replace the for-loop with your own codes). You do not need to change a pixel value which is greater than 255 to 255. clear all; img = imread ('hsv.jpg'); [rows, cols, dim] = size (img); output = zeros(size(img)); for i = 1:rows for j 1:cols output(i,j,1) img(i,j,1)+50; output(i,j,2) = img(i,j,2)+50; output(i,1,3) img(i, j,3)+50; end end imshow (uint8(output))
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
