|
On Mar 2, 4:17 pm, "bob " <behzad.maj...@gmail.com> wrote:
> Hey,
>
> I have a micrograph with different features with different sizes. I used the following code, to detect and remove regions with certain properties like area.
> Now, I want to change the color of regions with specific values of area. But I couldn't find a way to do that.
> I need to change the bw image to RGB but for example with regions having area less than 1000 to be displayed in red.
>
> Any comments?
> thanks.
>
> a= imread('test.jpg');
> b= im2bw(a);
>
> c= bwconncomp(b);
> stats= regionprops(c, 'Area');
> idx= find([stats.Area]>1000);
> d= ismember(labelmatrix(c), idx);
-------------------------------------------------------------------------------------
What makes you think im2bw() will give you a good segmentation of your
objects? Well anyway, after that you could simply do
b = bwareaopen(b, 1000);
Then when you call regionprops() you will be guaranteed of not having
any regions of 1000 pixels or fewer.
By the way, why don't you see my BlobsDemo tutorial at:
http://www.mathworks.com/matlabcentral/fileexchange/?term=authorid%3A31862
There are also color demos in there.
You can upload your photos to tinypic.com if you want further advice.
|