#QR camera help
1 messages ยท Page 1 of 1 (latest)
first pic is the setting for the raw image
second shows what I have in the camera scene
third shows what happens when I build the app
The goal is to be able to have the camera in the top third of the screen and have a background around the rest of the image
You are aware of windows button + shift + S?
Or don't you have discord on your desktop?
yes but I also wanted to send stuff from my phone
I am aware just stupid at times
Yeah thats more readable
Its pretty easy to make it fill the whole screen but Im not quite sure how to make it look good not doing that.
Can you make your second picture bigger?
And why has the third picture Discord in it?
just trying to show the cameras warped
Is this all?
yup
thats all I have so far
it makes and displays a camera and will scan qr codes. the displayed camera just looks warped when I do anything other than filling the entire display with it
The white box is where you want to show the camera?
basically. I would like to be able to resize that white box even more to make it perfectly square. but rn the camera isnt even showing in the white box
Can you show how you set up QRCam in your Unity Inspector?
Did you comment that out?
yeah. that is from the way that the QR scanner code I used displayed the camera. It didnt work with portrait mode apps so I commented it out. I will delete it later
Geesh, what a code ๐
Anyhow,
background.texture = camTexture;
And your background is not the same aspect ratio of your cam
float ratio = (float)camTexture.width / (float)camTexture.height;
fit.aspectRatio = ratio;
float scaleeY = camTexture.videoVerticallyMirrored ? -1f : 1f;
background.rectTransform.localScale = new Vector3(1f, scaleeY, 1f);
int orient = -camTexture.videoRotationAngle;
background.rectTransform.localEulerAngles = new Vector3(0, 0, orient);```
This whole part needs a Debug.Log to see what's what
There is some fuckery going on there I don't understand.
Maybe set your background to that ratio
lol yeah thats all for orientation as far as the tutorial I watched is concerned
The basics is not that difficult to be honest.
Connect to cam
Get picture from cam
Set picture on canvas
yeah its suprisingly simple
but making it look right is a real pain
you are right it probably is in that section you pointed out tho
Well can you debug.log those values?
Otherwise you need to start over and scrap 80% of this code.
maybe. Im not too familiar with that yet
yikes
what do you mean log? I am not sure what I need to change or what I would be looking for
float ratio = (float)camTexture.width / (float)camTexture.height;
fit.aspectRatio = ratio;
float scaleeY = camTexture.videoVerticallyMirrored ? -1f : 1f;
background.rectTransform.localScale = new Vector3(1f, scaleeY, 1f);
int orient = -camTexture.videoRotationAngle;
background.rectTransform.localEulerAngles = new Vector3(0, 0, orient);
Debug.unityLogger.logEnabled = true;
Debug.Log(ratio, scaleeY, orient);
this is what gets logged every frame
is that in the rect transform part of the inspector?
Still honestly, we have been at it for 50 minutes now. Just copy pasting code from the internet is not a good idea ๐
Yeah your Background one
very true. I appriciate your efforts
I have been at it much longer than 50 mins
either way I think that changing the aspect ration wont do what I want it to. maybe making the image a square will take going back to square one with this camera code.
maybe I could use a mask?
like use the whole screen but put another image over the raw image that acts as a mask?
I honestly think its an aspect ratio problem. You can see it in your second and third picture
Your mobile phone screen has less width
So the Star is smaller on the third screen
I am fiddling with this
But your camera is stretched on that background square
Looks good?
Lol I'm trying to find a way to make it square for the aesthetic of scanning QR codea
But this fixed the warp issue
Yup.
Amazing ๐