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

Crop into CIF (or SVGA) in-camera instead of scale to improve clarity #57

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

Physics-Dude
Copy link

This PR simply crops the CIF base image (400x296) to the middle 240x240 pixels in-camera.

  • Changes setCameraResolution to use set_res_raw instead of set_framesize
  • Crops the image without scaling/distorting the frame. (increases zoom/decreases FOV by 20%)
  • Includes other examples I tested with awesome results.

Cropping into a CIF image should always be done instead of scaling/distorting it (as with what FRAMESIZE_240X240 does). You get weird aliasing or non-uniform binning when you scale from 296 to 240. The "cost" of being 20% zoomed in is more of a benefit I'd wager too since the edge of your lens is never going to be as sharp. This is like upgrading a 160º camera to a crisp 130º.

- Changes setCameraResolution to use set_res_raw instead of set_framesize
- Crops the image without scaling/distorting the frame. (increases zoom/decreases FOV by 20%)
@Physics-Dude
Copy link
Author

Here is a GIF showing some of the above examples on a grid and circle. These were all taken with an old generic ESP-CAM with 160º camera over home wifi.

Untitled-1

@Physics-Dude
Copy link
Author

Here is a simulated example of the quality difference between scaling CIF to 240 and simply cropping a 240 window out of a CIF. The pixel ratio between the sensor array and image sent to the PC becomes 1:1.

crop-vs-scale

@Physics-Dude
Copy link
Author

Playing with some new HW and thought I'd get a IRL side by side image. Left uses a 240px crop within CIF field (default on this PR). One may argue eyelash fidelity is a bit less noisy too.

image
image

@lorow lorow added the enhancement New feature or request label Jun 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants