Quantcast
Channel: beginners - openFrameworks
Viewing all 4929 articles
Browse latest View live

Recommended video-player "jukebox" for oF 0.9.7, macOS10.10+

$
0
0

@visualist wrote:

Hi, being more of a webdev and an oF dabbler, I'm a bit confused as to which video player addon to use. I inherited an oF 0.8.4 project which used QTKit and was frequently crashing. I'd like to upgrade and eliminate crashing.

Ours is a simple application: a back-end player for art films from 35-seconds to full length movies. (The front-end film selection is made externally, and the commands are sent to this application.) The application will only be playing films one at a time, based on a queue, but will need to select among the 250+ disk-based films (and growing) in our collection. These films are stored on a disk array. All use mp4 containers and h264 encoding. Playback is 1920x1024 on a Barco projector, driven by a MacPro (macOS 10.10, 32G memory)

Going to http://ofxaddons.com/categories/12-video-camera and searching within page for “videoplayer” I find 8 or 9 options (eliminating those that don’t apply to macOS), with development activity ranging from 2–4 years ago and quoted releases from 0.7.3 to 0.9.2. The newest among these choices is ofxVLCVideoPlayer, but rather than introduce the vlc-library I’m wondering if adequate support exists for something mac-native—this would suggest either ofxAVFoundation (2 yrs old, 0.8.3) or ofxAVFVideoPlayer (3 yrs old, 0.7.4). I have to say, none of the options are comfortably new. To make matters worse, some of these players have multiple forks on github, all different from each other (e.g., ofxAVFVideoPlayer has 5 forks).

Having tried a few addons with their associated examples and experiencing various forms of crashing, I’m wary of making this choice arbitrarily and seek the advice of an expert in this area.

Posts: 1

Participants: 1

Read full topic


Bluetooth heart rate monitor using OF

$
0
0

@Mala wrote:

Hi,

I wanted to create a piece that changs colour and effects of an image based on your heart rate and was wondering if anyone has used a bluetooth heart rate monitor to do this? I've found a method of how to build your own Heart Rate Bluetooth Arduino but it looks quite clunky so was wondering whether anyone else has dev'd on one using OF.

Thanks in advance,

  • Mala

Posts: 1

Participants: 1

Read full topic

Will this code cause a memory leak?

$
0
0

@cuinjune wrote:

in ofApp.h

 unique_ptr<ofImage> myImage;

in ofApp.cpp

void ofApp::draw(){

myImage = make_unique<ofImage>();
myImage->load("image.jpg");
myImage->draw(0,0);

}

I know the memory allocation and the image loading part can be called once in setup()
But let's say I wrote this way, will it cause any memory leak?
I learned that smart pointers don't need to be deleted, but I also read somewhere it can be deleted using 'reset'. http://stackoverflow.com/questions/25609457/unique-ptr-explicit-delete

When I run the code in Xcode, the memory seemed to be gradually increasing although I'm not sure if it's a leak.
Can anyone clarify this for me please? Thanks in advance!

Posts: 6

Participants: 3

Read full topic

TTS - Speech Synthesis

$
0
0

@gu_ma wrote:

Hi there,

Does anyone have experience with Speech Synthesis? I would like to include some in an upcoming project but not sure where to proceed. I've tried a few lib and comparatively the system command "say" (OSX) produce better results. It also seems that there are a lot of potential to tweak the speakers voice ( http://apple.co/2gfzX4o ) but I'm not sure how to use this command and control all parameters within OF other than:

system("say 'this is a quick test' &");

As mentioned in this post: https://forum.openframeworks.cc/t/text-to-speech-amp-speech-to-text-libraries/3243/4

Thanks in advance,

Guillaume

Posts: 1

Participants: 1

Read full topic

Minimum requirements if using FBO

Controll some mics and calculate data recorded by mics

$
0
0

@K_tosaka wrote:

Hi!
I'm trying to record two mics like this

