When I select a part of an image and apply a negative function to it, it works 100%:
When trying to apply the same method using another function, the part of image becomes black:
What is the problem and how can I fix it?
'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.