Topic locked

change ImageTarget to another Image instead of stones.jpg

October 29, 2012 - 2:49am #1

Hi there, i have a problem here,

i want to change my image target to another image instead of the stones.jpg and chips.jpg, so i tried to  change this code

if (!dataSetStonesAndChips->load("StonesAndChips.xml", QCAR::DataSet::STORAGE_APPRESOURCE))

to this

if (!dataSetStonesAndChips->load("grass.xml", QCAR::DataSet::STORAGE_APPRESOURCE))

also i have imported my grass.jpg into /media, my grass.xml and grass.dat into my  /assets. but there was nothing happen, my object didn't show in my android.

i wonder what the problem, was it because i did wrong to the code, or the image is not good to be an ImageTarget? this, is the image that i used to my application http://gurusakti.files.wordpress.com/2012/02/marker2.gif

change ImageTarget to another Image instead of stones.jpg

March 3, 2014 - 12:43pm #24

The thread is going off-topic, please create new threads for new questions.

Thanks.

 

change ImageTarget to another Image instead of stones.jpg

March 2, 2014 - 12:33am #23

Hi,

I want to know how to determine the comparison between image and object

I've used image from sample(ChipsAndStones), but my objek looks small, so i try to change the value of kObjectScale to 300.0f and it's closer to camera

The object is not stand right on image

I mean like this :

 

Top is my object use chips.jpg and i want to make like the bottom one.

Also,i've tried to make my own image, i try to change the dimension of my image to 600x840, And i upload my image and fill the width 247, change the code, but it's same like before(chips.jpg)

Thanks.

change ImageTarget to another Image instead of stones.jpg

April 12, 2013 - 7:40am #22

Glad to help!

change ImageTarget to another Image instead of stones.jpg

April 12, 2013 - 7:33am #21

Ya it's working, Thanks a lot

change ImageTarget to another Image instead of stones.jpg

April 12, 2013 - 12:14am #20

Hi, in order to add an extra thumbnail, you need to modify the loadTextures() method in VideoPlayback.java, to accomodate the extra texture:

private void loadTextures()
{
    mTextures.add(Texture.loadTextureFromApk("VuforiaSizzleReel_1.png",
                getAssets()));
    mTextures.add(Texture.loadTextureFromApk("VuforiaSizzleReel_2.png",
                getAssets()));
    mTextures.add(Texture.loadTextureFromApk("MY_VIDEO_THUMBNAIL.png",
                getAssets()));
    mTextures.add(Texture.loadTextureFromApk("play.png",
                getAssets()));
    mTextures.add(Texture.loadTextureFromApk("busy.png",
                getAssets()));
    mTextures.add(Texture.loadTextureFromApk("error.png",
                getAssets()));
}

(NOTE: remember to add your thumbnail PNG file in the assets directory, and use the actual file name in the Java code above).

Then, you will also need to modify this code in VideoPlayback.cpp, to take into account the fact that we inserted a thumbnail texture at position 3 (index = 2) in the array, and that as a consequence all subsequent textures have been shifted by one position in the array:

// Depending on the status in which we are we choose the appropriate
// texture to display. Notice that unlike the video these are regular
// GL_TEXTURE_2D textures
switch (currentStatus[currentTarget])
{
    case READY:
        glBindTexture(GL_TEXTURE_2D, textures[3]->mTextureID);
        break;
    case REACHED_END:
        glBindTexture(GL_TEXTURE_2D, textures[3]->mTextureID);
        break;
    case PAUSED:
        glBindTexture(GL_TEXTURE_2D, textures[3]->mTextureID);
        break;
    case NOT_READY:
        glBindTexture(GL_TEXTURE_2D, textures[4]->mTextureID);
        break;
    case ERROR:
        glBindTexture(GL_TEXTURE_2D, textures[5]->mTextureID);
        break;
    default:
        glBindTexture(GL_TEXTURE_2D, textures[4]->mTextureID);
        break;
}

