This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function radius = imradius(sz) | |
% imradius | |
% radius = imradius(sz) | |
% | |
% return radius in pixcels in an images sz | |
radius = hypot(((1:sz(1)) - sz(1)/2 - 0.5)', ((1:sz(2)) - sz(2)/2 - 0.5)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
caxis([-max(abs(caxis)), max(abs(caxis))]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% MovieData should be arranged 4D [col, row, rgb, time] | |
% convert to frame (for movie function or writeVideo function in VideoWriter class) | |
%% Test RGB Data (with for loop) | |
NofFrame = 300; | |
MovieData = rand(64, 64, 3, NofFrame); | |
for fi = 1:NofFrame | |
frame(fi) = im2frame(MovieData(:, :, :, fi)); | |
end | |
movie(frame, 1, 30); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function response = slack_incoming(url, varargin) | |
%% response = slack_incoming(url, payload) | |
% url : [char] Webhook URL (you have to get Webhook URL from Slack) | |
% payload : [char, struct] payload must be JSON style string or struct | |
% # payload is a case when varagin is a single argument | |
% varargin : [char/char] optional mode for define payload as key/value pair | |
% | |
% response : 'ok' POST of payload was succeeded. | |
% otherwise failed to POST | |
% |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Hash = getGitHash(varargin) | |
if nargin == 0 || strcmp(varargin{1}, 'HEAD') | |
[~, ans] = system('git rev-parse HEAD'); | |
elseif nargin == 1 && isstr(varargin{1}) | |
[~, ans] = system(sprintf('git rev-parse %s', varargin{1}); | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function varargout = Cellfun(varargin) | |
%% Cellfun <- cellfun | |
% Avoid to type 'UniformOutput', false | |
if nargin | |
if nargout | |
varargout = cellfun(varargin{:}, 'UniformOutput', false); | |
else | |
cellfun(varargin{:}, 'UniformOutput', false); | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Replace <http://example.com/lecture%d.pdf> to specified filename | |
for i in {1..2}; do wget $(printf <http://example.com/lecture%d.pdf> $i); done; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
checker = @(X, Y, w, h, dx, dy) (mod(ceil((X-dx)/w), 2) == mod(ceil((Y-dy)/h), 2)); | |
XYrange = @(X, Y, Xmin, Xmax, Ymin, Ymax) (Xmin <= X & X <= Xmax & Ymin <= Y & Y <= Ymax); | |
[X, Y] = meshgrid(1:1920, 1:1080); | |
[THETA,RHO] = cart2pol(X-mean(X(:)), Y-mean(Y(:))); | |
THETA = -THETA; | |
Img = double(checker((180*THETA/pi), RHO, 15, 50, 0, 0) & XYrange(THETA, RHO, -inf, inf, 200, 400)) + ... | |
double(not(XYrange(THETA, RHO, -inf, inf, 200, 400))).*0.5; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
checker = @(X, Y, w, h, dx, dy) uint8((mod(ceil((X-dx)/w), 2) == mod(ceil((Y-dy)/h), 2)).*255); | |
[X, Y] = meshgrid(1:1920, 1:1080); | |
Img = checker(X, Y, 120, 120, 0, 0) | |
imagesc(Img); | |
imwrite(Img, filename); |