Пример #1
0
static void checkGlError(const char* file, int line) {
    GLenum error = glGetError();
    if (error != GL_NO_ERROR) {
        switch(error) {
        case GL_INVALID_ENUM:
            yError() << "OpenGL Error GL_INVALID_ENUM: GLenum argument out of range";
            break;
        case GL_INVALID_VALUE:
            yError() << "OpenGL Error GL_INVALID_VALUE: Numeric argument out of range";
            break;
        case GL_INVALID_OPERATION:
            yError() << "OpenGL Error GL_INVALID_OPERATION: Operation illegal in current state";
            break;
        case GL_STACK_OVERFLOW:
            yError() << "OpenGL Error GL_STACK_OVERFLOW: Command would cause a stack overflow";
            break;
        case GL_OUT_OF_MEMORY:
            yError() << "OpenGL Error GL_OUT_OF_MEMORY: Not enough memory left to execute command";
            break;
        default:
            yError() << "OpenGL Error " << error;
            break;
        }
    }
    yAssert(error == 0);
}
Пример #2
0
RobotInterface::CalibratorThread::CalibratorThread(yarp::dev::ICalibrator *calibrator,
                                                   const std::string &calibratorName,
                                                   yarp::dev::DeviceDriver *target,
                                                   const std::string &targetName,
                                                   RobotInterface::CalibratorThread::Action action) :
        mPriv(new Private(this))
{
    yAssert(calibrator);
    yAssert(target);
    yAssert(action == ActionCalibrate || action == ActionPark);

    mPriv->calibrator = calibrator;
    mPriv->calibratorName = calibratorName;
    mPriv->target = target;
    mPriv->targetName = targetName;
    mPriv->action = action;
}
Пример #3
0
bool deBayer_GRBG8_TO_RGB(yarp::sig::Image &source, yarp::sig::Image &dest, int pixelSize)
{
    yAssert(((pixelSize == 3) && (dest.getPixelCode() == VOCAB_PIXEL_RGB)) ||
    ((pixelSize == 4 && dest.getPixelCode() == VOCAB_PIXEL_RGBA)))

    dest.resize(source.width(), source.height());
    // perform conversion, skip borders
    for (int r = 0; r < source.height() - 2; r += 2)
    {
        unsigned char *destRow = dest.getRow(r);
        unsigned char *sourceRowCurrent = source.getRow(r);
        unsigned char *sourceRowNext = source.getRow(r + 1);

        //row i GRGRGR...
        for (int c = 0; c < source.width() - 2; c += 2)
        {
            //source is on G pixel 
            destRow[0] = sourceRowCurrent[1];    //red
            destRow[1] = sourceRowCurrent[0];    //green
            destRow[2] = sourceRowNext[0];;     //blue

            //jump a pixel in destination
            destRow += pixelSize;
            sourceRowCurrent++;
            sourceRowNext++;

            //source is now on R pixel
            destRow[0] = sourceRowCurrent[0];     //red
            destRow[1] = sourceRowCurrent[1];     //green
            destRow[2] = sourceRowNext[0];        //red

            destRow += pixelSize;
            sourceRowCurrent++;
            sourceRowNext++;
        }

        destRow = dest.getRow(r + 1);
        sourceRowCurrent = source.getRow(r + 1);
        sourceRowNext = source.getRow(r + 2);

        //row is now BGBGBG...
        for (int c = 0; c < dest.width() - 2; c += 2)
        {
            //source is on B pixel 
            destRow[0] = sourceRowNext[1];      //red
            destRow[1] = sourceRowCurrent[1];   //green
            destRow[2] = sourceRowCurrent[0];   //blue

            //jump a pixel in destination
            destRow += pixelSize;
            sourceRowCurrent++;
            sourceRowNext++;

            //source is now on G pixel
            destRow[0] = sourceRowNext[0];     //red
            destRow[1] = sourceRowCurrent[0];  //green
            destRow[2] = sourceRowCurrent[1];  //blue

            destRow += pixelSize;
            sourceRowCurrent++;
            sourceRowNext++;
        }
    }
    return true;
}