inspirit / jsfeat

JavaScript Computer Vision library.
MIT License
2.74k stars 374 forks source link

Warp perspective for RGBA images #52

Open vfateev opened 8 years ago

vfateev commented 8 years ago

I see warp perspective is implemented only for grayscale images. Is it hard to implement the same for standard color images? Want to hear your opinion before digging into Java JAI or OpenCV code. What was the reason why you implemented it for single channel source only?

inspirit commented 8 years ago

if you look into the warping code you will see it quite easy to adopt it to multichannel images. the reason it is done for single channel at the moment is performance. i dont know why u need this function for rgb(a) images but you might consider doing it with GL shader instead if its for pure render case and not further processing

josundin commented 8 years ago

Hello, previously I did an adoption of warp_perspective for rgba images, you can find a function called warp_perspective_color in: https://github.com/josundin/magcut/blob/master/js/imagewarp.js It's not optimized for performance but I guess it does what you are looking for.

vfateev commented 8 years ago

I was going to use glfx.js lib perspective API based on Web GL, but hopefully Johan has already shared implementation I was looking for. It works pretty fast at least for 2mb image, looks very promising. So thanks a million to Johan!

josundin commented 8 years ago

Cheers. Also thanks to inspirit making and sharing jsfeat!

DouglasCostaPinheiro commented 7 years ago

Hello,

I was trying to adapt the warping code to 4 channels (RGBA). But I'm struggling. Can someone help me?

Edit: Sorry, I'm dumb, didn't see the name of the function on the post of @josundin ... Thanks!