Skip to content

Instantly share code, notes, and snippets.

@ahmedfgad
Created July 9, 2019 14:48
Show Gist options
  • Save ahmedfgad/f834a5037cf0c979392d8f89fd67beb3 to your computer and use it in GitHub Desktop.
Save ahmedfgad/f834a5037cf0c979392d8f89fd67beb3 to your computer and use it in GitHub Desktop.
package opencvapp;
import org.opencv.core.Core;
import static org.opencv.core.CvType.CV_32F;
import org.opencv.core.Mat;
public class OpenCVApp {
public static void main(String[] args) {
System.load("D:\\Opencv-4.1.0-vc14_vc15\\opencv\\build\\java\\x64\\" + Core.NATIVE_LIBRARY_NAME + ".dll");
double[][] XORTrainArray = {
{0.0, 0.0},
{0.0, 1.0},
{1.0, 0.0},
{1.0, 1.0}
};
Mat XORTrain = new Mat(4, 2, CV_32F);
XORTrain.put(0, 0, XORTrainArray[0]);
XORTrain.put(1, 0, XORTrainArray[1]);
XORTrain.put(2, 0, XORTrainArray[2]);
XORTrain.put(3, 0, XORTrainArray[3]);
System.out.println("Train Inputs : \n" + XORTrain.dump());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment