当前位置:网站首页>Get the data of the first frame of unity's open camera
Get the data of the first frame of unity's open camera
2022-07-27 14:43:00 【Slowly sink】
using UnityEngine;
public class ExampleScript : MonoBehaviour
{
WebCamTexture webcamTexture;
Testure2D t2=new Testure2D;
Testure2D t2_1=new Testure2D;
Testure2D t2_2=new Testure2D;
int a=0;
void Start()
{
// Start web cam feed
webcamTexture = new WebCamTexture();
webcamTexture.Play();
t2=webcamTexture;// Take the camera picture directly , The approximate rate is Null;
}
void Update()
{
if (webcamTexture.didUpdateThisFrame)
{
a++;
if(a>1)
{
t2_2=webcamTexture;// The first frame will be black , The second frame is the frame with picture
}
}
}
IEnumerator Waiting()
{
yeild return new wait...// Waiting time , How long? ? How long does it take to turn on the camera ( Not sure )? I want to have the first frame of the picture ?
t2_1=webcamTexture;
}
}Because I'm not sure how long it will take for the camera to turn on , It is not the best choice for us to process data too early or too late , that WebCamTexture .didUpdateThisFrame
Just enough to meet our needs ;
Use this attribute to check whether the video buffer has changed since the last frame . When setting low frame rate , Video updates may be slower than games . Because every time Update Call to execute high overhead video Processing is meaningless , Please check this value before any processing .
When the first frame buffer changes , The frame has not been written , So it's a black frame , When the buffer changes the second time, it will be a new frame , That is, the first frame of the picture we want .
If it helps , Focus on + Click like to support bloggers , Readers are cordially invited to point out what is wrong , thank you !
边栏推荐
- Chapter 3 business function development (view clue details)
- MySQL advanced II. Logical architecture analysis
- @Repository详解
- Database storage series (1) column storage
- JS what is declaration in advance? The order of function and variable declaration in advance (the foreshadowing of execution context)
- < C> C language hash table usage
- "Game engine light in light out" 4.1 unity shader and OpenGL shader
- poj3461 Oulipo【KMP】
- 汉字风格迁移篇---对抗性区分域适应(L1)Adversarial Discriminative Domain Adaptation
- 【医疗行业】DICOM converter Tools
猜你喜欢

万字详解 Google Play 上架应用标准包格式 AAB
Database storage series (1) column storage

JS epidemic at home, learning can't stop, 7000 word long text to help you thoroughly understand the prototype and prototype chain

【STM32】EXTI

STM32——电容触摸按键实验

Advanced MySQL III. storage engine

自动化配置SSH免密登录和取消SSH免密配置脚本

架构——MVC的升华

Flexible and easy to use WYSIWYG visual report

Import the virtual machine officially made by Kali Linux into Oracle VirtualBox
随机推荐
telnet远程登录aaa模式详解【华为eNSP】
< C> C language hash table usage
在Oracle VirtualBox中导入Kali Linux官方制作的虚拟机
C语言基础知识梳理总结
HDU1422 重温世界杯【DP】
Detoxify! After Harbin Institute of technology was disabled MATLAB, domestic industrial software fought back domineering
Annual comprehensive analysis of China's online video market in 2022
架构——MVC的升华
Document translation__ Tvreg V2: variational imaging method for denoising, deconvolution, repair and segmentation (part)
【STM32】EXTI
arduino+ZE08-CH2O甲醛模块,输出甲醛含量
How to solve cache avalanche, breakdown and penetration problems
Hdu1422 revisits the world cup [DP]
How to return to the parent directory with commands
spark job 使用log4j appender 追加日志到本地文件或者mysql
MySQL advanced II. Logical architecture analysis
[intensive reading of papers] grounded language image pre training (glip)
获取Unity打开摄像头第一帧有画面的数据
次小生成树【模板】
This points to problems, closures, and recursion