void ofApp::audioIn(float * input, int bufferSize, int nChannels, int deviceID, unsigned long long tickCount){

double power_first = 0.0;
double power_second = 0.0;


for (int a = 0; a < bufferSize; a++) {

	if (deviceID == 1) {
		data1[a] = input[2*a];
		power_first += data1[a] * data1[a];
	}

	if (deviceID == 2) {
		data2[a] = input[2 * a + 1];
		power_second += data2[a] * data2[a];
	}
}
}

It does not work well...
Each mics can record the first half size of buffersize , but cannot record the second half size of buffersize well.

And it looks not switch deviceID well.

I need your help...

Thanks.

Posts: 1

Participants: 1

Read full topic

Cannot use QT creator on windows

$
0
0

@coclea wrote:

I just installed openFrameworks of_v0.9.7 on windows 7 with visual c++ 2015
I wrote a basic application and checked all the examples. All compiling and running fine.

I installed QT creator and msys2

It all works until I tried to compile the openFrameworksCompiled\project using make.
It says:


HOST_OS=MINGW64_NT-6.1
makefileCommon/config.shared.mk:217: *** This package doesn't support your platform, probably you downloaded the wrong package?. Stop.


When I try to use qtcreator directly, it says for
of_v0.9.7_vs_release\libs\openFrameworksCompiled\project\qtcreator/ofApp.qbs

parameter not correct

Any idea?
I would like to use QT as an interface.

Posts: 1

Participants: 1

Read full topic

Find name, min, max etc from ofParameter inside group

$
0
0

@Bruno_Afonso wrote:

Hi,

How can I find all entries in a ofParameterGroup and extract their min, max, type etc? I can get the name...

for (auto i: mainWindow->xpto.parameters ) {
   cout << i->getName() << endl;
}

I want this to generate a gui using ofxdatgui which currently does not support ofparameters.

Posts: 1

Participants: 1

Read full topic


ofxUI // automatic multiple DropDownList

$
0
0

@jbacelar wrote:

Hi.

I'm building two ofxUI dropdown menus in the same program:
First one get menu names from a vector via push_backs in the setup.
Second menu get toggle names (name2) from a set that comes from reading a CSV file and filtered by the fist menu selection:

string name2 = e.widget->getName();

ofxUIToggle *toggle2 = (ofxUIToggle *) e.widget;
ddl2->setShowCurrentSelected(toggle2->getValue());

if(g_img_N == 1 && g_changeMenu == true) { // choices from menu1

    ddl2->clearToggles();

    string addnames="";

    std::set<std::string>::iterator it_names = RArtLar.v_setRamos.begin();  // iterate names from the class's vector

    for(int i=0; i< RArtLar.maxElements; i++){ // adding elements

        addnames += *it_names;
        ddl2->addToggle(*it_names);
        it_names++;
    }
    g_changeMenu = false;
}

ofxUIDropDownList *ddlist2 = (ofxUIDropDownList *) e.widget;
vector<ofxUIWidget *> &selected2 = ddlist2->getSelected();

vector<string> seleNames = ddlist2->getSelectedNames(); // this line adds THE PROBLEM!

when I select toggle names in the application it crashes :
EXC_BAD_ACCESS(code=exci386_GPFLT)

even using getName();, like the menu1 method..
just kind of lost here ...

thanks in advance.

Posts: 1

Participants: 1

Read full topic

Extremely simple task that i can't get to work

$
0
0

@hachem28 wrote:

Super Beginner here. So all I'm trying to do is declare a variable of type ofRectangle or instantiate an object of type ofRectangle(which way is the correct way to say it?) and draw it. But i can't do this simple task., Here's what i have:

in ofApp.h:
ofRectangle player;

in ofApp.cpp:

void ofApp::setup()
{
player.set(100,100,100,100);
}

void ofApp::update(){

}

void ofApp::draw()
{
ofColor(255,0,0);
player;
}

I believe I'm not creating the object correctly, but I've searched everywhere and cannot find how to do it.

Thanks

Posts: 6

Participants: 4

Read full topic

Suggestions for Chroma Keying

$
0
0

@IEFilmStudios wrote:

From anyone's experience, what is the best way to handle chroma keying in OFx, using either anything built in or with an addon? We need to chroma key a football field during a game, leaving players to layer objects below them. What works best? Additionally, is there a system that allows you to pick colors to specifically NOT be keyed? Thanks.

