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


C++ ofPixels::getHeight方法代码示例

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


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

示例1: loadData

//----------------------------------------------------------
void ofTexture::loadData(const ofPixels & pix, int glFormat){
	if(!isAllocated()){
		allocate(pix.getWidth(), pix.getHeight(), ofGetGlInternalFormat(pix), ofGetUsingArbTex(), glFormat, ofGetGlType(pix));
	}
	ofSetPixelStoreiAlignment(GL_UNPACK_ALIGNMENT,pix.getWidth(),pix.getBytesPerChannel(),ofGetNumChannelsFromGLFormat(glFormat));
	loadData(pix.getData(), pix.getWidth(), pix.getHeight(), glFormat, ofGetGlType(pix));
}
开发者ID:jvcleave,项目名称:compare,代码行数:8,代码来源:ofTexture.cpp

示例2: publishPixels

	void Output::publishPixels(ofPixels &pix)
	{
		assert(mutex);

		if (pix.getWidth() == uiFrameWidth
			&& pix.getHeight() == uiFrameHeight)
		{
			mutex->lock();
			if (!back_buffer->isAllocated() ||
				back_buffer->getWidth() != pix.getWidth() ||
				back_buffer->getHeight() != pix.getHeight()) {
				back_buffer->allocate(pix.getWidth(), pix.getHeight(), pix.getNumChannels());
			}
			memcpy(&back_buffer->getData()[1], pix.getData(), pix.size() - 1);
			//*back_buffer = pix;

			if (back_buffer->getNumChannels() != 4)
				back_buffer->setNumChannels(4);

			has_new_frame = true;

			mutex->unlock();
		}
		else
			ofLogError("ofxDeckLinkAPI::Output") << "invalid pixel size";
	}
开发者ID:elliotwoods,项目名称:ofxBlackmagic2,代码行数:26,代码来源:Output.cpp

示例3:

ofPixels::ofPixels(const ofPixels & mom){
	bAllocated = false;
	pixels = NULL;
	if(mom.isAllocated()){
		allocate(mom.getWidth(),mom.getHeight(),mom.getImageType());
		memcpy(pixels,mom.getPixels(),mom.getWidth()*mom.getHeight()*mom.getBytesPerPixel());
	}
}
开发者ID:frogger,项目名称:openFrameworks,代码行数:8,代码来源:ofPixels.cpp

示例4: setDelayMap

void ofxSlitScan::setDelayMap(ofPixels& map){
	if(map.getWidth() != width || map.getHeight() != height){
		ofLog(OF_LOG_ERROR,"ofxSlitScan Error -- Map dimensions do not match image dimensions. given %fx%f, need %dx%d\n", map.getWidth(), map.getHeight(), width, height);
		return;
	}
	setDelayMap(map.getPixels(), map.getImageType());
}
开发者ID:robotconscience,项目名称:ofxSlitScan,代码行数:7,代码来源:ofxSlitScan.cpp

示例5: getData

	//----------
	bool Message::getData(ofPixels & data) const {
		auto & header = this->getHeader<Header::Pixels>();
		if (this->hasHeader<Header::Pixels>()) {
			const auto & header = this->getHeader<Header::Pixels>();
			auto bodySize = this->getBodySize();
			ofPixelFormat pixelFormat = (ofPixelFormat)header.pixelFormat;

			//reallocate if we need to
			if (data.getWidth() != header.width || data.getHeight() != header.height || data.getPixelFormat() != pixelFormat) {
				data.allocate(header.width, header.height, pixelFormat);
			}
			if (data.size() != bodySize) {
				OFXSQUASHBUDDIES_ERROR << "Message body is of wrong size to fill pixels. Maybe a bug in sender?";
				return false;
			}
			else {
				memcpy(data.getData(), this->getBodyData(), bodySize);
				return true;
			}
		}
		else {
			OFXSQUASHBUDDIES_WARNING << "Message Header doesn't match Pixels type";
			return false;
		}
	}
开发者ID:DHaylock,项目名称:ofxSquashBuddies,代码行数:26,代码来源:Message.cpp

