How can I read and show an .obj in Wikitude Native API? - java

I am trying to use Wikitude Native API to write an Android App. I see the Sample code and build imageTracker. I want to make a customView with other .obj from internet on the recognized image. Can any one give some idea or sample code to me please.
What I understand now is that, I should change the strokedRectangle to my objectLoader, and put it into glRenderer.setRenderablesForKey. The objectLoader should extends Renderable. However, what should I do next?
public void onImageRecognized(ImageTracker tracker, final ImageTarget target) {
Log.v(TAG, "Recognized target " + target.getName());
StrokedRectangle strokedRectangle = new StrokedRectangle(StrokedRectangle.Type.STANDARD);
glRenderer.setRenderablesForKey(target.getName() + target.getUniqueId(), strokedRectangle, null);
}

The Wikitude Native SDK itself is oblivious to the concept of augmentation rendering. All the related code (StrokedRectangle, Renderable, Renderer, etc.) is part of the example application layer only, meaning you can get rid of all of it and implement the rendering as you see fit. These classes merely serve as a demonstration of how one could implement the rendering.
Ultimately, all you need to do is receive a view matrix and the field of view from the Wikitude SDK and use them as your rendering input. You will need to create a projection matrix from the latter, which the sample code demonstrates as well.
If you should require additional assistance with the implementation, I'd be happy to have an extended discussion in the Wikitude forums. Stackoverflow does not seem to me to be the appropriate place for such support matters.

Related

VLCj: How to set motion blur?

I am developing an interactive video player and would like to dynamically set motion blur using VLCj 3.0.1. Since EmbeddedMediaPlayer doesn't provide some kind of setBlur method, I guess I am supposed to use addMediaOptions(String... options).
However, I haven't been able to figure out how to use it. Starting VLC from the command line I would have to add the following parameters --video-filter=motionblur blur-factor=44. Providing the same parameter in an array, doesn't show any effect though. I would be glad, if someone could show me the correct syntax. This is essentially my code:
EmbeddedMediaPlayerComponent vlc = new EmbeddedMediaPlayerComponent();
EmbeddedMediaPlayer player = vlc.getMediaPlayer();
player.playMedia(path);
String[] options = { "video-filter=motionblur", "blur-factor=" + blur };
player.addMediaOptions(options);
In your example code you are adding options after you play the media, that might work in some instances but you should really (generally) just pass them in as additional parameters on your playMedia call.
However...
Some of those options that are not directly supported by a LibVLC API function must be passed when you create the LibVLC instance (i.e. the vlcj MediaPlayerFactory) rather than when you play media.
Since you are using EmeddedMediaPlayerComponent then you should subclass your EmbeddedMediaPlayerComponent and override onGetMediaPlayerFactoryArgs() and pass your motion blur options, along with whatever else you need, there.
Note that you need to send the exact command-line switches, so you must prefix your options with "--".
There is an example of doing precisely that in the vlcj Javadoc for EmbeddedMediaPlayerComponent.
People often ask is there any documentation describing how each of the available VLC options can be set - the short answer is no there is not, and that any use of options like this is totally unsupported and may not work with a future version of VLC/LibVLC.
Ideally, enabling motion blur would be achievable by a new LibVLC API function, but someone would have to write a patch for VLC to make that happen.

Trasparent intro overlay to introduce user the app

I was wondering to create something like a setup wizard for when the user first starts my app. This is needed due to the complexity of the app to help the user. Searching for something like this I found a library that isn't a setup wizard, but lets you point an element on the screen and give some info about it.
The library is this link. (Showcase View Library by Espin)
I'm able to show one indication using this, but I can't concatenate more than one indication, you know, the first is shown, you pulse next and goes to the nex indication, this way until you arrive to the end and pulse finish.
Looking for any tutorial or step-by-step guide that could help me doing this, I found one, but it was done with old code, and the newest version of the library has some changes that doesn't fit the example. I've tried modifiying the code of this example to match with the new version of the library, but I don't get to view the indication one by one, I just get all them overlapped.
This is the link to the library's ShowcaseView class where all this logic is defined: ShowcaseView.java
And this is how the doc says to implement it ot your app:
new ShowcaseView.Builder(this)
.setTarget(new ActionViewTarget(this, ActionViewTarget.Type.HOME))
.setContentTitle("ShowcaseView")
.setContentText("This is highlighting the Home button")
.hideOnTouchOutside()
.build();
Has someone worked with this library and knows how could I concatenate few indications?
What's missing in v5
ShowcaseViews: the class which queues up ShowcaseViews in a
tutorial-type method. I never really liked this class (generally, you
should use SCV sparingly); I'll add it back in based on the Builder
class when I can.
So either:
implement it by yourself and submit a pull request.
Or wait for the next release.
Or use v4
Or submit an issue on github to directly ask the author when this will be released.

