Created
February 3, 2024 14:27
-
-
Save stephanschulz/fa32ffe2ab385f85a0174b319acdf444 to your computer and use it in GitHub Desktop.
makeGradientEdge_texture
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void makeGradientEdge_texture(int _x, int _y, float _scale, int _rotate90, ofMatrix4x4 _transformationMatrix, ofFbo & fbo){ | |
ofMatrix4x4 translate_offset; | |
translate_offset.makeTranslationMatrix(_x,_y,0); | |
ofMatrix4x4 scale_0; | |
scale_0.makeScaleMatrix(_scale,_scale,1); | |
ofMatrix4x4 temp_rotateM; | |
temp_rotateM.makeRotationMatrix(_rotate90*90, 0,0,1); | |
ofMatrix4x4 main_0; | |
main_0 = _transformationMatrix * scale_0 * translate_offset; | |
// gradientFBO_texture.clear(); | |
gradientFBO_texture.begin(); | |
ofClear(0, 0, 0, 0); // Clear the FBO | |
gradientShader.begin(); | |
gradientShader.setUniform1f("uGradientWidth", gradientAmount); // or some other value 0.1 = 10% of size | |
gradientShader.setUniform1f("uGradientStrength", gradientStrengthValue); | |
gradientShader.setUniform1f("uGradientThreshold", gradientThresholdValue); | |
ofPushMatrix(); | |
//apply transformation to level eyes and scale face | |
ofMultMatrix(main_0); | |
tracker_object->camera_object->vidSource_img.draw(0,0); // Draw the texture full size on the FBO | |
ofPopMatrix(); | |
gradientShader.end(); | |
gradientFBO_texture.end(); | |
ofPixels mPix; | |
gradientFBO_texture.readToPixels( mPix ); | |
if( mPix.getWidth() > 0 && mPix.getHeight() > 0 ) { | |
ofSaveImage(mPix, "outputImage.png", OF_IMAGE_QUALITY_HIGH); | |
} else { | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment