m8ta
You are not authenticated, login. |
|
{1471} | ||||||
Edited Terrence Eden's script to average multiple frames when producing a time-lapse video from a continuous video. Frames are averaged together before decimation, rather than pure decimation, as with ffmpeg. Produces appealing results on subjects like water. Also, outputs a video directly, without having to write individual images. python #!/usr/bin/python import cv2 import sys # Video to read print str(sys.argv[1]) vidcap = cv2.VideoCapture(sys.argv[1]) # Which frame to start from, how many frames to go through start_frame = 0 frames = 61000 # Counters count = 0 save_seq = 0 decimate = 10 rolling = 16 # average over N output frames transpose = False if(transpose): h = vidcap.get(3) w = vidcap.get(4) else: w = vidcap.get(3) h = vidcap.get(4) fourcc = cv2.VideoWriter_fourcc(*'mp4v') writer = cv2.VideoWriter("timelapse.mp4", fourcc, 30, (int(w), int(h)), True) avglist = [] while True: # Read a frame success,image = vidcap.read() if not success: break if count > start_frame+frames: break if count >= start_frame: if (count % decimate == 0): # Extract the frame and convert to float avg = image.astype('uint16') # max 255 frames averaged. if (count % decimate > 0 and count % decimate <= (decimate-1)): avg = avg + image.astype('uint16') if (count % decimate == (decimate-1)): # Every 100 frames (3 seconds @ 30fps) avg = avg / decimate if(transpose): avg = cv2.transpose(avg) avg = cv2.flip(avg, 1) avg2 = avg; for a in avglist: avg2 = avg2 + a avg2 = avg2 / rolling; avglist.append(avg); if len(avglist) >= rolling: avglist.pop(0) # remove the first item. avg2 = avg2.astype('uint8') print("saving "+str(save_seq)) # Save Image # cv2.imwrite(filename+str('{0:03d}'.format(save_seq))+".png", avg) save_seq += 1 writer.write(avg2) if count == frames + start_frame: break count += 1 writer.release() | ||||||
{1444} |
ref: -2012
tags: parvalbumin interneurons V1 perceptual discrimination mice
date: 03-06-2019 01:46 gmt
revision:0
[head]
|
|||||
PMID-22878719 Activation of specific interneurons improves V1 feature selectivity and visual perception
| ||||||
{1268} | ||||||
Simple perl scrip for removing duplicate files within sub-directories of a known depth: #!/usr/bin/perl -w @files = <*>; foreach $file (@files) { @files2 = <$file/*>; foreach $file2 (@files2) { print $file2 . "\n"; `rm -rf $file2/*_1.jpg`; `rm -rf $file2/*_2.jpg`; } } | ||||||
{1052} | ||||||
IEEE-5332822 (pdf) Neural prosthetic systems: Current problems and future directions
____References____ Chestek, C.A. and Cunningham, J.P. and Gilja, V. and Nuyujukian, P. and Ryu, S.I. and Shenoy, K.V. Engineering in Medicine and Biology Society, 2009. EMBC 2009. Annual International Conference of the IEEE 3369 -3375 (2009) | ||||||
{918} | ||||||
PMID-9537321[0] Somatosensory discrimination based on cortical microstimulation.
____References____
| ||||||
{49} | ||||||
http://www.klab.caltech.edu/news/crick-koch-05.pdf
| ||||||
{760} |
ref: -0
tags: LDA myopen linear discriminant analysis classification
date: 01-03-2012 02:36 gmt
revision:2
[1] [0] [head]
|
|||||
How does LDA (Linear discriminant analysis) work? It works by projecting data points onto a series of planes, one per class of output, and then deciding based which projection plane is the largest. Below, to the left is a top-view of this projection with 9 different classes of 2D data each in a different color. Right is a size 3D view of the projection - note the surfaces seem to form a parabola. Here is the matlab code that computes the LDA (from myopen's ceven % TrainData and TrainClass are inputs, column major here. % (observations on columns) N = size(TrainData,1); Ptrain = size(TrainData,2); Ptest = size(TestData,2); % add a bit of interpolating noise to the data. sc = std(TrainData(:)); TrainData = TrainData + sc./1000.*randn(size(TrainData)); K = max(TrainClass); % number of classes. %%-- Compute the means and the pooled covariance matrix --%% C = zeros(N,N); for l = 1:K; idx = find(TrainClass==l); % measure the mean per class Mi(:,l) = mean(TrainData(:,idx)')'; % sum all covariance matrices per class C = C + cov((TrainData(:,idx)-Mi(:,l)*ones(1,length(idx)))'); end C = C./K; % turn sum into average covariance matrix Pphi = 1/K; Cinv = inv(C); %%-- Compute the LDA weights --%% for i = 1:K Wg(:,i) = Cinv*Mi(:,i); % this is the slope of the plane Cg(:,i) = -1/2*Mi(:,i)'*Cinv*Mi(:,i) + log(Pphi)'; % and this, the origin-intersect. end %%-- Compute the decision functions --%% Atr = TrainData'*Wg + ones(Ptrain,1)*Cg; % see - just a simple linear function! Ate = TestData'*Wg + ones(Ptest,1)*Cg; errtr = 0; AAtr = compet(Atr'); % this compet function returns a sparse matrix with a 1 % in the position of the largest element per row. % convert to indices with vec2ind, below. TrainPredict = vec2ind(AAtr); errtr = errtr + sum(sum(abs(AAtr-ind2vec(TrainClass))))/2; netr = errtr/Ptrain; PeTrain = 1-netr; | ||||||
{638} | ||||||
{885} |
ref: -0
tags: entropy life proteonomics transcription factors
date: 07-08-2011 22:42 gmt
revision:0
[head]
|
|||||
Reduction in Structural Disorder and Functional Complexity in the Thermal Adaptation of Prokaryotes -- read the article. These are my disordered, mesothermophylic notes.
| ||||||
{867} |
ref: -0
tags: evolutionary psychology human mating sexuality discrimination wedlock
date: 01-09-2011 18:22 gmt
revision:1
[0] [head]
|
|||||
From Why Beautiful people have more daughters: "Abuse, degradation, and intimidation are all part of men's unfortunate repertoire of tactics employed in competitive situations. In other words, men are not harassing women because they are treating them differently than men (which is the definition of discrimination under which harassment legally falls), but the exact opposite: men harass women because they are not discriminating between men and women." Interesting argument. But in sexual discrimination cases, the women are not being treated the way they want to be treated - this is more a problem than the inequality. The author then goes on to pose that current sexual discrimination law and policy in US corporations actually inhibits welcome sexual/romantic interest/advances. Many people do find partners at work. Again, I beg to differ: if there is passion between people, things will fall as they should; if policy and culture serves to make this more civilized (provided it's not completely inhibited, as the author suggests), then all the better. In related news: An Analysis of Out-Of-Wedlock Births in the United States Central hypothesis: Contraceptive technology shifted the balance of power between the sexes: prior the pill, women could force the men into promising to marry; in the case of preganancy, cultural standards forced marriage - shotgun marriage. Men accepted these terms because they were uniform across all women - sex implies pregnancy implies child rearing. When contraception became available, this was decoupled, as sex did not beget pregnancy; those women who negotiated on the old terms were likely to lose their mate, hence shotgun marriages (the result of such negotiations) gradually disappeared from culture. The author generally approves of the idea of shotgun marriage, and suggests that a governmental body should enforce a form of it through child support payments. Presently about 40% of children in the US are born out of wedlock. Finally, Serial monogamy increases reproductive success in men but not in women. It rests upon data, only recently gathered, that supports that having multiple partners increases reproductive success more strongly in male than in female humans. This implies that the variance of the fertility of men should be higher than that of women - again, which is borne out in the data, but only weakly: men have 10% higher variance in # of offspring than women. This effect is correlated to serial monogamy - "Compared with men with 1 spouse, men with 3 or more spouses had 19% more children in the total sample". This did not hold with women, nor did varying spouse number in men change the survival rate of their offspring. Irregardless, this reading was spurred by someone mentioning that a genetic analysis of human populations reveals that while 80% of women reached reproductive success, only 40% of men did - implying that historically a few more successful men fathered a large fraction of children. I was unable to find evidence to support this on the internet (and indeed the Behavioral Ecology article gives much less dramatic figures), but it makes intuitive sense, especially in light of some patterns of male behavior. | ||||||
{735} |
ref: -0
tags: processing javascript vector graphics web
date: 05-03-2009 18:20 gmt
revision:0
[head]
|
|||||
http://www.mattryall.net/blog/2008/11/wiki-visualisations-with-javascript -- way cool!! | ||||||
{613} | ||||||
PMID-12383782[0] Reward, motivation, and reinforcement learning.
____References____ | ||||||
{588} | ||||||
images/588_1.pdf -- Good lecture on LDA. Below, simple LDA implementation in matlab based on the same: % data matrix in this case is 36 x 16, % with 4 examples of each of 9 classes along the rows, % and the axes of the measurement (here the AR coef) % along the columns. Sw = zeros(16, 16); % within-class scatter covariance matrix. means = zeros(9,16); for k = 0:8 m = data(1+k*4:4+k*4, :); % change for different counts / class Sw = Sw + cov( m ); % sum the means(k+1, :) = mean( m ); %means of the individual classes end % compute the class-independent transform, % e.g. one transform applied to all points % to project them into one plane. Sw = Sw ./ 9; % 9 classes criterion = inv(Sw) * cov(means); [eigvec2, eigval2] = eig(criterion); See {587} for results on EMG data. | ||||||
{407} | ||||||
http://www.baconbutty.com/blog-entry.php?id=13 how to make a text area where tab key inserts 'tab' into the text (like here - for tables!) "
| ||||||
{35} | ||||||
Overview: a projector light should have good luminous efficiency, have a long life, and most importantly have plenty of energy in the red region of the spectrum. most metal halides have yellow/green lines and blue lines, few have good red lines. http://www.osram.no/brosjyrer/english/K01KAP5_en.pdf in 1000 watt, the Osram Powerstar HQI-TS 1000/d/s looks the best: CRI > 90, 5900K color temperature. Unfortunately, I cannot seem to find any american places to buy this bulb, nor can i determine its average life. It can be bought, at a price, from http://www.svetila.com/eProdaja/product_info.php/products_id/442 { n.b. the osram HMI bulbs are no good-the lifetime is too short} In 400 watt, the Eye Clean Arc MT400D/BUD looks quite good, with a CRI of 90, 6500K color temp. http://www.eyelighting.com/cleanarc.html. EYE also has a ceraarc line, but the 400w bulb is not yet in production (and it has a lower color temperature, 4000K). Can be bought from http://www.businesslights.com/ (N.B. they have spectral charts for many of the lights!)
and fYI, the electrodelass bulbs are made by Osram and are called "ICETRON". They are rather expensive, but last 1e5 hours (!). Typical output is 80 lumens/watt more things of interest:
| ||||||
{81} |
ref: Stapleton-2006.04
tags: Stapleton Lavine poisson prediction gustatory discrimination statistical_model rats bayes BUGS
date: 0-0-2006 0:0
revision:0
[head]
|
|||||