如何在的Java API使用OpenCV中得到子图像 [英] how to get sub image by using OpenCV in java api

查看:512
本文介绍了如何在的Java API使用OpenCV中得到子图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在的Java API使用OpenCV的获得来自输入图像子图像。但经过我读到的OpenCV的Java API DOC的,我找不到在C要做到这一点,就像cvGetSubImage方法(...)。任何帮助或信息?谢谢!

I want to get sub image from input image by using OpenCV in java API. But after I read the doc about OpenCV java API, I can not find the method to do this just like cvGetSubImage(...) in c. Any help or information? Thanks!

推荐答案

您需要做的是找到一个子矩阵或ROI以选择图像的特定部分。

What you need to do is find a submatrix or ROI in order to select the particular part of your image.

原来JavaCV有这样的 submat

It turns out JavaCV has a nice little method for doing this submat.

这返回所选区域的垫。该方法的定义是:

This returns a Mat of the selected area. The method definition is:

public Mat submat(int rowStart,
     int rowEnd,
     int colStart,
     int colEnd)

从文件

**运营商做出的*本规定的子数组的新报头。它们是Mat.row,Mat.col,Mat.rowRange和Mat.colRange的最广义的形式。例如,A(范围(0,10),Range.all())是相当于A.rowRange(0,10)。类似于上述所有的,经营者为O(1)的操作,即,没有矩阵数据被复制

**The operators make a new header for the specified sub-array of *this. They are the most generalized forms of "Mat.row", "Mat.col", "Mat.rowRange", and "Mat.colRange". For example, A(Range(0, 10), Range.all()) is equivalent to A.rowRange(0, 10). Similarly to all of the above, the operators are O(1) operations, that is, no matrix data is copied.

这篇关于如何在的Java API使用OpenCV中得到子图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