Skip to content

Commit

Permalink
Update.
Browse files Browse the repository at this point in the history
  • Loading branch information
weichao66666 committed Mar 9, 2017
1 parent f355fce commit d7cf4a8
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion AS/OpenCV/app/src/main/cpp/opencv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ using namespace cv;

extern "C"
JNIEXPORT jintArray JNICALL
Java_io_weichao_opencv_MainActivity_nCorrode(JNIEnv *env, jobject obj /* this */,
Java_io_weichao_opencv_MainActivity_nErode(JNIEnv *env, jobject obj /* this */,
jintArray pixelArray,
int width, int height) {
jint *pixelPoint;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ protected void onCreate(Bundle savedInstanceState) {
int height = srcBitmap.getHeight();
int[] pixelArray = new int[width * height];
srcBitmap.getPixels(pixelArray, 0, width, 0, 0, width, height);
pixelArray = nCorrode(pixelArray, width, height);
pixelArray = nErode(pixelArray, width, height);

/*显示处理后的图像*/
Bitmap destBitmap = Bitmap.createBitmap(pixelArray, width, height, Bitmap.Config.ARGB_8888);
destImage.setImageBitmap(destBitmap);
}

private native int[] nCorrode(int[] pixelArray, int width, int height);
private native int[] nErode(int[] pixelArray, int width, int height);
}
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ VS 工程搭建参考【在 VS 上配置 OpenCV 工程】。

VS 工程目录结构:

![](https://github.com/weichao66666/OpenCV_Corrode/raw/master/README.md-images/01.png)
![](https://github.com/weichao66666/OpenCV_Erode/raw/master/README.md-images/01.png)

##**AS 工程**

Expand All @@ -33,7 +33,7 @@ AS 工程搭建参考:

AS 工程目录结构:

![](https://github.com/weichao66666/OpenCV_Corrode/raw/master/README.md-images/02.png)
![](https://github.com/weichao66666/OpenCV_Erode/raw/master/README.md-images/02.png)

---

Expand Down Expand Up @@ -63,17 +63,17 @@ AS 工程目录结构:

###**添加 test.png 到 main.cpp 所在目录**

![](https://github.com/weichao66666/OpenCV_Corrode/raw/master/README.md-images/test.png)
![](https://github.com/weichao66666/OpenCV_Erode/raw/master/README.md-images/test.png)

###**运行结果**

![](https://github.com/weichao66666/OpenCV_Corrode/raw/master/README.md-images/03.png)
![](https://github.com/weichao66666/OpenCV_Erode/raw/master/README.md-images/03.png)

##**AS 工程**

所有修改内容:

![](https://github.com/weichao66666/OpenCV_Corrode/raw/master/README.md-images/05.png)
![](https://github.com/weichao66666/OpenCV_Erode/raw/master/README.md-images/05.png)

###**修改 activity_main.xml**

Expand All @@ -98,7 +98,7 @@ AS 工程目录结构:

###**添加 test.png**

![](https://github.com/weichao66666/OpenCV_Corrode/raw/master/README.md-images/test.png)
![](https://github.com/weichao66666/OpenCV_Erode/raw/master/README.md-images/test.png)

###**修改 opencv.cpp**

Expand All @@ -110,7 +110,7 @@ AS 工程目录结构:

extern "C"
JNIEXPORT jintArray JNICALL
Java_io_weichao_opencv_MainActivity_nCorrode(JNIEnv *env, jobject obj /* this */,
Java_io_weichao_opencv_MainActivity_nErode(JNIEnv *env, jobject obj /* this */,
jintArray pixelArray,
int width, int height) {
jint *pixelPoint;
Expand Down Expand Up @@ -166,19 +166,19 @@ AS 工程目录结构:
int height = srcBitmap.getHeight();
int[] pixelArray = new int[width * height];
srcBitmap.getPixels(pixelArray, 0, width, 0, 0, width, height);
pixelArray = nCorrode(pixelArray, width, height);
pixelArray = nErode(pixelArray, width, height);

/*显示处理后的图像*/
Bitmap destBitmap = Bitmap.createBitmap(pixelArray, width, height, Bitmap.Config.ARGB_8888);
destImage.setImageBitmap(destBitmap);
}

private native int[] nCorrode(int[] pixelArray, int width, int height);
private native int[] nErode(int[] pixelArray, int width, int height);
}

###**运行结果**

![](https://github.com/weichao66666/OpenCV_Corrode/raw/master/README.md-images/04.png)
![](https://github.com/weichao66666/OpenCV_Erode/raw/master/README.md-images/04.png)

---

Expand Down

0 comments on commit d7cf4a8

Please sign in to comment.