Skip to content

Instantly share code, notes, and snippets.

View ochilab's full-sized avatar

おちラボ ochilab

View GitHub Profile
@ochilab
ochilab / _sampleProperty.cs
Last active December 17, 2015 19:29
C#のプロパティの記述方法。初心者向けのネタです。
class Mark{
private int x;
private int y;
public int X {
set {
this.x = value;
}
get {
@ochilab
ochilab / _sampleSort.cs
Last active December 17, 2015 19:29
C#でクラスの任意の変数を対象にしたソートプログラムの例
//Listにクラスを代入
foreach (var item in blobs) {
markList.Add(new Marker(item.X,item.Y));
}
//ソート実行(Yをソート対象とする場合)
markList.Sort(sortByY);
//出力例
foreach (Marker mk in markList) {
Console.WriteLine(mk.X + "," + mk.Y);
}
@ochilab
ochilab / trimming.cs
Created May 30, 2013 03:20
OpenCVSharpでトリミングする関数
private IplImage trimming(IplImage src, int x, int y, int width, int height){
IplImage dest = new IplImage(width, height, src.Depth, src.NChannels);
Cv.SetImageROI(src, new CvRect(x, y, width, height));
dest = Cv.CloneImage(src);
Cv.ResetImageROI(src);
return dest;
}
@ochilab
ochilab / binarize.cs
Created May 30, 2013 10:08
OpenCVSharpでの2値化処理
private IplImage binarize(IplImage src, int threshould) {
//グレースケールに変換
IplImage gray = new IplImage(src.Width,src.Height, BitDepth.U8, 1);
src.CvtColor(gray, ColorConversion.BgrToGray);
//二値化処理
Cv.Threshold(gray, gray, threshould, 255, ThresholdType.Binary);
return gray;
}
@ochilab
ochilab / EJExample.java
Created June 18, 2013 07:59
英和用例検索システム用データクラス
package org.ochilab.ejassist.client.entity;
import com.google.gwt.user.client.rpc.IsSerializable;
public class EJExample implements IsSerializable {
private String itemName;
private String enSentence;
private String jaSentence;
private String[] enWord;
@ochilab
ochilab / CiNiiPaperRDF.java
Last active December 18, 2015 15:19
CiNii検索用データクラス集
package org.ochilab.cinii.entity;
public class CiNiiPaperRDF {
private String enTitle;
private String jaTitle;
private String enDescription;
private String jaDescription;
public CiNiiPaperRDF(){
@ochilab
ochilab / MyCanvas.ui.xml
Last active December 18, 2015 15:19
GWTでHTML5Canvasを利用して図形を描画する際のサンプル。XMLファイルはUIBinderの記述方法です。 gwt.xmlには <inherits name='com.google.gwt.canvas.Canvas'/>が必要です。
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
xmlns:g="urn:import:com.google.gwt.user.client.ui"
xmlns:c="urn:import:com.google.gwt.canvas.client">
<ui:style>
</ui:style>
<g:HTMLPanel>
<c:Canvas ui:field="canvas"/>
</g:HTMLPanel>
@ochilab
ochilab / Feed.java
Created June 18, 2013 08:28
GWTでJSONPを利用するサンプル。Twitterを例にしていますが、今は無効です。
package org.ochilab.jsonp.client;
import com.google.gwt.core.client.JavaScriptObject;
import com.google.gwt.core.client.JsArray;
class Feed extends JavaScriptObject {
protected Feed() {}
public final native JsArray<User> getTrends() /*-{
@ochilab
ochilab / SampleData.cs
Created June 20, 2013 11:21
C#でDynamoDBにMapperを利用してデータを保存するサンプル
using Amazon.DynamoDB.DataModel;
[DynamoDBTable("DynaTest")]
class SampleData {
[DynamoDBHashKey(AttributeName = "id")]
public string id { get; set; }
[DynamoDBRangeKey(AttributeName = "name")]
public String name { get; set; }
[DynamoDBProperty("value")]
public String value { get; set; }
@ochilab
ochilab / ErrorList.cpp
Last active December 18, 2015 18:59
レポート用紙スキャンシステムのデータクラス
#include "StdAfx.h"
#include "ErrorList.h"
using namespace gazou1;
ErrorItem::ErrorItem()
{
this->file = "" ;
this->page = 0 ;
this->errortype = "" ;
this->bangou = "" ;