You can try this, it should work.

 

 

 

 

change ImageTarget to another Image instead of stones.jpg

April 11, 2013 - 10:55am #19

Could you give me a help in this

Android - How do I add another target to the Video Playback samp

i'm just wondering how can i add a thumbnail for the new vide that will appear before press play button.

 

Thanks

change ImageTarget to another Image instead of stones.jpg

April 11, 2013 - 8:42am #18

you're welcome.

change ImageTarget to another Image instead of stones.jpg

April 10, 2013 - 2:17am #17

Thanks for prompt reply :)

change ImageTarget to another Image instead of stones.jpg

April 9, 2013 - 11:51pm #16

Hi asabbour, 

that code is in ImageTargets.cpp, which is located under the JNI folder in your sample project directory.

change ImageTarget to another Image instead of stones.jpg

April 9, 2013 - 10:16am #15

Hi Dear

Could you help and tell me where is this code can be found to modify

if (!dataSetStonesAndChips->load("StonesAndChips.xml", QCAR::DataSet::STORAGE_APPRESOURCE))

 

Thanks in advance

change ImageTarget to another Image instead of stones.jpg

November 28, 2012 - 8:27am #14

Hi, this sounds like a Unity 3D question; please post it in the Unity section of the Forum.

Thanks.

change ImageTarget to another Image instead of stones.jpg

November 28, 2012 - 8:01am #13

I just want my ImageTarget to be invisible so my animatiuon can be seen below the target.

When i apply a Unlit / trans shader it gets swapped back at runtime...anyideas?

change ImageTarget to another Image instead of stones.jpg

November 3, 2012 - 9:31pm #12

thanks duane, i forgot to clean it first.

change ImageTarget to another Image instead of stones.jpg

November 3, 2012 - 9:35am #11

After the change, did you do an ndk-build on the project, then clean and rebuild the main project to force it to use the new native library?

change ImageTarget to another Image instead of stones.jpg

November 3, 2012 - 3:41am #10

i have problem to change image target to another image. i have been change this code:

 

if (!dataSetStonesAndChips->load("StonesAndChips.xml", QCAR::DataSet::STORAGE_APPRESOURCE)) //diubah { LOG("Failed to load data set."); return 0; }

 

with  my xml code. i change that code like this:

if (!dataSetStonesAndChips->load("AR_ANDArt_Version1.xml", QCAR::DataSet::STORAGE_APPRESOURCE)) //diubah { LOG("Failed to load data set."); return 0; }

 

but it not change the marker. when i show my picture, the virtual object not show. it still work with last picture (stones and chips). can you help me?

change ImageTarget to another Image instead of stones.jpg

October 31, 2012 - 9:15am #9

You're welcome.

change ImageTarget to another Image instead of stones.jpg

October 30, 2012 - 10:19pm #8

waw, your explanation is so helpfull Alessandro, you explained it very clear to me, now i understand the concept of the "world size" of our ImageTarget.. thank you very much..

change ImageTarget to another Image instead of stones.jpg

October 30, 2012 - 1:14am #7

The problem is that if you increase the size of your Image Target, then in a certain way, QCAR will adjust the "world size" with respect to your camera;

if you like, you can think of it as if you are changing the unit of measure in your world;

for example, imagine the original size in the samples (width = 247) is in millimeters (which is actually the size of an A4 paper);

then, when you hold your printeed target in front of your camea at (for instance) about half a meter distance, Vuforia will detect it and will report (in the pose) that it is about 500 units away (in practice, 500 millimeters, right?)

 

Now, suppose you change the target size to 24.7 (i.e. 10 times smaller); you can think of it as if you are now using centimeters instead of millimeters (247 millm is = 24.7 cm).

Now when you hold your printed target still at half a meter away from the camera, Vuforia will report (in the pose) that the target is about 50 units away.

So, to summarize, we have reduced the size by a factor 10, and thus we get a distance from the target also reduced by 10 (from 500 down to 50);

