Monday, September 23, 2013

최근 관심을 끌고 있는 Bluetooth 4.0 SMART (또는 Bluetooth Low Energy)에 관해서


 iPhone 5s 출시와 iOS 7 OS 업데이트와 관련해서 iBeacon이라는 기술에 대해서 사람들이 새삼스레 주목하고 있음.


 위 링크에 따르면, iBeacon은 Bluetooth 4.0 LE (Low Energy)기반이며, estimote 등의 회사에서 개발한 beacon을 활용하여 실내 측위나 결제에 활용 가능한 것으로 알려져 있음.
 참고로 Bluetooth Low Energy는 과거 Wibree라는 기술이 Bluetooth 표준에 들어가서, 2010년도에 4.0 버전에 포함되었음. 이와 유사한 기술이었던 Zigbee (IEEE 802.15.4)등은 여전히 비싼 칩 가격과 별도 칩으로 내장되어야 되는 불편함때문에 사실상 시장에서 사장되는 추세임.

 좀 더 정확하게 살펴보면, Bluetooth 4.0은
 iPhone 4s와 뉴아이패드 이후 기기에 탑재되어 있고, iOS 6부터 OS 레벨에서 지원가능한 것으로 알려져 있으며,
 안드로이드에선 Galaxy S3, Galaxy Nexus 이후에 나온 기기들은 대부분 지원하는 것으로 알려져 있음.  하지만 안드로이드의 경우 최근에 발표된 Android 4.3 Jelly Bean 이상의 버전에서 OS 적으로 제대로 지원하는 것으로 알려져 있음.



 현재 주된 응용처는 아래와 같음

Tuesday, August 13, 2013

Setup Play Framework in Ubuntu

Get Scala and JVM

  • Scala is a JVM language and Java is not usually installed by default. We will of course have to set up Scala as well. So let's have them installed. 
$ sudo apt-get install default-jre
$ sudo apt-get install scala
Get Play Framework

  • http://www.playframework.com/download
  • Extract the contents of the zip file. The default installation of Ubuntu does not include zip/unzip utilities, so you might want to install the unzip utility first. Also bear in mind that de-compressing the zip file will automatically create a lot of files in the directory where you have downloaded Play. Consider moving the zip file to its own directory before you extract its contents.
$ sudo apt-get install unzip
$ wget http://download.playframework.org/releases/play-2.0.4.zip
$ unzip play-2.0.4.zip

Setup Play Framework

  • If you wish to follow Linux's File Hierarchy Standard, then extract Play to /opt. Create a shortcut for theplay command from /usr/local/bin/play so that it is in user's PATH. Using a regular user account, type theplay command.
  • $ sudo mv play-2.0.4 /opt   $ sudo ln -s /opt/play-2.0.4 /opt/play   $ sudo ln -s /opt/play/play /usr/local/bin/play   $ play


Setup and connect AWS - Part I : Tips

Tip 1: If you use Bitnami images, root account is bitmani not ec2-user or ubuntu.

Tip 2: http://wiki.bitnami.com/Applications/BitNami_Drupal#How_to_start.2fstop_the_servers.3f

Sunday, May 19, 2013

Install Apache, PHP, APC, & MySQL on Amazon EC2 with Amazon Linux AMI (Draft)


Ref.





How to connect AWS vis SSH in Mac


  • Create a linux instance by AWS console
    • https://console.aws.amazon.com/ec2/v2/home?region=us-west-2
  • Check the instance and press the Actions button, then try to connect
    • It provides two options,
      • Connect with a standalone SSH Client
        • That's what I want to..
        • First, move yourname.pem file to /Users/yourUserName/.ssh
        • Second, change mod not to allow public access
          • such as, chmod 600 yourname.pem
        • Last, try to access via SSH
          • such as, ssh -i yourname.pem ec2-user@yourawspublicaddress.com
        • Remember that you should keep the first .pem file 
      • Connect from your browser using the Java SSH Client (Java Required)
        • Java required. If you don't, download it and restart your browser

Monday, July 23, 2012

Bitmap.compress() function has bugs about PNG file

 

Normally in Android, a developer uses Bitmap.compress() function for saving an image file as JPEG and PNG.

However, if some pixels of ARGB_8888 typed bitmap are not 0 or 255, for example 137 or 230, etc., unwanted value is saved when compress by Bitmap.compress() function.

Currently I don’t know how to solve the problem. Moreover I have found another problem (or maybe bug?).

