当前位置: 首页>>代码示例>>C++>>正文


C++ TLFImage::SetImage方法代码示例

本文整理汇总了C++中TLFImage::SetImage方法的典型用法代码示例。如果您正苦于以下问题:C++ TLFImage::SetImage方法的具体用法?C++ TLFImage::SetImage怎么用?C++ TLFImage::SetImage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TLFImage的用法示例。


在下文中一共展示了TLFImage::SetImage方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: CFLoadFromDIB

/*
    CFLoadFromDIB
	loads image from Windows DIB 
*/
CF_ERROR __EXPORT_TYPE CFLoadFromDIB( CF_IMAGE hImage, CF_BMP info, BYTE* DIBPixels )
{
    CF_ERROR status = CF_SUCCESS;
    TLFImage* image = (TLFImage*)hImage;
    if(image == NULL)
    {
        status = CFF_INVALID_HANDLE;
        return status;
    }
	awpImage* img = NULL;
    BITMAPINFO lInfo;
    memcpy( &lInfo, &info, sizeof(CF_BMP) );
    if( awpDIBToImage(&lInfo, DIBPixels, &img)!= AWP_OK )
    {
        status = CFF_INVALID_DIB;
        return status;
    }
    try
    {
        image->SetImage( img );
    }
    catch (...)
    {
        status = CFCR_NOT_ENOUGH_MEMORY;
        awpReleaseImage(&img);
        return status;
    }
    awpReleaseImage(&img);
    return status;
}
开发者ID:hatc,项目名称:ekc,代码行数:34,代码来源:cfimage.cpp

示例2: PorocessImage