Create an EGLContext in C++ and bind it to a Java GLSurfaceView

i try to create an EGLContext in C++ and bint it to a GLSurfaceView.
After some research on google and even here, i don't see something close to my problem.
It is possible to do this ?
I already know that i can do a NativeActivity, but i also need to use Java library for Loading Image, Audio, make HttpRequest, get Device information, etc.
Any help is welcome.

OpenGL JOGL Camera that can be moved by keyboard

I really need a simple camera that i could use with my application. I would like to be able to control the movement of the camera with the keyboard. I only really require that it moves forwards and backwards and rotates with respect to the y-axis.
thanks in advance for any help as i don't know where to start with this one. Many tutorials around on google, but not for jogl :/
among the files included with downloading the official jogl things you can download (demos, tutorials, etc) is included the 'gleem' package, which I've used and quite like.
gleem stands for: GL-E-E-M: GL Extremely Easy-to-use Manipulators
here's the original page for gleem: http://alumni.media.mit.edu/~kbrussel/gleem/#DEMOS (with some pretty images, and context for)
link to source downloads within the offical-ish jogl page: http://java.net/projects/jogl
anyway, however you get it, amongst the file check out these specific options:
gleem.TestExaminerViewer.java
gleem.TestHandleBox.java
gleem.TestMultiWin.java
gleem.TestTranslate1.java
gleem.TestTranslate2.java
gleem.Translate1Manip.java
gleem.Translate2Manip.java
and, I'd expect you'll find what you're looking for. gl
PS - I'm boldy guessing/assuming that you want to control some sort of 'camera' that can be seen, vs. per-say just updating the model_matrix stack (if the later, of course just tie your key bindings to the different values you pass in as you call to update the matrix stack, ala using 'gluLookAt' ... etc)

Recognizing colors/patterns in webpage

I want to try to create a learning chess application as a school project. My first plan was to simply pit this AI against itself, but to really show if it has been succesful it needs to be able to show how well it progresses. In order to do this, i want it to play rated games on sites such as chess.com. However, they do not (yet) have a public API, i believe.
Therefore, i wanted to make a program in java that recognizes colors and images. It keeps an internal 2-dimensional array of all the positions, and recognizes the pieces on the board. I think i have found a way to do this in a window using something like the Java Robot Class.
What i would like it to do, however, is to open this webpage in an internal window and keep doing this in the background. Is there a way to recognize colors within the own window, without needing to be in the foreground?
Edit: I'm planning on using this browser component i just found. I noticed that it is possible to create a full-page snapshot of the page and save it as a BufferedImage(?). Would this make it easier to do this?
Edit 2: I just read that 'Outside assistance from other people, computers/chess engines, or endgame tablebases is entirely prohibited'. I suppose letting a computer do all the playing does certainly include in that. So i might try using another site, so answers that are specific for chess.com won't cut it!
I don't know it it helps but may be you can have a look at the Sikuli project.
http://sikuli.org/
Sikuli is a program (and an API) to handle the interactions with the User Interface. For instance, you can write a script to click on an image or a button in certain conditions.
Especially interesting for you, there is a Java integration: http://sikuli.org/docx/faq/030-java-dev.html
Here is an extract of the website to give you an idea of the code you can write.
EDIT: in this code it is important to notice that you are defining new Patterns with the images. Sikuli will be able to find matching patterns.
import org.sikuli.script.*;
public class TestSikuli {
public static void main(String[] args) {
Screen s = new Screen();
try{
s.click("imgs/spotlight.png", 0);
s.wait("imgs/spotlight-input.png");
s.type(null, "hello world\n", 0);
}
catch(FindFailed e){
e.printStackTrace();
}
}
}
You should consider playing on a chess server where an API is avaible and chess engines are allowed. There is The Internet Chess Club (ICC) where you must pay to have a human account and then you can get a free computer account for your engine. There is also the Free Internet Chess Server (FICS) where you and your engine can get free accounts.
The ICC is usually prefered because the level of players is higher there with lots of international masters and chess masters playing there.
The best way to Interface with theses sites is to implement the xboard protocol. This will allow your engines to play through the Winboard or XBoard interface (among others) and theses interface can be used to connect on FICS or ICC and automatically play there.
I hope this help, even if it does not directly answer the question.
I'm not sure what your input is but you have two options:
You can work an a PNG image. Load the image into a BufferedImage (docs) object and examine it there. You can use a screen shot tool to create those.
It seems chess.com uses HTML with JavaScript. You can download the HTML using HttpComponents and examine it to see where the pieces are. This has the additional benefit that you don't have to guess which piece goes where since the HTML contains the source information.

Categories

Resources