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


C++ ImgFile_Ptr::GetMaskRect方法代码示例

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


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

示例1: Init

bool E_ColorReverse::Init(ImgFile_Ptr pFile)
{
	IImgLayer_weakPtr _sl = pFile->GetSelectLayer();
	if (_sl.expired()) {
		OutputError::Alert(IE_ERROR_SELECT_LAYER_DONT_EXIST);
		return false;
	}

	IImgLayer_Ptr sl = _sl.lock();
	if (sl->GetLayerType() != IE_LAYER_TYPE::NORMAL_LAYER) {
		OutputError::Alert(IE_ERROR_CANT_EDIT_LAYER);
		return false;
	}
	m_pEditLayer = std::dynamic_pointer_cast<ImgLayer>(sl);

	RECT rect, mask_rect;
	m_pEditLayer->GetLayerRect(&rect);

	//マスクの範囲取得
	if (pFile->GetMaskState() == IE_MASK_STATE_ID::INVALID) {
		m_mask = NULL;
	}
	else {
		pFile->GetMaskRect(&mask_rect);
		//範囲を計算
		AndRect(&rect, &mask_rect, &rect);

		//マスク切り出し
		IplImage* tmp_mask = cvCreateImage(
			cvSize(rect.right - rect.left, rect.bottom - rect.top),
			IPL_DEPTH_8U,
			1);

		pFile->CopyFileMask(
			rect.left,
			rect.top,
			rect.right - rect.left,
			rect.bottom - rect.top,
			tmp_mask,
			0, 0);

		m_mask = tmp_mask;
	}

	CvSize sizeOfImage;
	sizeOfImage.width = rect.right - rect.left;
	sizeOfImage.height = rect.bottom - rect.top;

	m_pEditLayerHandle = (EditLayerHandle*)pFile->CreateImgFileHandle( IFH_EDIT_LAYER );
	m_pEditLayerHandle->SetHandleName( DISPLAY_NAME );
	pFile->DoImgFileHandle( m_pEditLayerHandle );

	m_pEditNode = m_pEditLayerHandle->CreateEditNode(&rect);
	m_pEditNode->blt_rect = rect;

	return true;
}
开发者ID:fughz,项目名称:frayer,代码行数:57,代码来源:E_ColorReverse.cpp

示例2: OnSelect

void IImgSelecter::OnSelect()
{
	ImgFile_Ptr file = m_pImgEdit->GetActiveFile();
	if(file){
		file->SetMaskDrawType( MASK_SOLID_DRAW );

		LPUPDATE_DATA data = file->CreateUpdateData();
		data->isAll = false;
		file->GetMaskRect(&(data->rect));
		file->PushUpdateData(data);
	}
}
开发者ID:,项目名称:,代码行数:12,代码来源:

示例3: OnNeutral

void IMakeRectImgSelecter::OnNeutral()
{
	IMakeRect::OnNeutral();

	ImgFile_Ptr file = m_pImgEdit->GetActiveFile();
	if(file){
		file->SetMaskDrawType( MASK_DOT_LINE_DRAW );

		LPUPDATE_DATA data = file->CreateUpdateData();
		data->isAll = false;
		file->GetMaskRect(&(data->rect));
		file->PushUpdateData(data);
	}
}
开发者ID:,项目名称:,代码行数:14,代码来源:

示例4: Init

bool E_LaughingMan::Init(ImgFile_Ptr pFile)
{
	m_faces = NULL;
	IImgLayer_weakPtr _sl = pFile->GetSelectLayer();
	if(!_sl.expired()){
		OutputError::Alert(IE_ERROR_SELECT_LAYER_DONT_EXIST);
		return false;
	}

	IImgLayer_Ptr sl = _sl.lock();
	if(sl->GetLayerType() != IE_LAYER_TYPE::NORMAL_LAYER){
		OutputError::Alert(IE_ERROR_CANT_EDIT_LAYER);
		return false;
	}
	m_pEditLayer = std::dynamic_pointer_cast<ImgLayer>(sl);

	RECT rect, mask_rect;
	m_pEditLayer->GetLayerRect(&rect);

	//マスクの範囲取得
	if(pFile->GetMaskState() != IE_MASK_STATE_ID::INVALID){
		pFile->GetMaskRect(&mask_rect);
		//範囲を計算
		AndRect(&rect, &mask_rect, &rect);
	}

	CvSize sizeOfImage;
	sizeOfImage.width = rect.right - rect.left;
	sizeOfImage.height = rect.bottom - rect.top;

	m_pEditLayerHandle = (EditLayerHandle*)pFile->CreateImgFileHandle( IFH_EDIT_LAYER );
	m_pEditLayerHandle->SetHandleName( DISPLAY_NAME );
	pFile->DoImgFileHandle( m_pEditLayerHandle );

	m_pEditNode = m_pEditLayerHandle->CreateEditNode(&rect);
	m_pEditNode->blt_rect = rect;

	IplImage* bgraImg;
	IplImage* editImg;
	IplImage* grayImg;
	IplImage* editedImg;

	bgraImg = cvCreateImage(
		cvSize(rect.right - rect.left, rect.bottom - rect.top),
		IPL_DEPTH_8U,
		4);
	editImg = cvCreateImage(
		cvSize(rect.right - rect.left, rect.bottom - rect.top),
		IPL_DEPTH_8U,
		3);
	grayImg = cvCreateImage(
		cvSize(rect.right - rect.left, rect.bottom - rect.top),
		IPL_DEPTH_8U,
		1);
	editedImg = cvCreateImage(
		cvSize(rect.right - rect.left, rect.bottom - rect.top),
		IPL_DEPTH_8U,
		3);

	//レイヤーから有効範囲部分のデータを取得
	m_pEditLayer->CopyLayerImage(
		bgraImg,
		0,
		0,
		rect.left,
		rect.top,
		rect.right - rect.left,
		rect.bottom - rect.top);

	ucvCvtColor(bgraImg, editImg, CV_BGRA2BGR);
	cvCvtColor(editImg, grayImg, CV_BGRA2GRAY);
	cvEqualizeHist(grayImg, grayImg);

	m_cascade = (CvHaarClassifierCascade*)cvLoad(CASCADE_FILE_PATH, 0, 0, 0);
	if (m_cascade == NULL) {
		return false;
	}

	m_storage = cvCreateMemStorage(0);;
	cvClearMemStorage(m_storage);

    m_faces = cvHaarDetectObjects(grayImg, m_cascade, m_storage,
                                       1.1, 2, 0,//CV_HAAR_DO_CANNY_PRUNING,
                                       cvSize(30, 30) );


	cvReleaseImage(&bgraImg);
	cvReleaseImage(&editImg);
    cvReleaseImage(&grayImg);
    cvReleaseImage(&editedImg);

	return true;
}
开发者ID:fughz,项目名称:frayer,代码行数:93,代码来源:E_LaughingMan.cpp


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