Ask Your Question
0

Weird issue: Output of running same code on Android & OSx differs

asked 2013-02-23 13:27:34 -0600

Abhinav gravatar image

updated 2013-02-23 14:02:45 -0600

berak gravatar image

I've written some simple snippet in C++ and ran that on Android as well on OSx with same inputs and the result I got is different on both platform. Now the only thing I could think of is, the way I'm assuming to test the output is wrong, so here is the snippet..

string file = "imgage.jpg"; // trust me, files on both machines are same
Mat inputFrame = imread(file);

OrbFeatureDetector detector(500);
std::vector<KeyPoint> keypoints;

Mat image;
cvtColor(inputFrame, image, CV_RGB2GRAY);
detector.detect(image, keypoints);

cout << keypoints.size() << endl; //

Problem

cout << keypoints.size() << endl; // this gives different ouput running for same image on Android and OSx.

I ran this test on 8 different types of images and it runs fine except for the following image. Please ignore commenting on kind of image, this is just some random test.

image description

Running provided test on Android gives 176 keypoints while running on OSx gives 172 keypoints.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
2

answered 2013-02-23 14:29:04 -0600

Jpeg is lossy compression format. Potentially it can be decoded differ on different platforms. Try to use some loseless format like *.png. If problem will be reproduced with png I recommend you to create bug on OpenCV issue tracker.

edit flag offensive delete link more

Comments

made sense! Thank you. :)

Abhinav gravatar imageAbhinav ( 2013-02-23 21:56:02 -0600 )edit

I've tried this again with some other image(png) and again getting different result. I've further dig into keypoints and got this finding. Printing keypoints on OSx http://bpaste.net/show/6nCXv9WAS8D7zOwNWtb7/, printing keypoints on Android: http://bpaste.net/show/J4ALq14k17EW2nodT8oA/ ; Image used: http://snag.gy/G5XGJ.jpg

Abhinav gravatar imageAbhinav ( 2013-02-24 04:20:34 -0600 )edit

@Abhinav Hi, I am working on feature detection and I came across the same problem. http://answers.opencv.org/question/7298/issue-while-doing-simple-template-based-feature/ Could you please tell me how you figured it out? I have been working on this for such a long time...Any help is much appreciated!!

wowoo gravatar imagewowoo ( 2013-02-26 00:34:28 -0600 )edit

Question Tools

Stats

Asked: 2013-02-23 13:27:34 -0600

Seen: 280 times

Last updated: Feb 23 '13