Changeset 58
- Timestamp:
- 06/14/13 17:31:23 (12 years ago)
- Location:
- birds
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
birds/domilbirds.m
r57 r58 17 17 figure(3); clf; showspec(imag(S), f,t); 18 18 19 %% 19 20 % smooth and threshold the spectrogram? 20 21 G = fspecial('gaussian',[5 5],2); % window 5x5, sigma=2 … … 33 34 %% 34 35 s2 = specwhiten(S,fmax); 35 figure( 4); imagesc(t,f,s2);36 figure(5); imagesc(t,f,s2); 36 37 axis xy; xlabel('time (s)'); ylabel('freq.'); 38 39 % smooth and threshold the spectrogram? 40 G = fspecial('gaussian',[5 5],2); % window 5x5, sigma=2 41 I = imfilter(abs(s2),G,'same'); 42 t = dd_threshold(I(:),0.95); 43 mask = (I>t); 44 mask(f<2000,:) = 0; 45 46 figure(6); clf; imagesc(mask); axis xy; %Ja, dit ziet er vergelijkbaar uit, iets minder kleine blobs aanwezig geloof ik? 47 % measure something: 48 x = regionprops(bwlabel(mask),abs(s2)); 49 y = x([x.Area]>10) 50 -
birds/specwhiten.m
r57 r58 3 3 function s2 = whiten(s,fmax) 4 4 5 %Values output by spectrogram are already in [0, 1] range 5 %Not sure about this, but the paper seems to assume this 6 s = abs(s); 7 8 %Values output by spectrogram are already in [0, 1] range? 9 10 6 11 7 12 %Square root of spectrogram (of the absolute value?) 8 s1 = sqrt(abs(s)); 9 %s1 = sqrt(s); 13 14 %s1 = sqrt(abs(s)); %Version 1 15 s1 = s; %Version for segmentation 10 16 11 17 %For each frame, find a quantity similar to the energy" … … 21 27 22 28 lowestix = find(energy<threshold); 23 lowestenergy = energy(lowestix);29 %lowestenergy = energy(lowestix); 24 30 25 31 … … 27 33 s2 = s1; 28 34 for f=1:Nf 29 P(f) = sqrt(eps + sum(s1(f,lowestix).^2)); 35 %P(f) = sqrt(eps + sum(s1(f,lowestix).^2)); 36 37 P(f) = sum(s1(f,lowestix)) / length(lowestix); 30 38 s2(f,:) = s1(f,:) ./P(f); 31 39 end
Note: See TracChangeset
for help on using the changeset viewer.