source: birds/domilbirds.m @ 58

Last change on this file since 58 was 58, checked in by vcheplygina, 11 years ago
File size: 1.3 KB
RevLine 
[50]1% directory where the WAV-files of the birds are stored:
2dpath = fullfile(mildatapath,'birds');
3
[56]4fname = 'PC13_20090531_050000_0.wav';
[50]5%fname = 'PC8_20090531_050000_99.wav';
6[signal,fs] = wavread(fullfile(dpath,'wavs',fname));
7
8[S,f,t] = spectrogram(signal,512,256,[],fs);
[54]9fmax = 256;%Defined in paper
[50]10
[52]11figure(2); clf; showspec(S,f,t);
[54]12[S,f,t] = spectrogram(signal,512,256,fmax,fs);
13
14figure(2); imagesc(t,f,abs(S));
15axis xy; xlabel('time (s)'); ylabel('freq.');
16
[52]17figure(3); clf; showspec(imag(S), f,t);
[50]18
[58]19%%
[53]20% smooth and threshold the spectrogram?
21G = fspecial('gaussian',[5 5],2); % window 5x5, sigma=2
22I = imfilter(abs(S),G,'same');
23t = dd_threshold(I(:),0.8);
24mask = (I>t);
25mask(f<2000,:) = 0;
26
27figure(4); clf; imagesc(mask); axis xy;
[56]28% measure something:
29x = regionprops(bwlabel(mask),abs(S));
30y = x([x.Area]>10)
[53]31
32
[54]33
34%%
[57]35s2 = specwhiten(S,fmax);
[58]36figure(5); imagesc(t,f,s2);
[54]37axis xy; xlabel('time (s)'); ylabel('freq.');
[58]38
39% smooth and threshold the spectrogram?
40G = fspecial('gaussian',[5 5],2); % window 5x5, sigma=2
41I = imfilter(abs(s2),G,'same');
42t = dd_threshold(I(:),0.95);
43mask = (I>t);
44mask(f<2000,:) = 0;
45
46figure(6); clf; imagesc(mask); axis xy;    %Ja, dit ziet er vergelijkbaar uit, iets minder kleine blobs aanwezig geloof ik?
47% measure something:
48x = regionprops(bwlabel(mask),abs(s2));
49y = x([x.Area]>10)
50
Note: See TracBrowser for help on using the repository browser.