示例6: toCcv

ccv_dense_matrix_t toCcv(const ofPixels& pix) {
    return ccv_dense_matrix(pix.getHeight(),
                            pix.getWidth(),
                            CCV_8U | CCV_C3,
                            (void*) pix.getData(),
                            0);
}
开发者ID:danielmorena,项目名称:ofxCcv,代码行数:7,代码来源:ofxCcv.cpp

示例7: allocate

//----------------------------------------------------------
void ofTexture::allocate(const ofPixels& pix, bool bUseARBExtention){
	allocate(pix.getWidth(), pix.getHeight(), ofGetGlInternalFormat(pix), bUseARBExtention, ofGetGlFormat(pix), ofGetGlType(pix));
	if((pix.getPixelFormat()==OF_PIXELS_GRAY || pix.getPixelFormat()==OF_PIXELS_GRAY_ALPHA) && ofIsGLProgrammableRenderer()){
		setRGToRGBASwizzles(true);
	}
	loadData(pix);
}
开发者ID:jvcleave,项目名称:compare,代码行数:8,代码来源:ofTexture.cpp

示例8: createParticlesFromPixels

void testApp::createParticlesFromPixels ( ofPixels pix )
{
    int w = pix.getWidth() ; 
    int h = pix.getHeight() ;
    
    unsigned char * pixels = pix.getPixels() ; 
    //offsets to center the particles on screen
    int xOffset = (ofGetWidth() - w ) /2 ;
    //We're drawing the actual video too so we'll bump down where the video pixels are drawn too
    int yOffset = (ofGetHeight() - h ) * 0.825f ;
    
    //Loop through all the rows
    for ( int x = 0 ; x < w ; x+=sampling )
    {
        //Loop through all the columns
        for ( int y = 0 ; y < h ; y+=sampling )
        {
            //Pixels are stored as unsigned char ( 0 <-> 255 ) as RGB
            //If our image had transparency it would be 4 for RGBA
            int index = ( y * w + x ) * 3 ;
            ofColor color ;
            color.r = pixels[index] ;       //red pixel
            color.g = pixels[index+1] ;     //green pixel
            color.b = pixels[index+2] ;     //blue pixel
            
            particles.push_back( Particle ( ofPoint ( x + xOffset , y + yOffset ) , color ) ) ;
        }
    }

}
开发者ID:poisa,项目名称:Open-Frameworks-Tutorials,代码行数:30,代码来源:testApp.cpp

示例9: critical

	//----------
	void Decoder::operator<<(const ofPixels& pixels) {
		if (frame == 0) {
			data.allocate(pixels.getWidth(), pixels.getHeight(), payload->getWidth(), payload->getHeight());
		}

		if (frame > payload->getFrameCount() - 1) {
#pragma omp critical(ofLog)
			ofLogWarning("ofxGraycode") << "Can't add more frames, we've already captured a full set. please clear()";
			return;
		}

		if (!pixels.isAllocated()) {
			ofLogError("ofxGraycode") << "Cannot add this capture as the pixels object is empty";
			return;
		}

		const ofPixels* greyPixels;
		if (pixels.getNumChannels() > 1) {
			ofPixels* downsample = new ofPixels();
			downsample->allocate(pixels.getWidth(), pixels.getHeight(), OF_PIXELS_MONO);
			downsample->set(0, 0);
			const uint8_t* in = pixels.getData();
			uint8_t* out = downsample->getData();
			for (int i = 0; i < pixels.size(); i++, out += (i % pixels.getNumChannels() == 0)) {
				*out += *in++ / pixels.getNumChannels();
			}
			greyPixels = downsample;
		}
		else
			greyPixels = &pixels;

		if (this->payload->isOffline())
			captures.push_back(*greyPixels);
		else
			payload->readPixels(frame, *greyPixels);

		frame++;

		if (frame >= payload->getFrameCount()) {
			calc();
			frame = payload->getFrameCount();
		}

		if (greyPixels != &pixels)
			delete greyPixels;
	}
