Is it possible to convert boost matrix to image.

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Is it possible to convert boost matrix to image.

I am using boost for image processing, I found the boost::gil a bit too complicated for a newbie.. so instead i tried using other available libraries in boost to start off with.

So basically what i want to do is
1. Read a gray scale image.

2. Load the pixel values into a boost matrix.

3. Apply a random filter to the matrix.

4. convert the matrix back into and image for display.

so far what I have done is

   < QPixmap pixmap("lena.bmp");

   pixmap = pixmap.copy(512,512,128,128);
   pixmap = pixmap.scaled(128,128);
   QImage image = pixmap.toImage();
   QRgb col;

   int g;
   int width = pixmap.width();
   int height = pixmap.height();
   matrix<double> m(width,height);

   for (int j = 0; j < m.size2(); j++)
       for (int i = 0; i < m.size1(); i++)
            m(i,j) = qGray(image.pixel(i,j));

so basically i guess the pixel values are being saved into a matrix 'm' now i would like to display this matrix as an image is there someway that i can do this?

thanks in advance