Posts: 1

Participants: 1

Read full topic

Texture whit shader dont want work

$
0
0

@diego_di_battista wrote:

i'm a nebbie in oF and this code dont'work why?
the scader it take from book "open frame work essential", sorry for bad language i italian

include "ofApp.h"

//--------------------------------------------------------------
void ofApp::setup(){

fbo.allocate(ofGetScreenWidth() , ofGetScreenHeight() , GL_RGBA); // fbo is an ofFbo
tex.allocate(ofGetScreenWidth() , ofGetScreenHeight() , ofImageType::OF_IMAGE_COLOR_ALPHA);
videomod.allocate(ofGetScreenWidth(), ofGetScreenHeight(), OF_PIXELS_RGB);
tex.allocate(videomod);
shader.load("kaleido.vert","kaleido.frag");

}

//--------------------------------------------------------------
void ofApp::update(){
if (camera.isInitialized()) camera.update();
{
fbo.begin();
disegno();
tex.draw(0, 0, ofGetScreenWidth(), ofGetScreenHeight());

	if (schaderacceso == 1)
		{

	shader.begin();
	shader.setUniform1i("Ksectors",15);
	shader.setUniform1f("KangleRad", 90);
	shader.setUniform2f("Kcenter", 500, 500);
	shader.setUniform2f("KscreenCenter", 500, 600);
	shader.end();
	}
		fbo.end();
	}
	}
	//--------------------------------------------------------------

void ofApp::draw(){
fbo.draw(0, 0, ofGetScreenWidth(), ofGetScreenHeight());

}
//--------------------------------------------------------------
void ofApp::keyPressed(int key){
if (key == 'c')
{ schaderacceso = !schaderacceso;}

if (key=='z')
{
camera.setDeviceID(0);
camera.setDesiredFrameRate(30);
camera.initGrabber(camx, camy);

}
if (key == 'a'){
volumeR = volumeR + 5;
volumeG = volumeG + 5;
volumeB = volumeB + 5;
if (volumeR >= 255)
{
volumeR = 0;
}
if (volumeG >= 255)
{
volumeG = 0;
}
if (volumeB >= 255)
{
volumeB = 0;
}

	}
if (key == 'r')
	volumeR = volumeR + 5;
{
	if (volumeR >= 255)
	{
	volumeR = 0;
}
}
if (key == 'g')
	volumeG = volumeG + 5;
{
	if (volumeG >= 255)
	{
		volumeG = 0;
	}
}
if (key == 'b')
	volumeB = volumeB + 5;

{
if (volumeB >= 255)
{
volumeB = 0;
}
}
}

//--------------------------------------------------------------
void ofApp::keyReleased(int key){

}

//--------------------------------------------------------------
void ofApp::mouseMoved(int x, int y ){

}

//--------------------------------------------------------------
void ofApp::mouseDragged(int x, int y, int button){

}

//--------------------------------------------------------------
void ofApp::mousePressed(int x, int y, int button){

}

//--------------------------------------------------------------
void ofApp::mouseReleased(int x, int y, int button){

}

//--------------------------------------------------------------
void ofApp::mouseEntered(int x, int y){

}

//--------------------------------------------------------------
void ofApp::mouseExited(int x, int y){

}

//--------------------------------------------------------------
void ofApp::windowResized(int w, int h){

}

//--------------------------------------------------------------
void ofApp::gotMessage(ofMessage msg){

}

//--------------------------------------------------------------
void ofApp::dragEvent(ofDragInfo dragInfo){

}
void ofApp::disegno() {
if (camera.isFrameNew()) {
ofPixels & pixels =camera.getPixels();
int dim = (camx* camy * 3);
for (int i = 0; i < dim ; i++) {
videomod[i]=abs(volumeR- pixels[i]);
i++;
videomod[i] = abs(volumeG - pixels[i]);
i++;
videomod[i] = abs(volumeB - pixels[i]);
}
}
tex.loadData(videomod);
}

Posts: 1

Participants: 1

Read full topic

Light on a plane

$
0
0

@edapx wrote:

