When I select a part of an image and apply a negative function to it, it works 100%: figure1

figure1 code

When trying to apply the same method using another function, the part of image becomes black:


figure2 code

What is the problem and how can I fix it?


1 Answer 1


'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.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.