From: khalel dawod on
Hi guys
I'm a beginner in MATLAB and i really need some help with something
--------------------------------------------------------------------------------------------------------------------------
I want to design a system that could recognize intact plastic bottles from defective ones.

The main idea:
I get a picture of the sample bottle(either intact or defective), analyze the picture to know whether it's intact or defective.

defective Bottle characteristics Intact bottle characteristics
kind of a white color base transparent(blueish) base
white color upper body of bottle transparent(blueish) upper body

My dilemma is, how to know if there's any white color as described above, and what property could be used of the color "white" that could discriminate it from the"blueish"
such as intensity,...etc

Any input regarding that will be highly appreciated
(segmentation, color based analysis and anything that could be helpful in my system)

thanks in advance
K.Dawod




From: ImageAnalyst on
K.Dawod
Well, the color could be used to detect the color.
How about this: You upload several defective and intact images to
http://drop.io so we can make some suggestions. In the meantime, you
can study these examples:
http://www.mathworks.com/matlabcentral/fileexchange/25157
http://www.mathworks.com/matlabcentral/fileexchange/26420-simplecolordetection
http://www.mathworks.com/products/demos/image/color_seg_k/ipexhistology.html
From: khalel dawod on
i have posted 2 pictures on
------------------------------------------------
http://drop.io/donvqsf
------------------------------------------------

the defective bottle has a "White" base while as the intact one has a transparent(blueish) base
My system is a combination of Image Processing and Pattern Recognition

so any info or code segments regarding either part would great

K.Dawod


From: khalel dawod on
ImageAnalyst <imageanalyst(a)mailinator.com> wrote in message <7d13789f-aadb-4f4a-a3d8-8fb72532ef55(a)l36g2000yqb.googlegroups.com>...
> K.Dawod
> Well, the color could be used to detect the color.
> How about this: You upload several defective and intact images to
> http://drop.io so we can make some suggestions. In the meantime, you
> can study these examples:
> http://www.mathworks.com/matlabcentral/fileexchange/25157
> http://www.mathworks.com/matlabcentral/fileexchange/26420-simplecolordetection
> http://www.mathworks.com/products/demos/image/color_seg_k/ipexhistology.html

i have uploaded 2 images for now
http://drop.io/donvqsf

The defective bottle has a white base and the intact one has a transparent(blueish) base

My project is concerned with Image Processing and Pattern recognition
anything regarding either parts is really great.
From: ImageAnalyst on
K.Dawod
One way to do it. But it's not very robust and you'll have to perfect
it and make it more robust.
Be sure to join any lines broken into two by the news reader.


clc; % Clear the command window.
close all; % Close all figures (except those of imtool.)
clear all; % Erase all existing variables.
workspace; % Make sure the workspace panel is showing.

% Browse for the image file.
originalFolder = pwd;
% Set up a convenient starting folder.
folder = 'C:\Documents and Settings\userName\My Documents\Temporary
images';
if ~exist(folder, 'dir')
folder = pwd;
end
cd(folder);
baseFileName = 1;
while baseFileName ~= 0
% Browse for the image file.
[baseFileName, folder] = uigetfile('*.*', 'Specify an image
file');
fullImageFileName = fullfile(folder, baseFileName);
if baseFileName == 0
% User clicked cancel.
break;
end

% Read in standard MATLAB demo image.
rgbImage = imread(fullImageFileName);
[rows columns numberOfColorBands] = size(rgbImage);
subplot(2, 2, 1);
imshow(rgbImage);
title('Original color Image');
set(gcf, 'Position', get(0,'Screensize')); % Maximize figure.

% Get blue channel of image.
blueBand = rgbImage(:,:,3);
subplot(2, 2, 2);
imshow(blueBand);
title('Blue Band Image');
hold on;

% Define the ROI.
row1 = 1700;
row2 = row1 + 250;
column1 = 550;
column2 = column1 + 200;
hold on;
plot([column1 column1 column2 column2 column1], [row1 row2 row2
row1 row1], 'r-', 'linewidth', 2);

% Get ROI.
subImage = blueBand( row1:row2, column1:column2);
subplot(2, 2, 3);
imshow(subImage);
title('ROI');

% Just for fun, let's get its histogram.
[pixelCount grayLevels] = imhist(subImage);
subplot(2, 2, 4);
bar(pixelCount); title('Histogram of ROI of blue band image');
xlim([0 grayLevels(end)]); % Scale x axis manually.

% Calcuate the mean gray level.
meanGL = mean(subImage(:));
if meanGL > 95
message = sprintf('The mean gray level = %.1f\nThis bottle is
defective', meanGL);
else
message = sprintf('The mean gray level = %.1f\nThis bottle is
intact', meanGL);
end
uiwait(msgbox(message));
end

% Set current folder back to the original one.
cd(originalFolder);