1

I am trying to (in code) take an image file and apply three dimensional transformations (think: perspective) to it.

The application I'm working on is written in C#, and I've already looked at the MSDN info on skewing/rotating images. Unfortunately, this is not enough control -- I need the functionality offered by the "Perspective" tool that GIMP/Photoshop offer.

I'm already using P/Invoke to call the following C++ DLL's (got them out of the GIMP /bin folder) for other image functionality:

[DllImport("libgobject-2.0-0.dll", SetLastError = true)]
[DllImport("librsvg-2-2.dll", SetLastError = true)]
[DllImport("libgdk_pixbuf-2.0-0.dll", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]

This approach seems to work well for what I need to do (rasterize a vector image), and it keeps all of the code inside the application (I'd rather not have to go the commandline route -- I know GIMP can be scripted, but that's sort of a last resort right now).

I'd like to figure out a way to use these libraries (libgdk-pixbuf-2.0, libgobject) and others, if needed, to accomplish the three dimensional transforms I need to do.

Anyone have any suggestions? I'm open to other ideas, but really like the idea of using those opensource libraries to get the job don

  • If you want to write the software yourself, look into affine transforms. .NET has support for them, last I checked. – Rethunk Nov 09 '13 at 00:50

1 Answers1

1

Open CV has warpPerspective function which is exact to your need. For working in C#, you might consider Emgu.cv a c# wrapper to OpenCV.