
I don't think I'm copying back and forth. Maybe I misinterpreted the call to cvSetData( img , &view.begin()[0] , num_channels<View>::value * view.width() * sizeof( channel_t ));
Can you get access to the image buffer, scanline length, etc? These should do the trick: uchar * QImage::bits () const uchar * QImage::bits () const int QImage::bytesPerLine () const int QImage::depth () const QImage::Format QImage::format () const int QImage::height () const int QImage::width () const
So I can get a pointer to the image buffer. In the case of an ARGB8 image this pointer can be cast to QRgb* (which is a typedef for unsigned int). A (class modelling) PixelIteratorConcept should return a (class modelling) PixelConcept on dereference. unsigned int does not model PixelConcept, so I suppose I need to create a proxy class that does model PixelConcept... What I need to implement is this (please correct me if I'm mistaken): // a pixel in a QImage // models PixelConcept template<QImage::Format Format> struct qimage_pixel { // ... } // iterate over the pixels of a QImage // models PixelIterator/MutablePixelIterator template<QImage::Format Format> struct qimage_pixel_iterator; template<QImage::Format Format> struct qimage_const_pixel_iterator; // for every member of QImage::Format: template<QImage::Format Format> type_from_x_iterator<qimage_pixel_iterator<Format> >::view_t qimage_view(const QImage& image) { return interleaved_view( image.width(), image.height(), qimage_iterator<Format>(image.bits()), image.bytesPerLine() ); } // specialize some traits classes (const_iterator_type, channel_type, // color_space_type, ...) for qimage_pixel and qimage_pixel_iterator