how to encode and decode negative pixel to positive pixel in matlab ?

1 vue (au cours des 30 derniers jours)
nur aqila
nur aqila le 3 Mar 2018
Commenté : nur aqila le 6 Mar 2018
hi, I want to ask. I have 512x512 image and I want to calculate the entropy. But, it has some error because the pixel contains negative value. Has anybody in here know how to do Matlab code to convert negative pixel to positive pixel and decode it back? please help me

Réponse acceptée

Image Analyst
Image Analyst le 3 Mar 2018
Try this:
negPixels = grayImage < 0;
grayImage(negPixels) = 0; % or 1 or whatever you want.
  3 commentaires
Image Analyst
Image Analyst le 4 Mar 2018
Actually:
grayImage = max(0, grayImage);
nur aqila
nur aqila le 6 Mar 2018
thank you !

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Import, Export, and Conversion dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by