You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Image Classification of White Blood Cells with Few Examples
% GNU Octave / MATLAB languages
I = imread(imagepath); % READ **IMAGEPATH** INTO ARRAY
J = rgb2hsv(I)(:,:,2); % convert from rgb to hsv and select channel 2
K = imsmooth(J,"P&M",1); % smoothing with anisotropic diffusion
X = imadjust(K,[0.1;1.0],[0;1]); % adjust pixel intensities
X =X- edge(X,"LoG"); % LoG edge detection and removal
X = imsmooth(X,"P&M",1); % smoothing with anisotropic diffusion
% Thresholding to Isolate Nucleus% runs thresholding with "i" levels% extract pixels at all levels greater "j" if they total <1% image area
Y =X*0;
for i =2:6for j =0:(i-1)
tmp = (grayslice(X,i) >j);
avg = mean(tmp(:));
if (avg>0) && (avg<0.01)
Y += tmp;
endifendforendfor
% fill holes in object and background
Z = bwareaopen(Y,300);
Z = bwareaopen(!Z,50);
Z = !Z;
% Nucleus Recognition and Removal of Other Objects
A = imsmooth(Z,"Gaussian",2); % merge pixels belonging to each "object"
tmp = bwlabel(A); % label pixels of each object by object's number
ct = length(unique(tmp)) -1; % find total number of objects
ht = histc(tmp(:),1:ct); % bincount of pixels by label
val = find(ht== max(ht)); % find label corresponding to largest object
N = im2bw(Z- (tmp != val)); % remove all smaller objects from image
F = (im2uint8(J)).^N; % extract grayscale nucleus from original image