2013年6月30日星期日

JavaCV Installation and Using it in Eclipse

I always use C++ with OpenCV libs for coding the computer vision program, but I just find a nice library called JavaCV (wrapper classes used for openCV). It allows anyone to use OpenCV functions directly in desktop Java. Now I can write computer vision program with Java, great!

The links below is a basic guide to help anyone port their OpenCV code to JavaCV.
http://code.google.com/p/javacv/wiki/ConvertingOpenCV

Here I give a very short intro about how to set up JavaCV and use it.
A.
Download OpenCV-2.4.5.exe and javacv-0.5-bin.zip, from:
http://sourceforge.net/projects/opencvlibrary/files/
http://code.google.com/p/javacv/

B.
Install OpenCV-2.4.5
Extract javacv-0.5-bin.zip

C.
set the environment variables:
the user variables for you, such as:
CLASSPATH → D:\project\opencv\build\x86\vc10\lib;
PATH → D:\project\opencv\build\java\x86;D:\project\opencv\build\x86\vc10\bin

D.
Start Eclipse
create new java project →
click next →
1. add project to the build path
2. in Libraries tab → Add External JARs... → add javacv-bin\javacpp.jar, javacv-bin\javacpp.jar, javacv-bin\javacv-windows-x86.jar
3. in Order and Export tab → click all of these libraries we added
→ click finish
in the project → add a new class


E.
Copy the test code below, to run the test program, copy a img.jpg in the project folder:

import static com.googlecode.javacv.cpp.opencv_core.*;
import static com.googlecode.javacv.cpp.opencv_imgproc.*;
import static com.googlecode.javacv.cpp.opencv_highgui.*;


public class test {
    /**
     * @param args
     */
10     public static void main(String[] args) {
11         IplImage img = cvLoadImage("tmp.jpg");
12         
13         cvShowImage("test image", img);
14         cvWaitKey();
15         cvReleaseImage(img);
16     }
17 }
18

F.
in the menu → Project → Build All → Run the project

2013年6月24日星期一

Using WordPress for our company’s website


I just switch to use the WordPress for our company’s website. WordPress is very easy to use and has an intuitive interface. I found that the time spent on formatting is greatly reduced.I choose 3 plugins and a beautiful theme for our site. Below is a short intro about them.
Plugins:
  • qTranslate
  • Contact Form 7
  • WP-Mail-SMTP
A: Setting of WP-Mail-SMTP
1. in WP-Mail-SMTP:
need to set:
  • From Email
  • From Name
set Mailer “Send all Wordpress email via SMTP”
2. in STMP Options
need to set:
  • SMTP Host
  • SMTP Port
  • Encryption → No encryption
  • Authentication → Yes: use SMTP authentication
  • Username: your mail username
  • Password: your mail password
B: Setting of Contact Form 7
Set your email-SMTP in the form field.

Copy this code and paste it into your post, page or text widget content.
For Example: [contact-form-7 id="48" title="Contact form 1"]

C: qTranslate
ignore message “qTranslate Services could not load OpenSSL!”
You can add Language in the setting page.
→ In the Widget Page of the WordPress add the qTranslate Language Chooser to the Header

Theme:
I choose Pinboard, cause it is a crafty and elegant theme powered by an advanced theme framework and grid system. It looks beautiful. It is also a Free Responsive WordPress Theme for the business or personal site. It is very easy to customize the site title & tagline, colors, header or background image, navigation and static front page. It also integriert the SEO tool.

2013年6月6日星期四

VS 2008编译strmbase.lib

最近写程序很少,因为有两个手下帮我写,一个星期编不超过8小时程序吧,但是写的东西很杂,Java,C++,Matlab等等。今天需要使用一个同事很早以前写的AVI2Grabber模块对Lagarith Lossless Avi Video读取,里面使用了strmbase.lib有关于DirectShow的东西。

研究了一下才发现strmbase.lib并不在MS配的SDK \lib. 需要自己编译一个。

  • 下载并安装Microsoft Windows SDK for Windows 7 and .NET Framework 3.5 SP1
  • 安装后,可以在C:\Program Files\Microsoft SDKs\Windows\v7.0\Samples\multimedia\directshow\baseclasses找到baseclasses.sln,然后用VS 2008打开。
  • 用VS2008在Release下进行编译(编译模式“Debug” 改成 “Release”),可以在C:\Program Files\Microsoft SDKs\Windows\v7.0\Samples\multimedia\directshow\baseclasses\Release得到我们需要的strmbase.lib。