Hello, Thank you always.
I am studying oF using technical books.
The code written for that book does not work well again.
I get an error [No matching member function for call to ‘setFromPixels’] in [setFromPixels ()].
ofApp.h:
#pragma once
#include "ofMain.h"
#include "ofxOpenCv.h"
class ofApp : public ofBaseApp{
public:
void setup();
void update();
void draw();
void keyPressed(int key);
void keyReleased(int key);
void mouseMoved(int x, int y );
void mouseDragged(int x, int y, int button);
void mousePressed(int x, int y, int button);
void mouseReleased(int x, int y, int button);
void mouseEntered(int x, int y);
void mouseExited(int x, int y);
void windowResized(int w, int h);
void dragEvent(ofDragInfo dragInfo);
void gotMessage(ofMessage msg);
ofVideoGrabber vidGrabber;
ofxCvColorImage colorImg;
};
ofApp.h:
#include "ofApp.h"
//--------------------------------------------------------------
void ofApp::setup(){
ofBackground(0, 0, 0);
vidGrabber.initGrabber(320, 240);
colorImg.allocate(320,240);
}
//--------------------------------------------------------------
void ofApp::update(){
bool bNewFrame = false;
vidGrabber.update();
bNewFrame = vidGrabber.isFrameNew();
if(bNewFrame){
colorImg.setFromPixels(vidGrabber.getPixels(), 320, 240);
}
}
//--------------------------------------------------------------
void ofApp::draw(){
colorImg.draw(10,10);
}
It is like this
please tell me.