[Library] JmeProCamera

Here is the first release of the library I was showing off in my last post ( Pro camera library ) https://github.com/matthewseal/JmeProCamera

Here is how to use the library:

// to create a lens definition
LensDef lensDef = new LensDef("Canon EF 24-70mm f/2.8L USM")
            .setCanAutoFocus(true)
            //.setFstop(2.8f, 22f, 4f, 32f); for a variable aperture lens
            .setFstop(2.8f, 22f)
            .setMaximumFocal(70f)
            .setMinimumFocal(24f)
            .setNearestFocus(0.38f)// in meters
            .usableWith(Sensor.FULLFRAME, Sensor.CANON_APS_C);
// for usability with any sensor use, there will be no duplicate enumerations
lensDef.usableWith(Sensor.values());

// Then to create the actual lens
Lens lens = lensDef.create();
lens.setAutoFocus(true);// might want to set

// Finally initialize the CameraAppState
CameraAppState cameraState = new CameraAppState(Sensor.FULLFRAME, lens);// can also input a LensDef
cameraState.setDofEnabled(false);// use to disable the depth of field filter if not wanted
stateManager.attachState(cameraState);

I have also implemented the ability to interpolate on the focal length, fstop and focus distance(auto focus disabled) values of the lens through:

cameraState.setInterpolator(Lens.Value.FOCALLENGTH, /* start */ 17f, /* end */ 50f, /* velocity */ 1f);
// Note: these are reset upon lens changes.

To change the values of the lens:

lens.setFocalLength(35f);
lens.setFstop(2.8f);
lens.setFocusDistance(10f);// given that auto focus is disabled

If you want to see the library in action, I have created a demo that can be downloaded from the github repository.

Please tell me what you think and suggest any new features you want to see!

11 Likes

Can you add a few screenshots of before after? (also maybee link to the old description would be nice)

I tried to add the link, I am on mobile right now

Here are some screenshots as well as a gif
I am also working on a lens pack containing many different lenses to try out and find which one you want to use, including prime lenses (ones with a fixed focal length).

Nikon 35mm on an APS-C sensor:

Canon 11-24mm on a fullframe sensor:

Canon 70-200mm on a fullframe sensor:

Lens focus distance interpolation:

1 Like

What license do you intend for this code?

I ask as you have a MIT license file but then there are GPL headers in the code - these aren’t compatible. Have you re-used GPL code form elsewhere?

Also from a quick look (to see what sensors you have in there) I notice some of the sensor sizes are incorrect. E.g. four thirds should be 17.3x13 (see http://www.olympus.co.uk/site/en/c/cameras/om_d_system_cameras/om_d/e_m5_mark_ii/e_m5_mark_ii_specifications.html for example), and if I’m being pedantic the “micro” refers to the lens mount, not the sensor (which is just four thirds).

I don’t mean to come across negative though, I took the time to look as it seems like interesting work! So I’d encourage keeping at it.

Thanks for the info, I thought I set it all to GPL but I will fix that. I will also rename the “micro four thirds” sensor to just “four thirds” as well. Let me know if I got any of the other sensor sizes wrong