Board index FlightGear Support Graphics

How to simulate capturing an image using a camera

Graphics issues like: bad framerates, weird colors, OpenGL errors etc. Bad graphics ar usually the result of bad graphics cards or drivers.
Forum rules
In order to help you, we need to know a lot of information. Make sure to include answers to at least the following questions in your initial post.

- what OS (Windows Xp/Vista, Mac etc.) are you running?
- what FlightGear version do you use?
- what graphics card do you have?
- does the problem occur with any aircraft, at any airport?
- is there any output printed to the console (black window)?
- copy&paste your commandline (tick the "Show commandline box on the last page of FGRun or the "Others" section on the Mac launcher).
- please upload a screenshot of the problem.

If you experience FlightGear crashes, please report a bug using the issue tracker (can be also used for feature requests).
To run FlightGear on old computers with bad OpenGL support, please take a look at this wiki article. If you are seeing corrupted/broken textures, please see this article.

Note: If you did not get a reponse, even after 7 days, you may want to check out the FlightGear mailing lists to ask your question there.

How to simulate capturing an image using a camera

Postby roy111 » Tue Oct 29, 2013 12:58 pm

Hi,

Is there a convenient way use flight gear to simulate capturing a still image using a camera mounted on an aircraft ?
The camera has extrinsic parameters (position and orientation in some format), and hopefully some intrinsic parameters.

I wish to simulate image capturing automatically either by using a batch file while running an existing flight gear application, or building the open source of flight gear and interfacing the source such that I can request to obtain captured images given the camera's extrinsic and intrinsic parameters.

Thanks,
Roy
roy111
 
Posts: 3
Joined: Tue Oct 29, 2013 12:49 pm

Re: How to simulate capturing an image using a camera

Postby Hooray » Tue Oct 29, 2013 1:54 pm

Hi & welcome,

you can use custom views to come up with the corresponding view position: http://wiki.flightgear.org/Howto:Config ... FlightGear
and then use the built-in screen shot fgcommand to take screen shots: http://wiki.flightgear.org/List_of_Nasa ... _functions
These two features can be combined using Nasal scripting: http://wiki.flightgear.org/Nasal

If you should know C++ and how to build FlightGear from source, a better option would be extending the canvas system such that it can render scenery views and so that it can serialize canvases to a file/stream: http://wiki.flightgear.org/Canvas_Properties
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 11317
Joined: Tue Mar 25, 2008 8:40 am

Re: How to simulate capturing an image using a camera

Postby Johan G » Tue Oct 29, 2013 3:34 pm

Using the above techniques as well as a few more, as outlined in Howto:Make full spherical panorama on the wiki, one can make stunning panoramas like in the topic 360x180 Panoramic.

I'd say the limit will be your imagination. :wink:
Low-level flying — It's all fun and games till someone looses an engine. (Paraphrased from a YouTube video)
Improving the Dassault Mirage F1 (Wiki, Forum, GitLab. Work in slow progress)
Johan G
Moderator
 
Posts: 5461
Joined: Fri Aug 06, 2010 5:33 pm
Location: Sweden
Callsign: SE-JG
IRC name: Johan_G
Version: 3.0.0
OS: Windows 7, 32 bit

Re: How to simulate capturing an image using a camera

Postby roy111 » Wed Oct 30, 2013 10:10 am

Is there a way to define camera parameters ? (focal length, pixels number, radial distortion).
Also, can I save the image directly to a file? capturing screen shots seems to be very limited in case of large images.
roy111
 
Posts: 3
Joined: Tue Oct 29, 2013 12:49 pm

Re: How to simulate capturing an image using a camera

Postby Mr.Snappy » Wed Oct 30, 2013 3:44 pm

You can simulate radial distortion with Rembrandt, no idea about focal length and pixels number though.
Mr.Snappy
 
Posts: 41
Joined: Mon May 20, 2013 3:25 pm
Callsign: Mr.Snap, ATC-SNA
Version: 2.12
OS: Ubuntu 12.10

Re: How to simulate capturing an image using a camera

Postby Hooray » Wed Oct 30, 2013 4:16 pm

No, currently that's not directly supported as far a I know - but if you know some C++, you could definitely add those features by looking at existing C++ code, such as the screen shot feature and FlightGear's view manager. We have quite a few folks here who are into UAV stuff, so they would surely appreciate such features and be fully supportive. As previously mentioned, you'll have to XML/Nasal workarounds otherwise.

80-90% of the code is already there actually - it "just" needs to be slightly refactored and integrated.
Regarding "camera effects", we do not currently have shader support for canvas elements, but TheTom once mentioned that this could be added at some point - I guess, it should be also done at the canvas::Element layer - for that, you'd want to look at 1) the effects framework and 2) rembrandt

But feel free to file a feature request at: http://code.google.com/p/flightgear-bug ... %20request
Ideally, by linking to this forum thread, for future reference.

Eventually, this is probably going to be added as a custom Canvas::Element, just for viewManager-based camera views - the canvas system can already use other canvases as raster image sources, so that saving/streaming a canvas/camera view should be pretty straightforward.


FlightGear Developers Portal: http://wiki.flightgear.org/Portal:Developer

How to build FlightGear: http://wiki.flightgear.org/Building_FlightGear

How to start core development: http://wiki.flightgear.org/Howto:Start_core_development

Rendering camera views to a texture: http://wiki.flightgear.org/Howto:Use_a_ ... Instrument

The FlightGear property-view Manager: in $FG_SRC/Viewer/view*

https://gitorious.org/fg/flightgear/sou ... iewmgr.cxx

FlightGear's canvas system can be found in $SG_SRC/canvas

All supported canvas elements are in $SG_SRC/canvas/element

Implementing new canvas elements: http://wiki.flightgear.org/Talk:Canvas_Element
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 11317
Joined: Tue Mar 25, 2008 8:40 am

Re: How to simulate capturing an image using a camera

Postby Philosopher » Wed Oct 30, 2013 6:56 pm

Mr.Snappy wrote in Wed Oct 30, 2013 3:44 pm:You can simulate radial distortion with Rembrandt, no idea about focal length and pixels number though.

Yeah, Rembrandt has focal length too (IIRC; FG doesn't normally have distance blurring/whatever, but Rembrandt can do that). The number of pixels is simply going to be the size of your FG window, which can be specified on the commandline (so not really a "camera" property, per se):

Code: Select all
--geometry=WxH               Specify window geometry (640x480, etc)


roy111 wrote in Wed Oct 30, 2013 10:10 am:Also, can I save the image directly to a file? capturing screen shots seems to be very limited in case of large images.

What do you mean? Capturing a screen shot does save it to a file (.png).
Thanks,
Philosopher
(inactive but lurking occasionally...)
Philosopher
 
Posts: 1590
Joined: Sun Aug 12, 2012 6:29 pm
Location: Stuck in my head...
Callsign: AFTI
Version: Git
OS: Mac OS X 10.7.5

Re: How to simulate capturing an image using a camera

Postby Hooray » Thu Oct 31, 2013 8:23 am

right, again: there's a built-in feature for creating screen shots, which can be accessed through a so called "fgcommand", the fgcommand can be triggered in various ways - including via key/joystick bindings, network (http/telnet) or Nasal scripting.
However, the code itself is not particularly optimized, so in its current form it isn't suitable for capturing at very high frequencies (even "just" framerate is unlikely to work)
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 11317
Joined: Tue Mar 25, 2008 8:40 am

Re: How to simulate capturing an image using a camera

Postby roy111 » Sun Nov 03, 2013 8:44 am

I am interested in saving a captured image to a file. I do not care much about real time/calculation speed. Also, the image size I wish to save is larger than the screen size, and I do not wish to reduce resolution.
Will specifying --geometry=WxH option wherein the size is larger than the screen save an image with a resolution larger than the screen resolution ?
Thanks!
roy111
 
Posts: 3
Joined: Tue Oct 29, 2013 12:49 pm

Re: How to simulate capturing an image using a camera

Postby Hooray » Sun Nov 03, 2013 11:43 am

I don't think that the resolution of created screen shots can be independently configured - but if you're building from source, it would probably take only a handful of changes to support that, we already support custom filenames/paths, so the same technique could be used to communicate resolutions to the OSG backend code.

However, I haven't tried it - I suggest to just go ahead and play with some of these things, you may be surprised, and may even surprise us - overall, it would seem better to experiment a little from here on, rather than asking questions that are really uncharted territory :D
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 11317
Joined: Tue Mar 25, 2008 8:40 am


Return to Graphics

Who is online

Users browsing this forum: No registered users and 5 guests