Skip to main content

Posts

Showing posts from April, 2015

How to Crop Image in unity 3d or How to crop image from webcam in unity

Hi guys, it really feels good when you share something, today i am gonna share about cropping an image in unity and i will show, how you can take an image from webcam and crop it.

Today i started my day banging my head to every corner of the internet, just to find this simple solution :D I lost my battle with OpenCV  :( and than Unity's WebCamTexture saved my life :D,

Though it was not an easy task to crop an image, if you don't know anything about texture2d and its 2 golden functions GetPixels and SetPixels, than you have your whole life to get lost in the Internet. I was lucky though, withing half a day i found my solution, thanks to those hero's who gave me hints :) .


This is how my game screen looks like, you need to fit your face in that whole and click the camera and than the magic begins, aabra ka dabra!






ya that's me trying to fit my face in that whole :D

so let me explain what i did, I have 2 texture and 2 planes in the scene, the plane with black transparent …