Processed Image
CONCLUSION AND RECOMMENDATION
5.1 Conclusion
Image can be solved with ant software programming such as C language, Matrix – X (Mainframe or workstation, based on MATLAB), Visual Basic, Java program and MATLAB program. Image applications frequently need to produce multiple degrees of manipulation interactively. Image applications frequently need to interactively manipulate an image by continuously changing a single parameter and multi-parameter.
The best software program is the MATLAB toolbox for image processing. Interpolation and extrapolation of image can be a unifying approach, providing a simple function that supports many common images processing operation.
Since a degenerate image is sometimes easier to calculate, extrapolation may offer a more efficient method to achieve effects such as sharpening or saturation.
Blending is a linear operation, and so it must be performed in linear, not gamma-warped space. Component range must be also be monitored, since clamping, especially of the degenerate image, causes inaccuracy.
By using the GUI (Graphical User Interface) program, the application of image processing can successfully created. The function of the image processing program
36
include the enhance, threshold, rotate, blur (noise), deblur, identify round object and show the original and modified image together.
5.3 Problems
Although the image processing program function as we aspect, but there are still many way to improve this program. In the image processing program, the info for the function are not state clearly enough and make people understand. In the GUI program, the info should function as pop-up window after user press any function button.
As the project title is Image Processing using MATLAB – Learning Tool, the information is not good enough and clear to understand by people. The main problem is the effectiveness of people to understand it. MATLAB also can be used in industry are in the areas of bar coding, deck-top publication, copy preparation for printing and factory automation.
However, due to the information and studies this state of program of image processing that I only can create. More advance and more functional program can be creating by using MATLAB. Thereby, to write the program became problem and the this project not perfectly complete.
5.3 Recommendations
The result of the program is slightly sluggish. For future works, some recommendations have been listed based on the problems in order to improve the performance.
a) Create a 3-D for the image processing and animation. Then the image can be more sophisticated if the 3-D program instead. Can spin and move the image with applying that command, so that we can create a great animation for the image.
b) Add more functional button of more function to the program. It is less filter to filter image, such as Robert Gradient, Sobel Edge Detector Operator, Gaussion filter and other filters.
c) More information and detail about the function should be add in the program to educate people well.
38 REFERENCES
1. FIONN MURTAGH. Image processing data analysis. The Multi-scale approach.
University of Ulster
2. LOUIS J.GALBIATI, JR. Machine Vision and Digital Image Processing Fundamentals. Prentice-Hall International Editions.
3. ABDUL HALIM BIN BABA. Image processing Learning Tool-Edge detection.
Bachelor Degree. University of Technology Malaysia 1996.
4. CHIN CHIOON KHENG. Window based image processing-learning tool.
Bachelor Degree. University of Technology Malaysia 1997.
5. Fundamentals of Image Processing, [email protected] (http://www.cs.dartmouth.edu/~farid)
6. JEAN-LUC STARCK, Centre d’Etudes de Saclay, Fionn Murtagh. Image processing and data analysis the multiscale approach. University of Ulster.
7. C. ANDERSON. "An alternative to the Burt pyramid algorithm", memo in preparation.
8. S LEVIALDI, “Digital Image Analysis”, University of Rome
APPENDIX A
The contents of Image Processing Toolbox
Image input/output
bmpread -Read a BMP (Microsoft Windows Bitmap) file from disk.
bmpwrite -Write a BMP (Microsoft Windows Bitmap) file from disk.
gifread -Read a GIF (Graphical Interchange Format) file from disk.
gifread -Write a GIF (Graphical Interchange Format) file from disk.
hdfpeek -Read data from HDF file.
hdfwrite -Write data from HDF file.
pcxread -Read a PCX (ZSoft Paint Format) file form disk.
pcxwrite -Write a PCX (ZSoft Paint Format) file form disk.
tiffread -Read a TIFF (Tagged Image File Format) file from disk.
tiffwrite -Write a TIFF (Tagged Image File Format) file from disk.
xwdread -Read a XWD (X window dump) file from disk.
xwdwrite -Write a XWD (X window dump) file from disk.
Utility routines
getimage -Get image data form axes
isbw -True for black and white images.
isgray -True for intensity images.
isind -True for indexed images.
Color operations
brighten -Brighten or darken a colormap.
cmunique -Find unique colormap colors and corresponding image.
cmpermute -Permute colormap positions.
cmgamma -Gamma correct colormap.
cmgamdef -Default gamma correction table.
dither -Floyd-Steinberg image dithering.
hsv2rgb -Convert HSV values to RGB colorspace.
imadjust -adjust and stretch image by an image with fewer colors.
imapprox -Approximate indexed image by an image with fewer colors.
ntsc2rgb -Convert NTSC values to RGB colorspace.
rgb2gray -Convert RGB values to gray.
rgb2hsv -Convert RGB values to HSV colorspace.
rgb2ntsc -Convert RGB values to NTSC colorspace.
rgbplot -Plot RGB colormap components.
40 Geometric operations
imcrop -Crop image imresize -Resize image imrotate -Rotate image
truesize -Resize figure so that image is actual size imzoom -Zoom in and out an image or 2-D plot
Image enhancement/analysis
brighten -Brigthen or darken a colormap.
grayslice -Density (intensity) slicing.
histeq -Histogram equalization.
imadjust -Adjust and stretch image intensity
imapprox -Approximate indexed image by an image with fewer colors.
imhist -Image histogram impixel -color of a pixel improfile -intensity profile.
interp2 -2-D data interpolation.
Image Statistics.
mean2 -Mean of a matrix
corr2 -2-D correlation coefficient.
std2 -2-D standard deviation.
Morphological operations.
bwarea -Area of object in binary image.
dilate -Dilate (thicken) a binary image.
erode -Erode (thin) a binary image.
edge -Euler number.
bwmorph -Morphological operators.
bwperim -Perimeter of objects in a binary image.
FIR Filter design.
fsamp2 -2-D FIR filter design via frequency sampling.
fspecial -Special 2-D filter.
ftrans2 -2-D FIR filter design via frequency transformation.
fwind1 -2-D FIR filter design using 1-D windows.
fwind2 -2-D FIR filter design using 2-D windows.
imnoise -Image noise
Frequency response.
freqspace -Frequency spacing for 2-D frequency responses.
freqz2 -Two dimensional frequency response.
Filtering.
colfilt -Local non-linear filtering as columns.
conv2 -Two-dimensional convolution.
filter2 -Two-dimensional filtering.
medfilt2 -Two-dimensional median filtering.
mfilter2 -Masked filter.
nlfilter -Local non-linear filtering.
wiener2 -Adaptive 2-D Wiener filtering
Block processing
bestblk -Best block size for block processing.
blkproc -Process an image in blocks.
col2im -Rearrange distinct or sliding column blocks to form image, colfilt -Local non-linear filtering as columns.
im2col -Rearrange distinct or sliding blocks into columns.
Region of interest (ROI) mfilter2 -Masked filter
roipoly -Define polygonal region of interest (ROI).
roicolor -Define region of interest (ROI) by color.
Transforms.
dct2 -2-D discrete cosine transform.
fft2 -2-D Fast Fourier Transform.
fftshift -Move zeroth lag (DC component) to center.
idct2 -2-D inverse discrete cosine transform.
ifft2 -2-D inverse FFt radon -Radon transform.
Conversions.
dither -Floyed-Steinberg image dithering.
gray2ind -Convert gray scale intensity image to indexed image.
hsv2rgb -Covert HSV values to RGB colorspace.
im2bw -convert image to black and white by thresholding.
imslice -Get image slices into an image deck ind2rgb -Convert indexed image to an RGB image.
mat2gray - Convert matrix to (gray) intensity image.
ntsc2rgb - Convert NTSC values to an RGB image.
rgb2gray - Convert an RGB image r values to gray.
rgb2hsv - Convert RGB values to HSV colorspace..
rgb2ind - Convert RGB image to indexed image.
rgb2ntsc - Convert RGB values to NTSC colorspace.\
42
Image diplay
colorbar -Display color bar (color scale) colormap -Set or get the color look-up table.
gray -Linear gray-scale color map
hsv,hot,jet -Colormaps. Types HELP COLOR for others image -Display indexed image.
imagesc -Scale data and display as image imcoutour -Image coutour.
immovie -Make a movie of an image deck.
imshow -Display all type of image data.
montage -Display an image deck as a rectangular montage.
warp -Warp an image on
APPENDIX B
function varargout = LearningTool(varargin)
% LEARNINGTOOL M-file for LearningTool.fig
% LEARNINGTOOL, by itself, creates a new LEARNINGTOOL
% LEARNINGTOOL('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in LEARNINGTOOL.M
% with the given input arguments.
%
% LEARNINGTOOL('Property','Value',...) creates a new
% LEARNINGTOOL or raises the existing singleton*. \
% Starting from the left, property value pairs are
% applied to the GUI before LearningTool_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to LearningTool_OpeningFcn via varargin.
%
% *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one
% instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES
% Edit the above text to modify the response to help LearningTool
% Last Modified by GUIDE v2.5 12-Mar-2010 02:38:49
44
% Begin initialization code - DO NOT EDIT gui_Singleton = 1;
gui_State.gui_Callback = str2func(varargin{1});
end
if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT
% --- Executes just before LearningTool is made visible.
function LearningTool_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% varargin command line arguments to LearningTool (see VARARGIN)
% Choose default command line output for LearningTool handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes LearningTool wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = LearningTool_OutputFcn(hObject, eventdata, handles)
% varargout cell array for returning output args (see VARARGOUT);
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Get default command line output from handles structure varargout{1} = handles.output;
% --- Executes on button press in OpenFile.
function OpenFile_Callback(hObject, eventdata, handles)
% hObject handle to OpenFile (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA) global IMG ORI_IMG
% Showing the origional image imshow(IMG);title('original image');
46
% --- Executes on button press in Reset.
function Reset_Callback(hObject, eventdata, handles)
% hObject handle to Reset (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% reset the image after process global IMG ORI_IMG;
IMG=ORI_IMG;
%show the image
imshow(IMG);title('original image');
% --- Executes on button press in Blur.
function Blur_Callback(hObject, eventdata, handles)
% hObject handle to Blur (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA) global IMG;
LEN = 21;
THETA = 11;
PSF = fspecial('motion', LEN, THETA);
blurred = imfilter(IMG, PSF, 'conv', 'circular');
noise_mean = 0;
noise_var = 0.001;
blurred_noisy = imnoise(blurred, 'gaussian', ...
noise_mean, noise_var);
% --- Executes on button press in Deblured.
function Deblured_Callback(hObject, eventdata, handles)
% hObject handle to Deblured (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA) global IMG;
LEN = 21;
THETA = 11;
PSF = fspecial('motion', LEN, THETA);
blurred = imfilter(IMG, PSF, 'conv', 'circular');
noise_mean = 0;
noise_var = 0.001;
blurred_noisy = imnoise(blurred, 'gaussian', ...
noise_mean, noise_var);
A = deconvwnr(blurred_noisy, PSF, 0.001);
IMG=A;
imshow(IMG)
title('Restoration of Blurred, Noisy Image Using NSR = 0.001')
% --- Executes on button press in Enhance.
function Enhance_Callback(hObject, eventdata, handles)
% hObject handle to Enhance (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA) global IMG;
truecolor = IMG;
decorrstretched_truecolor = decorrstretch(truecolor, 'Tol', 0.01);
IMG=decorrstretched_truecolor;
imshow(IMG);
title('Image Composite after Decorrelation Stretch');
% --- Executes on button press in Rotate.
48
function Rotate_Callback(hObject, eventdata, handles)
% hObject handle to Rotate (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA) global IMG;
image=double(IMG);
s=size(image);
result=zeros(s(2),s(1),s(3)); % Allocating memory for fast execution for i = 1:s(1)
j=1:s(2);
k=s(2)-j+1;
result(k,i,:)=image(i,j,:); % Computing the new matrix end
res=uint8(result);
IMG=res;
imshow(IMG); % Displaying the rotated image title('Rotate Image');
% --- Executes on button press in Threshold.
function Threshold_Callback(hObject, eventdata, handles)
% hObject handle to Threshold (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA) global IMG;
% --- Executes on button press in IdentifyingRoundObjects.
function IdentifyingRoundObjects_Callback(hObject, eventdata, handles)
% hObject handle to IdentifyingRoundObjects (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA) global IMG;
RGB = IMG;
I = rgb2gray(RGB);
threshold = graythresh(I);
bw = im2bw(I,threshold);
% Using morphology functions, remove pixels which do not belong to the
% objects of interest.
% remove all object containing fewer than 30 pixels bw = bwareaopen(bw,30);
% fill a gap in the pen's cap se = strel('disk',2);
bw = imclose(bw,se);
% fill any holes, so that regionprops can be used to estimate
% the area enclosed by each of the boundaries bw = imfill(bw,'holes');
imshow(bw)
[B,L] = bwboundaries(bw,'noholes');
% Display the label matrix and draw each boundary IMG=label2rgb(L, @jet, [.5 .5 .5]);
imshow(IMG) hold on
for k = 1:length(B) boundary = B{k};
plot(boundary(:,2), boundary(:,1), 'w', 'LineWidth', 2) end
stats = regionprops(L,'Area','Centroid');
50
threshold = 0.94;
% loop over the boundaries for k = 1:length(B)
% obtain (X,Y) boundary coordinates corresponding to label 'k' boundary = B{k};
% compute a simple estimate of the object's perimeter delta_sq = diff(boundary).^2;
perimeter = sum(sqrt(sum(delta_sq,2)));
% obtain the area calculation corresponding to label 'k' area = stats(k).Area;
% compute the roundness metric metric = 4*pi*area/perimeter^2;
% display the results
metric_string = sprintf('%2.2f',metric);
% mark objects above the threshold with a black circle if metric > threshold
centroid = stats(k).Centroid;
plot(centroid(1),centroid(2),'ko');
end
% --- If Enable == 'on', executes on mouse press in 5 pixel border.
% --- Otherwise, executes on mouse press in 5 pixel border or over OpenFile.
function OpenFile_ButtonDownFcn(hObject, eventdata, handles)
% hObject handle to OpenFile (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --- Executes during object creation, after setting all properties.
function OpenFile_CreateFcn(hObject, eventdata, handles)
% hObject handle to OpenFile (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% --- If Enable == 'on', executes on mouse press in 5 pixel border.
% --- Otherwise, executes on mouse press in 5 pixel border or over Reset.
function Reset_ButtonDownFcn(hObject, eventdata, handles)
% hObject handle to Reset (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --- Executes during object creation, after setting all properties.
function Reset_CreateFcn(hObject, eventdata, handles)
% hObject handle to Reset (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% --- Executes on mouse press over axes background.
52
function axes1_ButtonDownFcn(hObject, eventdata, handles)
% hObject handle to axes1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --- Executes during object creation, after setting all properties.
function axes1_CreateFcn(hObject, eventdata, handles)
% hObject handle to axes1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: place code in OpeningFcn to populate axes1
% --- If Enable == 'on', executes on mouse press in 5 pixel border.
% --- Otherwise, executes on mouse press in 5 pixel border or over Rotate.
function Rotate_ButtonDownFcn(hObject, eventdata, handles)
% hObject handle to Rotate (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --- Executes during object creation, after setting all properties.
function Rotate_CreateFcn(hObject, eventdata, handles)
% hObject handle to Rotate (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% --- If Enable == 'on', executes on mouse press in 5 pixel border.
% --- Otherwise, executes on mouse press in 5 pixel border or over Blur.
function Blur_ButtonDownFcn(hObject, eventdata, handles)
% hObject handle to Blur (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --- Executes during object creation, after setting all properties.
function Blur_CreateFcn(hObject, eventdata, handles)
% hObject handle to Blur (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% --- Executes during object creation, after setting all properties.
function pushbutton2_CreateFcn(hObject, eventdata, handles)
% hObject handle to pushbutton2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% --- Executes on button press in Close.
function Close_Callback(hObject, eventdata, handles)
% hObject handle to Close (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA) clear all;
close;clear
% --- Executes on button press in Save.
function Save_Callback(hObject, eventdata, handles)
% hObject handle to Save (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
54
% handles structure with handles and user data (see GUIDATA) global IMG
% --- Executes on selection change in listbox1.
function listbox1_Callback(hObject, eventdata, handles)
% hObject handle to listbox1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: contents = get(hObject,'String') returns listbox1 contents as cell array
% contents{get(hObject,'Value')} returns selected item from listbox1
% --- Executes during object creation, after setting all properties.
function listbox1_CreateFcn(hObject, eventdata, handles)
% hObject handle to listbox1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: listbox controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --- If Enable == 'on', executes on mouse press in 5 pixel border.
% --- Otherwise, executes on mouse press in 5 pixel border or over text2.
function text2_ButtonDownFcn(hObject, eventdata, handles)
% hObject handle to text2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --- Executes during object creation, after setting all properties.
function text2_CreateFcn(hObject, eventdata, handles)
% hObject handle to text2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% --- Executes on button press in checkbox3.
function checkbox3_Callback(hObject, eventdata, handles)
% hObject handle to checkbox3 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hint: get(hObject,'Value') returns toggle state of checkbox3 global ORI_IMG IMG
if (get(handles.checkbox3,'Value') == 0),
subplot(1.2,0.99,1.05); % Deleting all subplots present imshow(IMG);
else
56
subplot(1.3,1.8,1), imshow(ORI_IMG),title('original image'); % Displaying origional image
subplot(1.3,1.8,2), imshow(IMG); % Displaying the rotated image
end