Skip to content

Instantly share code, notes, and snippets.

View masazdream's full-sized avatar

Masahiro I masazdream

View GitHub Profile
//============================================================================
// Name : Sample243_01.cpp
// Author :
// Version :
// Copyright : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================
#include <cv.h>
#include <highgui.h>
// アフィン変換の未知数
$a = '';
$b = '';
$c = '';
$d = '';
$l = '';
$m = '';
// 連立方程式を解く
$a = ($point[0]['x2'] * $point[1]['y1'] + $point[1]['x2'] * $point[2]['y1'] + $point[2]['x2'] * $point[0]['y1'] - $point[0]['x2'] * $point[2]['y1'] - $point[1]['x2'] * $point[0]['y1'] - $point[2]['x2'] * $point[1]['y1']) / ($point[0]['x1'] * $point[1]['y1'] + $point[1]['x1'] * $point[2]['y1'] + $point[2]['x1'] * $point[0]['y1'] - $point[0]['x1'] * $point[2]['y1'] - $point[1]['x1'] * $point[0]['y1'] - $point[2]['x1'] * $point[1]['y1']);
PHPからAWSのS3を使う。
○準備(CentOS6.3が前提
#pear upgrade pear
#pear channel-discover pear.amazonwebservices.com
#pear channel-discover guzzlephp.org/pear
#pear channel-discover pear.symfony.com
#pear install aws/sdk
@masazdream
masazdream / upload_for_s3_php_example
Created January 31, 2013 13:26
upload_for_s3_php_example。AWSのキーは管理画面から取得します。キーには書き込み権限のあるユーザのものを使用します。
<?php
// load SDK
require '/usr/share/pear/AWSSDKforPHP/aws.phar';
use Aws\Common\Aws;
use Aws\Common\Enum\Region;
use Aws\S3\Enum\CannedAcl;
use Aws\S3\Exception\S3Exception;
use Guzzle\Http\EntityBody;
<?php
class FileReadURL{
function getUrl(){
$aws_access_key_id = '[読み取り用のAWSキー]';
$aws_secret_key = '[読み取り用のAWSシークレットキー]';
$aws_bucket = 'バケット名';
$downloadAudioTimeout = '作成したURLの有効時間';
$file_path = '[ディレクトリパス]/[ファイル名]';
@masazdream
masazdream / HelloWorldJNI.java
Last active December 17, 2015 05:48
JNIでJavaからCPPを呼び出す<1>
package jp.sp.jni;
public class HelloWorldJNI {
static {
System.loadLibrary("HelloWorldJNI");
}
public native String sayHelloWorld();
public static void main(String[] args){
@masazdream
masazdream / HelloWorldJNI.cpp
Last active December 17, 2015 05:48
JNI JavaからCPPを呼び出す<2>
//============================================================================
// Name : HelloWorldJNI.cpp
// Author :
// Version :
// Copyright : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================
#include "jp_sp_jni_HelloWorldJNI.h"
@masazdream
masazdream / build.xml
Last active December 17, 2015 05:48
JNI JavaからCPPを呼び出す<3>
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- WARNING: Eclipse auto-generated file.
Any modifications will be overwritten.
To include a user specific buildfile here, simply create one in the same
directory with the processing instruction <?eclipse.ant.import?>
as the first entry and export the buildfile again. -->
<project basedir="." default="build" name="jni">
<property environment="env" />
<property name="ECLIPSE_HOME" value="../../eclipse" />
<property name="debuglevel" value="source,lines,vars" />
@masazdream
masazdream / JNI_javaからcppを実行する
Created May 11, 2013 14:27
JNI_javaからcppを実行する<0>
JNI Javaからcppを呼び出してみる。
■まずはJavaでコード書きます
https://gist.github.com/masazdream/5560075
<script src="https://gist.github.com/masazdream/5560075.js"></script>
■対応するCppファイルを書きます
https://gist.github.com/masazdream/5560082
//============================================================================
// Name : CombinationImages.cpp
// Author :
// Version :
// Copyright : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================
#include <cv.h>
#include <cvaux.h>