MATLAB: I need help with Matlab assignment

contrast adjustmentconvolutionhomeworkimage processingthreshold

Hello everyone!
I got today a Student Version because I need it for a Course in Image Processing. I will not ask you to do my work but I will apreciate any tips to help me finish my work. So, I need to import an image and extract the green components to represent a monochrome image. Then I need to implement a function for the adjustment of intensity values and contrast. The function must have two Parameters for the control of Intensity and Contrast(I think I need to use a Window Function). Then I have to implement a threshold function that applies a Filter like:
slow ... I(i,j)<=slow
I[slow shigh](i,j) := I(i,j) ... slow <= I(i,j) <= shigh
shigh ... shigh <= I(i,j)
Then I need to reduce Noise by using convolution. Lastly I need to proceed with edge detection.
My Instructor said that I could use these commands: Intensity values: min, max, impixel, improfile, imhist, imtool, imshow; Convolution, Linear Filtering: imfilter, fspecial, conv2.
I checked the documentation but I could go on and implement any of those.
I am only in my first steps and really need help 🙂
what I have done till now is just extracted the Green Component.
myimage=imread('TestImage.bmp');
myimage_green=myimage;
%Green Component
myimage_green(:,:,1)=0;
myimage_green(:,:,3)=0;
figure,imshow(myimage_green);
how should I proceed next? regards

Best Answer

You didn't extract the green channel, you set the red channel and blue channel to zero. That's not the same. Here, use this code:
% Extract the individual red, green, and blue color channels.
redChannel = rgbImage(:, :, 1);
greenChannel = rgbImage(:, :, 2);
blueChannel = rgbImage(:, :, 3);
To do the filter, you'd use intlut() if you want to change the image values.
map = gray(256);
map(1:slow) = slow;
map(shigh: You finish the rest!
To change the gray levels:
newGreenChannel = intlut(You finish the rest!
or to just change the display of it without changing the actual image itself,
imshow(greenChannel);
colormap(You finish the rest!
colorbar;
I've left parts undone for you to finish because that's what you requested. For noise reduction, you can blur the image with conv2().
noiseReducedImage = conv2(greenChannel, kernel);
kernel could be an N by N box with all ones. Make sure the kernel elements sum to 1 or else you're going to change the mean brightness of the image (so divide by N^2). Convolution is linear filtering. You could also use imfilter to do almost the same thing. imfilter is supposedly a little faster (according to the developer) and it doesn't flip the kernel like convolution does, though that doesn't make any difference if your kernel is symmetric.