Created
July 9, 2019 14:50
-
-
Save ahmedfgad/cd184df7ec56a54c530ea1ee14fabcce to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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()); | |
double[][] XORTrainOutArray = { | |
{0.0}, | |
{1.0}, | |
{1.0}, | |
{0.0} | |
}; | |
Mat XORTrainOut = new Mat(4, 1, CV_32F); | |
XORTrainOut.put(0, 0, XORTrainOutArray[0]); | |
XORTrainOut.put(1, 0, XORTrainOutArray[1]); | |
XORTrainOut.put(2, 0, XORTrainOutArray[2]); | |
XORTrainOut.put(3, 0, XORTrainOutArray[3]); | |
System.out.println("Train Labels : \n" + XORTrainOut.dump()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment