|
|
@ -49,7 +49,7 @@ CameraView::CameraView(int width, int height, int depth, int channels, QWidget* |
|
|
|
|
|
|
|
|
|
|
|
// Fill with black background
|
|
|
|
// Fill with black background
|
|
|
|
QImage fill = QImage(width, height, QImage::Format_Indexed8); |
|
|
|
QImage fill = QImage(width, height, QImage::Format_Indexed8); |
|
|
|
fill.setNumColors(1); |
|
|
|
fill.setColorCount(1); |
|
|
|
fill.setColor(0, qRgb(70, 200, 70)); |
|
|
|
fill.setColor(0, qRgb(70, 200, 70)); |
|
|
|
fill.fill(CameraView::initialColor); |
|
|
|
fill.fill(CameraView::initialColor); |
|
|
|
glImage = QGLWidget::convertToGLFormat(fill); |
|
|
|
glImage = QGLWidget::convertToGLFormat(fill); |
|
|
@ -104,7 +104,7 @@ void CameraView::setImageSize(int width, int height, int depth, int channels) |
|
|
|
if (depth <= 8 && channels == 1) { |
|
|
|
if (depth <= 8 && channels == 1) { |
|
|
|
image = new QImage(receivedWidth, receivedHeight, QImage::Format_Indexed8); |
|
|
|
image = new QImage(receivedWidth, receivedHeight, QImage::Format_Indexed8); |
|
|
|
// Create matching color table
|
|
|
|
// Create matching color table
|
|
|
|
image->setNumColors(256); |
|
|
|
image->setColorCount(256); |
|
|
|
for (int i = 0; i < 256; i++) { |
|
|
|
for (int i = 0; i < 256; i++) { |
|
|
|
image->setColor(i, qRgb(i, i, i)); |
|
|
|
image->setColor(i, qRgb(i, i, i)); |
|
|
|
//qDebug() << __FILE__ << __LINE__ << std::hex << i;
|
|
|
|
//qDebug() << __FILE__ << __LINE__ << std::hex << i;
|
|
|
@ -162,7 +162,7 @@ void CameraView::commitRawDataToGL() |
|
|
|
QImage* newImage = new QImage(rawImage, receivedWidth, receivedHeight, format); |
|
|
|
QImage* newImage = new QImage(rawImage, receivedWidth, receivedHeight, format); |
|
|
|
if (format == QImage::Format_Indexed8) { |
|
|
|
if (format == QImage::Format_Indexed8) { |
|
|
|
// Create matching color table
|
|
|
|
// Create matching color table
|
|
|
|
newImage->setNumColors(256); |
|
|
|
newImage->setColorCount(256); |
|
|
|
for (int i = 0; i < 256; i++) { |
|
|
|
for (int i = 0; i < 256; i++) { |
|
|
|
newImage->setColor(i, qRgb(i, i, i)); |
|
|
|
newImage->setColor(i, qRgb(i, i, i)); |
|
|
|
//qDebug() << __FILE__ << __LINE__ << std::hex << i;
|
|
|
|
//qDebug() << __FILE__ << __LINE__ << std::hex << i;
|
|
|
|