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
function colors = calcColorNum(RGBmat)
% RGBmat must be MxNx3 double
% Tue Nov 26 18:42:52 2013 Ryosuke Takeuchi
L = zeros([size(RGB,1) size(RGB,2)]);
colors = squeeze(RGB(1,1,:))';
for r = 1:size(L,1);
for c = 1:size(L,2);
colorNum = size(colors,1);
@rysk-t
rysk-t / init.el
Created December 2, 2013 12:35
matlab.el configuration
(add-to-list 'load-path (expand-file-name "~/.emacs.d/elisp/matlab-emacs/")) %パス設定
(autoload 'matlab-mode "matlab" "Enter Matlab mode." t)
(setq auto-mode-alist (cons '("\\.m$" . matlab-mode) auto-mode-alist))
(add-hook 'matlab-mode-hook
'(lambda ()
(set-buffer-file-coding-system 'sjis-dos))) %M-ファイルはシフトJISで開く
(setq matlab-shell-command "/Applications/MATLAB_R2012a_Student.app/bin/matlab" %bashにパス通しても上手くいかなかったので
matlab-indent-level 2 %ここら辺は好みでどうぞ
@rysk-t
rysk-t / matlabfunclist.rb
Created December 6, 2013 03:48
Getting Function list from Mathworks by "Nokogiti" (rubygem)
require "Nokogiri"
require "open-uri"
url = 'http://www.mathworks.co.jp/jp/help/matlab/functionlist.html'
doc = Nokogiri::HTML(open(url).read)
hoge = doc.css('td.term')
fuga = doc.css('td.description')
for i in 0..hoge.size-1
puts fuga[i].text
@rysk-t
rysk-t / wn.pde
Created June 7, 2014 16:43
random noise processing
int DispW = 1280;
int DispH = 720;
void setup()
{
frameRate(30);
size(DispW, DispH);
//noStroke();
noCursor();
rectMode(CENTER);
@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
@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
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 / 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
%% 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 / 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])