当前位置:网站首页>QT makes simple video calls

QT makes simple video calls

2022-06-10 07:20:00 Come on, Doo

Call the computer camera

First of all, the video call needs to call the computer camera .
The classes used are QCamera,QCameraImageCapture
QCamera Used to call the computer camera .QCameraImageCapture The number of frames used to capture the current camera

QCameraImageCapture There's a signal imageCaptured, When this signal is triggered , You can define a slot function to capture the current picture
 Insert picture description here
Define a image To capture

m_Image=preview.convertToFormat(QImage::Format_RGB888);

So the picture is captured . And then through tcp transmitted .

TCP Transfer pictures

Required 2 Classes
QTcpSocket,QTcpServer
socket For communication .server Used to listen to the interface .
First create the client socket. Define ports and ip Address .
connected This signal is used for connection .
tcpserver For monitoring . For example, I monitor 2022 This interface .

if(!m_pTcpServer->listen(QHostAddress::Any, 2022))   // Port is 2022

Judge whether the monitoring is successful .
To transmit a picture is to write the picture into QByteArray. Then it is converted when reading .
After the conversion is complete, use a qlabel Display .
I haven't added the voice function at present . I will study this later .
Anyway, the general principle is to capture the pictures of the current camera . And then through tcp Transfer the past .
Speed is OK . There's basically no Caton .
What you need can be done here Self taking . Thank you for your support .
design sketch :
 Insert picture description here
Transfer to desktop via laptop camera . Because desktop computers don't have cameras . So it's one-way .

原网站

版权声明
本文为[Come on, Doo]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/161/202206100715534912.html