Skip to content

Make ZOOM independent of aspect ratio #5

@tim-janik

Description

@tim-janik

When it comes to up/down scaling of the watermark information and the test image size distribution (see #3 (comment)), we should use sqrt(w*h) as the dimension of interest.
Because what counts when it comes to how much information (payload + redundancy) can be fit into an image, is the effective pixel "budget". IOW, in the embedding code, ZOOM should determine the ratio of pixel/watermartk_information, regardless of the aspect ratio.

Illustration:
In the following three cases we want to roughly embed the same amount of information + redundancy (here the x in 4x is a multiplier determined by other settings like pattern size etc):

Wide Image, pixel budget for 4x WM tiles, e.g. 512*128:
+-+-+-+-+
| | | | |
+-+-+-+-+
Square Image, pixel budget for 4x WM tiles, e.g. 256*256:
+-+-+
| | | 
+-+-+
| | |
+-+-+
Tall Image, pixel budget for 4x WM tiles, e.g. 128*512:
+-+
| |
+-+
| |
+-+
| |
+-+
| |
+-+

So we need something like sqrt(w*h) applied here, to use the same ZOOM factor for all three cases:

src/embed.py:155: ZOOM = min (face.shape[1], face.shape[0]) / Lwsmall / dynamic_zoom

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions