changed coor from m,n to col,row as per philipp request. added typecast to uint8 before bitmaskconversion.