2
$\begingroup$

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

figure2 code

What is the problem and how can I fix it?

$\endgroup$
1
$\begingroup$

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

$\endgroup$
0
$\begingroup$

Check the elements in your x, make sure they are not zeros. Then selectedArea=uint8(x);

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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