当前位置:网站首页>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 !
边栏推荐
- Arduino+ze08-ch2o formaldehyde module, output formaldehyde content
- < C> C language hash table usage
- Annual comprehensive analysis of China's online video market in 2022
- Getting started for beginners: build your own blog with WordPress
- SLAM综述阅读笔记六:基于图像语义的SLAM调研:移动机器人自主导航面向应用的解决方案 2020
- Blocking queue
- STM32 - capacitive touch button experiment
- @Detailed explanation of repository
- codeforces 1708E - DFS Trees
- Hard deduction SQL statement exercises, wrong question records
猜你喜欢

SLAM综述阅读笔记七:Visual and Visual-Inertial SLAM: State of the Art, Classification,and Experimental 2021

汉字风格迁移篇---对抗性区分域适应(L1)Adversarial Discriminative Domain Adaptation

Slam overview Reading Note 7: visual and visual intangible slam: state of the art, classification, and empirical 2021

Cultural tourism and data collection | travel to Yunnan in an artistic way

One of yolox improvements: add CBAM, Se, ECA attention mechanism

Interprocess communication

@What happens when bean and @component are used on the same class?

软件产品第三方测试费用为什么没有统一的报价?

10 practical uses of NFT

Leetcode · daily question · 592. fraction addition and subtraction · simulation
随机推荐
spark job 使用log4j appender 追加日志到本地文件或者mysql
2022 Niuke multi School II_ E I
万字详解 Google Play 上架应用标准包格式 AAB
一文搞懂 Redis 架构演化之路
炒黄金开户平台有没有正规,安全的
codeforces 1708E - DFS Trees
telnet远程登录aaa模式详解【华为eNSP】
Detoxify! After Harbin Institute of technology was disabled MATLAB, domestic industrial software fought back domineering
c语言分层理解(c语言数组)
【STM32】EXTI
Research on Chinese idiom metaphorical knowledge recognition and relevance based on transfer learning and text enhancement
JS 疫情宅在家,学习不能停,七千字长文助你彻底弄懂原型与原型链
Docker实践经验:Docker 上部署 mysql8 主从复制
What you want most is the most comprehensive summary of C language knowledge. Don't hurry to learn
How to deploy open source Siyuan privately
动态规划——股票买卖5
This points to problems, closures, and recursion
HDU4565 So Easy! [matrix multiplication] [derivation]
np. Usage and difference of range() and range()
终于有人把面试必考的动态规划、链表、二叉树、字符串全部撸完了