Team:Aachen/Notebook/Software/Measurarty
From 2014.igem.org
(→Statistical Region Merging (SRM)) |
(→Segmentation) |
||
Line 123: | Line 123: | ||
== Segmentation == | == Segmentation == | ||
<span class="anchor" id="segment"></span> | <span class="anchor" id="segment"></span> | ||
+ | |||
+ | 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! | ||
+ | |||
+ | <html> | ||
+ | <div class="codediv"> | ||
+ | <pre><code class="matlab"> | ||
+ | % 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 | ||
+ | </code></pre> | ||
+ | </div> | ||
+ | </html> | ||
{{Team:Aachen/BlockSeparator}} | {{Team:Aachen/BlockSeparator}} | ||
Revision as of 14:26, 15 October 2014
|
|
|
|
|
|