本文整理汇总了C++中ofxCvColorImage::scaleIntoMe方法的典型用法代码示例。如果您正苦于以下问题:C++ ofxCvColorImage::scaleIntoMe方法的具体用法?C++ ofxCvColorImage::scaleIntoMe怎么用?C++ ofxCvColorImage::scaleIntoMe使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ofxCvColorImage
的用法示例。
在下文中一共展示了ofxCvColorImage::scaleIntoMe方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: monoCmonoB
/*ipWidth = ipGrabber[i]->getWidth();
ipHeight = ipGrabber[i]->getHeight();
if ((ipWidth > 0) && (ipHeight >0) ) {
if ((ipWidth != ipImg[i].getWidth()) || (ipHeight != ipImg[i].getHeight())) {
if (ipImg[i].bAllocated) ipImg[i].resize(ipWidth, ipHeight);
else ipImg[i].allocate(ipWidth, ipHeight);
}
if ((ipWidth != outW) || (ipHeight != outH)) {
ofxCvColorImage tempIpImg;
tempIpImg.allocate(ipWidth, ipHeight);
tempIpImg.setFromPixels(ipGrabber[i]->getPixels(), ipWidth, ipHeight);
ipImg[i].scaleIntoMe(tempIpImg, OF_INTERPOLATE_NEAREST_NEIGHBOR);
}
else {
ipImg[i].setFromPixels(ipGrabber[i]->getPixels(), ipWidth, ipHeight);
}
}*/
}
}
///*****************************************************************
/// MONOCHANNEL MONOBLOB
///******************************************************************/
void testApp::monoCmonoB(){
int numBlobs = lastBlobs.size();
if (numBlobs > 0) {
if (bZoomTarget) {
left = lastBlobs[0].boundingRect.x * in_analysis_scale;
top = lastBlobs[0].boundingRect.y * in_analysis_scale;
targW = lastBlobs[0].boundingRect.width * in_analysis_scale;
targH = lastBlobs[0].boundingRect.height * in_analysis_scale;
// adjust to mantain inAspect ratio
int targW_inAspect = targH*inAspect;
if (targW < targW_inAspect) {
left -= (targW_inAspect-targW)/2;
targW = targW_inAspect;
}
else {
int targH_inAspect = targW/inAspect;
top -= (targH_inAspect-targH)/2;
targH = targH_inAspect;
}
}
else {
targW = cropW;
targH = cropH;
top = lastBlobs[0].centroid.y*in_analysis_scale-targH/2;
left = lastBlobs[0].centroid.x*in_analysis_scale-targW/2;
}
// copyRegion needs variables as argumets
int out_left = 0;
copyRegion( fullFrame, left, top, targW, targH,
outputImg, out_left, out_H_gap, outW, out_H_in_aspect);
}
}
///*****************************************************************
/// MONOCHANNEL MULTIBLOB
///******************************************************************/
void testApp::monoCmultiB(){
int numBlobs = lastBlobs.size();
if (numBlobs == 1) monoCmonoB();
else if (numBlobs > 1) {
int max_x = 0;
int max_y = 0;
for (unsigned int i = 0; i < lastBlobs.size(); i++) {
left = MIN( left, lastBlobs[i].boundingRect.x) ;
top = MIN( top, lastBlobs[i].boundingRect.y) ;
max_x = MAX( max_x, lastBlobs[i].boundingRect.x+
lastBlobs[i].boundingRect.width );
max_y = MAX( max_y, lastBlobs[i].boundingRect.y+
lastBlobs[i].boundingRect.height );
}
left *= in_analysis_scale;
top *= in_analysis_scale;
max_x *= in_analysis_scale;
max_y *= in_analysis_scale;
if (bZoomTarget) {
targW = (max_x-left);
targH = (max_y-top);
// adjust to mantain inAspect ratio
int targW_inAspect = targH*inAspect;
if (targW < targW_inAspect) {
left -= (targW_inAspect-targW)/2;
targW = targW_inAspect;
}
else {
int targH_inAspect = targW/inAspect;
top -= (targH_inAspect-targH)/2;
targH = targH_inAspect;
}
}
else {
targW = cropW;
targH = cropH;
// centroid of all blobs
top = (float)(top+max_y)/2;
top -= ((float)targH/2);
left = (float)(left+max_x)/2;
left -= ((float)targW/2);
//.........这里部分代码省略.........