Convert IplImage to Bitmap

classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

Convert IplImage to Bitmap

Raphael Gava
Hi people, does anyone know how i can convert an image (IplImage) to Bitmap? Can one help me?

Thanks a lot!



      ____________________________________________________________________________________
Veja quais são os assuntos do momento no Yahoo! +Buscados
http://br.maisbuscados.yahoo.com

[Non-text portions of this message have been removed]

Reply | Threaded
Open this post in threaded view
|

Re: Convert IplImage to Bitmap

yihaa_5
Hi my friend. I faced this problem before..
but what i ended up is
cvSaveImage( whatever u want to save);

 and then load it as a bitmap to your

System::Drawing::Bitmap::FromFile( where u have saved);
try it.. :)


--- In [hidden email], Raphael Gava <raphael_gava@...> wrote:

>
> Hi people, does anyone know how i can convert an image (IplImage) to Bitmap? Can one help me?
>
> Thanks a lot!
>
>
>
>       ____________________________________________________________________________________
> Veja quais são os assuntos do momento no Yahoo! +Buscados
> http://br.maisbuscados.yahoo.com
>
> [Non-text portions of this message have been removed]
>


Reply | Threaded
Open this post in threaded view
|

Re: Convert IplImage to Bitmap

Phani Bhushan Tholeti
In reply to this post by Raphael Gava
try saving the image as a bitmap

On Thu, Oct 8, 2009 at 02:21, Raphael Gava <[hidden email]>wrote:

>
>
> Hi people, does anyone know how i can convert an image (IplImage) to
> Bitmap? Can one help me?
>
> Thanks a lot!
>
> __________________________________________________________
> Veja quais são os assuntos do momento no Yahoo! +Buscados
> http://br.maisbuscados.yahoo.com
>
> [Non-text portions of this message have been removed]
>
>  
>



--
Lots o' Luv,
Phani Bhushan

Let not your sense of morals prevent you from doing what is right - Isaac
Asimov (Salvor Hardin in Foundation and Empire)


[Non-text portions of this message have been removed]

Reply | Threaded
Open this post in threaded view
|

Re: Convert IplImage to Bitmap

neuromancer1966
In reply to this post by Raphael Gava


--- In [hidden email], Raphael Gava <raphael_gava@...> wrote:
>
> Hi people, does anyone know how i can convert an image (IplImage) to Bitmap? Can one help me?
>
> Thanks a lot!

Quick and dirty solution:

// CWinGui.h

#pragma once

#include <cv.h>

class CWinGui
{
public:
        static void ShowImage(IplImage* img, HDC dc, int x, int y, int w, int h, int from_x, int from_y);

private:
        CWinGui(); // "seals" the class (prevents instantiation)
        CWinGui(const CWinGui&); // prevent copy-construction
        CWinGui& operator=(const CWinGui&); // prevent assignment

        static void FillBitmapInfo(BITMAPINFO* bmi, int width, int height, int bpp, int origin);
        static int Bpp(IplImage* img) { return img ? (img->depth & 255) * img->nChannels : 0; };
};

// CWinGui.cpp

#include "StdAfx.h"
#include "WinGui.h"

void CWinGui::ShowImage(IplImage* img, HDC dc, int x, int y, int w, int h, int from_x, int from_y)
{
    if (img && img->depth == IPL_DEPTH_8U)
    {
        uchar buffer[sizeof(BITMAPINFOHEADER) + 1024];
        BITMAPINFO* bmi = (BITMAPINFO*)buffer;
        int bmp_w = img->width, bmp_h = img->height;

                FillBitmapInfo(bmi, bmp_w, bmp_h, Bpp(img), img->origin);

        from_x = MIN(MAX(from_x, 0), bmp_w - 1);
        from_y = MIN(MAX(from_y, 0), bmp_h - 1);

        int sw = MAX(MIN(bmp_w - from_x, w), 0);
        int sh = MAX(MIN(bmp_h - from_y, h), 0);

        SetDIBitsToDevice(dc, // Handle to the device context
                                      x,  // Specifies the x-coordinate, in logical units, of the upper-left corner of the destination rectangle
                                                  y,  // Specifies the y-coordinate, in logical units, of the upper-left corner of the destination rectangle
                                                  sw, // Specifies the width, in logical units, of the DIB
                                                  sh, // Specifies the height, in logical units, of the DIB
                                                  from_x, // Specifies the x-coordinate, in logical units, of the lower-left corner of the DIB
                                                  from_y, // Specifies the y-coordinate, in logical units, of the lower-left corner of the DIB
                                                  from_y, // Specifies the starting scan line in the DIB
                                                  sh, // Specifies the number of DIB scan lines contained in the array pointed to by the lpvBits parameter
                          img->imageData + from_y*img->widthStep, // Pointer to DIB color data stored as an array of bytes
                          bmi, // Pointer to a BITMAPINFO structure that contains information about the DIB
                                                  DIB_RGB_COLORS); // Specifies whether the bmiColors member of the BITMAPINFO structure contains explicit red, green, blue (RGB) values or indexes into a palette
    }
}

