Segmentation
In the segmentation stage all background regions get removed. This task is quite crucial. If one removes too few, the final stage of finding pathogenes might get irritated.
On the other hand, if one removes too many regions, positive hits might get removed early before detection. This surely also must be avoided.
We opted for a simple thresholding step because it showed that while being easy, it is an effective weapon against the uniform background. In fact, the good image quality we wanted to reach with our device allows now less sophisticated methods.
Also the less computational intensive the steps are, the better they might even run directly on the Raspberry Pi in our device!
The HSV thresholding is performed on each component seperately (for more information on the HSV color space we refer to [http://en.wikipedia.org/wiki/HSL_and_HSV Wikipedia]). The first component is the hui, which we select to be inbetween $0.462$ and $0.520$ to select any blue-greenish (turquoise) color. We will not see bright green due to the filter selection in our device.
The saturation value must be high, between $0.99$ and $1.0$.
Finally the Value must be between $0.25$ and $0.32$, which assumes a relatively dark-ish color.
Indeed, these values are not problem specific, but specific for each setup and therefore must be determined experimentally.
The remainder of this stage creates a mask of pixels that fulfill the conditions.
% Auto-generated by colorThresholder app on 15-Oct-2014
%-------------------------------------------------------
function [maskedRGBImage] = createMask(srmimg)
RGB = srmimg;
% Convert RGB image to chosen color space
I = rgb2hsv(RGB);
% Define thresholds for channel 1 based on histogram settings
channel1Min = 0.462;
channel1Max = 0.520;
% Define thresholds for channel 2 based on histogram settings
channel2Min = 0.99;
channel2Max = 1.000;
% Define thresholds for channel 3 based on histogram settings
channel3Min = 0.25;
channel3Max = 0.32;
% Create mask based on chosen histogram thresholds
BW = (I(:,:,1) >= channel1Min ) & (I(:,:,1) <= channel1Max) & ...
(I(:,:,2) >= channel2Min ) & (I(:,:,2) <= channel2Max) & ...
(I(:,:,3) >= channel3Min ) & (I(:,:,3) <= channel3Max);
% Initialize output masked image based on input image.
maskedRGBImage = RGB;
% Set background pixels where BW is false to zero.
maskedRGBImage(repmat(~BW,[1 1 3])) = 0;
end
|