Ask Your Question

Revision history [back]

How to use cvMakeSeqHeaderForArray in Javacv?

My developing environment is javacv. I have an array of CvPoint data, and I want to convert them into a CvSeq by using the function cvMakeSeqHeaderForArray. However, the result CvSeq data are different from the original CvPoint array data. The following is my codes:

             CvSeq contours = new CvSeq();
             cvMakeSeqHeaderForArray(
                    CV_SEQ_ELTYPE_POINT,
                    Loader.sizeof(CvContour.class),
                    Loader.sizeof(CvPoint.class),
                    pixels[0],
                    pixels.length,
                    contours,
                    seqBlock
            );

where pixels[] is my defined CvPoint array. Then I use the following sentence to detect the converting result: CvPoint tempPoint = new CvPoint(cvGetSeqElem(contours.position(0),indx)); When indx is an even number, temPoint returns one of elements of pixels[] but with position of about index/2. When indx is an odd number temPoint returns wrong data. What's wrong?