It’s that when a bitmap image constructed by OpenCV, especially bitmapToMat(), Android didn’t assume that bitmap created by PNG format.

Wednesday, February 29, 2012

OpenCV in Android

 

일단 OpenCV의 헤더파일을 JNI에서 불러오기 위해선,  Android.mk에 아래와 같이 include 경로를 지정해줘야 함.

LOCAL_C_INCLUDES := <OpenCV Install Directory>/include

Friday, February 24, 2012

Android Bitmap Class and OpenCV Mat Class


(1) Bitmap in Android
안드로이드에서 Bitmap 클래스는 android.graphics.Bitmap에 있음.
Bitmap은 Bitmap.compressFormat에 JPEG, PNG, WEBP를 지원하며,  Bitmap.Config에서 ALPHA_8, ARGB_4444, ARGB_8888, 그리고 RGB_565 타입을 지원함.
ALPHA_8은 alpha 채널 하나에 데이터를 저장하고,
자주 쓰이는 ARGB_8888은 각각의 픽셀은 4byte=32bit에 저장됨.  따라서 RGB 각각 8 bit, 그리고 Alpha값 8bit로 저장됨
그리고 RGB_565는 RGB값만을 2byte=16bit로 저장함. 이때, R은 5bit, G는 6bit, B는 5bit임. 그래서 565임
Bitmap에서 Raw Data는 getPixels함수를 통해 int[] 형태로 얻어낼 수 있음. 그리고 얻어낸 pixel에 대해, RGB 및 Alpha 값은 다음과 같은 간단한 코드로 가져올 수 있음.  즉, ARGB_8888은 총 32비트 중 앞에서 순서대로 각 8비트 씩, Alpha (default는 ff), R, G, B로 저장되어 있음.
 // Get R, G, B from pixels
 int R= (pixels[i] >> 16) & 0xff;
 int G= (pixels[i] >> 8) & 0xff;
 int B= pixels[i] & 0xff;

 // Get pixel value from R, G, B (assumes Alpha is ff)
 int newPixels[]=ff*0x1000000 + R*0x10000 + G*0xff + B;


참고로 Android에서 int형 및 float형은 32비트이며, char은 16비트 unicode, byte는 8비트임

그리고 위와 같이 복잡하게 할 것 없이, Android는 android.graphics.Color 클래스에서 color 값에서 R, G, B를 구하거나, R, G, B에서 color 값을 구하는 함수를 제공하고 있으며, HSV와 RGB간의 변환을 제공함

RGBm YUV, HSV에 대해선 카페 링크블로그 참조



(2) Mat in OpenCV for Android

Computer Vision에서 널리 쓰이는 OpenCV도 Android로 포팅되어 있기에, Computer Vision 관련 알고리즘이 필요할 때 유용하게 사용할 수 있음.

OpenCV에선 IPL Image 클래스 뿐만 아니라 Mat 클래스도 이미지 정보를 담기 위해 많이 사용됨.  참고로, IplImage는 OpenCV 초창기부터 사용되었던 구조체로, alloc, dealloc을 수동으로 해줘야 되는 불편함이 있기에, C++ 버젼부터 Mat 클래스를 제공함.  


 OpenCV for Android의 Mat 클래스는 Android의 ARGB_8888에 대응하여 CV_8UC4를 많이 사용함.

 이때 8bit로 4개의 channel을 표현하므로, 이를 Java Array로 담을때는 byte[] 형을 사용해야 함.
 그리고 각 채널은 순서대로 R, G, B, Alpha 정보를 담고 있음.
 즉, Alpha 정보가 저장된 순서가 맨앞 (Android Bitmap)이냐? 뒤 (OpenCV for Android의 Mat) 냐? 라는 차이가 있음.

 

Friday, February 10, 2012

Learning Android Programming (1) – Dynamic Layout

 

안드로이드에서 프로그램을 통해 동적으로 Layout이 변경하기 위해서는, addView() 함수를 사용하게 됨.

이러한 경우 setContentView (R.layout.main) 함수는 addView() 함수 전에 실행되어야 하며, 이후에 실행되면 Error가 발생함.

Monday, January 02, 2012

Learning Souce Code Control System - Git

 

일단, SVN 대비 Git는 장점이 많음. 특히 Branch의 Merge에 있어서, SVN은 Git에 상대도 되지 않음. (예, KLDP에 올라온 경험담). 이건 SVN과 Git가 컨셉이 좀 다르기 때문인듯함.

따라서, Git에 대해서 좀 더 자세히 공부하기로 함.

(To be continued..)