Depth Mode on BT-2000 - Moverio BT-200 General

Hello guys,
I'm trying to develop apps for Moverio BT-2000 but the depth mode stay a mystery, I'm able to set params without crash but my ImageView stay black.
Have you any sample code to show how to use this mode.
Thanks a lot.
Franck,

Related

Can you sample a vertical movement of the device?

I'm trying to sample a gesture of physically moving the device up and down (not necessarily tilting it) - is this possible?
The only values that i get either from the accelerometer/orientation/magnetometer is from tilting the device..
yes.
download "Sensor Test" from the market to see what sensor data is available to your program
sensing a jerk is easy simply root sum squates (RSS) the accelerometer values and test against some threshold.
If you want to know up from down you need to rotate the acceleration values by the normalized orientation vector.
Then integrate acceleration with respect to time.
p = (1/2)at^2 + vt +p;
if you want relative sample to sample movements you can simplify by assigning initial conditions to 0... thus
p = 1/2at^2.
p = change in position
t = change in time from sample to sample.
now the accelerometer is probably only accurate to 0.1 G which is very poor
so don't expect super accurate distances.
machine learning gesture algorithm
Thanks, but unfortunately "elevator" like movements can't be detected by simply using any of the sensors.
i guess for that you'll need to manipulate some data using the device's camera.
or for a simpler solution, check if any natural vertical movement is joined with some tilt to the device which can be easily sensed by any of the built in sensors.
But for anther topic, do you know by any chance where could i find a working machine learning gesture algorithm?

How to change ImageView content in layout?

Hi,
in my simple app i have an activity with some textviews and a single imageview.
I'm trying to understand how to dynamically change the content of the imageview in my linear layout. I have a linearlayout and i only need to change the image in it (based on the logic of the underlying application) and similarly the text of the textviews. The pictures are .png files that i have put in res/drawable.
It seems to me that the only way is to use an adapter (simpleadapter) but i struggle to find an example of source code as all the ones i found so far refer to more complex adapters (e.g. simplecursoradapter). Anyway i'm very new to these concepts (adapters, helpers, etc.).
Do i really need to define and use AdapterView (or a more specific subclass?) or if if i keep the image files in res/drawable there is a more straightforward way to dynamically change the ImageView?
Thanks in advance,
x70
ImageView iv = (ImageView)findViewById(R.id.myimageview);
iv.setImageResource(resId);
where resId = R.drawable.mypng
With the textviews is similar, just call setText.
Thanks a lot janfsd. That was really easy...
I did actually try before in that way but i thought i needed also to explicitly set the view (eg via setContentView) and it didnt work; i didn't realise that there is no need for that.
still its not clear to me when do i need to use setContentView, but i made good progress!
Cheers,
x70
setContentView is normally used to set the layout(View) of the activity. I have only used it once per activity. Unless you want to change all the Layout of the activity then don't use it more than once, only on the onCreate method after the super call.
So you should only need to use setSomething method which each view should have it.

Drawing on top of a camera view

Hi there. I'm making an AR app and I couldn't figure out a way to draw on top of a camera view. I've created a custom SurfaceView class which uses Camera.startPreview and Camera.setPreviewDisplay to draw the real time feed from the camera upon it. Now I'm trying to render something on it. I have another SurfaceView which has a painter thread which is running with 30 fps and is drawing every frame on a Canvas obtained by SurfaceHolder.lockCanvas(). I put the two views in a FrameLayout like this
Code:
Preview cv = new Preview(
this.getApplicationContext());
Pano mGameView = new Pano(this.getApplicationContext());
FrameLayout rl = new FrameLayout(
this.getApplicationContext());
setContentView(rl);
rl.addView(cv);
rl.addView(mGameView);
And sadly it doesn't work. It shows only the camera feed. If I switch the order like this
Code:
rl.addView(mGameView);
rl.addView(cv);
The camera feed dissipates and only the painter is visible...
How should I make it work
Phew. Just to tell you I found a solution. You add this line
Code:
getHolder().setFormat(PixelFormat.TRANSLUCENT);
in the initialization of your overlay view

[Q] GLSurfaceView and Soft Input

Hi,
I'm writing an open gl game and it requires the user to be able to type input for things such as high scores, saved games and whatnot.
The problem I'm having is that I can't get the soft input keyboard to display with the GLSurfaceView focused for input events.
Is there a trick to it? is it even possible? or do I have to draw my own keyboard with opengl?
I definitely do not want to show a separate activity with android controls because that would look really cheap and subtract from the game experience.
Any help would be appreciated,
Thank you.
Figured it out.
In the GLSurfaceView constructor I needed to set:
Code:
this.setFocusable(true);
this.setFocusableInTouchMode(true);
And then to show the keyboard:
Code:
((InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE)).showSoftInput(view, 0);
And to hide:
Code:
((InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE)).hideSoftInputFromWindow(view.getWindowToken(), 0)
Not difficult, but it just isn't documented anywhere, at least not the setFocusable() stuff.

Image Low Quality

