zoukankan      html  css  js  c++  java
  • ilpimage to bitmap

    Iplimage To Bitmap (銀展提供)



    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);

    }

    }



    Bitmap To Iplimage 



    IplImage* tmp;

    System::Drawing::Imaging::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();

    }

  • 相关阅读:
    数据库之联合查询和连接查询
    数据库要素 ER
    数据库事务
    关系数据库常用名词及解释
    数据库索引
    关于数据库主键和外键(终于弄懂啦)
    coredata 删除与更新
    Predicate Programming Guide
    NSPredicate
    coreData-Fetching Managed Objects
  • 原文地址:https://www.cnblogs.com/mfryf/p/2349443.html
Copyright © 2011-2022 走看看