2010년 5월 18일 화요일

[공모전] bada Developer Challenge (5/17개최)

1회 삼성 bada Developer Challenge가 개최됩니다.

 

세계대회 출전을 통해 역량을 키울 수 있는 좋은 기회가 될 것 같습니다.

 

공모전 세부 내용은 Bada 웹사이트를 통해 확인하실 수 있으며,

Bada SDK는 이미 Release 되어 사용할 수 있으니 바로 학습/개발 가능합니다

 

1차 제출 일정이 7월 말입니다.

 

- bada Developer Challenge 바로 가기

http://developer.bada.com/challenge/index.do?menu=MC01160200&utm_source=samsung&utm_medium=newsletter_kr&utm_campaign=dc

 

- bada SDK 다운로드 -

http://developer.bada.com/apis/docs/commonpage.do?menu=MC01040000&utm_source=samsung&utm_medium=newsletter_kr&utm_campaign=sdk

2010년 5월 9일 일요일

[Java] Serial Communication API (시리얼통신)

아직까지도 주요 통신 수단인 시리얼 통신(RS-232C)은 현재 J2SE에서 제공하고 있지 않다.


하지만 하드웨어 관련한 프로젝트를 해보면 알겠지만 매우 필요한 수단이다.


일단은 표준 API가 아니므로 추가적으로 설치해야하는데 다음 링크를 따라가보자


[링크] : http://java.sun.com/products/javacomm/index.html

[파일] : 

 

* 설치


1. 링크를 따라가면 화면 좌측으로 다운로드 링크가 있다. 따라가도록 하자.

 

2. 아래쪽으로 플랫폼을 선택할 수 있는데 윈도우라면 Generic을 선택한 후 다운로드를 진행한다.

    (현재는 로그인을 해야 다운로드가진행된다. 메일주소와 이름등만 적으면 되므로 가입후 진행하자)

 

2. 첨부파일 저장 후 comm.jar, javax.comm.properties, win32com.dll 파일을 java.exe 파일이 있는 C:\Program Files\Java\jdk1.6.0_18\bin (경로는 본인에 맞게)에 복사한다.


3. comm.jar를 클래스 패스에 추가시킨다.


4. 사용하려는 클래스에서 import javax.comm.*; 을 하여 사용한다.

 

 


* 사용예제


import java.io.*;

import javax.comm.*;
public class Rs232c {
    public static void main( String arg[] ) {
        try {
            CommPortIdentifier ports = CommPortIdentifier.getPortIdentifier( "COM1" );
            SerialPort port = ( SerialPort )ports.open( "RS232C", 1000 );
            port.setSerialPortParams( 9600,
                SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE );
            port.setFlowControlMode( SerialPort.FLOWCONTROL_NONE );
            OutputStream out = port.getOutputStream();
            String msg = "Serial Comm.\n";
            out.write( msg.getBytes() );
            out.flush();
            out.close();
            port.close();
        }
        catch( Exception e ) {
            System.out.println( "Error:" + e.getMessage() );
        }
    }
}

2010년 5월 7일 금요일

[GOCR] 소스분석 <gocr-0.48/src/ocr0.c/ocr0_oO()>

문자인식을 위한 프로젝트를 진행하기위해 gocr소스를 분석하였다.

일단 전체적으로 분석하기에는 구조가 조금 복잡한 면이 있어서

알파벳 o,O를 분석하는 함수인 ocr0_oO()를 분석하고자 한다.

 

static wchar_t ocr0_oO(ocr0_shared_t *sdata){...}

- 내부 사용 함수

 get_bw()

 num_cross()

 loop()

 setac()

 

1. char get_bw(int x0, int x1, int y0, int y1, pix * p, int cs, int mask)

  - Look for dots in the rectangular region x0 <= x <= x1 and y0 <= y <= y1 in pixmap p.  The two low order bits in mask indicate the color of dots to look for: If mask==1 then look for black dots (where a pixel value less than cs is considered black).  If mask==2 then look for white dots.  If mask==3 then look for both black and white dots. If the dots are found, the corresponding bits are set in the returned value.  Heavily used by the engine ocr0*.cc

  - pixmap p의 x0 <= x <= x1 와 y0 <= y <= y1 범위의 사각형 영역의 점을 찾는다. mask 변수의 하위 2비트는 찾으려고 하는 점들의 색을 나타낸다. : mask==1이면 검은점을 나타내고(cs보다 작은 값은 검은점으로), mask==2이면 흰점을 mask==3이면 검은점과 흰점 둘다 나타낸다. 특정 점을 찾아 그에 해당하는 리턴 값으로 셋팅된다. 주로 ocr0*.cc에서 쓰인다.

 

2. int num_cross(int x0, int x1, int y0, int y1, pix *p, int cs)

  - more general Mar2000 (x0,x1,y0,y1 instead of x0,y0,x1,y1! (history)) look for black crossings throw a line from x0,y0 to x1,y1 and count them follow line and count crossings ([white]-black-transitions)

  - ex: horizontal num_cross of 'm' would return 3
  - fail for:  .a... a-to-b counts no transitions, but there is
 *            ...#.
 *            ..#..
 *            .#..b

  - Mar2000보다 일반적인 형태로 x0,y0부터 x1,y1 선분에 있는 검은 색 교차지점(백-흑 변화)을 찾아 그 개수를 리턴한다.

  - 예) m의 가로 num_cross값은 3을 리턴한다.

 

3. int loop(pix *p,int x,int y,int l,int cs,int col, DIRECTION r)

  - move from x,y to direction r until pixel of color col is found or maximum of l steps return the number of steps done

  - x,y부터 r방향으로 이동하면서 col 색을 찾거나 최고 l스텝까지 이동하여 스텝값을 리턴한다.

 

4. int setac(struct box *b, wchar_t ac, int weight)

  - this function will be replaced by a call of setas() later

  - 이 함수는 추후 setas()로 대체될 것이다.

 

5. int setas(struct box *b, char *as, int weight)

  - set alternate chars and its weight, called from the engine if a char is recognized to (weight) percent can be used for filtering (only numbers etc) often usefull if Il1 are looking very similar
   should this function stay in box.c ??? weight is between 0 and 100 in percent, 100 means absolutely sure not final, not time critical (js) replace it by a string-function setaobj(*b,"string",weight) and let call setac the setas function

  - 서로 엇갈리는 문자들과 이 문자들의 가중치을 정하고, ........ ??? 가중치값은 0과 100퍼센트 사이값이다.