Topic locked

word box coordinates error

March 24, 2014 - 12:36am #1

In my application, i create a bitmap of the camera image using the call back c++ function as discussed in your forums. Using textreco sample, when i get a word result and get x,y coordinates for the word box i use this to crop the original bitmap. many times the x,y coords are not within the original image and end up getting an error. any idea why?

word box coordinates error

March 25, 2014 - 8:51am #12

Ok.

word box coordinates error

March 25, 2014 - 7:29am #11

Sorry..that was the oversite on my part. Got it right now.

word box coordinates error

March 25, 2014 - 7:22am #10

..

word box coordinates error

March 25, 2014 - 7:18am #9

Yes, that makse sense; as I said in my previous post, you need to swap wordx and wordy  (because the wordx and wordy are referred to landscape)

 

word box coordinates error

March 25, 2014 - 7:16am #8
The logged coordinates before crash as below:
 
03-25 17:13:34.396: E/AUGMENT(1726): Word coordinates : x : 77 Y : 520
03-25 17:13:34.396: E/AUGMENT(1726): Bitmap size : x :800 Y : 480
03-25 17:13:34.401: A/libc(1726): Fatal signal 11 (SIGSEGV) at 0x00000028 (code=1), thread 2010 (Thread-9319)
 
my implementation:
float wordx = obb.getCenter().data[1];
float wordy = obb.getCenter().data[0];
 
//Convert float to int and pass this to java. The values are then logged.
    xCoord = (int)wordx;
    yCoord = (int)wordy;
 
Bitmap is created as per tutorial:
 
Im using Samsung S4
 

word box coordinates error

March 25, 2014 - 7:05am #7

OK, I just tested this, and one thing that you need to keep in mind is that the obb coordinates are always reported in landscape mode,

i.e. in reference to the Image Camera frame (which is always considered landscape, although you might be using Text Reco in Portrait mode).

So, the issue you are seeing is probably just because you need to swap the X and Y coordinates.

 

word box coordinates error

March 25, 2014 - 6:13am #6

Ok, so, this is from the API reference:

https://developer.vuforia.com/sites/default/files/doxygen/12-16-2013-05-43-59_doxygen/publicAPI/nav_f.png); background-color: rgb(221, 236, 238); line-height: 18px; background-repeat: repeat no-repeat;">
Obb2D com.qualcomm.vuforia.WordResult.getObb (  )  

Returns the oriented bounding box in image space of the word.

the bounding box (obb) of the word is reported in camera image space, i.e. in pixels of  the camera image;

so, technically, if you take the center of the OBB, this should be within the boundaries of the camera image;

for example, if the camera bitmap is 640 x 480, then the obb center should be: x between 0 and 640,  y between 0 and 480.

So, you are saying that occasionally the x,y coordinates fall outside those values.

Do you have a print out of the Logs, where you print the bitmap size and the x,y coordinates, just to get an idea of how much the coordinates are off ?

 

word box coordinates error

March 25, 2014 - 5:25am #5

Using the tutorial https://developer.vuforia.com/forum/faq/android-how-can-i-access-camera-image i create a bitmap in java of one of the camera images.

From the renderer native function, when a word is detected i get the x,y coordinates as stated below and pass these to java.
The main aim of doing this is to get that exact position in the created bitmap. At times i get an error since the coordinates lie outside the bitmap created.
Am i going about this the wrong way?

word box coordinates error

March 25, 2014 - 4:18am #4

Ok, so, now I understand better the obb center part, however, when you say 

"...from a bitmap created using the native callback function"

which bitmap do you refer to ? how do you create this bitmap ? or what does it represent ?

word box coordinates error

March 25, 2014 - 4:09am #3

From my native i use obb.getCenter().data[1] and obb.getCenter().data[1] to get x,y coordinates of word box centre. i use this coordinates to select this area in java from a bitmap created using the native callback function. when i use these coordinates i at times get the centre of the word box and at times get an error since either the x or y are too large compared to the original sved image.

word box coordinates error

March 24, 2014 - 1:23am #2

many times the x,y coords are not within the original image and end up getting an error

This depends on how you compute the x,y coordinates within the rectangle;

this sounds like it has nothing to do with Vuforia, as this is simply about computing x,y (row,column) coordinates inside a bitmap; so it is a mere C++ or Java and maths programming issue.

We would really like to see questions that strictly relate to Vuforia in this Forum.

Also, and more in general, it is hard to tell what the problem is, if:

  • you don't explain what exactly you are doing by showing some details on your maths and your code, etc.
  • you mention some error, but you don't clarify what the exact errors are (e.g. providing the log messages or so).

 

 

Topic locked