void CWinGui::FillBitmapInfo(BITMAPINFO* bmi, int width, int height, int bpp, int origin)
{
    assert(bmi && width >= 0 && height >= 0 && (bpp == 8 || bpp == 24 || bpp == 32));

    BITMAPINFOHEADER* bmih = &(bmi->bmiHeader);

    memset(bmih, 0, sizeof(*bmih));
    bmih->biSize = sizeof(BITMAPINFOHEADER);
    bmih->biWidth = width;
    bmih->biHeight = origin ? abs(height) : -abs(height);
    bmih->biPlanes = 1;
    bmih->biBitCount = (unsigned short)bpp;
    bmih->biCompression = BI_RGB;

    if (bpp == 8)
    {
        RGBQUAD* palette = bmi->bmiColors;
       
                for (int i = 0; i < 256; i++)
        {
            palette[i].rgbBlue = palette[i].rgbGreen = palette[i].rgbRed = (BYTE)i;
            palette[i].rgbReserved = 0;
        }
    }
}

// Simple usage:
//
//
//
// CWinGui::ShowImage(iplShow, hdc, 0, 0, iplShow->width, iplShow->height, 0, 0);



Reply | Threaded
Open this post in threaded view
|

Re: Convert IplImage to Bitmap

cathco1987
In reply to this post by yihaa_5
I found the below code on this website: http://www.wretch.cc/blog/mitnick/21840107. It has proven to be very useful to me.

// Convert .NET Bitmap to an OpenCV IplImage.
static IplImage*  BitmapToIplImage(Bitmap^ bitmap)
{
    IplImage* tmp;

    BitmapData^ bmData = bitmap->LockBits(System::Drawing::Rectangle(0, 0, bitmap->Width, bitmap->Height), System::Drawing::Imaging::ImageLockMode::ReadWrite, bitmap->PixelFormat);
                if(bitmap->PixelFormat == System::Drawing::Imaging::PixelFormat::Format8bppIndexed)
                {
                        tmp = cvCreateImage(cvSize(bitmap->Width , bitmap->Height) , IPL_DEPTH_8U , 1);
                        tmp->imageData = (char*)bmData->Scan0.ToPointer();
                }

                else if (bitmap->PixelFormat == System::Drawing::Imaging::PixelFormat::Format24bppRgb)
                {
                        tmp = cvCreateImage(cvSize(bitmap->Width , bitmap->Height) , IPL_DEPTH_8U , 3);
                        tmp->imageData = (char*)bmData->Scan0.ToPointer();
                }

                bitmap->UnlockBits(bmData);

                return tmp;
        }

        // Convert OpenCv's IplImage into a .NET Bitmap.
        static Bitmap^ IplImageToBitmap(IplImage* ipl)
        {
                if (ipl->depth == 8)
                {
                        if (ipl->nChannels == 3)
                        {
                                return gcnew System::Drawing::Bitmap(ipl->width , ipl->height , ipl->widthStep , System::Drawing::Imaging::PixelFormat::Format24bppRgb,
                                (System::IntPtr)ipl->imageData);
                        }
                       
                        else
                        {
                                return gcnew System::Drawing::Bitmap(ipl->width , ipl->height , ipl->widthStep , System::Drawing::Imaging::PixelFormat::Format8bppIndexed ,
                                (System::IntPtr)ipl->imageData);
                        }
                }
        }

Reply | Threaded
Open this post in threaded view
|

Res: Re: Convert IplImage to Bitmap

Raphael Gava
In reply to this post by neuromancer1966
I'll try it!!!

Thank you very much!