I'm having a strange issue with a simple shader that I'm applying to a sphere and to a plane. On the sphere it works, on the plane it looks like there is no light.

This is the vertex shader:

#version 150
uniform mat4 modelViewProjectionMatrix;

in vec4 position;
in vec4 normal;

out vec4 vPosition;
out vec3 vNormal;

void main() {
    vNormal = normal.xyz;
    vPosition = modelViewProjectionMatrix * position;
    gl_Position = vPosition;
}

And this is the fragment shader:

#version 150

uniform vec3 lightPos;
in vec4 vPosition;
in vec3 vNormal;

out vec4 vFragColor;

void main() {
    vec4 color = vec4(1.0,0.0,0.0,1.0);
    vec3 lightDirection = normalize(lightPos - vPosition.xyz);
    float dProd = max(0.3, dot(vNormal, lightDirection));
    vec4 colorWithLight = vec4( vec3( dProd ) * vec3( color ), 1.0 );
    vFragColor = colorWithLight;
}

And this is the draw method:

void ofApp::draw(){
    ofDisableDepthTest();
    gui.draw();
    ofEnableDepthTest();
    cam.begin();
    shader.begin();
    shader.setUniform3f("lightPos", lightPos);
    sphere.draw();
    plane.draw();
    shader.end();
    light.draw();
    cam.end();
}

Am I doing something wrong?

Posts: 3

Participants: 2

Read full topic

Anyone successfully using OF 0.9.7(or 0.9.8) with msys2/Qt Creator on Windows?

$
0
0

@php0614 wrote:

it looks like so many users have failed to use OF 0.9.7 or 8 with msys2/Qt Creator version. is there anyone successfully using it on Windows 10 or any other windows system?

if so, what you did is only following the setup guide and everything worked smoothly?

if someone can share his/her experience it would be really appreciated.

Posts: 2

Participants: 2

Read full topic

Improving Boid Flocking

$
0
0

@aceslowman wrote:

