Re: returning a ublas matrix from a function

Joaquim Duran <[email protected]>
Newsgroups gmane.comp.lib.boost.ublas
Message-ID <CANdawSELNwmK-B18mLDGzhy0YqqaZ==ZHFw0hMc5aO23wTuquQ@mail.gmail.com>
Ublas is a library for algebra, so the matrices or vectors could not
be displayed as an image. IMO, you should:

1 - Copy the contents of a GIL image to a matrix.

2 - Manipulate the contents of the matrix: filter,....

3 - Copy the matrix to a GIL image

4 - Show the contents of the new image.

Joaquim Duran


2014-08-22 9:08 GMT+02:00 sanann <[email protected]>:
> 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
>
>
>
> --
> View this message in context: http://boost.2283326.n4.nabble.com/returning-a-ublas-matrix-from-a-function-tp4666050p4666752.html
> Sent from the Boost - uBLAS mailing list archive at Nabble.com.
> _______________________________________________
> ublas mailing list
> [email protected]
> http://lists.boost.org/mailman/listinfo.cgi/ublas
> Sent to: [email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.