larael / javacv

Automatically exported from code.google.com/p/javacv
GNU General Public License v2.0
0 stars 0 forks source link

JavaCV Stitcher.stitch method throws assertion failure #211

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1- Execute this pseudo-code

stitcher = Stitcher.createDefault(false);

MatVector images = new MatVector(imageN.size());
for(...){
   CvArr image = cvLoadImage(imageN);
   images.put(index,image);
}

MatVector result = new MatVector(1);
int status = stitcher.stitch(images,result);

if( status == stitcher.OK )
{
   cvSaveImage(result.getIplImage(0));
}

What is the expected output? What do you see instead?
Stitching does not provide any output, it throws exception

What version of the product are you using? On what operating system?
0.1 on Windows 7 64bit

Please provide any additional information below.

Actually in C/C++ version of the OpenCV Stitcher.stitch method includes pano 
parameter as cv::OutputArray but it uses this parameter as cv::Mat in the 
implementation. But by using JavaCV developer has to pas std::vector<cv::Mat> 
as pano parameter. So this causes an exception in the stitcher.cpp line 153( 
pano.getMatRef ). So user may be able to pass cvMat parameter in JavaCV lib.

Original issue reported on code.google.com by aligokal...@gmail.com on 21 Jun 2012 at 11:12

GoogleCodeExporter commented 9 years ago
Ok, I've fixed that in the source here:
http://code.google.com/p/javacv/source/detail?r=f91e96a69104e97ea832270472922dce
72e0c27a
but to test it out, you will need to recompile JavaCV... Let me know that it 
works!

Original comment by samuel.a...@gmail.com on 23 Jun 2012 at 10:56

GoogleCodeExporter commented 9 years ago
Ok I'll look at it...

Original comment by aligokal...@gmail.com on 25 Jun 2012 at 6:07

GoogleCodeExporter commented 9 years ago
I tried to compile it but no success, could not be able to set reference path 
for opencv\includes...

Any way i can provide sample stitching code for verifying the bug-fix, i also 
attach a simple sample data

Original comment by aligokal...@gmail.com on 25 Jun 2012 at 8:53

Attachments:

GoogleCodeExporter commented 9 years ago
Sample Code:
stitcher = Stitcher.createDefault(false);

MatVector images = new MatVector(2);
images.put(0,cvLoadImage("sample1.png"));
images.put(1,cvLoadImage("sample2.png"));

CvMat result = new CvMat();
int status = stitcher.stitch(images,result);

if( status == stitcher.OK )
{
   cvSaveImage(result);
}

Original comment by aligokal...@gmail.com on 26 Jun 2012 at 11:52

GoogleCodeExporter commented 9 years ago
Hi, i tried to compile JavaCV but no succes, i don't know too much about
JavaCpp but i could not define base directory for it. Added it to path but
it did not work.

Any way, i have provided simple images and code. It can be verified by
simply executing the code and seeing it show the result.

Original comment by aligokal...@gmail.com on 26 Jun 2012 at 11:53

GoogleCodeExporter commented 9 years ago
Ok, will try it out, thanks!

Original comment by samuel.a...@gmail.com on 26 Jun 2012 at 1:46

GoogleCodeExporter commented 9 years ago
With the following:
    MatVector images = new MatVector(2);
    images.put(0,cvLoadImage("sample1.png"));
    images.put(1,cvLoadImage("sample2.png"));

    IplImage result = new IplImage(null);
    int status = stitcher.stitch(images,result);

    if( status == stitcher.OK )
    {
        cvSaveImage("result.png", result);
    }

I get this output:
    Finding features...
    Features in image #1: 1483
    Features in image #2: 888
    Finding features, time: 0.598631 sec
    Pairwise matching
    1->2 matches: 468
    1->2 & 2->1 matches: 491
    .Pairwise matching, time: 0.0889254 sec
    Removed some images, because can't match them or there are too similar images: (2).
    Try to decrease --match_conf value and/or check if you're stitching duplicates.
    Need more images

So, it seems to be working...

Original comment by samuel.a...@gmail.com on 1 Jul 2012 at 12:51

GoogleCodeExporter commented 9 years ago
Yes it seems working....very well done...

Original comment by aligokal...@gmail.com on 1 Jul 2012 at 2:59

GoogleCodeExporter commented 9 years ago
The modifications have been included in JavaCV 0.2. Let me know that it works 
alright, thanks!

Original comment by samuel.a...@gmail.com on 22 Jul 2012 at 12:46

GoogleCodeExporter commented 9 years ago
I tried and it works right. This bug can be closed

Original comment by aligokal...@gmail.com on 23 Jul 2012 at 2:06

GoogleCodeExporter commented 9 years ago
I tried the code from comment 7 and get this error:
Exception in thread "main" java.lang.RuntimeException: Uncompilable source code 
- Erroneous ctor sym type: <any>
    at opencvtest.StitchExperiment.main(StitchExperiment.java:37)

line 37 is IplImage result = new IplImage(null); 
If I fix line 37 to this: 
IplImage result = cvCreateImage( cvSize( image1.width()*2, image2.height() ), 
IPL_DEPTH_32S, 1 );

I get:
Exception in thread "main" java.lang.NullPointerException: This pointer address 
is NULL.
    at com.googlecode.javacv.cpp.opencv_stitching$Stitcher.stitch(Native Method)
    at opencvtest.StitchExperiment.main(StitchExperiment.java:43)

So I'm lost here... 

Original comment by thomas.f...@gmail.com on 14 Sep 2012 at 9:28

GoogleCodeExporter commented 9 years ago
@thomas That's a known bug of the "compile on save" feature of NetBeans 7.1 
(and up?), so disable it and try again. Please post your questions on the 
mailing list if possible next time, thank you

Original comment by samuel.a...@gmail.com on 15 Sep 2012 at 4:46

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
I have tried this code and there is a error with the stitcher, how can use 
stitcher in Eclips?
i have import

import static com.googlecode.javacv.cpp.opencv_stitching.Stitcher;

and still it is give error.
If you can please can I have a solution for this issue.
Thank you

Original comment by sahpiy...@gmail.com on 15 May 2013 at 12:45