@juca wrote:
I am trying to copy a part of an image to another one but the code is not working. I followed the instructions here.
The following code is throwing an error. According to the documentation and also the source code this should work.
I call this:
bool ofPixels_::pasteInto(ofPixels_ &dst, size_t x, size_t y)Using this:
ofPixels_ & ofImage_::getPixels()Any ideas?
ofFloatImage ofApp::processImg(ofFloatImage img) { ofFloatImage processImg; int processImgW = 100; int processImgH = 100 processImg.allocate( processImgW, processImgH, OF_IMAGE_COLOR); ofPixels tempPixels = img.getPixels(); tempPixels.pasteInto(processImg.getPixels(), 0,0 ); return processImg; }
/mnt/FILES/CODE/OF/OF_100_64B_GCC6/apps/myApps/myApp/src/myApp.cpp: In member function ‘ofFloatImage ofApp::processImg(ofFloatImage)’: /mnt/FILES/CODE/OF/OF_100_64B_GCC6/apps/myApps/myApp/src/myApp.cpp:276:44: error: cannot bind non-const lvalue reference of type ‘ofPixels_<unsigned char>&’ to an rvalue of type ‘ofPixels_<unsigned char>’ 276 | tempPixels.pasteInto(processImg.getPixels(), 0,0 );
Posts: 2
Participants: 2