Example #1
0
TextureView::TextureView(std::size_t id, mve::CameraInfo const & camera,
    mve::ByteImage::Ptr image)
    : id(id), image(image) {

    width = image->width();
    height = image->height();

    camera.fill_calibration(*projection, width, height);
    camera.fill_camera_pos(*pos);
    camera.fill_viewing_direction(*viewdir);
    camera.fill_world_to_cam(*world_to_cam);
}
void print_number(mve::ByteImage::Ptr image, int x, int y, int digit, math::Vec3uc color) {
    assert(0 <= x && x < image->width() - 3);
    assert(0 <= y && y < image->height() - 5);
    assert(0 <= digit && digit <= 9);

    for(int i = 0; i < 3; ++i) {
        for(int j = 0; j < 5; ++j) {
            if(font[30 * j + digit * 3 + i]) {
                for(int c = 0; c < image->channels(); ++c) {
                    image->at(x+i, y+j, c) = color[c];
                }
            }
        }
    }
}
Example #3
0
cacc::ByteImagecacc::HOST>::Ptr
convert(mve::ByteImage::Ptr image) {
    if (image->channels() != 3 && image->channels() != 4) {
        throw std::runtime_error("Only support for 3/4 channels");
    }

    int widht = image->width();
    int height = image->height();

    cacc::ByteImage<cacc::HOST>::Ptr ret;
    ret = cacc::ByteImage<cacc::HOST>::create(width, height);
    cacc::ByteImage<cacc::HOST>::Data & data = ret->data();

    for (int y = 0; y < height; ++y)
        for (int x = 0; x < width; ++x) {
            uint pixel = 0x00000000;
            for (int c = 0; c < image->channels(); ++c) {
                pixel |= static_cast<uint>(image->at(x, y, c)) << 8 * c;
            }
            data.data_ptr[y * data.pitch + x] = pixel;
        }
    }