________________________________
De: neuromancer1966 <[hidden email]>
Para: [hidden email]
Enviadas: Quinta-feira, 8 de Outubro de 2009 4:44:56
Assunto: [OpenCV] Re: Convert IplImage to Bitmap

 


--- In OpenCV@yahoogroups. com, Raphael Gava <raphael_gava@ ...> wrote:
>
> Hi people, does anyone know how i can convert an image (IplImage) to Bitmap? Can one help me?
>
> Thanks a lot!

Quick and dirty solution:

// CWinGui.h

#pragma once

#include <cv.h>

class CWinGui
{
public:
static void ShowImage(IplImage* img, HDC dc, int x, int y, int w, int h, int from_x, int from_y);

private:
CWinGui(); // "seals" the class (prevents instantiation)
CWinGui(const CWinGui&); // prevent copy-construction
CWinGui& operator=(const CWinGui&); // prevent assignment

static void FillBitmapInfo( BITMAPINFO* bmi, int width, int height, int bpp, int origin);
static int Bpp(IplImage* img) { return img ? (img->depth & 255) * img->nChannels : 0; };
};

// CWinGui.cpp

#include "StdAfx.h"
#include "WinGui.h"

void CWinGui::ShowImage( IplImage* img, HDC dc, int x, int y, int w, int h, int from_x, int from_y)
{
if (img && img->depth == IPL_DEPTH_8U)
{
uchar buffer[sizeof( BITMAPINFOHEADER ) + 1024];
BITMAPINFO* bmi = (BITMAPINFO* )buffer;
int bmp_w = img->width, bmp_h = img->height;

FillBitmapInfo( bmi, bmp_w, bmp_h, Bpp(img), img->origin) ;

from_x = MIN(MAX(from_ x, 0), bmp_w - 1);
from_y = MIN(MAX(from_ y, 0), bmp_h - 1);

int sw = MAX(MIN(bmp_ w - from_x, w), 0);
int sh = MAX(MIN(bmp_ h - from_y, h), 0);

SetDIBitsToDevice( dc, // Handle to the device context
x,  // Specifies the x-coordinate, in logical units, of the upper-left corner of the destination rectangle
y,  // Specifies the y-coordinate, in logical units, of the upper-left corner of the destination rectangle
sw, // Specifies the width, in logical units, of the DIB
sh, // Specifies the height, in logical units, of the DIB
from_x, // Specifies the x-coordinate, in logical units, of the lower-left corner of the DIB
from_y, // Specifies the y-coordinate, in logical units, of the lower-left corner of the DIB
from_y, // Specifies the starting scan line in the DIB
sh, // Specifies the number of DIB scan lines contained in the array pointed to by the lpvBits parameter
img->imageData + from_y*img-> widthStep, // Pointer to DIB color data stored as an array of bytes
bmi, // Pointer to a BITMAPINFO structure that contains information about the DIB
DIB_RGB_COLORS) ; // Specifies whether the bmiColors member of the BITMAPINFO structure contains explicit red, green, blue (RGB) values or indexes into a palette
}
}

void CWinGui::FillBitmap Info(BITMAPINFO* bmi, int width, int height, int bpp, int origin)
{
assert(bmi && width >= 0 && height >= 0 && (bpp == 8 || bpp == 24 || bpp == 32));

BITMAPINFOHEADER* bmih = &(bmi->bmiHeader) ;

memset(bmih, 0, sizeof(*bmih) );
bmih->biSize = sizeof(BITMAPINFOHE ADER);
bmih->biWidth = width;
bmih->biHeight = origin ? abs(height) : -abs(height) ;
bmih->biPlanes = 1;
bmih->biBitCount = (unsigned short)bpp;
bmih->biCompression = BI_RGB;

if (bpp == 8)
{
RGBQUAD* palette = bmi->bmiColors;

for (int i = 0; i < 256; i++)
{
palette[i].rgbBlue = palette[i].rgbGreen = palette[i].rgbRed = (BYTE)i;
palette[i].rgbReser ved = 0;
}
}
}

// Simple usage:
//
//
//
// CWinGui::ShowImage( iplShow, hdc, 0, 0, iplShow->width, iplShow->height, 0, 0);


   


      ____________________________________________________________________________________
Veja quais são os assuntos do momento no Yahoo! +Buscados
http://br.maisbuscados.yahoo.com

[Non-text portions of this message have been removed]

Reply | Threaded
Open this post in threaded view
|

Re: Convert IplImage to Bitmap

