i'm currently doing a project on drowsiness detection using image processing and EEG signals. right now i have got samples of EEG database from one of the hospitals for my references. now please tel me how to read these databases in matlab

2 views (last 30 days)
this is samples that i got from hospital. Pz-P4 electrodes are used for drowsy detection.

Answers (1)

Image Analyst
Image Analyst on 27 Dec 2014
You will have to ask the maker of the EEG instrument for the format of the file. Also ask if they have MATLAB code to read it. If you're lucky they will. Or see if that program you have a screenshot of can export the data into some common format like an Excel workbook or a csv file.
  2 Comments
pawan gupta
pawan gupta on 8 Apr 2016
Edited: pawan gupta on 8 Apr 2016
Hi,can anybody tell me about the algorithm which is used in the following code? like viola jones,template matching etc.
it would be greatly appericiated if u could help me. thank you!!!
clc clear all; close all;
% initialize webcam (read instructions if required 'README_TO_SET_YOUR_CAMERA.m')
vobj=videoinput('winvideo',1,'YUY2_640x480','ReturnedColorSpace','rgb'); figure('Name','My Custom Preview Window'); uicontrol('string','close','callback','close(gcf)');
% create an image object for previewing
vidRes=get(vobj,'VideoResolution'); nBands=get(vobj,'NumberOfBands'); hImage=image(zeros(vidRes(2),vidRes(1),nBands)); preview(vobj,hImage);
%pause % coordinates to draw lines
rs=vidRes(2); cs=vidRes(1); C1=floor(cs/6); C2=floor(267*cs/320);
C3=floor(0); C4=floor(cs);
R1=floor(rs/4); R2=floor(rs/2); R3=floor(3*rs/4); R4=floor(rs);
x1=[C1 C1]; x2=[C2 C2]; x3=[C3 C3]; x4=[C4 C4];
x5=[C3 C4];
y1=[0 rs]; y2=[R1 R1]; y3=[R2 R2]; y4=[R3 R3]; y5=[R4 R4];
%draw lines
line(x1,y1,'color','r','LineWidth',1.5) line(x2,y1,'color','r','LineWidth',1.5)
%line(x3,y1,'color','g','LineWidth',2) %line(x4,y1,'color','g','LineWidth',2)
line(x5,y2,'color','g','LineWidth',1.5) line(x5,y3,'color','g','LineWidth',1.5) line(x5,y4,'color','g','LineWidth',1.5)
%line(x5,y5,'color','w','LineWidth',2)
% write text
text1=text(19*cs/96,rs/8,'FOREHEAD REGION','color','r'); text2=text(19*cs/96,3*rs/8,'EYE REGION','color','r'); text3=text(19*cs/96,5*rs/8,'NOSE REGION','color','r'); text4=text(19*cs/96,7*rs/8,'MOUTH REGION','color','r'); % initialize flags
FlagForHead=0; FlagEyes=0; FlagNose=0; FlagMouth=0;
cnt=0;
% initialize vision toolbox
shape=vision.ShapeInserter('BorderColor','Custom','CustomBorderColor',[255 255 0]); EyeDetector1=vision.CascadeObjectDetector('EyePairSmall'); NoseDetector=vision.CascadeObjectDetector('Nose'); MouthDetector1=vision.CascadeObjectDetector('Mouth');
%%press any key while you are ready
for i=1:5 % for 200 frames, increse/decrese if required I2=getsnapshot(vobj); pause(0.5) FirstSeg=imcrop(I2,[C1 0 C2-C1 R1]); % figure(2),subplt(1,2,1);imshow(FirstSeg);
BlackDetect=(FirstSeg(:,:,1)<70)&(FirstSeg(:,:,2)<70)&(FirstSeg(:,:,3)<70);
BW1=imfill(BlackDetect,'holes');
BW2=bwareaopen(BW1,2000);
%subplot(1,2,2),imshow(BW2);
[Matl Nr]=bwlabel(BW2);
if Nr~=0
FlagForHead=1;
else
FlagForHead=0;
end
SecondSegment=imcrop(I2,[C1 R1 C2-C1 R2-R1]);
figure(3),subplot(1,2,1),imshow(SecondSegment);
bbox_eye1=step(EyeDetector1,SecondSegment);
I_Eye=step(shape,SecondSegment,int32(bbox_eye1));
if isempty(bbox_eye1)~=1
FlagEyes=1;
EyeRegion=imcrop(SecondSegment,[bbox_eye1(1,1),bbox_eye1(1,2),bbox_eye1(1,3),bbox_eye1(1,4)]);
subplot(2,1,1),imshow(I_Eye),title('EYE INPUT');
subplot(2,1,2),imshow(EyeRegion),title('EYE REGION');
else
FlagEyes=0;
end;
ThirdSegment=imcrop(I2,[C1 R2 C2-C1 R3-R2]);
% figure(4),subplot(1,2,1),imshow(ThirdSegment);
bbox_Nose1=step(NoseDetector,ThirdSegment);
I_Nose=step(shape,ThirdSegment,int32(bbox_Nose1));
if isempty(bbox_Nose1)~=1
FlagNose=1;
%
NoseRegion=imcrop(ThirdSegment,[bbox_Nose1(1,1),bbox_Nose1(1,2),bbox_Nose1(1,3),bbox_Nose1(1,4)]);
%subplot(3,2,5),imshow(I_Nose),title('Nose INPUT');
%subplot(1,2,2),imshow(NoseRegion),title('Nose REGION');
else
FlagNose=0;
end;
FourthSegment=imcrop(I2,[C1 R3 C2-C1 R4-R3]);
%figure(5),subplot(1,2,1),imshow(FourthSegment);
bbox_Mouth1=step(MouthDetector1,FourthSegment);
I_Mouth=step(shape,FourthSegment,int32(bbox_Mouth1));
if isempty(bbox_Mouth1)~=1
FlagMouth=1;
%
MouthRegion=imcrop(FourthSegment,[bbox_Mouth1(1,1),bbox_Mouth1(1,2),bbox_Mouth1(1,3),bbox_Mouth1(1,4)]);
% subplot(3,2,3),imshow(I_Mouth),title('MOUTH INPUT');
% subplot(1,2,2),imshow(MouthRegion),title('MOUTH REGION');
else
FlagMouth=0;
end;
if ((FlagForHead==1)&&(FlagEyes==1)&&(FlagMouth==1))
disp('Normal Condition')
cnt=0;
else
disp('possible drowsiness detection')
cnt=cnt+1;
end
if cnt>3
cnt=0;
disp('drowsiness confirmed')
load gong.mat;
sound(y);
pause(5);
end
end

Sign in to comment.

Categories

Find more on EEG/MEG/ECoG 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!