This file contains hidden or 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
/** | |
* 2つのmecab結果のベクトル内積を計算し、正規化を行う。 | |
* | |
* @param $mecab_rt1 テキスト1 | |
* @param $mecab_rt2 テキスト2 | |
*/ | |
public static function textmatching($mecab_rt1, $mecab_rt2){ | |
// 改行コードで分けて配列に格納する | |
$mecab_array1 = explode("\n", $mecab_rt1); |
This file contains hidden or 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
// execで形態素解析する | |
$bash1 = '/usr/local/bin/mecab ' . $text_file_name; | |
$mecab_rt1 = shell_exec($bash1); |
This file contains hidden or 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
import java.io.IOException; | |
import javax.servlet.annotation.WebServlet; | |
import javax.servlet.http.HttpServlet; | |
import javax.servlet.http.HttpServletRequest; | |
import javax.servlet.http.HttpServletResponse; | |
@WebServlet(urlPatterns = { "/TomcatTest" }) | |
public class TomcatTest extends HttpServlet { | |
private static final long serialVersionUID = 1L; |
This file contains hidden or 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
/** | |
* ホモグラフィー(透視変換)を行う | |
* | |
* pts1 元の4点 | |
* pts2 変換後の4点 | |
*/ | |
Mat cv_perspective(InputArray src, Point2f pts1[], Point2f pts2[]) { | |
// ホモグラフィ行列取得。サーバアプリ内でも求めているので3×3のMatを自作すれば不要。 | |
Mat perspective_matrix = getPerspectiveTransform(pts1, pts2); | |
Mat dst_img; |
This file contains hidden or 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
Vector<KeyPoint> keyPoint0 = keypoints_vec[0]; | |
Vector<KeyPoint> keyPoint1 = keypoints_vec[1]; | |
Mat descriptor0 = descriptors_vec[0]; | |
Mat descriptor1 = descriptors_vec[1]; | |
vector<DMatch> matches; | |
BFMatcher matcher(NORM_HAMMING, true); | |
matcher.match(descriptor0, descriptor1, matches); |
This file contains hidden or 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
#include <stdio.h> | |
int main(int argc, char *argv[]){ | |
FILE *fp; | |
int c, n; | |
if ((fp = fopen(argv[1], "rb")) == NULL) { | |
printf("file open error!\n"); | |
return -1; | |
} |
This file contains hidden or 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
$ch2 = curl_init($url); | |
curl_setopt($ch2, CURLOPT_SSL_VERIFYPEER, FALSE); // -k | |
curl_setopt($ch2, CURLOPT_POST, TRUE); // POST | |
curl_setopt($ch2, CURLOPT_BINARYTRANSFER, TRUE); // --data-binary | |
curl_setopt($ch2, CURLOPT_HTTPHEADER, ['Content-Type: text/xml;charset=utf-8', 'User-Agent: curl']); // Http Header | |
// 返り値を文字列として受け取る場合はONに | |
//curl_setopt($ch2, CURLOPT_RETURNTRANSFER, TRUE); | |
//curl_setopt($ch2, CURLOPT_TRANSFERTEXT, TRUE); | |
//curl_setopt($ch2, CURLOPT_COOKIESESSION, TRUE); |
This file contains hidden or 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
template<class II, class OI> inline OI std_copy(II in, II end, OI out) { | |
for (; in != end; ++in, ++out) *out = *in; | |
return out; | |
} | |
int main() { | |
int a [] = {1, 2, 3}; | |
int b [] = {4, 5, 6}; | |
std_copy(a, a + 3, b); | |
} |
This file contains hidden or 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
#include <iostream> | |
#include <sstream> | |
// この順番でインクルード | |
#include <Windows.h> | |
#include <NuiApi.h> | |
#include <opencv2/opencv.hpp> | |
#define ERROR_CHECK( ret ) \ |
This file contains hidden or 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
#include <iostream> | |
#include <sstream> | |
// この順番でインクルード | |
#include <Windows.h> | |
#include <NuiApi.h> | |
#include <opencv2/opencv.hpp> | |
#define ERROR_CHECK( ret ) \ |