Skip to content

Instantly share code, notes, and snippets.

View rysk-t's full-sized avatar

Ryosuke Takeuchi rysk-t

  • Nagoya Univ.
  • Japan
View GitHub Profile
@rysk-t
rysk-t / segmentation.m
Created September 27, 2015 06:50
segmentation
radi = 10;
seD = strel('diamond',1);
close all;
img = (ROI.RAW(:,:,2))*255;
simg = size(img);
background = imopen(medfilt2(img, [25 25]), strel('disk', round(length(img)/60)));
imagesc(img-background ); axis image
%img = img - background;
img = img - min(img(:));
close all; tic
[X Y] = meshgrid(1:512, 1:512);
Z = (X-255).^2 + (Y-255 -200).^2;
Z(Z<50^2) = 1;
Z(Z~=1) = 0;
toc
imagesc(Z); axis image; colorbar
@rysk-t
rysk-t / ipadmov.m
Created September 11, 2015 18:15
matlab mobile with matlab2015; acceralation & orientation
if ~exist('m')
m = mobiledev()
end
i=1;
tic
close all
clear t x
while true
subplot(121)
clear all;
close all;
%% 適当にスパイクっぽいものの生成
x = -1.:0.25:6*pi;
mu = [1 2];
sigma = [1 0.5; 0.5 2];
R = chol(sigma);
z = randn(10,2)*R;
z2 = randn(100120, 1);
@rysk-t
rysk-t / xytMat2avi.matlab
Created August 22, 2015 12:58
makeAVI from XYT
function [] = msclab_mat2avi(frames, exportfileName, fps)
% function [avifile] = msclab_mat2avi(frames, exportfileName, fps)
% function for making moviefile from XxYxTime matrix
% Value range should be 0~1.
frameVol = size(frames);
roi_window = [0 0 size(frames, 1) size(frames, 2)];
disp(['Export "' exportfileName '"...']);
disp 'MatrixSize'
disp([frameVol])
%% Cell masker
close all; clear all;
rawImg = imread('coins.png');
mask = zeros(size(rawImg));
mask(1:end-1,1:end-1) = 1;
% img = medfilt2(rawImg, [0.5 0.5]);
img = imsharpen(rawImg);
segmentImage(img)
%%
@rysk-t
rysk-t / Lighting.ino
Created February 21, 2015 12:11
Lighting test in my house (Panasonic LED Light Remote Control)
int ir_out = 12;
int led = 9;
// Original Codefrom http://eikatou.net/blog/2012/07/1796/
// 全明
unsigned int data[] = {347,174,44,44,42,43,43,130,44,132,42,44,41,131,43,44,43,44,43,43,43,131,42,43,43,43,43,130,43,44,43,133,41,43,43,130,43,45,42,43,42,132,43,44,42,43,43,43,44,45,41,43,43,42,45,131,42,130,43,46,41,131,43,46,41,44,42,131,42,45,41,131,42,44,43,43,43,131,42,45,43,43,43};
unsigned int dataWarm[] = {343,173,46,43,40,48,38,133,40,135,38,48,38,136,38,48,40,45,38,48,41,132,41,45,38,48,38,132,41,46,41,135,41,45,38,135,38,48,38,48,38,136,38,133,40,136,38,48,42,44,38,136,38,132,41,48,38,136,38,48,38,48,38,48,38,133,41,48,38,135,38,48,38,48,38,133,40,132,44,42,42,132,44};
unsigned int dataCold[] = {343,179,41,43,43,46,40,132,39,132,41,45,41,131,42,48,40,43,41,48,41,130,41,46,40,46,41,130,44,48,38,132,41,46,41,132,41,46,41,48,38,130,43,133,41,132,41,48,39,45,41,46,41,131,43,45,41,132,41,45,41,46,41,45,41,132,41,132,41,132,41,45,41,45,42,132,41,132,42,48,38,132,41};
int last = 0;
unsigned long us = micros
clear all;
close all;
% PVM1741 Params
dp.Dist = 570;
dp.Width = 365.8;
dp.WidPx = 1920;
% calc
dp.WidDeg = 2*(atan(0.5*dp.Width/dp.Dist)*180/pi); % Angle of View
@rysk-t
rysk-t / pmid2APA.m
Last active August 29, 2015 14:15
parsing medline by matlab
function [Citation] = pmid2APA(pmid)
%%
bufCell=pmid2medlineCell(pmid);
%% JNS用
ROIcitation={'AU' 'DP' 'TI' 'TA' 'VI' 'IP' 'PG'};
for i=1:length(ROIcitation)
eval(['Cell.' ROIcitation{i} '=strfind(bufCell, ''' ROIcitation{i} ''' );']);
eval([ROIcitation{i} '=' '[];']);
end
@rysk-t
rysk-t / linspace.rb
Created February 3, 2015 04:24
linspace in ruby
def linspace(initVal, last, num)
arr = [*initVal..num]
arr = arr.collect{|i| i.to_f*last/num}
return arr
end