本文整理汇总了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;
}
示例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);
}
}
示例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);
}
}
示例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;
}