Separating a group of higher intensity pixels in an image

I have an binary image in which only a particular group of pixels are my area of interest. I want to separate these higher intensity group of pixels in a new figure of want to differentiate them with a different color. How can I do it? Please have a look at the link for clarification

Antworten (3)

Sean de Wolski
Sean de Wolski am 19 Mär. 2011
I would do an:
cirx = imfill(bw, 'holes');
on your circles. Then do a logical AND on this to get the areas inside the circles that are also white. Then maybe bwlabel to color them. I.e:
both = BW&cirx;
L = bwlabel(both);
imshow(label2rgb(L));

1 Kommentar

Niranjan
Niranjan am 20 Mär. 2011
No Sean de, I am sorry If I have mislead you. The circles were drawn by me for identification of the regions. The original image does not contain these circles. I just want to separate out the aggregated pixels in an image eg) the circled ones. Hope I didn't confuse you this time :)

Melden Sie sich an, um zu kommentieren.

Sean de Wolski
Sean de Wolski am 20 Mär. 2011
Then use:
bwareaopen
to remove small blobs.

6 Kommentare

Niranjan
Niranjan am 20 Mär. 2011
I AM GETTING THIS ERROR WHEN I USE bwareaopen(BW,P), CAN YOU TELL ME WHAT SHOULD BE WRONG??
----------------------------------------------------------
??? Error using ==> imageDisplayParseInputs>validateCData at 291
If input is logical (binary), it must be two-dimensional.
Error in ==> imageDisplayParseInputs at 207
common_args.CData = validateCData(common_args.CData,image_type);
Error in ==> imshow at 199
[common_args,specific_args] = ...
Error in ==> mytry at 77
figure, imshow(bwAreaOpenBW);
>>
Niranjan
Niranjan am 20 Mär. 2011
This is the code I have used
bwAreaOpenBW = bwareaopen(I2I6,50);
figure, imshow(bwAreaOpenBW);
what is the result when you type:
size(BW);
is it [something, something, 3]?
Niranjan
Niranjan am 20 Mär. 2011
[ 900 1200 3]
Niranjan
Niranjan am 20 Mär. 2011
Can you tell me where the problem is ?
So you have all 3-dimensions of your rgb image binarized.
The easiest way to view it would just be to do:
imshow(uint8(bwAreaOpenBW)*255);
But I get the feeling that you're not understanding everything going on under the hood. Do you want a convert your rgb image to gray scale and then do the logical/morphological operations on them? Do you want to binarize all three dimensions (as you have) and then come up with some criteria based on that e.g. if true in two planes leave true, else no. Etc....

Melden Sie sich an, um zu kommentieren.

pratibha rane
pratibha rane am 10 Apr. 2013

0 Stimmen

Code: BW = imread('E:\ProjectCode\45.jpg');%Binary image BW2 = bwareaopen(BW, 24); figure,imshow(BW2)
Error: Error using ==> imageDisplayParseInputs>validateCData at 291 If input is logical (binary), it must be two-dimensional.
I want to highlight only object area with white color

Gefragt:

am 19 Mär. 2011

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by