Hey,
So I'm making an app that needs to display a bitmap or raw (something where X/Y pixels can be modified, so no compression like a jpg).
There's an Activity which contains only an ImageView, I get the Bitmap from the bundle given in the callback from the camera (it's put into the intent before the Activity starts), then I set it to the ImageView in onCreate of this new Activity (which is basically only an ImageView).
For some reason, when viewing this Activity, the picture is of EXTREMELY low quality. Like, tons of jaggies, like it's a thumbnail or something and is force-scaled up to the screen size. The image isn't really like this, though, when I view it in my gallery it's crystal clear. So why is the quality being dragged down to all hell when I set it in the ImageView? I don't care about the performance constraints, this isn't a production app.
I feel there's some quality control function in the ImageView or something, but I have no idea what. Can somebody tell me the "why" or the "fix" - plzzzz - I'm on a really truncated time schedule and haven't had much luck with this camera for too long .
TIA
Syndacate said:
Hey,
So I'm making an app that needs to display a bitmap or raw (something where X/Y pixels can be modified, so no compression like a jpg).
There's an Activity which contains only an ImageView, I get the Bitmap from the bundle given in the callback from the camera (it's put into the intent before the Activity starts), then I set it to the ImageView in onCreate of this new Activity (which is basically only an ImageView).
For some reason, when viewing this Activity, the picture is of EXTREMELY low quality. Like, tons of jaggies, like it's a thumbnail or something and is force-scaled up to the screen size. The image isn't really like this, though, when I view it in my gallery it's crystal clear. So why is the quality being dragged down to all hell when I set it in the ImageView? I don't care about the performance constraints, this isn't a production app.
I feel there's some quality control function in the ImageView or something, but I have no idea what. Can somebody tell me the "why" or the "fix" - plzzzz - I'm on a really truncated time schedule and haven't had much luck with this camera for too long .
TIA
Click to expand...
Click to collapse
what other info does the camera intent return, what extras?
alostpacket said:
what other info does the camera intent return, what extras?
Click to expand...
Click to collapse
How do I check?
I used somebody else's tutorial to learn that the URI is in the 'data' of the bundle.
I tried checking earlier by using its to-string, but that just gave me the container size.
Syndacate said:
How do I check?
I used somebody else's tutorial to learn that the URI is in the 'data' of the bundle.
I tried checking earlier by using its to-string, but that just gave me the container size.
Click to expand...
Click to collapse
you probably have the URI to the thumbnail
Post the tutorial you used and some code, shouldn't be too hard to figure out.
alostpacket said:
you probably have the URI to the thumbnail
Post the tutorial you used and some code, shouldn't be too hard to figure out.
Click to expand...
Click to collapse
There's like upteen thousand tutorials that I compiled to make what I have.
I have no "links" anymore.
I got the Intent from the camera in the onActivityResult function after calling the camera. I pulled the bundle from it using the getExtras() function on the intent.
I then passed that intent to the new Intent I made to create my second Activity. I passed it via the putExtras function on the new intent.
In essence, I did;
Code:
Intent in = new Intent();
in.putExtras(incoming_intent_from_camera.getExtras());
And then called my second Activity.
In the onCreate() function of my second Activity, I pull the bitmap data using:
Code:
Bitmap bmp = (Bitmap)getIntent().getExtras().get("data");
There are two things in this Bundle, data (a Bitmap (android.graphics.Bitmap)) and a bitmap-data, which is a boolean.
EDIT:
Yes, it is definitely the URI to the thumbnail, I need the large image URI.
I have a feeling the problem is that it needs the EXTRA_OPTION string, the only issue is, I don't want to save this any place in particular. I'll let the camera save it to the default location on my SDCard. I just want the URI to that full size or something usable.
I can't do:
Code:
intent.putExtra(MediaStore.EXTRA_OPTION, <URI>);
Because I don't have nor want an additional URI to store it... I got to get EXTRA_OPTION to the camera somehow..
Okay, so here's the deal, that apparently nobody was able to help me with ():
- Like alostpacket said, the "data" key in the bundle returned from the camera activity (in the callback) contains the URI to the thumbnail - that's useless unless I'm making an icon or some other small/tiny/low res picture.
I was correct in the fact that it had something to do with putting the EXTRA_OPTION into the extras that I passed off to the camera intent.
This DID come at a price, though. You have to make a temporary place to store the image (you know, because the regular one in the gallery just isn't good enough of or something). And by temporary I kind of mean permanent, it gets overwritten every time (assuming you use the same path), but won't get removed. I am unable to understand this functionality. If somebody could explain it that would be great.
So all in all my intent to the camera looks like this:
Code:
image_path = Environment.getExternalStorageDirectory().getAbsolutePath() + "/tmp_image.jpg";
File img = new File (image_path);
Uri uri = Uri.fromFile(img);
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
intent.putExtra(MediaStore.EXTRA_OUTPUT, uri);
startActivityForResult(intent, PICTURE_REQUEST);
Where image_path is a private class String and PICTURE_REQUEST is a final String (also class level scope) - which can represent any non-0 number, but is unique to the request (think of it as a request ID).
Then, in the callback function, after checking to make sure the request code is PICTURE_REQUEST, and the resultCode was OK:
Code:
Bitmap bmp = BitmapFactory.decodeFile(image_path);
img_view.setImageBitmap(bmp);
img_view.invalidate();
Where image_path is (a String) wherever the image specified as an extra to the camera activity, img_view is an ImageView display element. The invalidate method will redraw the ImageView.
I hope that helps somebody else stuck in the same position I am.
I'm going to leave this question as "unresolved" because there's one thing I still can't figure out. The "EXTRA_OUTPUT" extra passed to the intent seems like a work-around. All that does is define an alternate path to write the file to, then the callback (or whatever) grabs it from there. It's a hack and a half. There has to be a legit way to grab the full quality image taken with the camera. Whether that's accessing the gallery intent or not I'm not sure, but this is definitely a work around. I hope somebody can provide the answer to that, because a lot of tutorials mention the EXTRA_OUTPUT method, and given what it does, I don't believe that is correct.

Categories

Resources