How can I do non-contact hemoglobin measurement with matlab using 30 sec videos.

5 views (last 30 days)
Video images of people with known hemoglobin values from different people were taken for 30 seconds. Using these images, we will try to estimate the hemoglobin values of these people with matlab and compare them with real measurements.
My first idea is to convert video footage to image format,
Approximately 900 images can be obtained from 30-second videos,
it will be made into a single image and a single matrix by averaging only the red colors on the face in these images,
This will be done for different hemoglobin values in all videos,
The images obtained will be introduced to the system with deep learning and classes will be created.
Could you share the code for this part? I'm new to matlab and I don't know how to write.
  1 Comment
Rik
Rik on 9 Jan 2022
I would suggest you try to walk before trying to run. This is a big project. If you plan to do anything with this, I would suggest recruiting a programmer as a coauthor.
I would also reconsider your choice of averaging to merge the video into a single image. It seems like it would make more sense to process each frame as a separate image. That way your pipeline should be much more robust.

Sign in to comment.

Answers (2)

Image Analyst
Image Analyst on 10 Jan 2022
This is a challenging project - you don't even know what you're in for. For example you don't seem to know that you need to calibrate your colors. You need to have a color standard in your field of view:
That will let you compensate for different light intensities and colors and let you convert the arbitrary RGB values into calibrated CIELAB values, which would be necessary to give a formula between the average LAB of a face to its known hemoglobin value. See attached tutorial for a start.
If you hire someone to help you, like Rik suggested, you need an image analysis person - that is someone who knows optics, spectroscopy, color science (especially this), image processing, and how to program.
You might also be interested in "Eulerian Video Magnification" by MIT:
  1 Comment
Rik
Rik on 10 Jan 2022
Thank you for taking the time to elaborate.
I know enough of this field to know that there is a huge amount I don't know. I understand the conceptual idea of looking at a face and trying to determine oxygenation (I have even done a research internship project based on that idea; hyperspectral imaging of diabetic feet).
I'm afrain OP needs a supervisor, not Matlab Answers.

Sign in to comment.


sedat mutlu
sedat mutlu on 10 Jan 2022
hi,
Approximately 900 images can be obtained from 30-second videos, - done
video = VideoReader('C:\Users\Sony\Desktop\yeni image\H.mp4');
numberFrames= video.NumFrames;
n=numberFrames;
Folder = 'C:\Users\Sony\Desktop\yeni image';
for iFrame = 1:n
frames = read(video, iFrame);
imwrite(frames, fullfile(Folder, sprintf('%06d.jpg', iFrame)));
end
FileList = dir(fullfile(Folder, '*.jpg'));
for iFile = 1:length(FileList)
aFile = fullfile(Folder, FileList(iFile).name);
img = imread(aFile);
end
it will be made into a single image and a single matrix by averaging only the red colors on the face in these images,
this part i wrote something but not giving exactly what is requested. could you check?
% Script to take the gray scale or RGB images in the folder and average them together to produce a mean image.
% If the images are of different sizes, it resizes them to the size of the first image.
% If the images are of different color bits, it makes them the color (gray scale or RGB) of the first image.
clc; % Clear the command window.
close all; % Close all figures (except those of imtool.)
clear; % Erase all existing variables. Or clearvars if you want.
workspace; % Make sure the workspace panel is showing.
format long g;
format compact;
fontSize = 20;
%--------------------------------------------------------------------------------
% Get folder name where the images are that we want to average.
% Option #1:
folder = fileparts(which('000001.jpg')); % Determine where MATLAB demo images folder is.
% Option #2:
folder = 'C:\Users\Sony\Desktop\yeni image'; % Specify some particular folder.
% Option #3:
folder = uigetdir(pwd, 'Select folder');
% folder will be 0 (a double) if they click cancel.
% folder will be the path (a string) if they clicked OK.
if folder == 0
% Clicked cancel. Exit program.
return;
end
% Comment out whichever folder selection options above that you don't want to use.
% Make sure the folder actually exists.
if ~isfolder(folder)
errorMessage = sprintf('Error: The following folder does not exist:\n%s', folder);
uiwait(warndlg(errorMessage));
return;
else
fprintf('Averaging images in the following folder:\n %s', folder);
end
%--------------------------------------------------------------------------------
% Get a list of all TIF, PNG, BMP, and JPG files.
imageFiles = [dir(fullfile(folder,'*.TIF')); dir(fullfile(folder,'*.PNG')); dir(fullfile(folder,'*.BMP')); dir(fullfile(folder,'*.jpg'))];
%--------------------------------------------------------------------------------
% Now do the averaging in a loop
numberOfImages = length(imageFiles);
theyreColorImages = false;
for k = 1 : numberOfImages
fullFileName = fullfile(folder, imageFiles(k).name);
fprintf('About to read %s\n', fullFileName);
thisImage=imread(fullFileName);
[thisRows, thisColumns, thisNumberOfColorChannels] = size(thisImage);
if k == 1
% Save the first image.
sumImage = double(thisImage);
% Save its dimensions so we can match later images' sizes to this first one.
rows1 = thisRows;
columns1 = thisColumns;
numberOfColorChannels1 = thisNumberOfColorChannels;
theyreColorImages = numberOfColorChannels1 >= 3;
% Add in the "if" block below if you want to force them to be color, even if the first image is gray scale.
% if numberOfColorChannels1 == 1
% % Convert to color
% thisImage = cat(3, thisImage, thisImage, thisImage);
% theyreColorImages = false;
% end
else
% It's the second, or later, image.
if rows1 ~= thisRows || columns1 ~= thisColumns
% It's not the same size, so resize it to the size of the first image.
thisImage = imresize(thisImage, [rows1, columns1]);
end
% Make sure the colors match - either all color or all gray scale, according to the first one.
if thisNumberOfColorChannels == 3 && numberOfColorChannels1 == 1
% We have color. Need to change it to grayscale to match the first one.
thisImage = rgb2gray(thisImage);
theyreColorImages = false;
elseif thisNumberOfColorChannels == 1 && numberOfColorChannels1 == 3
% We have grayscale. Need to change it to RGB to match the first one.
thisImage = cat(3, thisImage, thisImage, thisImage);
theyreColorImages = true;
end
% Now do the summation.
sumImage = sumImage + double(thisImage); % Be sure to cast to double to prevent clipping. [rows, columns, numberOfColorBands]=size(thisImage);
% It can't display an RGB image if it's floating point and more than 255.
% So divide it by the number of images to get it into the 0-255 range.
if theyreColorImages
displayedImage = uint8(sumImage / k);
else
displayedImage = sumImage;
end
imshow(displayedImage, []);
drawnow;
end
end
%--------------------------------------------------------------------------------
% Compute and display the final image:
sumImage = uint8(sumImage / numberOfImages);
cla;
imshow(sumImage, []);
caption = sprintf('Average of %d Images', numberOfImages);
title(caption, 'FontSize', fontSize);
%--------------------------------------------------------------------------------
% Set up figure properties:
% Enlarge figure to full screen.
set(gcf, 'Units', 'Normalized', 'OuterPosition', [0 0 1 1]);
% Get rid of tool bar and pulldown menus that are along top of figure.
set(gcf, 'Toolbar', 'none', 'Menu', 'none');
% Give a name to the title bar.
set(gcf, 'Name', 'Demo by ImageAnalyst', 'NumberTitle', 'Off')
Regards,

Community Treasure Hunt

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

Start Hunting!