openframeworks/ofBook

Example 2 in "Image Processing and Computer Vision" - Code does not build in Xcode

alexanderogle opened this issue · 7 comments

After copying the code for example 2 from "Image Processing and Computer Vision" (Preliminaries to Image Processing) into Xcode and attempting to build the application, the build fails due to the following error:

In ofApp.cpp of example 2:
[line 30] unsigned char* pixelData = myVideoGrabber.getPixels();
Introduces the error:
“No viable conversion from ‘ofPixels’ (aka ‘ofPixels_’) to ‘unsigned char *’ "

screen shot 2016-10-25 at 11 27 45 am

hi @alexanderogle ,
that line should be
unsigned char* pixelData = myVideoGrabber.getPixels().getData();
can you please test it in order to make the fix? Please inform if any other issue.
best!

Hey @roymacdonald,

That was definitely the fix. I was able to build and run the program after that.

Nice work!

cc @golanlevin -- it's a small fix for getPixels (which now returns ofPixels() vs before when it returned a pointer to the data)... maybe you can take a look at your chapter and see if there are any updates you need to make to the code accordingly ?

esnho commented

Hi, the issue with getPixels is still there, unfortunately it's a bit confusing because is hard to find a fix on google.

@alexanderogle I guess you should open back this issue.

I've re-opened the issue, I think it's not just as simple as adding getPixels().getData() everywhere but maybe also re-writing the chapter about low level vs high level access to explain the ofPixels object.

Hi there,
I wrote this some time ago as some sort of extension to Golan's ofBook chapter. I'd be glad if this is used as well as helping to improve this chapter.