Friday, April 19, 2013

Binary-image


Reference
http://www.neuroforge.co.uk/index.php/binary-images-with-opencv



After apply it

+Fatal signal 11 (SIGSEGV) at 0x00000010 (code=1)


RGB 色彩學



+ wiki https://zh.wikipedia.org/wiki/%E4%B8%89%E5%8E%9F%E8%89%B2%E5%85%89%E6%A8%A1%E5%BC%8F


note:
+三原色的原理不是出於物理原因,而是由於生理原因造成的。

+ 相依性 (所見境界)
不同的生物眼中辨別顏色的細胞並不相同,例如類眼中有四種分別對不同波長光線敏感的細胞,而一般哺乳動物只有兩種,所以對它們來說只有兩種原色光。


+ 色表
新增說明文字








inline 與#define 的比較(行內函式(Inline function))

Reference:
+http://blog.yam.com/swwuyam/article/11745212

[效能提升]
Result: after apply inline method,
save the timing from 420ms to 180ms.


Monday, April 15, 2013

findContours


Step 1: Refer to
http://answers.opencv.org/question/2885/findcontours-gives-me-the-border-of-the-image/

Source code:?

Step 2: after process:
Draw in RGB mat

Draw in Gray mat:

OpenCV @youtube



test2

test3:


Android-OpenCV doc :submat

http://docs.opencv.org/java/index.html?org/opencv/core/


http://yester-place.blogspot.tw/2008/07/blog-post_17.html






左右交換


Step1:
source code:

Mat screen = new Mat(height, width, CvType.CV_8UC4);
Mat[] s = new Mat[2];
Mat[] cells = new Mat[2];

cells[0] = screen.submat(0, height, 0, width/2);
cells[1] = screen.submat(0, height, width/2, width);
s[0] = src.submat(0, height, 0, width/2);
s[1] = src.submat(0, height, width/2, width);

s[0].copyTo(cells[1]);
s[1].copyTo(cells[0]);

return screen;

Step2: test result:





Pyrdown



http://docs.opencv.org/modules/imgproc/doc/filtering.html#pyrdown



code:

exception:


04-15 10:47:57.887: E/cv::error()(28686): OpenCV Error: Assertion failed (src.dims == 2 && info.height == (uint32_t)src.rows && info.width == (uint32_t)src.cols) in void Java_org_opencv_android_Utils_nMatToBitmap2(JNIEnv*, jclass, jlong, jobject, jboolean), file /home/reports/ci/slave/50-SDK/opencv/modules/java/generator/src/cpp/utils.cpp, line 97
04-15 10:47:57.887: E/org.opencv.android.Utils(28686): nMatToBitmap catched cv::Exception: /home/reports/ci/slave/50-SDK/opencv/modules/java/generator/src/cpp/utils.cpp:97: error: (-215) src.dims == 2 && info.height == (uint32_t)src.rows && info.width == (uint32_t)src.cols in function void Java_org_opencv_android_Utils_nMatToBitmap2(JNIEnv*, jclass, jlong, jobject, jboolean)
04-15 10:47:57.887: E/CameraBridge(28686): Mat type: Mat [ 144*192*CV_8UC1, isCont=true, isSubmat=false, nativeObj=0x772270, dataAddr=0x6d08a0 ]
04-15 10:47:57.887: E/CameraBridge(28686): Bitmap type: 384*288
04-15 10:47:57.887: E/CameraBridge(28686): Utils.matToBitmap() throws an exception: /home/reports/ci/slave/50-SDK/opencv/modules/java/generator/src/cpp/utils.cpp:97: error: (-215) src.dims == 2 && info.height == (uint32_t)src.rows && info.width == (uint32_t)src.cols in function void Java_org_opencv_android_Utils_nMatToBitmap2(JNIEnv*, jclass, jlong, jobject, jboolean)

Canny edge detector



+ Wiki

Step1: 
source code:
Imgproc.cvtColor(image, image, Imgproc.COLOR_RGB2GRAY);
Imgproc.Canny(image, image, lowThresh, highThresh);  //lowThresh=10,highThresh=100;

Step2:
test result: (before)
(after process)

進階版: show in the same screen.
code: ?


result:

result 2:

Step 3: trace the canny.cpp source code in OpenCV

+ Location: \modules\imgproc\src\canny.cpp