15 lines
347 B
C++
15 lines
347 B
C++
|
#include <SFML/Graphics.hpp>
|
||
|
#include <opencv2/opencv.hpp>
|
||
|
|
||
|
sf::Texture getTextureFromCvFrame(cv::Mat frame) {
|
||
|
cv::Mat frameRGBA;
|
||
|
sf::Image image;
|
||
|
sf::Texture texture;
|
||
|
|
||
|
cv::cvtColor(frame, frameRGBA, cv::COLOR_BGR2RGBA);
|
||
|
image.create(frameRGBA.cols, frameRGBA.rows, frameRGBA.ptr());
|
||
|
texture.loadFromImage(image);
|
||
|
|
||
|
return texture;
|
||
|
}
|