opencv: Stitcher not working on the real Windows Phone (Lumia 950) but works fine on emulator

System information (version)

  • OpenCV => 3.0.0-dev (master)
  • Operating System / Platform => Windows Phone 8.1
  • Compiler => Visual Studio 2013

Detailed description

Stitcher.stitch() function works pretty fine on Windows Phone emulators (x86 code, checked both WP8.1 and W10M) but fails on the real device (I used Microsoft Lumia 950 for development). From my code trace, I found that call of matcher->knnMatch(features1.descriptors, features2.descriptors, pair_matches, 2); in the matchers.cpp produces different pair_matches on emulator and real handset. Sorry, I can’t trace this sophisticated code too deep.

I’m using this picture set; for the test app, I’ve modified slightly (for simplicity) opencv_perf_stitching project by this way (added these lines at the beginning:

    Mat pano;
    vector<Mat> imgs;
    imgs.push_back( imread( "1.jpg" ) );
    imgs.push_back( imread( "2.jpg" ) );
    imgs.push_back( imread( "3.jpg" ) );

   Stitcher stitcher = Stitcher::createDefault();
   auto result = stitcher.stitch(imgs, pano);

Could you please fix this issue as soon as you can (or suggest workaround)? It’s a real showstopper for me now 😦

Steps to reproduce

  • download and unzip this picture set
  • open solution OpenCV.sln
  • set active project opencv_perf_stitching
  • modify source file perf_stitch.cpp as described above
  • add images 1.jpg, 2.jpg, 3.jpg as a Content to the project
  • build project on x86 platform and run on emulator, status will be 0 (normal situation, panorama built)
  • build project on arm platform and run on real phone, status will be 1, i.e. ERR_NEED_MORE_IMGS (matcher not found points)

About this issue

  • Original URL
  • State: open
  • Created 7 years ago
  • Reactions: 1
  • Comments: 32 (14 by maintainers)

Most upvoted comments

Hi Alex, sorry for delayed response. I tried your advice and it works but… vise versa way 😃 By default ARM_NEON definition wasn’t enabled for the WP/UWP ARM builds. I tried to enable it and… it starts working! Sorry, I’m not very familiar with opencv build code so can’t send you a patch; hope, you know how to properly apply this definition for WP/UWP ARM builds…

P.S. I also have small feature request (much easier than this bug): could you implement progress callback on the pics stitching? Stitching many pics in hi res takes a lot of time on arm (btw, I’m very surprised how iPhone software makes hi-res panos - actually, in real time…)

Unfortunately, opencv_test_features2d fails after long time of processing; looks like no output for the passed tests, I copied errors log from “Output” VS window. First fail came from test_agast.cpp, there is no file “agast/result%d.xml” (where %d is type) and I unsure that app can write to the sd-card via standard file i/o. Second fail came from test_detectors_regression.cpp, and after that in about 5 minutes app crashes and exited with code 0x1.

D:\Projects\opencv\modules\ts\src\ts.cpp(519): error: Failed

	failure reason: Unexpected output
	test case #-1
	seed: ffffffffffffffff
-----------------------------------

The thread 0x4ac has exited with code 0 (0x0).
D:\Projects\opencv\modules\ts\src\ts.cpp(519): error: Failed

	failure reason: Bad accuracy
	test case #-1
	seed: ffffffffffffffff
-----------------------------------
	LOG:
badPointCount = 1744; validPointCount = 1744; calcPointCount = 1744
 - Bad accuracy!

-----------------------------------
	CONSOLE: ............................................................
-----------------------------------

The program '[2788] opencv_test_features2d.exe' has exited with code 1 (0x1).

Alex, as far as I remember, one of the differences between emulator and real phone is: app install directory is write accessible on emulator but write protected on the real device. Do you know, does the stitching process some file write operations? And (if “yes”) how to point opencv to the another location?

Alex, do you have an ideas where to trace/what I need to check? I can do side by side tracing/comparison in two running instances of VS with app running on emulator and Lumia but stitching code is sophisticated. I ended up with matcher.cpp (see bug description) but got stuck for now.

P.S. I also tried Emgu.CV C# port and found very same behavior (i.e. bug). By the way, should you mark this issue as a bug? As for me, it looks like bug: Stitcher class is non-functional on WP ARM platform.

Hi @alalek but your patches can’t apply. What I did:

error: patch failed: modules/core/src/parallel.cpp:166
error: modules/core/src/parallel.cpp: patch does not apply
error: patch failed: modules/core/test/test_rand.cpp:382
error: modules/core/test/test_rand.cpp: patch does not apply
  • git apply 8294.diff
error: patch failed: modules/stitching/perf/perf_stich.cpp:2
error: modules/stitching/perf/perf_stich.cpp: patch does not apply

What I’m doing wrong?