Path: news.mathworks.com!not-for-mail
From: "Ashish Uthama" <first.last@mathworks.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Help with image processing
Date: Thu, 05 Nov 2009 14:48:36 -0500
Organization: TMW
Lines: 48
Message-ID: <op.u2xtbaqya5ziv5@uthamaa.dhcp.mathworks.com>
References: <hcp0nc$on$1@fred.mathworks.com>
 <151680ce-a53e-4537-858e-4fd98565d087@s15g2000yqs.googlegroups.com>
 <0e74e8f2-0156-4017-9652-c7d9310f174f@d34g2000vbm.googlegroups.com>
 <hcq12a$cv$1@fred.mathworks.com> <hcup9k$h7m$1@fred.mathworks.com>
NNTP-Posting-Host: uthamaa.dhcp.mathworks.com
Mime-Version: 1.0
Content-Type: text/plain; charset=iso-8859-15; format=flowed; delsp=yes
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1257450516 12608 172.31.57.126 (5 Nov 2009 19:48:36 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Thu, 5 Nov 2009 19:48:36 +0000 (UTC)
User-Agent: Opera Mail/10.01 (Win32)
Xref: news.mathworks.com comp.soft-sys.matlab:582845


On Thu, 05 Nov 2009 10:00:04 -0500, M Ladderman <mirresimons@gmail.com>  
wrote:

> Hi after tweaking the settings of my edge detection and using imclose I  
> get pretty close in selecting my fish. However now I have the problem  
> that I do not want to select its tail fin, so the part of the fish on  
> the rightest part of the photograph. So coming back to my point, is  
> there an "easy" way to fit a drop shape (which is pretty much what the  
> fish body looks like) to the binary mask and select only those pixels? I  
> find it hard to think of how to do this. Thanks
>
>
> "M Ladderman" <mirresimons@gmail.com> wrote in message  
> <hcq12a$cv$1@fred.mathworks.com>...
>> Hi guys,
>>
>> The fish is not on ice it is in a small tank with water and what you  
>> think is ice is whitish foam.. I could have used black foam but then I  
>> think I would have had the same problem with the top of the fish not  
>> having a clear 'edge'. I could use different colours however... I do  
>> not want reflexion from this. I have now also posted a colour image so  
>> that my setup is more clear maybe..
>>
>> Any more suggestions on coding I could use are very welcome..


You might be able to use ideas like active contours (others might  
clarify), where you could start out with an average 'drop shape' and then  
use gradient maps to fit this shape to the particular fish.

However, doing a better job at the image acquisition stage would be so  
much easier :)

For example, with the current image.. simple thresholding would give you a  
decent input for your image processing pipeline:

in=imread('in.jpg');
hsv=rgb2hsv(in);
v=hsv(:,:,3);
imtool(v); %use the contrast button to find a good range
%Fish = .24,.5 range
v(v>.24 & v<.5)=0;
imtool(v)

If you can ensure that the fish is placed at the center of a uniformly  
white background, you will most likely get much better results. Noting  
that the fins are translucent, you might even be able to get rid of them  
using the same logic of thresholding.