Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request: Fix picture shift #1

Open
maskaz opened this issue Aug 6, 2018 · 3 comments
Open

Request: Fix picture shift #1

maskaz opened this issue Aug 6, 2018 · 3 comments

Comments

@maskaz
Copy link

maskaz commented Aug 6, 2018

Would be possible to fix picture shift? Picture has bigger height than screen and bottom is cutted.
(Great feature will be option to configure picture position, height and width)

Regards

@meekys
Copy link
Owner

meekys commented Aug 11, 2018

Currently there's no configuration for this, but if you edit the x/y values in screenQuad and overlayQuad in cam_overlay.c you should be able to adjust the position on screen.

https://github.com/meekys/cam_overlay/blob/master/cam_overlay.c#L264

Values are x, y, z, u, v for each line and the x/y values range from -1.0 for far left/top to 1.0 for far right/bottom

ie. This should display an image half the size in the middle of the screen
static GLfloat screenQuad[4][5] = { // x, y, z, u, v
{-0.5f, 0.5f, 0.0f, 0.0f, 0.0f}, // Top left
{-0.5f, -0.5f, 0.0f, 0.0f, 1.0f}, // Bottom left
{ 0.5f, 0.5f, 0.0f, 1.0f, 0.0f}, // Top right
{ 0.5f, -0.5f, 0.0f, 1.0f, 1.0f} // Bottom right
};

After these changes you will need to re-run make

@maskaz
Copy link
Author

maskaz commented Aug 11, 2018

Thanks I had tried this before and by change resolution of input but problem is somewhere else.
Picture looks like stretched to 4:3 format and bottom part is cutted from picture.
Ratio change in the code did not help too.

@meekys
Copy link
Owner

meekys commented Aug 12, 2018

What resolutions are shown on startup for the cam/display?

Dimensions: 720 x 480 Pixel Format: YUYV
Opened screen 0 @ 1920 x 1200

What resolutions are available?
v4l2-ctl --list-formats-ext

Does capturing an image using fswebcam or any other v4l2 capable software you've got installed also crop the image?
fswebcam --no-banner -S 100 image.jpg

You might also be able to fiddle with this line to adjust the display ratio, but it sounds like you've already tried this? By default it should stretch the image to the screen dimensions. If you set this to 1, it should appear as a square image.
https://github.com/meekys/cam_overlay/blob/master/cam_overlay.c#L290

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants