얼굴을 검출하는 방법은 많다. 지금 포스팅 된 글은 얼굴 정면을 기계학습시킨 xml을 활용해서 만든 자료이다.약간만 틀어저도 얼굴로 인식을 안한다는.....( 이 xml은 인터넷에 많이 있으니 참고하길... ) #include "cv.h" #include "highgui.h" int main() { int i; CvHaarClassifierCascade *cascade; // face sequence will reside in the storage CvMemStorage *storage; IplImage *image; CvSeq *faces; const char *classifer = "haarcascade_frontalface_alt.xml"; // load classfier cascade from X..
Checked or Unchecked Exceptions? 우선 Checked Exception은 throws를 사용해서 명시적으로 표시해주거나, try-catch-finally를 사용해서 예외를 처리하게 된다. 반면, UncheckedException은 이런 요구들을 처리하지 않아도 된다. 둘째로, Checked Exception은 java.lang.Exception을 바로 상속하며, UncheckedException은 java.lang.RuntimeException을 상속받도록 되어있다. (자바 예외 계층구조는 다음과 같이 되어있다.) RuntimeException을 상속받은 예외들(UncheckedException)은 런타임시에 확인되며, CheckedException은 컴파일시에 확인되는 예외들이다.
properties을 사용하기 위해 우선, 프로젝트에 properties파일을 생성해야한다. 자신이 원하는 이름의 properties파일을 사용하는 프로젝트에 생성하자. 확장명은 ????.properties이다. properties는 자료구조의 Map에서 key와 value로 구성되어, 사용되는 것과같이 유사한 방식으로 사용한다. properties에서 key=value로 개행하면서 글만 써주면된다. public static String getClassName(String key) { Properties properties = new Properties(); try { properties.load(new FileInputStream("project.properties")); } catch (FileNot..
문자열로 클래스를 만들기 위해서는 java.lang.Class.forName() 을 사용할 수 있다. 우선, Class.forName()의 정의는 이렇다. The java.lang.Class.forName(String name) method returns the Class object associated with the class or interface with the given string name. The java.lang.Class.forName(String name, boolean initialize, ClassLoader loader) method returns the Class object associated with the class or interface with the given stri..
자바에서 MySql을 사용하기 위해서는 Connector가 필요하다. 다음 링크에서 최신버전의 mysql Connector를 받고, 압축 해제 후 jar파일을 사용하고자하는 프로젝트에 추가해준다. LINK http://dev.mysql.com/downloads/connector/j/5.0.html#downloads jar파일을 추가한 다음에는 사용하는 프로젝트의 클래스에서 import java.sql.*; 를 추가해준다. public class DBManager { private Connection conn; private Statement stmt; private DBManager() { }; private static class SingleHolder { public static DBManager s..
OpenCV를 설치하기 위해서는 아래의 링크로 들어가서 다운로드 받는다.http://opencv.org/downloads.html 원하는 경로를 설정하고, Extract를 누르게 되면 다음과 같이 설치가 진행된다. 설치가 완료되면, 원하는 경로에 opencv폴더가 추가됨을 확인할 수 있다. 이제부터 opencv실행을 위한 환경설정과 Visual Studio의 간단한 세팅을 해야한다.환경 변수 설정을 위해서는 다음 경로로 이동한다.내 컴퓨터 - 시스템 속성 - 고급 시스템 설정 - 고급 - 환경변수 다음 창에서 2번째 블럭의 시스템 변수에서 Path를 수정해야한다. 자신이 설치한 경로에서 opencv - build - x86 - vc10 - bin 의 경로를 추가 해야한다. 내가 설치한 경로는 C:\ 이므..
자바를 사용할 때 문자열을 합하는 경우가 꽤 많다. 문자열을 합칠 때에는 StringBuilder와 StringBuffer의 append를 사용한 경우와 단순히 String에서 '+'를 사용한 경우의 시간을 비교해 보았다. public class test { public static void main(String[] args) { String a = new String(); StringBuilder sb = new StringBuilder(); StringBuffer sbf = new StringBuffer(); long start1 = System.nanoTime(); for (int i = 0; i < 10000; i++) { a += "abcde"; } long end1 = System.nanoTi..
public static void gc()Runs the garbage collector.Calling the gc method suggests that the Java Virtual Machine expend effort toward recycling unused objects in order to make the memory they currently occupy available for quick reuse. When control returns from the method call, the Java Virtual Machine has made a best effort to reclaim space from all discarded objects. gc는 가비지 콜렉터를 말한다. System.gc(..
자바에서 List나 배열과 같은 일련의 오브젝트들을 접근할 때에는 for, for-each, iterator, while과 같은 반복문, 반복자를 사용한다. 우선 가장 기본적인 for문을 살펴보면, List의 크기를 구해서 그 해당 크기만큼 출력한다. public class test { public static void main(String[] args) { ArrayList number_list = new ArrayList(); number_list.add("num_1"); number_list.add("num_2"); number_list.add("num_3"); number_list.add("num_4"); number_list.add("num_5"); System.out.print("[For Lo..
아래 함수들은 문자만을 처리할 때 자주 사용되는 함수들이다. int isalpha(int) 영문자인 경우 1, 아닌 경우 0를 리턴한다. int isupper(int) 영문 대문자를 검사한다. 다른 문자 또는 소문자 인 경우 모두 0을 리턴한다. int islower(int) 영문 소문자를 검사한다. 다른 문자 또는 대분자 인 경우 모두 0을 리턴한다. int isdigit(int) 0~9 의 숫자를 검사한다. 숫자가 아니면 0을 리턴한다. int isspace(int) 공백을 검사한다. int isalnum(int) 영문과 숫자를 검사한다. (0~9, A~Z, a~z) int toupper(int) 영문 소문자를 대문자로 변환한다. int tolower(int) 영문 대문자를 소문자로 변환한다. int..
- Total
- Today
- Yesterday