Quantcast
Channel: Questions in topic: "webcamtexture"
Viewing all 358 articles
Browse latest View live

i want ip-cam texture help

$
0
0
i know movietexture and webcamtexture but i want ip-camtexture because i want cctv rive texture i have cctv ip adress , cctv id and password i want cctv video texture help!!

Performance problem with AR-App on Android

$
0
0
Hello everyone. I'm currently working on an augmented reality app for a lecture in my university. For now it contains basically the video presentation via the WebCamTexture (which works fine since I use GetColor32 to avoid memory leak ;) and then I grab the Color information to Compute stuff.. I am aware that you cant help me to optimize these routines, but when I run the App on my Nexus 5 a strange thing happens: the first 2 seconds the app run perfectly, then the frame rate drops down significantly. (First Question: Why?) Now what is really silly, when I start tapping at the screen the performance gets great again. When I stop tapping, frame rate drops! So obviously the Device is capable to compute my stuff enough. Is there any way to get this speed without tapping??? Thank you very much!

Facebook Audience Network conflicts with WebCamTexture

$
0
0
I tried to use WebCamTexture while the Facebook Audience Network is integrated in the app, but the camera only displays a black screen, and if the Facebook Audience Network is NOT integrated the WebCamTexture works well. Is there any other way to open the camera(Android & iOS) without having a conflict with Facebook Audience Network? Thank You.

How to apply a WebCameraTexture to a projector ?

$
0
0
Hi, I want to apply a WebCameraTexture to a projector so for now I made that : renderTexture.mainTexture = webcamTexture; gameObject.GetComponent().material = renderTexture; webcamTexture.Play(); Where renderTexture is a material. But I got this message : NullReferenceException: Object reference not set to an instance of an object CameraTexture.Start (). Any idea ? Thank you.

How can I connect webcamtexture to each usb port.

