1. A method for generating an embedded image comprising a two dimensional code image embedded within a graphic image, the method comprising the steps of: obtaining, by a processor, the graphic image, wherein the graphic image is represented as a matrix with M rows and N columns of pixels, each pixel having a respective value from a range of values and row and column coordinates within the M by N matrix; obtaining the two dimensional code image, wherein the two dimensional code is represented as a matrix with M rows and N columns of pixels, each two dimensional code image pixel having either a first value or a second value and row and column coordinates within the M by N matrix; subdividing the M by N graphic image matrix into sub-blocks of m rows and n columns of pixels, where m is less than M and n is less than N; subdividing the M by N two dimensional code image matrix into sub-blocks of m rows and n columns of pixels; where m is less than M and n is less than N, wherein each sub-block of the two dimensional code corresponds to a sub-block of the graphic image having an identical pixel row and column coordinates as the two dimensional code sub-block; applying, in each graphic image sub-block, a first filter to identify a graphic image center region having a plurality of central pixels around a center pixel of the respective graphic image sub-block; identifying pixels in each graphic image sub-block by applying a second filter to surrounding pixels outside the center region of each graphic image sub-block for luminance value modification, wherein each identified pixel corresponds to a pixel in a sub-block of the two dimensional code with an identical pixel row and column coordinates; modifying luminance values of central pixels in the center region and the identified pixels surrounding the center region in each graphic image sub-block based on a probability of detection model related to the obtained two dimensional code image; and for each sub-block of the two dimensional code, replacing pixel values in the two dimensional code sub-block with the modified pixel luminance values of the identical pixel row and column coordinate from the graphic image sub-block.