开发者ID:elliotwoods,项目名称:ofxGraycode,代码行数:47,代码来源:Decoder.cpp

示例10: pixelateInv

void ofxImageTS::pixelateInv(ofPixels pixels, int pixelRatio, int X, int Y, int W, int H) {
    ofPixels R,G,B, Rc, Gc, Bc;
    pixels.resize(W,H);
    R = pixels.getChannel(0);
    G = pixels.getChannel(1);
    B = pixels.getChannel(2);
    Rc = R;
    Gc = G;
    Bc = B;
    int c = 0;
    for(int i = R.size()-1; i > 0; i--){
        Rc[c] = R[i];
        Gc[c] = G[i];
        Bc[c] = B[i];
        c++;
    }
    if(pixelRatio > 4 || pixelRatio < 0) {
        ofLogNotice("Pixel Ratio must be between 0 and 5");
    }
    else {
        
        int camWidth = pixels.getWidth();
        int camHeight = pixels.getHeight();
        int boxWidth = pixels.getWidth()/(pow(2,pixelRatio)*10);
        int boxHeight = pixels.getHeight()/(pow(2,pixelRatio)*10);
        
        float tot = boxWidth*boxHeight;
        for (int x = 0; x < camWidth; x += boxWidth) {
            for (int y = 0; y < camHeight; y += boxHeight) {
                float Red = 0, Green = 0, Blue = 0;
                for (int k = 0; k < boxWidth; k++) {
                    for (int l = 0; l < boxHeight; l++) {
                        int index = (x + k) + (y + l) * camWidth;
                        Red += Rc[index];
                        Green += Gc[index];
                        Blue += Bc[index];
                    }
                    ofSetColor(Red/tot,Green/tot,Blue/tot);
                    ofFill();
                    ofDrawRectangle(x+X, y+Y, boxWidth, boxHeight);
                }
            }
        }
    }
}
开发者ID:essteban,项目名称:ofxImageTS,代码行数:45,代码来源:ofxImageTS.cpp

示例11: findHaarObjects

int ofxCvHaarFinder::findHaarObjects(ofPixels& input, int minWidth, int minHeight){
	ofxCvGrayscaleImage gray;
	gray.allocate(input.getWidth(), input.getHeight());

	if( input.getImageType() == OF_IMAGE_COLOR ){
		ofxCvColorImage color;
		color.allocate(input.getWidth(), input.getHeight());
		color.setFromPixels(input);
		gray = color;
	}else if( input.getImageType() == OF_IMAGE_GRAYSCALE ){
		gray.setFromPixels(input);
	}else{
		ofLog(OF_LOG_ERROR, "ofxCvHaarFinder::findHaarObjects doesn't support OF_IMAGE_RGBA ofImage");
		return 0;
	}

	return findHaarObjects(gray, minWidth, minHeight);
}
开发者ID:echa,项目名称:libopenframeworks,代码行数:18,代码来源:ofxCvHaarFinder.cpp

示例12: pixelate

void ofxImageTS::pixelate(ofPixels pixels, int pixelRatio, int X, int Y, int W, int H, int form) {
    if(pixelRatio > 4 || pixelRatio < 0) {
        ofLogNotice("Pixel Ratio must be between 0 and 5");
    }
    else {
        ofPixels R,G,B, copy;
        pixels.resize(W,H);
        copy.allocate(pixels.getWidth(), pixels.getHeight(), OF_PIXELS_RGBA);
        copy = pixels;
        R = copy.getChannel(0);
        G = copy.getChannel(1);
        B = copy.getChannel(2);
        int camWidth = pixels.getWidth();
        int camHeight = pixels.getHeight();
        int boxWidth = pixels.getWidth()/(pow(2,pixelRatio)*10);
        int boxHeight = pixels.getHeight()/(pow(2,pixelRatio)*10);
        
        float tot = boxWidth*boxHeight;
        for (int x = 0; x < camWidth; x += boxWidth) {
            for (int y = 0; y < camHeight; y += boxHeight) {
                float Red = 0, Green = 0, Blue = 0;
                for (int k = 0; k < boxWidth; k++) {
                    for (int l = 0; l < boxHeight; l++) {
                        int index = (x + k) + (y + l) * camWidth;
                        Red += R[index];
                        Green += G[index];
                        Blue += B[index];
                    }
                    ofSetColor(Red/tot,Green/tot,Blue/tot);
                    ofFill();
                    if(form == 1)
                        ofDrawRectangle(x+X, y+Y, boxWidth, boxHeight);
                    if(form == 2)
                        ofDrawBox(x+X, y+Y, boxWidth, boxHeight);
                    if(form == 3)
                        ofDrawCircle(x+X, y+Y, boxWidth, boxHeight);
                    if(form == 4)
                        ofDrawTriangle(x+X, y+Y, X+x+boxHeight, y+Y, x+X, y+Y+boxWidth);
                }
            }
        }
    }
}
开发者ID:essteban,项目名称:ofxImageTS,代码行数:43,代码来源:ofxImageTS.cpp

