8-bit greyscale images allow for 256 different shades of gray to be represented
ID: 3918789 • Letter: 8
Question
8-bit greyscale images allow for 256 different shades of gray to be represented with a value of 0 assigned to black and a value of 255 assigned to white. Using the function imread), load the images into MATLAB and assign them names. After your image has gone through the desired function, plot the image using the function imshow) Brightness In this portion of the project, we will explore how brightness (whiteness or blackness) distorts the image and alters how we view a particular image. Manipulate your image in such a way that you add values (brighten) or subtract values (darken) by a user defined percentage. ie. By what percentage does the user want to brighten their image. Cropping In this portion of the project, we will explore how cropping portions of images alters and amplifies the importance of certain areas of interest in the image. For cropping, use the marker tool to determine the exact pixel locations, which correspond to the location of your matrix. Ask the user to input desired pixel locations to crop the image. Bordering In this portion of the project, we will explore how bordering images (with three different color borders- one white, one black, and one the mean image pixel value) highlights and amplifies the importance of the image. Ask the user what color they want their border, and what percentage of the image they want to border. Contrasting In this portion of the project, we will explore how contrasting distorts the image and alters how we view a particular image. If the pixel value is less than 128 change the pixel value by the desired percentage, closer to the value of zero. If the pixel value is greater or equal to 128, change the pixel value by the desired percentage closer to 255. Ask the user by what percentage do they want to contrast their image.Explanation / Answer
The following main code (maincode.m) is the matlab code which contains different functions for brightness, cropping, bordering and contrasting.
clc;
A1=imread('one.jpg');
figure,imshow(A1);
title('image named as one.jpg');
% if one.jpg is color image, we need to convert it into grayscale image
G=rgb2gray(A1);
figure,imshow(G);
title('Gray scale image of A1');
p=bright(A1);
figure,imshow(p);
q=cropp(A1);
%userdefined function for brightness(bright.m)
function [a]=bright(x); %x is input and a is output
a=j;
end
%cropping image interactivly
function [b]=cropp(y) %y is input and b is output
end
%bordering the image
function[c]=border(z)
z = addborder(X, 20, 62, 'center');
image(z);
colormap(map);
c=z
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.