Changed the data type for edges in the image. As per the online document at giclab.com, the edges of input image should be encoded in binary. Thus changed the data type for all the matrices to logical.