Need another calcOpticalFlowPyrLK Java signature taking input List<Mat> pyramid (Feature #3508)
Description
The function of buildOpticalFlowPyramid
and calcOpticalFlowPyrLK
in OpenCV-2.4.8-android-sdk is:
public static int buildOpticalFlowPyramid(Mat img, List<Mat> pyramid, Size winSize, int maxLevel) 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)
If I just use the image as the input of calcOpticalFlowPyrLK
, not using pyramid, it works well. But If I use buildOpticalFlowPyramid
to build a pyramid as input of calcOpticalFlowPyrLK
. The List<Mat> pyramid
is not applicable for Mat prevImg
.
If I declare the pyramid as vector<Mat>
, buildOpticalFlowPyramid
works well, but the app will be forced to stop whenever call calcOpticalFlowPyrLK
.
Here is parts of the code.
MatOfByte status = new MatOfByte(); int maxlevel=2; Mat prev = new Mat(mRgba.size(),CvType.CV_8UC1); Mat curr = new Mat(mRgba.size(),CvType.CV_8UC1); List<Mat> pyramid1= new ArrayList<Mat>(maxlevel); List<Mat> pyramid2= new ArrayList<Mat>(maxlevel); Mat pyramid3 = new Mat(); Mat pyramid4 = new Mat(); MatOfPoint2f featurestracked = new MatOfPoint2f(); MatOfFloat err = new MatOfFloat(); int i,count; TermCriteria optical_flow_termination_criteria =new TermCriteria(); optical_flow_termination_criteria.epsilon =.03; optical_flow_termination_criteria.maxCount = 20; Size winSize = new Size(21,21); Imgproc.cvtColor(hp.TrackingFrame, prev, Imgproc.COLOR_RGBA2GRAY,0); Imgproc.cvtColor(mRgba, curr, Imgproc.COLOR_RGBA2GRAY,0); //Build pyramid int level1= Video.buildOpticalFlowPyramid(prev, pyramid1, winSize, maxlevel); int level2 = Video.buildOpticalFlowPyramid(curr, pyramid2, winSize, maxlevel); pyramid3 = Converters.vector_Mat_to_Mat(pyramid1); pyramid4 = Converters.vector_Mat_to_Mat(pyramid2); MatOfPoint2f features_next2f = new MatOfPoint2f(hp.features_next.toArray()); Video.calcOpticalFlowPyrLK(pyramid3, pyramid4,features_next2f,featurestracked,status,err, winSize,maxlevel,optical_flow_termination_criteria, 0, 0.001);
History
Updated by Vladislav Vinogradov about 11 years ago
- Description changed from The function of buildOpticalFlowPyramid and calcOpticalFlowPyrLK in OpenCV-2.... to The function of buildOpticalFlowPyramid and calcOpticalFlowPyrLK in OpenCV-2.... More
Updated by Vladislav Vinogradov about 11 years ago
- Description changed from The function of buildOpticalFlowPyramid and calcOpticalFlowPyrLK in OpenCV-2.... to The function of @buildOpticalFlowPyramid@ and @calcOpticalFlowPyrLK@ in OpenC... More
Updated by Vladislav Vinogradov about 11 years ago
- Status changed from New to Open
- Category changed from android to java bindings
Updated by Alexander Smorkalov about 11 years ago
@Andrey Pavlenko, can you comment the issue?
Updated by Xin Guo about 11 years ago
FYI:when I declare the pyramid as vector<Mat>, I use the Converters.vector_Mat_to_Mat(Pyramid) as the input of calcOpticalFlowPyrLK.
Thank you very much.
Updated by Xin Guo about 11 years ago
Could you please comment this issue? Or give me some info about how to do about it? Thank you.
Alexander Smorkalov wrote:
@Andrey Pavlenko, can you comment the issue?
Updated by Andrey Pavlenko about 11 years ago
Java version of this function doesn't support pyramid as input.
This is actually a feature request on adding one more calcOpticalFlowPyrLK
signature taking List<Mat>
(we don't have InputArray
in Java).
Updated by Andrey Pavlenko about 11 years ago
- Difficulty set to Medium
- Subject changed from can not input a List<Mat> pyramid into calcOpticalFlowPyrLK (OpenCV-2.4.8-android-sdk) to Need another calcOpticalFlowPyrLK Java signature taking input List<Mat> pyramid
- Tracker changed from Bug to Feature
Updated by Xin Guo about 11 years ago
Thank you.
Andrey Pavlenko wrote:
Java version of this function doesn't support pyramid as input.
This is actually a feature request on adding one morecalcOpticalFlowPyrLK
signature takingList<Mat>
(we don't haveInputArray
in Java).
Updated by Alexander Smorkalov almost 11 years ago
- Target version set to 3.0-alpha
Updated by Maksim Shabunin almost 10 years ago
- Target version changed from 3.0-alpha to 3.0
Updated by Maksim Shabunin over 9 years ago
Issue has been transferred to GitHub: https://github.com/Itseez/opencv/issues/4689