forked from leadrien/opencv_native_androidstudio
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnative-lib.cpp
More file actions
22 lines (20 loc) · 691 Bytes
/
native-lib.cpp
File metadata and controls
22 lines (20 loc) · 691 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include <jni.h>
#include <string>
#include <opencv2/core/core.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/features2d/features2d.hpp>
using namespace std;
using namespace cv;
extern "C"
{
void JNICALL Java_ch_hepia_iti_opencvnativeandroidstudio_MainActivity_salt(JNIEnv *env, jobject instance,
jlong matAddrGray,
jint nbrElem) {
Mat &mGr = *(Mat *) matAddrGray;
for (int k = 0; k < nbrElem; k++) {
int i = rand() % mGr.cols;
int j = rand() % mGr.rows;
mGr.at<uchar>(j, i) = 255;
}
}
}