Jean-Pierre Landry
In reply to this post by neuromancer1966
In fact, almost identical code is already there in OpenCV...

HighGUI defines a wrapper for IplImage called CvvImage (I think CImage
is also a synonym...) which has methods 'Show' and 'DrawToHDC'...

This wrapper takes care of deallocation so you don't even have to call
cvReleaseImg for these type of variable defined locally on the stack
(CvvImage destructor call underlying IplImage cvReleaseImg...)

neuromancer1966 wrote:

>
> --- In [hidden email], Raphael Gava <raphael_gava@...> wrote:
>> Hi people, does anyone know how i can convert an image (IplImage) to Bitmap? Can one help me?
>>
>> Thanks a lot!
>
> Quick and dirty solution:
>
> // CWinGui.h
>
> #pragma once
>
> #include <cv.h>
>
> class CWinGui
> {
> public:
> static void ShowImage(IplImage* img, HDC dc, int x, int y, int w, int h, int from_x, int from_y);
>
> private:
> CWinGui(); // "seals" the class (prevents instantiation)
> CWinGui(const CWinGui&); // prevent copy-construction
> CWinGui& operator=(const CWinGui&); // prevent assignment
>
> static void FillBitmapInfo(BITMAPINFO* bmi, int width, int height, int bpp, int origin);
> static int Bpp(IplImage* img) { return img ? (img->depth & 255) * img->nChannels : 0; };
> };
>
> // CWinGui.cpp
>
> #include "StdAfx.h"
> #include "WinGui.h"
>
> void CWinGui::ShowImage(IplImage* img, HDC dc, int x, int y, int w, int h, int from_x, int from_y)
> {
>     if (img && img->depth == IPL_DEPTH_8U)
>     {
>         uchar buffer[sizeof(BITMAPINFOHEADER) + 1024];
>         BITMAPINFO* bmi = (BITMAPINFO*)buffer;
>         int bmp_w = img->width, bmp_h = img->height;
>
> FillBitmapInfo(bmi, bmp_w, bmp_h, Bpp(img), img->origin);
>
>         from_x = MIN(MAX(from_x, 0), bmp_w - 1);
>         from_y = MIN(MAX(from_y, 0), bmp_h - 1);
>
>         int sw = MAX(MIN(bmp_w - from_x, w), 0);
>         int sh = MAX(MIN(bmp_h - from_y, h), 0);
>
>         SetDIBitsToDevice(dc, // Handle to the device context
>              x,  // Specifies the x-coordinate, in logical units, of the upper-left corner of the destination rectangle
>  y,  // Specifies the y-coordinate, in logical units, of the upper-left corner of the destination rectangle
>  sw, // Specifies the width, in logical units, of the DIB
>  sh, // Specifies the height, in logical units, of the DIB
>  from_x, // Specifies the x-coordinate, in logical units, of the lower-left corner of the DIB
>  from_y, // Specifies the y-coordinate, in logical units, of the lower-left corner of the DIB
>  from_y, // Specifies the starting scan line in the DIB
>  sh, // Specifies the number of DIB scan lines contained in the array pointed to by the lpvBits parameter
>                           img->imageData + from_y*img->widthStep, // Pointer to DIB color data stored as an array of bytes
>                           bmi, // Pointer to a BITMAPINFO structure that contains information about the DIB
>  DIB_RGB_COLORS); // Specifies whether the bmiColors member of the BITMAPINFO structure contains explicit red, green, blue (RGB) values or indexes into a palette
>     }
> }
>
> void CWinGui::FillBitmapInfo(BITMAPINFO* bmi, int width, int height, int bpp, int origin)
> {
>     assert(bmi && width >= 0 && height >= 0 && (bpp == 8 || bpp == 24 || bpp == 32));
>
>     BITMAPINFOHEADER* bmih = &(bmi->bmiHeader);
>
>     memset(bmih, 0, sizeof(*bmih));
>     bmih->biSize = sizeof(BITMAPINFOHEADER);
>     bmih->biWidth = width;
>     bmih->biHeight = origin ? abs(height) : -abs(height);
>     bmih->biPlanes = 1;
>     bmih->biBitCount = (unsigned short)bpp;
>     bmih->biCompression = BI_RGB;
>
>     if (bpp == 8)
>     {
>         RGBQUAD* palette = bmi->bmiColors;
>        
> for (int i = 0; i < 256; i++)
>         {
>             palette[i].rgbBlue = palette[i].rgbGreen = palette[i].rgbRed = (BYTE)i;
>             palette[i].rgbReserved = 0;
>         }
>     }
> }
>
> // Simple usage:
> //
> //
> //
> // CWinGui::ShowImage(iplShow, hdc, 0, 0, iplShow->width, iplShow->height, 0, 0);
>
>
>
>
>
> ------------------------------------
>
> Change settings: http://www.yahoogroups.com/mygroups, select
>    Get Emails (get all posts)
>    Daily Digest (one summary email per day)
>    Read on the web (read posts on the web only)Or Unsubscribe by mailing [hidden email]

