I need to count cell nucleus in these images how can I do that

2 views (last 30 days)
Can I get a code in image processing field to count the cells’ nucleus from these photos

Answers (1)

Vinayak Agrawal
Vinayak Agrawal on 15 Jun 2023
Hi Asia,
Yes, here is an example code in MATLAB for counting the cells' nucleus from a JPEG photo:
% Load the image
img = imread('cells.jpg');
% Convert the image to grayscale
grayimg = rgb2gray(img);
% Apply a median filter to remove noise
medimg = medfilt2(grayimg);
% Enhance contrast using histogram equalization
equalizedimg = histeq(medimg);
% Segment the image using adaptive thresholding
thresimg = adaptthresh(equalizedimg, 0.3);
binaryimg = imbinarize(equalizedimg, thresimg);
% Remove small objects from the binary image
binaryimg = bwareaopen(binaryimg, 10);
% Find the connected components in the binary image
cc = bwconncomp(binaryimg);
% Count the number of cells' nucleus
nucleusCount = cc.NumObjects;
% Display the results
figure;
subplot(2,2,1); imshow(img); title('Original Image');
subplot(2,2,2); imshow(medimg); title('Grayscale Image with Median Filtering');
subplot(2,2,3); imshow(equalizedimg); title('Contrast Enhanced Image');
subplot(2,2,4); imshow(binaryimg); title(['Detected Nuclei: ', num2str(nucleusCount)]);
You may need to adjust the parameters of the image processing functions and methods used in this code to obtain the desired results for your input image. Also, note that this code assumes a certain level of expertise in image processing and MATLAB programming
Hope it helps
  1 Comment
Image Analyst
Image Analyst on 15 Jun 2023
The histogram equalization step is not needed. It is almost never needed in any situation.

Sign in to comment.

Categories

Find more on Biomedical Imaging in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!