int main ( int argc, char** argv ) { if ( argc < 4 ) { printf ( "usage: %s <source file> <destimation file> <format> [default = bg2rgb]\n", argv[0]); printf ( " - format: bg2bgr, gb2BGR, rg2bgr, gr2bgr, bg2rgb, gb2BGR, rg2bgr, gr2bgr\n"); printf ( " ---> option not yet impemented\n"); if (( argc < 3 ) || ( argc > 4 )) { return 1; } } printf ( "source %s\n, destimation %s\n, ", argv[1], argv[2] ); cv::Mat imageSrc = cv::imread(argv[1], 0 ); cv::Mat imageBy = imageSrc; cv::Mat imageColor(imageSrc.cols, imageSrc.rows, CV_8UC3); cv::cvtColor(imageBy, imageColor, CV_BayerGB2RGB); cv::imwrite(argv[2], imageColor); cv::namedWindow ( "Image", 1 ); do { cv::imshow("Image", imageColor); } while (cv::waitKey(10000) == -1); return 0; }
void ScreenMx508::flushColorScreen(Qt::GlobalColor color) { QImage imageColor(screenWidth(),screenHeight(), QImage::Format_RGB32); imageColor.fill(color); flushImage(imageColor,QPoint(0,0)); }
void Image3DOverlay::render(RenderArgs* args) { if (!_renderVisible || !getParentVisible() || !_texture || !_texture->isLoaded()) { return; } // Once the texture has loaded, check if we need to update the render item because of transparency if (!_textureIsLoaded && _texture && _texture->getGPUTexture()) { _textureIsLoaded = true; bool prevAlphaTexture = _alphaTexture; _alphaTexture = _texture->getGPUTexture()->getUsage().isAlpha(); if (_alphaTexture != prevAlphaTexture) { auto itemID = getRenderItemID(); if (render::Item::isValidID(itemID)) { render::ScenePointer scene = AbstractViewStateInterface::instance()->getMain3DScene(); render::Transaction transaction; transaction.updateItem(itemID); scene->enqueueTransaction(transaction); } } } Q_ASSERT(args->_batch); gpu::Batch* batch = args->_batch; float imageWidth = _texture->getWidth(); float imageHeight = _texture->getHeight(); QRect fromImage; if (_fromImage.isNull()) { fromImage.setX(0); fromImage.setY(0); fromImage.setWidth(imageWidth); fromImage.setHeight(imageHeight); } else { float scaleX = imageWidth / _texture->getOriginalWidth(); float scaleY = imageHeight / _texture->getOriginalHeight(); fromImage.setX(scaleX * _fromImage.x()); fromImage.setY(scaleY * _fromImage.y()); fromImage.setWidth(scaleX * _fromImage.width()); fromImage.setHeight(scaleY * _fromImage.height()); } float maxSize = glm::max(fromImage.width(), fromImage.height()); float x = _keepAspectRatio ? fromImage.width() / (2.0f * maxSize) : 0.5f; float y = _keepAspectRatio ? -fromImage.height() / (2.0f * maxSize) : -0.5f; glm::vec2 topLeft(-x, -y); glm::vec2 bottomRight(x, y); glm::vec2 texCoordTopLeft((fromImage.x() + 0.5f) / imageWidth, (fromImage.y() + 0.5f) / imageHeight); glm::vec2 texCoordBottomRight((fromImage.x() + fromImage.width() - 0.5f) / imageWidth, (fromImage.y() + fromImage.height() - 0.5f) / imageHeight); float alpha = getAlpha(); glm::u8vec3 color = getColor(); glm::vec4 imageColor(toGlm(color), alpha); batch->setModelTransform(getRenderTransform()); batch->setResourceTexture(0, _texture->getGPUTexture()); DependencyManager::get<GeometryCache>()->renderQuad( *batch, topLeft, bottomRight, texCoordTopLeft, texCoordBottomRight, imageColor, _geometryId ); batch->setResourceTexture(0, nullptr); // restore default white color after me }