I want to segment this Red Blood Cell Image on HSI color space.I want to try the Otsu Method but from what I read that method work only on Grayscale image.Do you have any suggestion for suitable image segmentation on those red blood cell image ? [EDIT] This is what i want to achieve(Segmented Blood Cell)
You might try converting your image to greyscale first with
greycells = rgb2gray(rgbcells);
where rgbcells contains the color image of your cells (see here).
Then use Otsu's threshold on the greyscale image like so
threshcells = graythresh(greycells);
like so (see here).
EDIT After OP explained what image should be the resulting image.
Using: FIJI (formerly ImageJ)
I am still not 100% sure as to which images you finally want to obtain. It seems like you only want to see the cells with the many purple dots (sorry, I am not a biologist myself) inside them and completely remove the others. For this attempt at a solution I use FIJI, but the principle can be easily applied in Python / Matlab, you name it...
Your images are somewhat different, because in the first image the other cells pretty much have the same color as the one in the middle (that you want to segment probably). In the second image the other cells are much lighter.
Let us look at the second image first:
Converting to HSI
Use the Color Transformer 2 Plugin to convert the images to HSI using the options "From Colorspace: sRGB" and "To Colorspace: HSI". Looking at the channels we can see that S and I carry pretty much the same information. So let's stick with the I channel. It looks like this: .
Selecting a Threshold
Now we use the useful "Auto Threshold" (Image->Adjust->Auto Threshold) feature of Fiji on this channel. Clip the image from the HSI stack and convert it to 16 bit first. Use the option "Try All", also check "Ignore White" and uncheck "white objects on black background". Now we can see a whole panel of different thresholding algorithms applied to this image. It looks like this:
You can see that many thresholding methods do what you want. Among them Otsus method (as you suggested) and MaxEnt. Now that we know MaxEnt or Otsus thresholding works for this image lets do the same thing again (meaning AutoThreshold), but instead of "Try All" we select "MaxEnt" as our threshold of choice (you'll see below why MaxEnt). Then we invert the threshold and overlay it on the image and we end up with:
Now for the first image
Here we can do exactly the same. Repeating the steps, we end up with an I channel like this:
The other cells are very well visible here. This is also true for the other channels. I have also plotted the histogram. The left hump corresponds to the wihte background, the right hump to pretty much all cells. This will be important in the next step.
Now try all thresholds again like above and we will see this:
You see that Otsus threshold separates the cells from the background, but does not give you the cell in the middle that you want. Look at the Histogram: due to the way Otsus method is designed (see here) it will seperate these two clusters. Which is not what you want (as I understand) in this case. But MaxEnt(Maximum Entropy) does. So use the MaxEnt threshold as above.
You will end up with this:
SUMMARY This is my processing chain:
- Do HSI transform
- Apply MaxEnt threshold to the I channel
- Use the binary mask on the RGB image again to clip out the relevant parts
OUTLOOK If you are not satisfied with the results, then play around with different thresholds. Ultimately changing the colorspance and thresholding are powerful but very low tech ways of image segmentation. You might be interested in more sophisticated ways. For a software suite catered especially to cell biologists check out Cell Profiler. Former colleagoues have used it and were very happy with it.
LITERATURE Maximum Entropy Threshold: Wong et al: "A gray-level threshold selection method based on maximum entropy principle", https://ieeexplore.ieee.org/document/35351