Path: news.mathworks.com!not-for-mail
From: "Chaos" <rothko.fan@gmail.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: image processing
Date: Thu, 13 Aug 2009 22:23:04 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 59
Message-ID: <h623o8$scf$1@fred.mathworks.com>
References: <h5qafv$hej$1@fred.mathworks.com> <56457914-5735-46aa-8352-5a8dc00f781e@k26g2000vbp.googlegroups.com>
Reply-To: "Chaos" <rothko.fan@gmail.com>
NNTP-Posting-Host: webapp-05-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1250202184 29071 172.30.248.35 (13 Aug 2009 22:23:04 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Thu, 13 Aug 2009 22:23:04 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 293962
Xref: news.mathworks.com comp.soft-sys.matlab:563258


ImageAnalyst <imageanalyst@mailinator.com> wrote in message <56457914-5735-46aa-8352-5a8dc00f781e@k26g2000vbp.googlegroups.com>...
> On Aug 10, 7:29?pm, "Mathew Thomas" <mathe...@gmail.com> wrote:
> > Hello everyone,
> >
> > I have a color image and want to find the edges. The image has two colors - black n brown... I only want to find the edges of the brown portion. How can I do this ?? I tried thresholding, but I guess I could not apply it right...Any help is welcome..
> >
> > Thank you,
> >
> > Matt
> 
> ----------------------------------------------------------------------------------------------------------------
> Matt:
> Try this demo:
> Good luck,
> ImageAnalyst
> 
> 
> % Demo macro to outline brown regions.
> % by ImageAnalyst
> clc;
> close all;
> workspace;
> rgbImage = uint8(zeros([200 200 3]));
> rgbImage(60:120, 60:120, 1) = 150;
> rgbImage(60:120, 60:120, 2) = 80;
> subplot(3,1,1);
> imshow(rgbImage);
> title('Original image.');
> % Find brown.  Since the only other color is black [0, 0, 0],
> % brown will be anyplace that is non-zero.
> % But for generality, let's look for red between 120 and 180
> % and for green between 50 and 100.
> inRedRange = rgbImage(:,:, 1) > 120 & rgbImage(:,:, 1) < 180;
> inGreenRange = rgbImage(:,:, 2) > 50 & rgbImage(:,:, 2) < 100;
> % AND them together to find where they're both true.
> binaryImage = inRedRange & inGreenRange;
> subplot(3,1, 2);
> imshow(binaryImage, []);
> title('Thresholded image.');
> % Now find the boundaries
> [boundaries, labeledImage] = bwboundaries(binaryImage,'noholes');
> % Display them over the original image.
> subplot(3,1, 3);
> imshow(rgbImage);
> hold on; % Don't let plot() blow away our image.
> title('Original image with boundaries.');
> for k = 1:length(boundaries)
>     thisBoundary = boundaries{k};
>     plot(thisBoundary(:,2), thisBoundary(:,1), 'w', 'LineWidth', 2)
> end
> % Maximize window.
> set(gcf, 'Position', get(0, 'ScreenSize')); % Maximize figure.

IA  is at again with another load of bloated crap code!  this looks like something out of a textbook or matlab example tutorial, lame!

go here
http://www.csse.uwa.edu.au/~pk/Research/MatlabFns/

scroll down find what you need