示例13: pixSaturation

void ofxImageTS::pixSaturation(ofPixels pixels, int pixelRatio, float saturation) {
    if(pixelRatio > 4 || pixelRatio < 0) {
        ofLogNotice("Pixel Ratio must be between 0 and 5");
    }
    else {
        ofPixels R,G,B, copy;
        if(pixels.getWidth() < pixels.getHeight())
            pixels.resize(640,480);
        if(pixels.getWidth() > pixels.getHeight())
            pixels.resize(480,640);
        copy.allocate(pixels.getWidth(), pixels.getHeight(), OF_PIXELS_RGB);
        copy = pixels;
        R = copy.getChannel(0);
        G = copy.getChannel(1);
        B = copy.getChannel(2);
        int camWidth = pixels.getWidth();
        int camHeight = pixels.getHeight();
        int boxWidth = pixels.getWidth()/(pow(2,pixelRatio)*10);
        int boxHeight = pixels.getHeight()/(pow(2,pixelRatio)*10);
        
        float tot = boxWidth*boxHeight;
        for (int x = 0; x < camWidth; x += boxWidth) {
            for (int y = 0; y < camHeight; y += boxHeight) {
                float Red = 0, Green = 0, Blue = 0;
                for (int k = 0; k < boxWidth; k++) {
                    for (int l = 0; l < boxHeight; l++) {
                        int index = (x + k) + (y + l) * camWidth;
                        Red += R[index];
                        Green += G[index];
                        Blue += B[index];
                    }
                    ofColor color;
                    color.set(Red/tot,Green/tot,Blue/tot);
                    color.setSaturation(saturation);
                    ofSetColor(color);
                    ofFill();
                    ofDrawRectangle(x, y, boxWidth, boxHeight);
                }
            }
        }
    }
}
开发者ID:essteban,项目名称:ofxImageTS,代码行数:42,代码来源:ofxImageTS.cpp

示例14: record

SingleImageRecorder::SingleImageRecorder(ofPixels &p)
{
    //SingleImageRecorder::SingleImageRecorder();
    isVisible = true;
    bIsRecording = false;
    brightness = 0;
    
    pixels.allocate(p.getWidth(), p.getHeight(), 1);
    record(p);
    
}
开发者ID:glungtung,项目名称:shadows,代码行数:11,代码来源:SingleImageRecorder.cpp

示例15: alterColorRGB

ofPixels ofxImageTS::alterColorRGB(ofPixels pixels,float R, float G, float B){
    
    pixels.allocate(pixels.getWidth(), pixels.getHeight(), OF_PIXELS_RGB);
    ofPixels copy;
    copy = pixels;
    for(int i = 0; i < pixels.size()-3; i += 3){
        copy[i] = R * pixels[i];
        copy[i+1] = G * pixels[i+1];
        copy[i+2] = B * pixels[i+2];
    }
    return copy;
}
开发者ID:essteban,项目名称:ofxImageTS,代码行数:12,代码来源:ofxImageTS.cpp


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