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
cv::Mat image=cv::imread("./image.png",-1); | |
cv::Mat trans=cv::imread("./trans.png",0); | |
cv::Rect rect1(startColumn1,startRow1,trans.cols,trans.rows); | |
cv::Mat subdst1=dst(rect1); | |
trans.convertTo(subdst1,subdst1.type(),alpha);//double alphaは透過率[0.0, 1.0] | |
cv::Rect rect2(startColumn2,startRow2,image.cols,image.rows); | |
cv::Mat subdst2=dst(rect2); | |
image.copyTo(subdst2); |
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
cv::Mat image=cv::imread("./image.png",-1); | |
cv::Mat image_mask=cv::imread("./mask.png",0); | |
cv::Rect rect(startColumn,startRow,image.cols,image.rows); | |
cv::Mat subdst=dst(rect); | |
image.copyTo(subdst,image_mask); |
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
# -*- coding: utf-8 -*- | |
#BoF(SIFT)により一般物体認識を行うサンプルコード | |
#今回はイルカと象を識別 | |
#評価用のデータセットとしてCaltech 101を使用 | |
#see also: http://www.vision.caltech.edu/Image_Datasets/Caltech101/ | |
import cv2 | |
import numpy as np | |
from sklearn import svm | |
from sklearn import cross_validation |
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
Ave. score(BagOfFeatures):70.492308[%] | |
Ave. score(BagOfFeaturesGMM):71.323077[%] |
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
#Its behavior is like hash (associative array). | |
hash.test=list("square"=function(x){x**2}, | |
"pi"=3.1415926535) | |
hash.test[["square"]](2) | |
hash.test[["pi"]] | |
#probability that a random selected number is a prime number. | |
6/hash.test[["square"]](hash.test[["pi"]]) |
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
> hash.test[["square"]](2) | |
[1] 4 | |
> hash.test[["pi"]] | |
[1] 3.141593 | |
> | |
> #probability that a random selected number is a prime number. | |
> 6/hash.test[["square"]](hash.test[["pi"]]) | |
[1] 0.6079271 |
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
#過去の解答を読み込む | |
examH25<-read.csv("C:/center_kokugo - H25.csv",header=T) | |
examH24<-read.csv("C:/center_kokugo - H24.csv",header=T) | |
#過去問をくっつけます | |
exam<-rbind(examH25,examH24) | |
#選択肢が5個のものだけの解答を抽出します | |
exam5<-exam$Correct[exam$Choices==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
> #各選択肢の出現回数を求めます | |
> choiceTable<-table(exam5) | |
> choiceTable | |
exam5 | |
1 2 3 4 5 | |
15 12 13 12 15 | |
> | |
> #各選択肢に対して同じ回数出現しているかを統計的に調べます。 | |
> #(カイ二乗検定による適合度検定) | |
> chisq.test(choiceTable) |
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
No | Part | Correct | Choices | |
---|---|---|---|---|
1 | 1 | 1 | 5 | |
1 | 2 | 3 | 5 | |
1 | 3 | 1 | 5 | |
1 | 4 | 1 | 5 | |
1 | 5 | 5 | 5 | |
2 | 6 | 1 | 5 | |
3 | 7 | 5 | 5 | |
4 | 8 | 2 | 5 | |
5 | 9 | 5 | 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
No | Part | Correct | Choices | |
---|---|---|---|---|
1 | 1 | 3 | 5 | |
1 | 2 | 2 | 5 | |
1 | 3 | 5 | 5 | |
1 | 4 | 3 | 5 | |
1 | 5 | 5 | 5 | |
2 | 6 | 4 | 5 | |
3 | 7 | 5 | 5 | |
4 | 8 | 1 | 5 | |
5 | 9 | 3 | 5 |