OpenSceneGraph Forum Forum Index OpenSceneGraph Forum
Official forum which mirrors the existent OSG mailing lists. Messages posted here are forwarded to the mailing list and vice versa.
 
   FAQFAQ    SearchSearch    MemberlistMemberlist    RulesRules    UsergroupsUsergroups    RegisterRegister 
 Mail2Forum SettingsMail2Forum Settings  ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
   AlbumAlbum  OpenSceneGraph IRC ChatOpenSceneGraph IRC Chat   SmartFeedSmartFeed 

How to simulate camera distortion ?


 
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> General
View previous topic :: View next topic  
Author Message
blackball
Newbie


Joined: 20 Nov 2017
Posts: 3

PostPosted: Fri Dec 08, 2017 11:16 am    Post subject:
How to simulate camera distortion ?
Reply with quote

Hi,

I would like to simulate a real camera with intrinsics and distortion parameters.

To make it more clear: I want to have a viewer, which I could assign a real camera model (pinhole, fisheye, etc) to, then I could get the real camera view. (I want to record the sequence for some later processing).

I have checked the source code of osg/Camera, seems it doesn't support distortion. I wonder how I can do it.

...

Thank you!

Cheers,
Jishen
Back to top
View user's profile Send private message
bbjorn
Appreciator


Joined: 12 Oct 2010
Posts: 207
Location: Linköping, Sweden

PostPosted: Fri Dec 08, 2017 1:35 pm    Post subject:
Reply with quote

Hi Jishen,

I did the opposite, i.e. corrected the optical distortion from a captured image. This was done by applying the captured camera image to a plane and then using a fragment shader to rectify the image.

https://github.com/bjornblissing/osgueye/blob/master/src/camerarectification.frag

You could do the opposite, i.e. render your scene to a texture then apply a fragment shader to distort your image according to your camera parameters.

Note that you will have to calculate the correct field of view of the camera you wish to simulate and apply this FoV to your osg::Camera before rendering to the texture.

Cheers,
Björn
Back to top
View user's profile Send private message Visit poster's website
robertosfield
OSG Project Lead


Joined: 18 Mar 2009
Posts: 11311

PostPosted: Fri Dec 08, 2017 1:55 pm    Post subject:
How to simulate camera distortion ?
Reply with quote

Hi Jishen,

Have a look at the osgdistortion example, this use a render the 3d
scene to a texture, then a rendering this texture to the screen using
a distorted mesh. Alternatively you can do wha Bjorn suggested and
use a simple quad and shader to do the distortion during the second
pass.

Robert.

On 8 December 2017 at 11:17, Jishen Li <> wrote:
Quote:
Hi,

I would like to simulate a real camera with intrinsics and distortion parameters.

To make it more clear: I want to have a viewer, which I could assign a real camera model (pinhole, fisheye, etc) to, then I could get the real camera view. (I want to record the sequence for some later processing).

I have checked the source code of osg/Camera, seems it doesn't support distortion. I wonder how I can do it.

...

Thank you!

Cheers,
Jishen

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=72551#72551








------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message
blackball
Newbie


Joined: 20 Nov 2017
Posts: 3

PostPosted: Fri Dec 08, 2017 3:08 pm    Post subject:
Reply with quote

Thanks very much @robertosfield && @Bjorn!

I will check your suggestions out.

...

Thank you!

Cheers,
Jishen
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> General All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum

Similar Topics
Topic Author Forum Replies Posted
No new posts Slave camera lighting with disabled m... ravidavi General 9 Tue Jan 09, 2018 1:06 am View latest post
No new posts Free camera manipulator Styx General 2 Sun Jan 07, 2018 8:06 am View latest post
No new posts Resizing an FBO camera with OSG 3.2.0 James Turner General 7 Fri Dec 08, 2017 9:07 pm View latest post
No new posts When gets the view matrix of a camera... wernerM General 2 Sat Nov 18, 2017 4:08 pm View latest post
No new posts Camera collision with terrain ht11 General [3rdparty] 0 Fri Oct 13, 2017 7:34 am View latest post


Board Security Anti Bot Question MOD - phpBB MOD against Spam Bots
Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP