I need help with Matlab assignment

3 次查看(过去 30 天)
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

采纳的回答

Image Analyst
Image Analyst 2012-4-29
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.
  4 个评论
Thomas
Thomas 2012-4-29
I get ??? Undefined function or variable 'slow'.
How can I make it go away?
thank you
Image Analyst
Image Analyst 2012-4-29
Well you have to say what slow and shigh are. For example slow = 42 and shigh = 213 or something like that. If you want to make it somewhat fancy, you can get these values from a pair of slider controls.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Image Processing Toolbox 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by