Reply | Threaded
Open this post in threaded view
|

Res: Re: Convert IplImage to Bitmap

Raphael Gava
In reply to this post by cathco1987
I tried all examples that you sent but i cant do it. I didn't try only save and open because my system will be not good doing it.

What i need to do is:

- open an .avi (ok)
- taking every frame (ok)
- show this frame in a panel (c++ builder 6) (not ok)

For i can do this last one i need to convert a IplImage to Bitmap, do you have another idea???

Thank you so much!
                   




________________________________
De: cathco1987 <[hidden email]>
Para: [hidden email]
Enviadas: Quinta-feira, 8 de Outubro de 2009 13:46:25
Assunto: [OpenCV] Re: Convert IplImage to Bitmap

 
I found the below code on this website: http://www.wretch. cc/blog/mitnick/ 21840107. It has proven to be very useful to me.

// Convert .NET Bitmap to an OpenCV IplImage.
static IplImage*  BitmapToIplImage( Bitmap^ bitmap)
{
IplImage* tmp;

BitmapData^ bmData = bitmap->LockBits( System::Drawing: :Rectangle( 0, 0, bitmap->Width, bitmap->Height) , System::Drawing: :Imaging: :ImageLockMode: :ReadWrite, bitmap->PixelFormat );
if(bitmap->PixelFor mat == System::Drawing: :Imaging: :PixelFormat: :Format8bppIndex ed)
{
tmp = cvCreateImage( cvSize(bitmap- >Width , bitmap->Height) , IPL_DEPTH_8U , 1);
tmp->imageData = (char*)bmData- >Scan0.ToPointer ();
}

else if (bitmap->PixelForma t == System::Drawing: :Imaging: :PixelFormat: :Format24bppRgb)
{
tmp = cvCreateImage( cvSize(bitmap- >Width , bitmap->Height) , IPL_DEPTH_8U , 3);
tmp->imageData = (char*)bmData- >Scan0.ToPointer ();
}

bitmap->UnlockBits( bmData);

return tmp;
}

// Convert OpenCv's IplImage into a .NET Bitmap.
static Bitmap^ IplImageToBitmap( IplImage* ipl)
{
if (ipl->depth == 8)
{
if (ipl->nChannels == 3)
{
return gcnew System::Drawing: :Bitmap(ipl- >width , ipl->height , ipl->widthStep , System::Drawing: :Imaging: :PixelFormat: :Format24bppRgb,
(System::IntPtr) ipl->imageData) ;
}

else
{
return gcnew System::Drawing: :Bitmap(ipl- >width , ipl->height , ipl->widthStep , System::Drawing: :Imaging: :PixelFormat: :Format8bppIndex ed ,
(System::IntPtr) ipl->imageData) ;
}
}
}


   


      ____________________________________________________________________________________
Veja quais são os assuntos do momento no Yahoo! +Buscados
http://br.maisbuscados.yahoo.com

[Non-text portions of this message have been removed]

Reply | Threaded
Open this post in threaded view
|

Re: Res: Re: Convert IplImage to Bitmap

palopita
This post has NOT been accepted by the mailing list yet.
In reply to this post by Raphael Gava
Thank you so much for your code!
Works perfectly :)
Reply | Threaded
Open this post in threaded view
|

Re: Convert IplImage to Bitmap

blackchaos
This post has NOT been accepted by the mailing list yet.
In reply to this post by neuromancer1966
neuromancer1966 wrote
--- In [hidden email], Raphael Gava <raphael_gava@...> wrote:
>
> Hi people, does anyone know how i can convert an image (IplImage) to Bitmap? Can one help me?
>
> Thanks a lot!

Quick and dirty solution:

// CWinGui.h

#pragma once

#include <cv.h>

