Re: [osg-users] parameters
Hi Robert, So there is no way I can capture focal length effects in OSG using the Prespective projection matrix? Thank you! Cheers, Ricky -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=30680#30680 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] parameters
Hi, I am a little confused now. I was wondering if I can do this now: http://www.opengl.org/discussion_boards/ubbthreads.php?ubb=showflatNumber=211014 Thank you! Cheers, Ricky -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=30633#30633 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] parameters
Hi, I wanted help with setting these five camera parameters: focal length, f, the location of the image in pixel coordinates (o_x, o_y), the effective pixel size in the horizontal and vertical direction (s_x, s_y)? How can I set these is osg?? Thank you! Cheers, Ricky -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=30558#30558 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Camera intrinsics
Hi, I have a quick question. I looked up online on setting camera intrinsics (5 parameters, including radial distortion). Would I be using viewer.getCamera()-setProjectionMatrixAsPerspective(intrinsic_parameter_matrix)? Also, can I do this (with a different matrix) before rendering each frame? Thank you! Cheers, Ricky -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=30318#30318 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Camera intrinsics
Thank you! I am essentially changing the view (using setViewMatrix) before rendering each frame. With each new view matrix, I have a different set of intrinsic parameters and I was wondering if I can set those again. In essence, can I repeatedly change intrinsic parameters of the camera? Keith Parkins wrote: Use camera-setProjectionMatrix(intrinsic_parameter_matrix); Not sure what you are trying to do with respect to the other question you have. On Tue, 27 Jul 2010, Ricky Flintoff wrote: Hi, I have a quick question. I looked up online on setting camera intrinsics (5 parameters, including radial distortion). Would I be using viewer.getCamera()-setProjectionMatrixAsPerspective(intrinsic_parameter_matrix)? Also, can I do this (with a different matrix) before rendering each frame? Thank you! Cheers, Ricky -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=30318#30318 ___ osg-users mailing list http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org Keith ParkinsU of R Center for Visual Science ___ osg-users mailing list http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- Post generated by Mail2Forum -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=30320#30320 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Camera intrinsics
Hi, Oh wow! Thank you very very much! Thank you! Cheers, Ricky -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=30328#30328 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Camera intrinsics
Hi, Sorry! I have a couple of more questions. Whats _near and _far? Also, is there any reference for these equations? Thank you again for your tremendous help. Cheers, Ricky -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=30330#30330 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] osg camera : setting view matrix
Hi, I have a quick question regarding reference frames. I was reading this: http://www.openscenegraph.org/projects/osg/wiki/Support/Tutorials/CameraControl If I am correct, by rotating -90 on X axis, I am transforming from (X pointing to the right, Y looking up, Z pointing out of the screen) to (X pointing to the right, Y pointing into the screen, Z pointing up). Thank you! Cheers, Ricky -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=30249#30249 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] osg camera location
Hi, Thank you for the reply! I understand that I need to set the view matrix at each frame and that's exactly what I am going for. However, my problem has been to find out how the model is set up. In other words, where is it placed in terms of camera coordinates? If I am right, from the looks of it, it is placed in the center? What I am going for is basically this: I want to keep the model stationary, but move the camera (view matrix) around and capture snapshots of the model from different locations. I want to hard code the view matrices, but I cannot fathom how I can place them. I am used to transforming the object and keeping the camera fixed (OpenGL way). Any suggestions to what I can do? Thank you! Cheers, Ricky -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=30009#30009 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] osg camera location
Hi, I have a question regarding the transformation matrix of the viewer. What is the default? I mean, when just loading the osg file and then displaying using viewer.run, what are the matrices? How does osg render it? I am used to explicity transforming the object from the viewer reference, however, osg does it for me. I don't seem to fathom where does it keep the object and the camera. Thank you! Cheers, Ricky -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=29905#29905 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Screeshots from multiple cameras/views
Tom Pearce wrote: Ricky, Based on the code you posted, you're taking a screenshot every frame - and from the same position, no less. You're creating the same matrix each time, and thus setting the view matrix to be identical each frame. Then you're doing file I/O that is the exact same too. When I ran your code without doing all of this on every frame (i.e. returning after the first frame or two) everything seemed to work. In fact, I also ran it exactly as you'd posted it, and it still executed without error, just very slowly. I'm not sure where the seg faults are coming from but perhaps you're just bogging stuff down too much since the code isn't really doing something you actually want it to do...? In principle I don't see a problem with moving the camera from one view to another and taking a picture from two (or more) points - but the way it is set up right now isn't right. At least, not as I see it. Cheers, Tom Thank you very much for running my code. I have decided to attack the problem by rendering the scene graph and then changing the view matrix in order to capture scene from different views. Also, when you ran my code, did you see the cow moving or rotating? I just wanted to make sure that you saw that. Again, thank you very much for your help. -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=29412#29412 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Screeshots from multiple cameras/views
Hi Robert, robertosfield wrote: Hi Ricky, On Tue, Jun 22, 2010 at 3:54 AM, Ricky Flintoff wrote: Thank you very very much for your suggestion! I actually ran into another problem with the code. I tend to get segmentation faults. My idea was to take multiple pictures as I changed the position of my camera. Any way I can get rid of these seg faults? This isn't something we can answer - it's your code, it's your crash, we know nothing about what might be causing it. To get rid of seg faults you have use a debugger and work what is going wrong. Robert. ___ osg-users mailing list http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- Post generated by Mail2Forum Thanks a lot! Also, I was wondering if you know any good debugging tools for linux/osg? Thanks, RIcky -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=29413#29413 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Screeshots from multiple cameras/views
Hi, As a solution, I decided to change the viewpoint of the camera and then take pictures as I change the viewpoint. However, with the code I have, it's really slow (cow rotates very slowly) Any suggestions or ways I can over come this problem? Code: //capture an image of the scenegraph class CCameraPostDrawCallback: public osg::Camera::DrawCallback { public: CCameraPostDrawCallback(const int cX, const int cY, const int w, const int h, const std::string str) { centerX = cX; centerY = cY; width = w; height = h; fileName = str; } void operator () (const osg::Camera cam) const { //take a picture of the scene osg::ref_ptrosg::Image screenShot = new osg::Image; screenShot-readPixels(centerX, centerY, width, height, GL_RGB, GL_UNSIGNED_BYTE); osgDB::writeImageFile(*screenShot, fileName); } private: int centerX; int centerY; int width; int height; std::string fileName; }; osg::Node* CreateScene() { //add rendering modifications //load the osg model osg::Node* loadedModel = osgDB::readNodeFile(cow.osg); return loadedModel; } int main(int argc, char *argv[]) { osgViewer::Viewer viewer; viewer.setSceneData(CreateScene()); viewer.getCamera()-setProjectionMatrixAsPerspective(60., 1., 1., 100. ); viewer.setUpViewInWindow(0, 0, 500, 500); //create a matrix to specify a distance from the viewpoint. osg::Matrix trans; trans.makeTranslate(0., 0., -12.); //Rotation angle (in radians) double angle(0.); while (!viewer.done()) { viewer.getCamera()-setPostDrawCallback(new CCameraPostDrawCallback(0, 0, 500, 500, screenshot.jpg)); //Create the rotation matrix. osg::Matrix rot; rot.makeRotate(angle, osg::Vec3(1, 0., 0.)); angle += 0.01; viewer.getCamera()-setViewMatrix(rot * trans); viewer.frame(); } } Thank you! Cheers, Ricky -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=29188#29188 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Screeshots from multiple cameras/views
Hi, Thank you very very much for your suggestion! I actually ran into another problem with the code. I tend to get segmentation faults. My idea was to take multiple pictures as I changed the position of my camera. Any way I can get rid of these seg faults? Thank you! Cheers, Ricky -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=29237#29237 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Screeshots from multiple cameras/views
Hi, I am new to OSG. I have gone through several example code, tutorial and the OSG quick start guide in order to understand OSG functionality. My goal is to essentially produce a framework that researchers could use to evaluate object tracking algorithms. In order to successfully accomplish this, I want to create a setup that allows user to render their models and take screen shots from several different angles of their models. I have been able to accomplish this with a single camera. However, I am having a hard time with the next step: creating multiple cameras (should I be using multiple cameras or a master-slave system?) in the scene and taking screen shots from there. Is there any tutorial that specifically addresses this? I couldn't find it. Any help on this would be great! Thank you! Cheers, Ricky -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=29169#29169 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org