Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

WIP for Eigen plugin (number-crunching)
Started by StarCrunch Jun 01 2017 03:53 PM

No replies to this topic
eigen matrices numerical matlab solvers number crunching linear algebra
[TOPIC CONTROLS]
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

StarCrunch

[GLOBAL: userInfoPane.html]
StarCrunch
  • Contributor

  • 814 posts
  • Corona SDK

Hi.

 

In another topic I mentioned that I was dabbling with Eigen, a well-known linear algebra toolkit. This is largely aimed at large-scale number crunching, but for all I know might be generally useful. Anyone familiar with MATLAB or GNU Octave will have done similar work. The use cases I have now or in mind for the future deal mainly with processing images, where a lot of math needs to touch most or all pixels.

 

Almost up-to-date interfaces are found in the docs here. I'm not sure when I'll flesh them out for real, but most of these methods come from Eigen, in which case its own docs should give a pretty good idea.

 

So far I only have a Windows version, but in case it's of interest, I've attached my current test program, which uses thin plate splines to distort an image. The DLLs may be added to the %appdata%/Roaming/Corona Labs/Corona Simulator/Plugins/plugin folder (create the last bit if necessary).

 

Apologies for the lazy interface! Basically, you have N (this is 15, but can be changed) pairs of small shapes on top of the image, the so-called "landmarks". You can drag a given circle somewhere on the image, then drag the square of the same color to another spot. When you're ready, hit the white circle and it will bake a warp + affine transformation map (you will see said map being rendered during this process). Then with the slider you can transition from the original image to its warped counterpart. The landmarked points will go from circle to corresponding square, while everything else from the image goes along for the ride.

 

Owing to some laziness, you'll need to relaunch to try again.  :P

 

With a little work on the Lua side, this could be turned into a tool. One could do a display.save() before attaching the shader and then reuse it later. The shader itself should be reusable elsewhere.

 

As mentioned in the previous topic, another case I have in mind is IK.

 

Much of the dense API is bound, with completeness as the goal. I'm not sure about the sparse API; I might go crazy at this point, if I try.  :D I'm vacillating on adding the geometry module.

 

For anyone interested, I've been trying to keep the repository here up-to-date with the development one. This builds on the utilites I posted some time ago, as well as a small helper library to recycle objects, when desired. I've been trying to comment the code lately, but it's ongoing.

Attached Files




[topic_controls]
[/topic_controls]

Also tagged with one or more of these keywords: eigen, matrices, numerical, matlab, solvers, number crunching, linear algebra