Search Results

• 3D zooming technique to maintain the relative position of an object on screen

- by stark
Is it possible to zoom to a certain point on screen by modifying the field of view and rotating the view of the camera as to keep that point/object in the same place on screen while zooming ? Changing the camera position is not allowed. I projected the 3D pos of the object on screen and remembered it. Then on each frame I calculate the direction to it in camera space and then I construct a rotation matrix to align this direction to Z axis (in cam space). After this, I calculate the direction from the camera to the object in world space and transform this vector with the matrix I obtained earlier and then use this final vector as the camera's new direction. And it's actually "kinda working", the problem is that it is more/less off than the camera's rotation before starting to zoom depending on the area you are trying to zoom in (larger error on edges/corners). It looks acceptable, but I'm not settling for only this. Any suggestions/resources for doing this technique perfectly? If some of you want to explain the math in detail, be my guest, I can understand these things well.

• Interesting 3d zooming technique

- by stark
Is it possible to zoom to a certain point on screen by modifying the field of view and rotating the camera as to keep that point/object in the same place on screen while zooming ? Changing the camera position is not allowed.. I projected the 3d pos of the object on screen and remembered it. Then on each frame I calculate the direction to it in camera space and then I construct a rotation matrix to align this direction to Z axis (in cam space). After this, I calculate the direction from the camera to the object in world space and transform this vector with the matrix I obtained earlier and then use this final vector as the camera's new direction. And it's actually "kinda working", the problem is that it is more/less off than the camera's rotation before starting to zoom depending on the area you are trying to zoom in (larger error on edges/corners). It looks acceptable, but I'm not settling for only this. Any suggestions/resources for doing this technique perfectly ? If some of you want to explain the math in detail, be my guests, I can understand these things well. Thanks. Edit: I'll check often for responses, I'm really curious about this :D

• Create Adjustable Depth of Field Photos with a DSLR

- by Jason Fitzpatrick
If you’re fascinating by the Lytro camera–a camera that let’s you change the focus after you’ve taken the photo–this DSLR hack provides a similar post-photo focus processing without the \$400 price tag. Photography tinkers at The Chaos Collective came up with a clever way of mimicking the adjustable depth-of-field adjustment effect from the Lytro camera. The secret sauce in their technique is setting the camera to manual focus and capturing a short 2-3 second video clip while they rotate the focus through the entire focal range. From there, they use a simple applet to separate out each frame of the video. Check out the interactive demo below: Anywhere you click in the photo shifts the focus to that point, just like the post processing in the Lytro camera. It’s a different approach to the problem but it yields roughly the same output. Hit up the link below for the full run down on their technique and how you can get started using it with your own video-enabled DLSR. Camera HACK: DOF-Changeable Photos with an SLR [via Hack A Day] Secure Yourself by Using Two-Step Verification on These 16 Web Services How to Fix a Stuck Pixel on an LCD Monitor How to Factory Reset Your Android Phone or Tablet When It Won’t Boot

• Issues implementing arcball viewer

- by Pris
My scene has a simple cube, and a camera built with the lookAt function (I'm using OpenGL). The scene renders fine, and I'm sure I have my model/view/projection matrices set up correctly. Now I'm trying to implement arcball rotation for my camera, but I'm having some trouble. I've got it down to calculating the angle/axis rotation for a virtual sphere in normalized screen coordinates. That means when I move my mouse left to right, I get an angle around the Y axis... and moving my mouse up/down will get me an angle about X. I'm not sure where to go from here -- what do I need to do with my axis so I can apply the angle to simulate camera rotation about its viewpoint? If I try directly applying the axis/angle rotation the camera/view transform I get what you'd expect. The view is rotated about the world axes which the mouse moving over the virtual sphere on the screen corresponds to. So if I move the mouse up/down the view rotates about the world's X axis (what I get reminds me of a first-person view)... but this isn't what I want. I think I need the axis I get to be transformed so it passes through the camera viewpoint and is oriented correct in reference to the camera... but I don't know if that's right or how to do that.

• Problems with 3D transformation - (SharpDX)

- by Morphex
First of all , I have been trying to get this right for a couple of day already, I have read so much info and still fail miserably to understand this. So I am going to tell you that even though I have done fairly amount of research myself, I failed to implement it. I must say miserably I am trying to create a generic camera class for a game engine of sorts - for research purposes only - the thing is I have no idea how to go about it. I have read about quaternions and matrices, but when it comes to the actual implementation I suck at it. Sharpdx has already Matrices and QUaternions implemented. SO no big deal on the map behind it. How in the world would I go about creating a camera? I have seen so many camera examples and still can't make one that works as expected. I would like to implement diferent types too (Orbital, 6DoF, FPS). So what is need for a camera? UP, Forward and Right vectors I read they are needed, also a quaternion for rotations, and View and Projection matrices. I understand that a FPS camera for instance only rotates around the World Y and the Right Axis of the camera. the 6DoF rotates always around their own axis, and the orbital is just translating for set distance and making it look always at a fixed target point. The concepts are there, now implementing this is not trivial for me. Can anyone point me on what am I missing, what I got wrong? I would really enjoy if you could give a tutorial, some piece of code, or just plain explanation of the concepts. Thank you for readin, a frustrated coder.

• How do I cap rendering of tiles in a 2D game with SDL?

- by farmdve
I have some boilerplate code working, I basically have a tile based map composed of just 3 colors, and some walls and render with SDL. The tiles are in a bmp file, but each tile inside it corresponds to an internal number of the type of tile(color, or wall). I have pretty basic collision detection and it works, I can also detetc continuous presses, which allows me to move pretty much anywhere I want. I also have a moving camera, which follows the object. The problem is that, the tile based map is bigger than the resolution, thus not all of the map can be displayed on the screen, but it's still rendered. I would like to cap it, but since this is new to me, I pretty much have no idea. Although I cannot post all the code, as even though I am a newbie and the code pretty basic, it's already quite a few lines, I can post what I tried to do void set_camera() { //Center the camera over the dot camera.x = ( player.box.x + DOT_WIDTH / 2 ) - SCREEN_WIDTH / 2; camera.y = ( player.box.y + DOT_HEIGHT / 2 ) - SCREEN_HEIGHT / 2; //Keep the camera in bounds. if(camera.x < 0 ) { camera.x = 0; } if(camera.y < 0 ) { camera.y = 0; } if(camera.x > LEVEL_WIDTH - camera.w ) { camera.x = LEVEL_WIDTH - camera.w; } if(camera.y > LEVEL_HEIGHT - camera.h ) { camera.y = LEVEL_HEIGHT - camera.h; } } set_camera() is the function which calculates the camera position based on the player's positions. I won't pretend I know much about it. Rectangle box = {0,0,0,0}; for(int t = 0; t < TOTAL_TILES; t++) { if(box.x < (camera.x - TILE_WIDTH) || box.y > (camera.y - TILE_HEIGHT)) apply_surface(box.x - camera.x, box.y - camera.y, surface, screen, &clips[tiles[t]]); box.x += TILE_WIDTH; //If we've gone too far if(box.x >= LEVEL_WIDTH) { //Move back box.x = 0; //Move to the next row box.y += TILE_HEIGHT; } } This is basically my render code. The for loop loops over 192 tiles stored in an int array, each with their own unique value describing the tile type(wall or one of three possible colored tiles). box is an SDL_Rect containing the current position of the tile, which is calculated on render. TILE_HEIGHT and TILE_WIDTH are of value 80. So the cap is determined by if(box.x < (camera.x - TILE_WIDTH) || box.y > (camera.y - TILE_HEIGHT)) However, this is just me playing with the values and see what doesn't break it. I pretty much have no idea how to calculate it. My screen resolution is 1024/768, and the tile map is of size 1280/960.

• How does one make the camera on the iphone appear from the app delegate? Is it possible?

- by K-RAN
I'm just playing around with a simple program that opens the camera. That's literally all that I want to do. I'm a beginner and I believe that I have the basics down in terms of UI management for the iPhone so I decided to give this one a whirl. What I'm trying to do right now is... - (BOOL) application:(UIApplication*) application didFinishLaunchingWithOptions:(NSDictionary*) launchOptions { UIImagePickerController * camera = [[UIImagePickerController alloc] init]; camera.delegate = self; camera.sourceType = UIImagePickerControllerSourceTypeCamera; camera.allowsEditing = NO; camera.showsCameraControls = NO; [viewController presentModalViewController:camera animated:NO]; [window addSubview:viewController.view]; [window makeKeyAndVisible]; return YES: } So basically, initialize the camera, set some things and show it in the main view. I set the camera's delegate to self because this code is placed in the delegate class (and yes, the delegate class is conforming to UIImagePickerControllerDelegate && UINavigationControllerDelegate). Main problem right now is that nothing is appearing on the screen. I have absolutely no idea what I'm doing wrong, especially since the program is building correctly with no errors or warnings... Any help is appreciated! Thanks a lot :D

• How to use web camera in android emulator to capture a live image?

- by Kumar
Hi,As far as i know, Android emulator doesn't have a camera .To capture a live image we have to use web camera.I have seen code in this web site "http://www.tomgibara.com/android/camera-source" to use web camera in android emulator to capture a image but, i don't how to use this code.I am new to this field , can any one help me how to do it. regards, s.kumaran.

• How to select camera by index when running VLC from cmd?

- by Ole Jak
When I start VLC from cmd how\is it possible to select a camera for directshow source by index (for example i have camera "A" and camera "B" so i would say 0 for "A" and 1 for "B") i do not know device name and i do not know camera name - only its index (0, 1...)?

• How can I take a photo from my camera phone remotely? [closed]

- by kurt
Is there any app where I could control the camera of my phone remotely(even bluetooth would do) I have a Nokia 5800 xpress music. The app could either be a stand alone app installed on the mobile phone than could click snaps at predefined intervals or if there is a app that I can install on my PC and then control my phone's camera via bluetooth or wifi or anything else. Is this possible?

• Java.lang.RuntimeException:setParameters failed at android.hardware.camera.native_setParameter(Nativ

- by bean chan
I'm using the Android APIDemo sample code. but my phone is G2 Android OS 2.1

• surveillance camera viewer programming in .net

- by Takamari
I'm trying to build a viewer application for analog surveillance cameras in .NET. Something along the line of Zoneminder. Just wondering if there's any api available or where should I start looking in the .NET framework? I'm no expert in the imaging area. Thank you.

• android surfaceview camera preview

- by Arutha
I am trying to resize a surfaceview on which I am displaying a video. That doesn't work on the nexus one - after resizing the surfaceview, the screen is white.

• Draw over camera using JAVA ME

- by Richard Ibarra
I'm wondering if there is anyway for drawing somethin over the videoControl. I tried using LWUIT but I can't achieve any result, have anybody done somethin similar? Any help will be appreciate

• Sometimes UIImageView seems to reject the image taken with iPhone Camera

- by maxbareis
Hi, it is very strange, because this error doesn't happen all the time... I have the following code: - (IBAction)getPhoto:(id)sender { UIImagePickerController * picker = [[UIImagePickerController alloc] init]; picker.delegate = self; #if TARGET_IPHONE_SIMULATOR picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary; #else picker.sourceType = UIImagePickerControllerSourceTypeCamera; #endif [self presentModalViewController:picker animated:YES]; } with the corresponding delegated selector - (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info { UIImage *image = [[info objectForKey:@"UIImagePickerControllerOriginalImage"] imageByScalingToSize:CGSizeMake(480, 320)]; [[self imageView] setImage:image]; [picker dismissModalViewControllerAnimated:YES]; } strange thing is, somtimes the image appears in imageView and sometimes not. I have called (gdb) po UIImagePNGRepresentation(image) right after setImage and stuffed the output into a file. The file is a perfect png. Has anyone experienced the same? Has anyone found a solution for it? Thanks in advance Max

• Developing an app with Camera Access and GPS

- by Jins
I need to develop a symbian application in which the app is triggered while taking a photo and upload to a web location with the GPS location of the phone. I would like to know which all devices can support this and is there any API restrictions or licence required to do this.

• Easiest way to position camera in XNA?

- by DMan
Everytime I load my model into XNA, I can usually see it far off in the distance. When I change some parameters and make it zoom up close, 10/10 times it's rotated funny and I'm set with the task of rotating it. Is there any easy way to do it except by experimenting? Or am I exporting it wrong (using Blender)? Is there any value I should set the objects in my 3d scene to be before exporting it so they appear 'upright'?

• Samsung UMPC, Built in Camera doesn't support DirectX how can I use it?

- by Markive
The Samsung Q1 Ultra, is the perfect device for my software except that the built in camera seems to be incompatible with standard DirectX drivers, so my .Net camera implementation can't use the device. I have limited experience in this area.. Even Skype can't access this camera, but a little program from Samsung can.. I've looked at the program's assemblies and it's too obfuscated to see inside so I can't see anyway to use them.. What sort of camera could this be? Are there any .Net classes / implementations I can use to access this camera?

• Quaternion Camera

- by Alex_Hyzer_Kenoyer
Can someone help me figure out how to use a Quaternion with the PerspectiveCamera in libGDX or in general? I am trying to rotate my camera around a sphere that is being drawn at (0,0,0). I am not sure how to go about setting up the quaternion correctly, manipulating it, and then applying it to the camera. Edit: Here is what I have tried to do so far. // This is how I set it up Quaternion orientation = new Quaternion(); orientation.setFromAxis(Vector3.Y, 45); // This is how I am trying to update the rotations public void rotateX(float amount) { Quaternion temp = new Quaternion(); temp.set(Vector3.X, amount); orientation.mul(temp); } public void rotateY(float amount) { Quaternion temp = new Quaternion(); temp.set(Vector3.Y, amount); orientation.mul(temp); } public void updateCamera() { // This is where I am unsure how to apply the rotations to the camera // I think I should update the view and projection matrices? camera.view.mul(orientation); ... }

• Box2D how to implement a camera?

- by Romeo
By now i have this Camera class. package GameObjects; import main.Main; import org.jbox2d.common.Vec2; public class Camera { public int x; public int y; public int sx; public int sy; public static final float PIXEL_TO_METER = 50f; private float yFlip = -1.0f; public Camera() { x = 0; y = 0; sx = x + Main.APPWIDTH; sy = y + Main.APPHEIGHT; } public Camera(int x, int y) { this.x = x; this.y = y; sx = x + Main.APPWIDTH; sy = y + Main.APPHEIGHT; } public void update() { sx = x + Main.APPWIDTH; sy = y + Main.APPHEIGHT; } public void moveCam(int mx, int my) { if(mx >= 0 && mx <= 80) { this.x -= 2; } else if(mx <= Main.APPWIDTH && mx >= Main.APPWIDTH - 80) { this.x += 2; } if(my >= 0 && my <= 80) { this.y += 2; } else if(my <= Main.APPHEIGHT && my >= Main.APPHEIGHT - 80) { this.y -= 2; } this.update(); } public float meterToPixel(float meter) { return meter * PIXEL_TO_METER; } public float pixelToMeter(float pixel) { return pixel / PIXEL_TO_METER; } public Vec2 screenToWorld(Vec2 screenV) { return new Vec2(screenV.x + this.x, yFlip * screenV.y + this.y); } public Vec2 worldToScreen(Vec2 worldV) { return new Vec2(worldV.x - this.x, yFlip * worldV.y - this.y); } } I need to know how to modify the screenToWorld and worldToScreen functions to include the PIXEL_TO_METER scaling.

• How can I add a portrait layout on top of a landscape Camera SurfaceView?

- by user319919
I need a Camera SurfaceView for my application. The camera should be set to fixed landscape view which is done by setting android:screenOrientation="landscape" for the activity in the AndroidManifest.xml. After doing some experiments and Google researches trying to use setRotation(int) inside the camera preview implementation, I came to the conclusion, that it is obviously the common practice to get a preview with correct behaviour. Now the camera preview itself looks fine for landscape orientation. But I need to have an overlay that holds a bunch of buttons. Due to usability the user interface should be in portrait view (or even better orientation aware). There seemed no other option to me, but to fix the activity screenOrientation, so that the camera preview looks normal (in portrait mode the whole view is streched and rotated to the left) Is there a workaround to get my buttons back to portrait orientation? Or another overall approach to deal with the camera view? Parameters.setRotation(int) obvisouly didnt work. I am quite new to the Android plattform programming. Of course I dont know much about the programming tricks and workarounds yet. I did a lot of research over the last two weeks, but couldnt find the right solution so far.

• Move camera to fit 3D scene

- by Burre
Hi there. I'm looking for an algorithm to fit a bounding box inside a viewport (in my case a DirectX scene). I know about algorithms for centering a bounding sphere in a orthographic camera but would need the same for a bounding box and a perspective camera. I have most of the data: I have the up-vector for the camera I have the center point of the bounding box I have the look-at vector (direction and distance) from the camera point to the box center I have projected the points on a plane perpendicular to the camera and retrieved the coefficients describing how much the max/min X and Y coords are within or outside the viewing plane. Problems I have: Center of the bounding box isn't necessarily in the center of the viewport (that is, it's bounding rectangle after projection). Since the field of view "skew" the projection (see http://en.wikipedia.org/wiki/File:Perspective-foreshortening.svg) I cannot simply use the coefficients as a scale factor to move the camera because it will overshoot/undershoot the desired camera position How do I find the camera position so that it fills the viewport as pixel perfect as possible (exception being if the aspect ratio is far from 1.0, it only needs to fill one of the screen axis)? I've tried some other things: Using a bounding sphere and Tangent to find a scale factor to move the camera. This doesn't work well, because, it doesn't take into account the perspective projection, and secondly spheres are bad bounding volumes for my use because I have a lot of flat and long geometries. Iterating calls to the function to get a smaller and smaller error in the camera position. This has worked somewhat, but I can sometimes run into weird edge cases where the camera position overshoots too much and the error factor increases. Also, when doing this I didn't recenter the model based on the position of the bounding rectangle. I couldn't find a solid, robust way to do that reliably. Help please!