I'm working right now on adapting Shiffman's flocking example (https://www.processing.org/examples/flocking.html) for openFrameworks. So far, the flocking itself works great, but I know there are ways to make the flocking much more efficient, but I'm not sure if I'm going about this correctly.

My idea right now is to create a flock grid system, in which a boid in the flock is only concerned about the location of nearby boids. Because a boid might inhabit a spot right next to the grid boundary, it will continue to look at all adjacent grid areas, but exclude distant ones. This will at least reduce the number of boids that each boid will need to check the location of.

My confusion, and possibly where I might be mislead, is how I'm doing this within vectors. Essentially, I'm creating a vector< vector >, with the first dimension being the grid id (for which I have a working formula for assigning an id), and the second for the individual boid. Will all of my efforts to reduce the number of checks actually increase the number of calculations? Every boid will now have to constantly tell the flock structure if it has or hasn't left it's grid location.

Does anyone have some advice on how I might approach this?

Posts: 1

Participants: 1

Read full topic


Horizontal Lines on Webcam Feed because of LED Flickering on Openframeworks + OpenCV

$
0
0

@meric_dagli wrote:

I am having horizontal lines in my webcam feed in Openframeworks and I am using a Playstation Eye cam with ofxPS3EyeGrabber to achieve this. I have also tried opencvexample sketch but it looks like the same.

For defining the context, I am trying to create a real-time hand drawing tracker by using a webcam , lighttable and some transparencies. So the idea is to digitalize the drawn sketch on a transparent acrylic sheet by using computer (similar to an overhead projector). The setup is similar to “Where do you call home?” by Peter Thompson (2008) https://vimeo.com/122126723. If you have any ideas on how to built this kind of setup without this flickering issue, I would like to hear them also.

I have also checked this thread but I can't solve my problem with the suggested solutions.

Does anyone have an idea how I can tackle this problem?

Thank you!

Posts: 1

Participants: 1

Read full topic

Tessellating unfilled ofPath?

$
0
0

@cuinjune wrote:

Hi, I'm trying to tessellate unfilled ofPath so I can draw the path using ofMesh.
But the following code below does not draw anything.

void ofApp::draw(){

ofPath path;
path.setFilled(false);
path.setStrokeWidth(2);
path.rectangle(ofGetWidth()/2, ofGetHeight()/2, 100, 100);

ofMesh mesh = path.getTessellation();
mesh.draw();

}

If I set "path.setFilled(true)", then it draws a filled rectangle, but nothing appears if I set "path.setFilled(false)".
Is it not possible to get tessellation of an unfiiled path and draw it?
I would like to draw the unfilled path through ofMesh(or ofVboMesh) for extra efficiency if possible.
Could anyone please give me any advice? Thanks!

Posts: 1

Participants: 1

Read full topic

Getting set of 3d primitive faces considering position and rotation

$
0
0

@CrazySage wrote:

Hello. I'm starting to work with OF and I have following problem:
I create some 3-d scene with OF 3d-primitives (ofConePrimitive, ofBoxPrimitive and so on), using code like this:

ofBoxPrimitive box;
box.setMode(OF_PRIMITIVE_TRIANGLES);
box.setHeight(obj["height"].asFloat());
box.setWidth(obj["width"].asFloat());
box.setDepth(obj["depth"].asFloat());
box.setPosition(obj["x"].asFloat(), obj["y"].asFloat(), obj["z"].asFloat());
box.setResolution(obj["resolution"].asInt());
box.rotate(obj["spin_x"].asFloat(), 1.0, 0, 0);
box.rotate(obj["spin_y"].asFloat(), 0, 1.0, 0);
box.rotate(obj["spin_z"].asFloat(), 0, 0, 1.0);

where obj is json-object of file I'm reading.
Then I need to get all triangles of scene for further processing, but when I call

std::vector<ofMeshFace> primitive_faces = some_primitive_.getMeshPtr()->getUniqueFaces();

I get triangles like I haven't called neither setPosition() nor rotate().
I understand how to add position, I will just add some_primitive_.getPosition() to each vertice of each face, but how can I apply rotation as well?
Or maybe there is just easy way to do it, without manual work?

Posts: 1

Participants: 1

Read full topic

Merging multiple ofPlanePrimitive on a single mesh

$
0
0

@edapx wrote:

Hi, as the title suggest, I want to create a mesh out of different ofPlanePrimitive. After that, i want to apply a texture on it. For now I'm just debugging the mesh creation.

This is what I'm doing:
- in my header file i've of3dPrimitive foliage.
- in my App.cpp:

    //in the setup
    int n_planes = 3;
    int distance = 100;
    float rot = 0;
    for (uint i = 0; i < n_planes; i++) {
        auto p = ofPlanePrimitive(width, height, resolution, resolution);
        p.setPosition(0, 0,float(distance*i));
        // this loop is needed otherwise all the planes will be on the same z position
        for (int i=0; i<p.getMesh().getNumVertices(); i++) {
            ofVec3f actualVert =p.getMesh().getVerticesPointer()[i];
            ofVec3f newVert = actualVert * p.getGlobalTransformMatrix();
            p.getMesh().getVerticesPointer()[i] = newVert;
        }
        foliage.getMesh().append(p.getMesh());
    }

In the draw method there is simply a foliage.drawWireframe(). And this is the result.

As you see there are some lines that connect the last vertex of a plane mesh with the first vertex of the next plane mesh. Is there a way to avoid this?

I've also considered putting all the planes in a container, like std::vector<shared_ptr<ofPlanePrimitive> > planesContainer; and then iterate through them, calling mapTexCoordsFromTexture(ofTexture texture) on each of them and then draw the plane. But it is slow when the planes are more than 3, that's why I was thinking to merge the meshes in a single of3dPrimitive, call mapTexCoordsFromTexture(ofTexture texture) on it and then draw it.

Posts: 9

Participants: 2

Read full topic

Projector distortion correction

$
0
0

@tejaswi_prakash wrote:

Given a 3d surface(an obj file) and an image . I was hoping I could achieve undistorted projection on it by performing the following steps

Draw a rectangular image onto the object. Switch to projector viewpoint (set glfrustum to projector properties) and capture this as the image to be projected from the projector.
Does anyone see a problem with this approach?

Posts: 1

Participants: 1

Read full topic

Viewing all 4929 articles
Browse latest View live