now, at this point you want to render your Teapot, but the teapot mesh (vertices in the vertex array) is defined (suppose) in millimeters

(i.e. you have vertex coordinates that make sense for a real teapot if you interpret those coordinates to be in millimeters);

 

because the coordinates of the teapot are in millimeters, they will range between for example -100 and +100 (just as an example) in X, Y, and Z;

so suddenly, when using the size of your target in centimeters, your teapot will now look huge, because Vuforia will place it at "just" 50 units (instead of 500 units) away from the camera; 

 

In short: reducing the size of the Image Target (in the XML) has the consequence of increasing the size of the teapot (assuming you are using the same A4 printed target in all tests); 

and vice versa, of course, increasing the size of the target (as you did), results in the teapot to look smaller, thus requiring a larger scale.

 

So, it is normal that you have to increase the kObjectScale in your case, to compensate.

 

However, the value of 800 looks definitely too big, unless you are using a model other than the teapot, are you ?

If not, then I would suggest to try to play with the target size in the XML, trying different values, starting from the original sample size (247 width), and changing it by a factor 2 and see what scale you need to set...

 

I hope this helps.

 

 

 

 

 

 

 

change ImageTarget to another Image instead of stones.jpg

October 29, 2012 - 11:40pm #6

I did your suggesion, i also tried to upload my Images and pick one which had the stars at the most. and finally my object appeared on my image target, but the size changed to very very small. i must change the kObjectScale value into 800 to make it fit. i think it is strange i changed the kObject scale soo big like that.. any idea?

was the problem is in my xml

<?xml version="1.0" encoding="UTF-8"?>
<QCARConfig xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="qcar_config.xsd">
    <Tracking>
        <ImageTarget size="1000 777" name="rainbowleaves"/>
    </Tracking>
</QCARConfig>

the part that i blocked.. is pretty big if we compare to StonesAndChips.xml, 247 173.

change ImageTarget to another Image instead of stones.jpg

October 29, 2012 - 9:56am #5

once again, thank you for the explanation and suggesion, it is very helpfull for me :D
well i'll try it tomorrow 'cause it's already midnight at my place, i think i should go to sleep for a while, ahaha

change ImageTarget to another Image instead of stones.jpg

October 29, 2012 - 9:21am #4

About the code: yes, your code change is sufficient, as long as you put your new dataset (TestAR.xml and TestAR.dat) in the /assets folder, which is what you do already, right ? so that's fine!

 

One suggestion (in general): one "safe" way of testing whether your code change and all the dataset creation process is correct, is to try by taking one of the sample images (e.g. Chips.jpg or Stones.jpg), maybe renaming them to "MyTestAR.jpg" and uploading it to TMS, and so generate a dataset that will (for sure) have a high star rating (because it is made from the same assets we use in the samples);

then you can test your code changes while being sure that there is no problem with the tracking rate; once you have that confidence, you can repeat the process with your actual image (e.g. Grass.jpg or similar).....

 

change ImageTarget to another Image instead of stones.jpg

October 29, 2012 - 9:00am #3

thx for your fast reply Alessandro :)

yeah, i noticed the rating of my image, only had one star. and yeah, maybe i should try to find another image that has 3 or more stars to make sure it can be easily detected to the camera.

but how about the code? is that right to modify the code just like that? or there are more code that i should modify or add?

change ImageTarget to another Image instead of stones.jpg

October 29, 2012 - 5:27am #2

Hi hoaxman,

I tried to upload your image (after converting it from GIF to JPG)  to the online Target Management System, and the result is that the 5-star Tracking Rate is quite low, just: 1.

The issue with your image seems to be a low local contrast (need to have more local contrast).

Considering that the ideal is 5, you should try to increase your tracking rate a little bit (I would recommend to reach a level of "3" at least);

have a look at https://ar.qualcomm.at/qdevnet/developer_guide/ in the AR App Design Guide section, where it explains how to improve your image rating.

 

 

Topic locked