fix(immersive): increase crop sample size for more relevant colors
Zoom factor changed from 1.5-3x to 1.1-1.6x Now samples 62-90% of image instead of 33-66%
This commit is contained in:
1 parent
0bdd83dc08
commit
8917049b00
2 files changed
+4
-4
No files matched your search
@@ -99,8 +99,8 @@
|
|||||||
const cropCtx = cropCanvas.getContext('2d');
|
const cropCtx = cropCanvas.getContext('2d');
|
||||||
if (!cropCtx) { isLoading = false; return; }
|
if (!cropCtx) { isLoading = false; return; }
|
||||||
|
|
||||||
// Zoom factor: 1.5x to 3x
|
// Zoom factor: 1.1x to 1.6x (takes 62%-90% of image for more relevant colors)
|
||||||
const zoomFactor = 1.5 + rand() * 1.5;
|
const zoomFactor = 1.1 + rand() * 0.5;
|
||||||
const sourceSize = Math.min(img.width, img.height) / zoomFactor;
|
const sourceSize = Math.min(img.width, img.height) / zoomFactor;
|
||||||
const maxOffset = Math.min(img.width, img.height) - sourceSize;
|
const maxOffset = Math.min(img.width, img.height) - sourceSize;
|
||||||
|
|
||||||
|
|||||||
@@ -60,8 +60,8 @@ function extractRandomCrop(
|
|||||||
|
|
||||||
const rand = seededRandom(seed);
|
const rand = seededRandom(seed);
|
||||||
|
|
||||||
// Zoom factor: 1.5x to 3x (we take 33%-66% of the image)
|
// Zoom factor: 1.1x to 1.6x (we take 62%-90% of the image for more relevant colors)
|
||||||
const zoomFactor = 1.5 + rand() * 1.5;
|
const zoomFactor = 1.1 + rand() * 0.5;
|
||||||
|
|
||||||
// Source region size (what portion of original image to take)
|
// Source region size (what portion of original image to take)
|
||||||
const sourceSize = Math.min(img.width, img.height) / zoomFactor;
|
const sourceSize = Math.min(img.width, img.height) / zoomFactor;
|
||||||
|
|||||||
Reference in new issue
Block a user