本文整理汇总了Java中org.opencv.core.MatOfByte类的典型用法代码示例。如果您正苦于以下问题:Java MatOfByte类的具体用法?Java MatOfByte怎么用?Java MatOfByte使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MatOfByte类属于org.opencv.core包,在下文中一共展示了MatOfByte类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: imshow
import org.opencv.core.MatOfByte; //导入依赖的package包/类
/**
* Display image in a frame
*
* @param title
* @param img
*/
public static void imshow(String title, Mat img) {
// Convert image Mat to a jpeg
MatOfByte imageBytes = new MatOfByte();
Highgui.imencode(".jpg", img, imageBytes);
try {
// Put the jpeg bytes into a JFrame window and show.
JFrame frame = new JFrame(title);
frame.getContentPane().add(new JLabel(new ImageIcon(ImageIO.read(new ByteArrayInputStream(imageBytes.toArray())))));
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.pack();
frame.setVisible(true);
frame.setLocation(30 + (windowNo*20), 30 + (windowNo*20));
windowNo++;
} catch (Exception e) {
e.printStackTrace();
}
}
示例2: drawMatches
import org.opencv.core.MatOfByte; //导入依赖的package包/类
public static void drawMatches(Mat img1, MatOfKeyPoint keypoints1, Mat img2, MatOfKeyPoint keypoints2, MatOfDMatch matches1to2, Mat outImg, Scalar matchColor, Scalar singlePointColor, MatOfByte matchesMask, int flags)
{
Mat keypoints1_mat = keypoints1;
Mat keypoints2_mat = keypoints2;
Mat matches1to2_mat = matches1to2;
Mat matchesMask_mat = matchesMask;
drawMatches_0(img1.nativeObj, keypoints1_mat.nativeObj, img2.nativeObj, keypoints2_mat.nativeObj, matches1to2_mat.nativeObj, outImg.nativeObj, matchColor.val[0], matchColor.val[1], matchColor.val[2], matchColor.val[3], singlePointColor.val[0], singlePointColor.val[1], singlePointColor.val[2], singlePointColor.val[3], matchesMask_mat.nativeObj, flags);
return;
}
示例3: imencode
import org.opencv.core.MatOfByte; //导入依赖的package包/类
public static boolean imencode(String ext, Mat img, MatOfByte buf)
{
Mat buf_mat = buf;
boolean retVal = imencode_1(ext, img.nativeObj, buf_mat.nativeObj);
return retVal;
}
示例4: calcOpticalFlowPyrLK
import org.opencv.core.MatOfByte; //导入依赖的package包/类
public static void calcOpticalFlowPyrLK(Mat prevImg, Mat nextImg, MatOfPoint2f prevPts, MatOfPoint2f nextPts, MatOfByte status, MatOfFloat err, Size winSize, int maxLevel)
{
Mat prevPts_mat = prevPts;
Mat nextPts_mat = nextPts;
Mat status_mat = status;
Mat err_mat = err;
calcOpticalFlowPyrLK_1(prevImg.nativeObj, nextImg.nativeObj, prevPts_mat.nativeObj, nextPts_mat.nativeObj, status_mat.nativeObj, err_mat.nativeObj, winSize.width, winSize.height, maxLevel);
return;
}
示例5: imencode
import org.opencv.core.MatOfByte; //导入依赖的package包/类
public static boolean imencode(String ext, Mat img, MatOfByte buf, MatOfInt params)
{
Mat buf_mat = buf;
Mat params_mat = params;
boolean retVal = imencode_0(ext, img.nativeObj, buf_mat.nativeObj, params_mat.nativeObj);
return retVal;
}
示例6: drawMatches2
import org.opencv.core.MatOfByte; //导入依赖的package包/类
public static void drawMatches2(Mat img1, MatOfKeyPoint keypoints1, Mat img2, MatOfKeyPoint keypoints2, List<MatOfDMatch> matches1to2, Mat outImg, Scalar matchColor, Scalar singlePointColor, List<MatOfByte> matchesMask, int flags)
{
Mat keypoints1_mat = keypoints1;
Mat keypoints2_mat = keypoints2;
List<Mat> matches1to2_tmplm = new ArrayList<Mat>((matches1to2 != null) ? matches1to2.size() : 0);
Mat matches1to2_mat = Converters.vector_vector_DMatch_to_Mat(matches1to2, matches1to2_tmplm);
List<Mat> matchesMask_tmplm = new ArrayList<Mat>((matchesMask != null) ? matchesMask.size() : 0);
Mat matchesMask_mat = Converters.vector_vector_char_to_Mat(matchesMask, matchesMask_tmplm);
drawMatches2_0(img1.nativeObj, keypoints1_mat.nativeObj, img2.nativeObj, keypoints2_mat.nativeObj, matches1to2_mat.nativeObj, outImg.nativeObj, matchColor.val[0], matchColor.val[1], matchColor.val[2], matchColor.val[3], singlePointColor.val[0], singlePointColor.val[1], singlePointColor.val[2], singlePointColor.val[3], matchesMask_mat.nativeObj, flags);
return;
}
示例7: calcOpticalFlowPyrLK
import org.opencv.core.MatOfByte; //导入依赖的package包/类
public static void calcOpticalFlowPyrLK(Mat prevImg, Mat nextImg, MatOfPoint2f prevPts, MatOfPoint2f nextPts, MatOfByte status, MatOfFloat err)
{
Mat prevPts_mat = prevPts;
Mat nextPts_mat = nextPts;
Mat status_mat = status;
Mat err_mat = err;
calcOpticalFlowPyrLK_2(prevImg.nativeObj, nextImg.nativeObj, prevPts_mat.nativeObj, nextPts_mat.nativeObj, status_mat.nativeObj, err_mat.nativeObj);
return;
}
示例8: calcOpticalFlowPyrLK
import org.opencv.core.MatOfByte; //导入依赖的package包/类
public static void calcOpticalFlowPyrLK(Mat prevImg, Mat nextImg, MatOfPoint2f prevPts, MatOfPoint2f nextPts, MatOfByte status, MatOfFloat err, Size winSize, int maxLevel, TermCriteria criteria, int flags, double minEigThreshold)
{
Mat prevPts_mat = prevPts;
Mat nextPts_mat = nextPts;
Mat status_mat = status;
Mat err_mat = err;
calcOpticalFlowPyrLK_0(prevImg.nativeObj, nextImg.nativeObj, prevPts_mat.nativeObj, nextPts_mat.nativeObj, status_mat.nativeObj, err_mat.nativeObj, winSize.width, winSize.height, maxLevel, criteria.type, criteria.maxCount, criteria.epsilon, flags, minEigThreshold);
return;
}
示例9: drawMatchesKnn
import org.opencv.core.MatOfByte; //导入依赖的package包/类
public static void drawMatchesKnn(Mat img1, MatOfKeyPoint keypoints1, Mat img2, MatOfKeyPoint keypoints2, List<MatOfDMatch> matches1to2, Mat outImg, Scalar matchColor, Scalar singlePointColor, List<MatOfByte> matchesMask, int flags)
{
Mat keypoints1_mat = keypoints1;
Mat keypoints2_mat = keypoints2;
List<Mat> matches1to2_tmplm = new ArrayList<Mat>((matches1to2 != null) ? matches1to2.size() : 0);
Mat matches1to2_mat = Converters.vector_vector_DMatch_to_Mat(matches1to2, matches1to2_tmplm);
List<Mat> matchesMask_tmplm = new ArrayList<Mat>((matchesMask != null) ? matchesMask.size() : 0);
Mat matchesMask_mat = Converters.vector_vector_char_to_Mat(matchesMask, matchesMask_tmplm);
drawMatchesKnn_0(img1.nativeObj, keypoints1_mat.nativeObj, img2.nativeObj, keypoints2_mat.nativeObj, matches1to2_mat.nativeObj, outImg.nativeObj, matchColor.val[0], matchColor.val[1], matchColor.val[2], matchColor.val[3], singlePointColor.val[0], singlePointColor.val[1], singlePointColor.val[2], singlePointColor.val[3], matchesMask_mat.nativeObj, flags);
return;
}
示例10: mat2Image
import org.opencv.core.MatOfByte; //导入依赖的package包/类
/**
* Convert a Mat object (OpenCV) in the corresponding Image for JavaFX
*
* @param frame
* the {@link Mat} representing the current frame
* @return the {@link Image} to show
*/
private Image mat2Image(Mat frame)
{
// create a temporary buffer
MatOfByte buffer = new MatOfByte();
// encode the frame in the buffer, according to the PNG format
Imgcodecs.imencode(".png", frame, buffer);
// build and return an Image created from the image encoded in the
// buffer
return new Image(new ByteArrayInputStream(buffer.toArray()));
}