$
0
0
First, Sorry for my english skill. I want to use sevral webcams to get sevral videos simultaneously.(4 webcam) void Start () { int numOfCams = WebCamTexture.devices.Length; nameOfCams = new string[numOfCams]; Quaternion rotation = Quaternion.identity; for (int i = 0; i < numOfCams; i++) { nameOfCams[i] = WebCamTexture.devices[i].name; rotation.eulerAngles = new Vector3(180, i*90, 0); GameObject go = Instantiate(WebcamTexturePrefab, new Vector3(0, 0, 0), rotation) as GameObject; go.transform.parent = gameObject.transform; webcamTexture = new WebCamTexture(1280, 720, 30); webcamTexture.deviceName = nameOfCams[i]; webcamTextures.Add(webcamTexture); go.transform.GetChild(0).GetComponent().material.mainTexture = webcamTextures[i]; webcamTextures[i].Play(); } } Here is the code I got from a youtube video and I changed little.(https://www.youtube.com/watch?v=SO60rkkFUvo) I want to set the order of webcamTexture to place specific webcam to location I want. I think that to fix this problem, I have to set connection of webcamtexture to each usb port. How can I do this? Please help me.

Best approach for alpha blending multiple webcamtexture is renderTexture?

$
0
0
Hi, I want to blend multiple webcamtextures from multiple webcameras to be viewed by a user in VR. The blend should be able to - Fullscreen alpha blend, e.g. 50% cameraA + 25% cameraB + 25% cameraC - Area blend, e.g. leftmost 25% is CameraA + middle 50% cameraB + rightmost 25% is cameraC I am wondering what is the best approach for implementation. Each webcamera is different in resolution so cannot use one single cameraPlane with multiple materials and shader for blending. I think each webcam must be rendered to each's own cameraPlane, e.g. cameraPlaneA cameraPlaneB cameraPlaneC and have 3 unity camera camA camB camC each looking at the cameraPlane. Then render each to a renderTexture, and attach the 3 renderTextures to a single blendedCameraPlane with custom shader to be displayed to the user. The custom shader then handles the blending of the 3 materials. Is this the correct approach? Thank you.

Cannot get pixels when webcam is not running

$
0
0
I am trying to simply sync the current camera frame with the other person in the mutliplayer room, using photon. This is my script: using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class streamWebcam : Photon.MonoBehaviour { public Texture2D imgCam; public Texture2D nocam; public Texture2D receivedImage = null; public void sendBytes() { WebCamTexture webcamTexture = new WebCamTexture(); if (WebCamTexture.devices.Length > 0) { imgCam.SetPixels(webcamTexture.GetPixels()); //<--- ERROR HERE imgCam.Apply(); webcamTexture.Play(); } else { imgCam = nocam; imgCam.Apply(); } photonView.RPC("bytes", PhotonTargets.All, imgCam.EncodeToJPG(), PhotonNetwork.player.NickName); } [PunRPC] void bytes(byte[] received, string playername) { if (PhotonNetwork.player.NickName != playername) { print("received!"); Texture2D got = new Texture2D(640, 480, TextureFormat.RGBA32, false, false); got.LoadImage(received); got.Apply(); receivedImage = got; } } } But i get this error when i try to do imgCam.SetPixels(webcamTexture.GetPixels()); Cannot get pixels when webcam is not running. I searched every where and didn't find anything regarding this. Please help. Thanks, Mark.

how do i get differences between a background and webcam texture like a green screen?

$
0
0
i don't know if anyone else has a similar problem but i'm trying to make a kinect like motion controller script that uses a webcam such as the one on your laptop and the way i'm doing it is taking a picture of the background and the current camera texture2d. the only problem is i can't subtract the same pixels from both of them. i looked online and there was almost no talk about comparing 2 texture2d and none included a green screen effect. here is my script using System.Collections; using System.Collections.Generic; using System.IO; using UnityEngine; public class facerecognition : MonoBehaviour { void Start () { WebCamTexture CamTex = new WebCamTexture(); Renderer renderer = GetComponent(); renderer.material.mainTexture = CamTex; CamTex.Play(); } // Update is called once per frame void Update () { //sets the background when s is pressed if (Input.GetKeyUp("s")) { StartCoroutine (setBackground()); //lets you know s key has registerd Debug.Log ("s has been pressed"); } StartCoroutine(backgroundisolation()); } //isolates background IEnumerator backgroundisolation() { yield return WaitForEndOfFrame(); //gets current webcamtexture Texture2D tex2 = null; tex2.SetPixels((GetComponent().material.mainTexture as WebCamTexture).GetPixels()); //variables for background Texture2D tex = null; byte[] fileData; //loads background fileData = File.ReadAllBytes(Application.persistentDataPath + "background.png"); tex = new Texture2D(2, 2); tex.LoadImage(fileData); //checks if it's the same (helps for lag and can program default animation if (tex2 != tex) { //texture2d the green screen effect is applying to Texture2D changes = new Texture2D(tex.width, tex.height); //heres my problem \|/ changes.SetPixels(tex2 - tex); } yield break; } //sets the background public IEnumerator setBackground() { yield return new WaitForEndOfFrame(); //gets current webcamtexture Texture2D snap = new Texture2D(GetComponent().material.mainTexture.width, GetComponent().material.mainTexture.height); snap.SetPixels((GetComponent().material.mainTexture as WebCamTexture).GetPixels()); snap.Apply(); byte[] bytes = snap.EncodeToPNG(); //writes a png File.WriteAllBytes(Application.persistentDataPath + "background.png", bytes); //to know it was called Debug.Log ("background saved"); } } if there's any operators i don't know of or something like SamePixels that would really help thank you.

WebcamTexture leak memory

$
0
0
I have a scene. It has a button relating to "ChangeWebcam" method. Each time, I hit that button, then check in Profiler, one instance WebcamTexture will add to memory. So N times, in memory will have N instance. It will be problem if the size of an instance is more than 3Mb. Thanks for any help using System.Collections; public class WebcamtextureExample : MonoBehaviour { WebCamTexture wct; public void ChangeWebcam() { ... wct = new WebCamTexture(); //code for change camera (front or back) ... } } [1]: /storage/temp/85412-proplem.png

Can I use another USB camera (not a webcam)

$
0
0
Hello, I'm new to unity and before I really dive in, I need to know if I can use an external USB3 camera for AR-like application in unity 5+. It's a Toupcam microscope camera (see link below) which I have running well in standard C# VS. It has it's own SDK and DLL. http://www.touptek.com/product/showproduct.php?lang=en&id=195 I'm working on a microscope training (and other) simulator and AR visualization kit. I have successfully got a logitech webcam to work using other info here (RawImage, etc.) but I don't know how to get the toupcam up since it's not a "webcam". Sorry if this is beginner question. I really need to know this before I spend hundreds of hours in Unity and then find out it's not possible... THANKS.

WebCamTextures square

$
0
0
I want to make a picture in 1024x1024 this is needed!. The first issue is displaying the WebCamTexture on a square rawImage this pushes the image together and ruins the original image. I want to get a square of the webcamtexture and center it instead of pushing it together/cropping. The second issue is to save it with a resolution of 1024/1024 no matter what. my code: using System; using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class CameraController : MonoBehaviour { public string deviceName; private WebCamTexture wct; public GameObject rawImageARF; public Text t; // Use this for initialization void Start() { WebCamDevice[] devices = WebCamTexture.devices; deviceName = devices[0].name; wct = new WebCamTexture(deviceName, 1024, 1024, 90); rawImageARF.GetComponent().texture = wct; wct.Play(); } void Update() { float videoRatio = (float)wct.width / (float)wct.height; rawImageARF.GetComponent().aspectRatio = videoRatio; t.text = "Ratio: " + videoRatio; if (Input.GetKeyDown(KeyCode.Mouse0)) TakePicture(); } void TakePicture () { Texture2D snap = new Texture2D(wct.width, wct.height); snap.SetPixels(wct.GetPixels()); snap.Apply(); System.IO.File.WriteAllBytes(Application.dataPath + "/pictures/" + DateTime.Now.ToString().Replace('/', '-').Replace(':', '-') + ".png", snap.EncodeToPNG()); Debug.Log("picture saved"); } }

WebCamTexture Screen not smooth

$
0
0
Help!!! my camera is 1080p. soo 1920*1080 not smooth,but 1280*720 no problem. ---------------------------------------- public class Example : MonoBehaviour { private WebCamTexture webTexture; private Texture texture; void Start() { webTexture = new WebCamTexture(WebCamTexture.devices[0].name, 1920, 1080, 30); texture = webTexture; webTexture.Play(); } void OnGUI() { GUI.DrawTexture(new Rect(0, 0, Screen.width, Screen.height), texture); } }

Front facing camera is not working on windows phone (Lumia 640 XL), using webcam texture.

$
0
0
im using following code: WebCamDevice[] devices = WebCamTexture.devices; if (!isFrontCam) { isFrontCam = true; if (_webCamTexture != null) { _webCamTexture.Stop(); _webCamTexture = null; _webCamTexture = new WebCamTexture(); } _webCamTexture.deviceName = devices [0].name; renderer.GetComponent().material.mainTexture = _webCamTexture; _webCamTexture.Play(); } else { isFrontCam = false; if (_webCamTexture != null) { _webCamTexture.Stop(); _webCamTexture = null; _webCamTexture = new WebCamTexture(); } _webCamTexture.deviceName = devices [1].name; renderer.GetComponent().material.mainTexture = _webCamTexture; _webCamTexture.Play(); }

Unity wont detect device camera

$
0
0
Simply trying to use WebCamTexture to see video in game. But unity will not detect device camera on laptop or my phone. I know the code works because I used it before. I keep getting this error. Cannot find webcam device no camera available.. UnityEngine.WebCamTexture:Play() kslklvk:Start() (at Assets/kslklvk.js:10) Unity simply will not detect the camera on a windows or andriod device to use the WebCamTexture. Please help Here is the code I am using. var cam2:UI.Image; function Start () { var devices:WebCamDevice; var webcamTexture:WebCamTexture = new WebCamTexture(); var renderer:Renderer = cam2.GetComponent(Renderer); renderer.material.mainTexture = webcamTexture; webcamTexture.Play(); } function Update () { }

Switching between front/back device cameras and saving screenshot to photo album

$
0
0
H! I am developing C# code for an iPhone augmented reality app. My code needs to choose between the front-facing camera and the back-facing camera, and then grab a screenshot and save it to the photo album. I understand that `Application.CaptureScreenshot( Application.dataPath + "Screenshot.png" );` saves the screenshot as an image (in some mysterious location). Anyway, how do I choose between the two cameras? I can see that `WebCamDevice[] devices = WebCamTexture.devices;` gives me a list of the available cameras, but how do I specify ONE of these cameras to be used for the screen capture? Secondly...I notice many people asking how to find where the screen-captured image can be found. People are saying that it drops it into a documents folder. I want it in the Photo album. Do I have to make this specification in XCode? I can do that if I have to, but if there's an easier way through Unity, I'd prefer that. Thanks!

Take photo from webcam (not grab frame from video stream)

$
0
0
Hi, I have a few apps that grab images from a webcam to take photos. That's easy with WebCamTexture. But the quality sometimes is not realy great, webcam video streams do not have the quality of a real photo taken or the webcam full resolution. Anyone knows how to take a real photo in Unity?

Webcam not streaming on Unity3D windows

$
0
0
I have a simple webcam streaming scene containing a webcamTexture I have written that is streaming from a Ricoh Theta. Everything works well on a Mac. But when I deployed the same project on my Windows 10 PC, it does not stream from Ricoh Theta UVC. Direct Ricoh Theta works fine. Error received : 'Cannot find webcam device' Things I've tried: 1. Installed OBS application and checked the input camera stream - All streams working well there 2. Forced OpenGL on WIndows - Didn't solve the issue. Can someone think of a way I can solve this issue?

WebCamDevice and WebCamTexture FPS

$
0
0
I'm making a mobile game where I use the camera in the smartphone to take a selfie. When the camera is capturing and rendering, I'm getting 20-30 frames per second, which impacts negatively in some animations I have on the screen at the same time. We are now trying TastyBits CameraCaptureKit, but it's not getting better. Has anybody achieved 40+ fps using the camera in a mobile device? If so, how did you do it? I guess it also depends in the phone specs. I have an HTC m8 which is very good, so I don't think that's the problem in this case. Thanks!

How to set up a Videocamcorder as a Webcam in Unity?

$
0
0
Hey Guys, i just did the tutorial( https://www.youtube.com/watch?v=Fgd21lbhikU) for an augmented reality system and it works quite well with my webcam (Logitec). Now i want to do this again with a Videocamcorder to get a better quality with an HDMI output (Canon HV 30). I bought the Black magic decklink 4K to get the HDMI signal into my computer and it works with other video mixing softwares like vMix, but not unity.... What do i have to do that unity could get the HDMI live signal?

How to make a WebCamTexture 'run'?

$
0
0
I'm trying to use a WebCamTexture object to take a picture when a button is pressed, but I'm stuck with the following error: Cannot get pixels when webcam is not running UnityEngine.WebCamTexture:GetPixels() Here's my code (note that it's only the code regarding the problem): private WebCamTexture _cam; private Texture2D _picture; void Start() { _cam = new WebCamTexture(); if (WebCamTexture.devices.Length > 1) { _cam = new WebCamTexture(WebCamTexture.devices[1].name); Debug.Log("Set WebCamTexture to device 2/" + WebCamTexture.devices.Length); } else if (WebCamTexture.devices.Length > 0) { // This returns true in my case _cam = new WebCamTexture(WebCamTexture.devices[0].name); Debug.Log("Set WebCamTexture to 1/" + WebCamTexture.devices.Length); } _cam.Play(); } private bool UpdatePicture() { if (!_cam.isPlaying) { _cam.Play(); } if (_picture == null) _picture = new Texture2D(_cam.width, _cam.height, TextureFormat.RGB24, false); if (_cam.didUpdateThisFrame) { _picture.SetPixels(_cam.GetPixels()); _picture.Apply(); return true; } return false; } The problem is at the if(_cam.didUpdateThisFrame()), this is always false and when I remove the if statement the above error occurs. Does anybody know why this may happen or how to solve this? Thanks.
Viewing all 358 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>