Why does part of my image turn black when applying functions to a part of an image in Matlab?
'edited image' is of type uint8 and the selected area which you have taken for processing finally after applying all operations is coming out as type double.But when you place it in original image it is considered as of type uint8 because the image is of type uint8. Hence before putting it in original image you should multiply x by 255 so that it get be properly scaled.