bool TLFSabotage::PorocessImage(awpImage* img, bool* result)
{
	*result = false;
	if (img == NULL)
		return false;
	// преобразования. 
	awpImage* tmp = NULL;
	// копируем входное изображение во временное. 
	if (awpCopyImage(img, &tmp) != AWP_OK)
		return false;
	if (tmp->sSizeX != this->m_srcWidth || tmp->sSizeY != this->m_srcHeight || tmp->bChannels != this->m_srcBPP)
	{
		// переинициализация
		TLFImage initImage;
		initImage.SetImage(img);
		this->Init(&initImage);
		_AWP_SAFE_RELEASE_(tmp)
		return true;
	}
开发者ID:telnykha,项目名称:VideoA,代码行数:19,代码来源:LFSabotage.cpp

示例3: CFLoadFromDump

// загрузака растрового изображения из неструктуированной памяти. 
CF_ERROR __EXPORT_TYPE CFLoadFromDump(CF_IMAGE hImage, CF_WORD width, CF_WORD height, CF_WORD bpp, CF_BYTE* pixels,  CF_WORD line_width)
{
	CF_ERROR status = CF_SUCCESS;
    // получение указателя на изображение
	TLFImage* image = (TLFImage*)hImage;
	if(image == NULL)
	{
		status = CFF_INVALID_HANDLE;
		return status;
	}
	// проверка указателя на пиксели
	if (pixels == NULL)
	{
		status = CFF_INVALID_PARAM;
		return status;
	}
	// проверка числа битов на пиксель
	if (bpp != 8 && bpp != 24)
	{
		status = CFF_INVALID_PARAM;
		return status;
	}
	awpImage* tmp = NULL;
	if (awpCreateImage(&tmp, width, height, bpp == 8?1:3, AWP_BYTE) != AWP_OK)
	{
	   status = CFCR_NOT_ENOUGH_MEMORY;
	   return status;
	}
	// копирование пикселей в изображение tmp
	int bufsize = width*(bpp == 8 ? 1:3);// число байт в строке, с возможным выравниваием
	BYTE* b = (BYTE*)tmp->pPixels;
	for (int i = 0; i < height; i++)
	{
		memcpy(b, pixels, bufsize);
		b+= bufsize; 
		pixels += line_width;
	}
	image->SetImage(tmp);
	awpReleaseImage(&tmp);
	return status;
}
开发者ID:hatc,项目名称:ekc,代码行数:42,代码来源:cfimage.cpp

示例4: LoadCheckTrack

bool CLBPTrackCompare::LoadCheckTrack(const char* lpFileName)
{
    bool res = CNCCPTrackCompare::LoadCheckTrack(lpFileName);
    this->m_checklbp.Clear();
    if (res)
    {
        for (int i = 0; i < this->m_pcheck->GetNumImages(); i++)
        {
            awpImage* img = this->m_pcheck->GetImage(i);
            awpImage* dscr = NULL;
            int descrSize = 59;
            int imgHeight = 16;
            awpCreateImage(&dscr, descrSize, imgHeight, 1, AWP_DOUBLE);
            awpLBPGridDescriptor(img, dscr, NULL, 4, 4, AWP_LBP_U2R1, true, 1);
            TLFImage* lfimg = new TLFImage();
            lfimg->SetImage(dscr);
            this->m_checklbp.Add(lfimg);
        }
    }
    return res;
}
开发者ID:telnykha,项目名称:VideoA,代码行数:21,代码来源:awpTrackValidate.cpp

示例5: DoSegmentation

/*
	Image segmentation main function
*/
bool DoSegmentation(awpImage* input, TSegmentationOptions& options, TLFObjectList* list)
{
    bool result = false;
    if (input == NULL || list == NULL)
        return result;
    // cluster sgments
    if (options.segmentationType == 0)
        return result;
    TLFImage source;
    awpImage* tmp = NULL;
    double alfa = 1;
    if (options.needResize)
    {
        int w = options.imageWidth;
        int h = w*input->sSizeY / input->sSizeX;
        awpResizeNip(input, &tmp, w,h);
    }
    else
        awpCopyImage(input, &tmp);
    awpConvert(tmp, AWP_CONVERT_3TO1_BYTE);
    source.SetImage(tmp);

    TLFTileScanner scanner;
    scanner.SetBaseHeight(options.baseHeight);
    scanner.SetBaseWidth(options.baseWidth);
    scanner.GetParameter(0)->SetValue(options.tileOverlap);
    scanner.Scan(source.GetImage()->sSizeX, source.GetImage()->sSizeY);

    //
    list->Clear();
    if (scanner.GetFragmentsCount() > 0)
    {
        for (int i = 0; i < scanner.GetFragmentsCount(); i++)
        {
            awpRect rect = scanner.GetFragmentRect(i);
            TLFSegmentationResult* sr = CreateFeature(options.baseFeature, &rect);
            if (sr != NULL)
            {
                sr->Process(&source);
                if (options.needResize)
                {
                    alfa = (double)input->sSizeX / (double)options.imageWidth;
                    sr->GetRect()->Scale(alfa);
                }
                list->Add(sr);
            }
        }
    }
    // filtering
    if (options.selectionCriteria == 0)
    {
        for (int i = list->GetCount() - 1; i >= 0; i--)
        {
            TLFSegmentationResult* sr = (TLFSegmentationResult*)list->Get(i);
            if (sr->Value() < options.moreThen)
                list->Delete(i);
        }
    }
    else if (options.selectionCriteria == 1)
    {
        for (int i = list->GetCount() - 1; i >= 0; i--)
        {
            TLFSegmentationResult* sr = (TLFSegmentationResult*)list->Get(i);
            if (sr->Value() > options.lessThen)
                list->Delete(i);
        }
    }
    else
    {
        for (int i = list->GetCount() - 1; i >= 0; i--)
        {
            TLFSegmentationResult* sr = (TLFSegmentationResult*)list->Get(i);
            if (sr->Value() < options.minValue || sr->Value() > options.maxValue)
                list->Delete(i);
        }
    }



    _AWP_SAFE_RELEASE_(tmp)


    result = true;
    return result;
}
开发者ID:telnykha,项目名称:VideoA,代码行数:88,代码来源:SegmentationUnit.cpp


注:本文中的TLFImage::SetImage方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。