Skip to content

Instantly share code, notes, and snippets.

View YoshiRi's full-sized avatar

Yoshi Ri YoshiRi

  • Shinagawa, Tokyo, Japan
View GitHub Profile
@YoshiRi
YoshiRi / rls_const.m
Last active June 29, 2016 06:49
RLS Source in MATLAB Class
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 2016/6/28 Yoshi R supported by Tokuma I @ Univercity of Tokyo
% The class files for RLS estimation.
% Explanation about this algorithm in Japanese is here
% ( URL : http://yoh.ise.ibaraki.ac.jp/edu/graduateschool/Project1.pdf )
% 6/29 Updated # add property forgetting_function
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
classdef rls_const < handle
% Estimate Constant value
@YoshiRi
YoshiRi / rls_const_func.m
Created June 30, 2016 08:59
RLS function for MATLAB
function [Cta, Pn, Rn] = rls_const_func(Cta_,Pn_,Rn_,Yn ,Zn)
%% forgetting factor (Time varying)
Rn = (1 - 0.01)*Rn_ + 0.01;
%% function
Num = Rn+Zn'*Pn_*Zn;
Pn = 1/Rn*( Pn_ - (Pn_ * Zn * Zn' * Pn_/Num) );
Ln = Pn_*Zn /Num;
En = Yn - Zn.' * Cta_;
@YoshiRi
YoshiRi / rls_single.m
Last active July 8, 2016 11:03
Simpler RLS class for MATLAB
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 2016/6/28 Yoshi R supported by Tokuma I @ Univercity of Tokyo
% The class files for RLS estimation.
% Explanation about this algorithm in Japanese is here
% ( URL : http://yoh.ise.ibaraki.ac.jp/edu/graduateschool/Project1.pdf )
% 6/29 Updated # add property forgetting_function
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
classdef rls_single < handle
% Estimate Constant value
@YoshiRi
YoshiRi / rls_single_func.m
Created July 8, 2016 11:04
RLS Program for MATLAB Estimating one Parameter from single input and output
function Theta_est = rls_single_func(Yn ,Zn)
%% forgetting factor (Time varying)
persistent Rn ;
if isempty(Rn)
Rn = 0.95;
end
Rn = (1 - 0.01)*Rn + 0.01;
%% Covariance Mat and Estimated val
persistent Pn;
@YoshiRi
YoshiRi / ImageMatching.m
Last active April 18, 2018 11:01
Evaluation function for Image Matching SSD, NCC, ZNCC,
%% SSD %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function e = SSD(img1,img2)
if(~(size(img1)==size(img2)))
error('IMG size is differnt!');
end
[height,width] = size(img1);
Total = height * width;
@YoshiRi
YoshiRi / MutualInformation.m
Last active August 16, 2017 00:22
Calculations of Mutual Information between 2 image
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 2015 10/5 Yoshi R @ Univ. Tokyo
% input : 2 image with same size, grad:tone of image
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function mu = MutualInformation(img1,img2, grad)
if(~(size(img1)==size(img2)))
error('IMG size is differnt!');
end
%% data
xhat = [ 1 2 3 4 1 2 3 4 -1 -2 -3 -4 -1 -2 -3 -4].';
yhat = [ 1 2 3 4 -1 -2 -3 -4 1 2 3 4 -1 -2 -3 -4].';
phat = [1 2 1 2 -1 5]; % a,b,c,d,e,f
Noise = 5*randn(16,1);
syms x y z
p = sym('p',[ 1 6]);
@YoshiRi
YoshiRi / beamer_temp.sty
Last active May 2, 2017 17:29
Beamer Template Package
% 印刷時のサイズ調整?
\AtBeginDvi{\special{pdf:tounicode 90ms-RKSJ-UCS2}}
%%%%% 和文用 %%%%%
\usepackage{bxdpx-beamer}
\usepackage{pxjahyper} % PDF目次文字化け回避(platexでは不要)
\usepackage{minijs}%和文用
%%%%% スライドの見た目 %%%%%
@YoshiRi
YoshiRi / facerecog.py
Last active June 22, 2017 16:46
face recognizing for static image
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Jun 23 00:05:14 2017
@author: ossyaritoori
"""
#coding: utf-8
# -*- coding: utf-8 -*-
# largely from here
# http://russeng.hatenablog.jp/entry/2015/06/16/004704
import numpy
import cv2
# get file name efficiently
from glob import glob
def main():