Patent ID: 8194918

Claim:
A method of inserting watermark codes onto an input image and extracting watermark codes from the input image, comprising: inserting watermark code onto said input image by: providing at least one mask block indicating regions of said input image upon which said watermark codes may be written; providing a message block containing said watermark codes; dividing said input image into at least one image block, where the number of image blocks corresponding to the number of mask blocks; assign a one-to-one relationship between said mask Blocks and corresponding image blocks; for each image block, applying the following steps: (I) using the current image block's corresponding mask block to create a mask-filtered block; (II) sub-dividing said mask-filtered block into “message-pattern-size” sub-blocks of equal size and dimension as a corresponding current message block, each message-pattern-size sub-block being divisible into a plurality of pattern image segments having a one-to-one correspondence with the watermark codes in its corresponding message block; (III) for each message-pattern-size sub-block, cycling through each watermark code in its corresponding message block, and if the message-pattern-size sub-block indicates that the pattern image segment corresponding to the current watermark code is suitable for writing, then writing said watermark code within the image pattern image segment; and extracting watermark codes from the input image by: applying a pre-processing sequence to said input image to at least assure that said watermark codes are readable in a pre-defined orientation beginning from a predefined corner of the input image's current orientation; converting said input image to a single channel digital image; generating a gradient image from said single channel digital image; defining a memory space hold an extracted message; defining a lower intensity threshold and an upper intensity threshold, setting a current threshold equal to said lower intensity threshold; if said current intensity threshold is not greater than said upper intensity threshold, then repeating the following sub-steps, in sequence, until the current intensity threshold is greater than said upper intensity threshold: (a) increasing said current intensity threshold by a predefined, fixed amount; (b) binarizing said gradient image using said current intensity threshold to create a binarized image; (c) applying a message extraction routine to said binarized image and identifying the message extracted by the message extraction routine as a new_message; (d) if the new_message has a higher confidence of accuracy than the current contents in said memory space, then storing said new_message in said memory space; and defining the contents of said memory space as the deciphered watermark code.