ImageToMemory does not behave as expected


You might consider it heresy, but I am trying to use OpenCV to process image that have been aquired with CVBlox. I am copying the image to a memory block using ImageToMemory, but when I look at the results in OpenCV the image looks entirely garbled. Can you fix this?

Hi, Did you had the chance to look at the application note that addresses how to get CVB images over to OpenCV and vice versa?

I’ve copied it over to the Forum FTP server - you can download it here.


Hey @taserface!

Heresy? Don’t worry, we won’t call the Spanish Inquisition and cardinal Fang won’t poke you with that soft cushion of his… :wink:

We don’t have a problem with questions like that - after all why should we? Different vision SDKs have different advantages, and it only makes sense to use what best fits your application. In fact we’re happy that you’ve seen a benefit in :cvb: and made use of it!

Now to your question at hand: Contrary to what the name may indicate, ImageToMemory is not the function you are looking for. ImageToMemory basically dumps a :cvb: image object into a block of memory - including all sorts of internal object information. What you are after is the pixel data, and only the pixel data. And ideally you’d not even want to copy those pixels because most often that is just a waste of time.

A while back I’ve written up and application notes that happens to use OpenCV as an example on how to get CVB to interoperate with other vision SDKs. It’s the one @Frank pointed out. I hope it gives you a good idea of what to do - and if not you know where you’ll find us :slightly_smiling_face:


Hi guys! Thanks for the hint - the information in the PDF did it for me!