Quantcast
Channel: Questions in topic: "webcam"
Viewing all articles
Browse latest Browse all 256

How to save custom size photo from a webcam? and Problems

$
0
0
Hi i´m using the code from: http://answers.unity3d.com/questions/384734/how-to-take-a-photo-from-a-webcam.html the question is how to use the variable for photos like the vector3 size, or how to apply them on the save photo?, because i want to save a custom size photo but when i try to do this: **Texture2D snap = new Texture2D((int)size.x, (int)size.y);** an unity error appear in console: **Array size must be at least width * height UnityEngine.Texture2D:SetPixels(Color[])** my conclusion is that you can´t save a photo that is not the same width and height of the webcam device or less, and when you try this for example: **wct = new WebCamTexture(deviceName, 640, 480, 12);** and save the photo like this: **Texture2D snap = new Texture2D(100, 100);** a 100x100 photo is saved but you got pixel data wrong. The other problem that i did not have was that now my web cam freezes when unity is running on game tab(play mode), when i first tried the code from above nothing like this was happening, but now after a couple of weeks without using the webcam code or even editing something from it i hit play button and this happens this jumps(freezes) between movement, it improves a little if i don´t set the fps value or if i set it to a value like 120: **wct = new WebCamTexture(deviceName, 640, 480);** **wct = new WebCamTexture(deviceName, 640, 480, 120);** why is this happening?, plz help me...!!!

Viewing all articles
Browse latest Browse all 256

Trending Articles



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