class CWinGui
{
public:
        static void ShowImage(IplImage* img, HDC dc, int x, int y, int w, int h, int from_x, int from_y);

private:
        CWinGui(); // "seals" the class (prevents instantiation)
        CWinGui(const CWinGui&); // prevent copy-construction
        CWinGui& operator=(const CWinGui&); // prevent assignment

        static void FillBitmapInfo(BITMAPINFO* bmi, int width, int height, int bpp, int origin);
        static int Bpp(IplImage* img) { return img ? (img->depth & 255) * img->nChannels : 0; };
};

// CWinGui.cpp

#include "StdAfx.h"
#include "WinGui.h"

void CWinGui::ShowImage(IplImage* img, HDC dc, int x, int y, int w, int h, int from_x, int from_y)
{
    if (img && img->depth == IPL_DEPTH_8U)
    {
        uchar buffer[sizeof(BITMAPINFOHEADER) + 1024];
        BITMAPINFO* bmi = (BITMAPINFO*)buffer;
        int bmp_w = img->width, bmp_h = img->height;

                FillBitmapInfo(bmi, bmp_w, bmp_h, Bpp(img), img->origin);

        from_x = MIN(MAX(from_x, 0), bmp_w - 1);
        from_y = MIN(MAX(from_y, 0), bmp_h - 1);

        int sw = MAX(MIN(bmp_w - from_x, w), 0);
        int sh = MAX(MIN(bmp_h - from_y, h), 0);

        SetDIBitsToDevice(dc, // Handle to the device context
                                      x,  // Specifies the x-coordinate, in logical units, of the upper-left corner of the destination rectangle
                                                  y,  // Specifies the y-coordinate, in logical units, of the upper-left corner of the destination rectangle
                                                  sw, // Specifies the width, in logical units, of the DIB
                                                  sh, // Specifies the height, in logical units, of the DIB
                                                  from_x, // Specifies the x-coordinate, in logical units, of the lower-left corner of the DIB
                                                  from_y, // Specifies the y-coordinate, in logical units, of the lower-left corner of the DIB
                                                  from_y, // Specifies the starting scan line in the DIB
                                                  sh, // Specifies the number of DIB scan lines contained in the array pointed to by the lpvBits parameter
                          img->imageData + from_y*img->widthStep, // Pointer to DIB color data stored as an array of bytes
                          bmi, // Pointer to a BITMAPINFO structure that contains information about the DIB
                                                  DIB_RGB_COLORS); // Specifies whether the bmiColors member of the BITMAPINFO structure contains explicit red, green, blue (RGB) values or indexes into a palette
    }
}

void CWinGui::FillBitmapInfo(BITMAPINFO* bmi, int width, int height, int bpp, int origin)
{
    assert(bmi && width >= 0 && height >= 0 && (bpp == 8 || bpp == 24 || bpp == 32));

    BITMAPINFOHEADER* bmih = &(bmi->bmiHeader);

    memset(bmih, 0, sizeof(*bmih));
    bmih->biSize = sizeof(BITMAPINFOHEADER);
    bmih->biWidth = width;
    bmih->biHeight = origin ? abs(height) : -abs(height);
    bmih->biPlanes = 1;
    bmih->biBitCount = (unsigned short)bpp;
    bmih->biCompression = BI_RGB;

    if (bpp == 8)
    {
        RGBQUAD* palette = bmi->bmiColors;
       
                for (int i = 0; i < 256; i++)
        {
            palette[i].rgbBlue = palette[i].rgbGreen = palette[i].rgbRed = (BYTE)i;
            palette[i].rgbReserved = 0;
        }
    }
}

// Simple usage:
//
//
//
// CWinGui::ShowImage(iplShow, hdc, 0, 0, iplShow->width, iplShow->height, 0, 0);
Thanks for sharing.
I use your code to display an image loaded with cvLoadImage() to a static control, but when I load a new image, the new image is just loaded over the old image. How can I clear the content of a static control before I load a new image?

Thanks in advance.
Reply | Threaded
Open this post in threaded view
|

Re: Res: Re: Convert IplImage to Bitmap

akrynski
This post has NOT been accepted by the mailing list yet.
In reply to this post by Raphael Gava
Hi,
 This is very old post, but if someone, like me, reads it then I suggest to add buffer[0] after calling to SetDIBitsToDevice() to avoid memory leaks.
Greets, Andrzej