Supplementary IV: The realization of automatized image processing

1. Schematic representation of automatized image processing for screening of high Monascus pigment producing strain.

An automated image analysis protocol was developed in MatLab 2014a. The schematic representation of image automated processing procedure is illustrated in Fig. 2. The algorithm codes, together with the corresponding note, were given in Supplementary III.

The first step of the procedure consisted of the conversion of RGB images into grayscale images. Then, an adaptive threshold selection named Ostu method [20] was used to get binary images. Ostu can analyze image histograms automatically and obtain the best threshold value in statistics. In this work, it was carried out by using function graythresh from the Matlab image processing toolbox. Then binary images were additionally processed by image filling, in which function streland imfill wereused. At last, with the functions of bwboundaries, regionprops and mean, the colony area and R value of the images were calculated. By importing colony area and R value into the SVM, Monascus pigment production can be predicted.

2. The algorithm codes for automatized image processing

Explanation: The code for automatically image processing. The code is suitable for Matlab environment and thesentence after '%' is the note for the code.

Figure S4-1 the sample image for automated analysis

% Loading the picture

[b,a]=uigetfile('*.*'); % Select the image to be analyzed

RGB=imread([a,b]); % Load the picture

d1=imshow(RGB); % Show the picture

% Converting the image format

I=rgb2gray(RGB);% Convert the image format

threshold=graythresh(I); % Convert the image format

bw=im2bw(I,threshold);% Convert the image format

bw=~bw;% Convert the image format

imshow(bw);%Convert the image format

% Preprocessing

se=strel('disk',2);

bw=imclose(bw,se);

bw=imfill(bw,'holes');

bw=bwareaopen(bw,50);% Deleting the objects whose pixels less than 50

figure;

imshow(~bw);

% Preprocessing

figure;

imshow(RGB);

hold on

[B,L]=bwboundaries(bw,'noholes'); % Analyzing the object boundaries

boundary=B{1};

plot(boundary(:,2),boundary(:,1),'b','linewidth',2) % Marking the boundaries

hold on

pdi= 3.4332e-05;% The area of each pixel (cm2). Reader can adjust in based on hisowncircumstances

% Calculation the area of the object

stats=regionprops(L,'Area','Centroid');

CCC=stats.Centroid; % the centroid of the object on the image

x1=CCC(2);

y1=CCC(1);

text(x1-40,y1,['Area:' num2str(stats.Area*pdi) ' cm2'],'color','b','Fontsize',14,'fontweight','bold');

% Calculation the R value of the object image

Rdata=RGB(:,:,1); % Obtaining the color matrix of Red

R=mean(Rdata(logical(L))); %Calculating the R vale of the object image

% Reporting the analysis result

sprintf(' The colony area is : %f \nThe R value of the colony is : %f \n', stats.Area*pdi,R)