I am trying to compress and reconstruct an image but facing problems with the data type of the compressed image pixel values which are of float64 and therefore, when I am trying to retrieve the pixel values from the compressed image , reconstruction is poor because on reading the pixel values corresponding to compressed image, the pixel value array elements are converted to uint8 type, thus leading to loss in the pixel data on automatic conversion from float to uint8. I want to take dwt of the image, store the dwt coefficients as an image (as images are of the lesser size as compared to pixel values stored in a file), and then retrieve the pixel values from the coefficient images, and thus reconstructing the image on taking inverse wavelet of the coefficients arrray obtained on reading the coefficient array. I am implementing the complete system in OpenCV python.

  • $\begingroup$ Do you mean that the float64 data type has different range than the usual uint8 triplet you would expect, or something else (?) $\endgroup$
    – A_A
    Jun 22 '18 at 16:18
  • $\begingroup$ yes, I am writing a separate code for decomposition of the compressed image, there when I am reading the compressed image for retrieving the pixel values, the pixel values are transformed to uint8, for instance, if the compressed image had pixel values like 2.335465 then I am not getting a correct corresponding uint8 value instead most of the values are transformed to 255, which I think are not correct. $\endgroup$ Jun 23 '18 at 7:45
  • $\begingroup$ Can you please edit the question with a little bit more information on how you handle the conversion between the data types and their different ranges? $\endgroup$
    – A_A
    Jun 23 '18 at 8:00
  • $\begingroup$ I have updated the question $\endgroup$ Jun 23 '18 at 11:10
  • $\begingroup$ Thank you. I am sorry but I still don't understand how you handle the conversion currently. float64 has an enormous range, uint8's range is 0-255. The possible reason why you don't "see" something that resembles an image is because you are not handling the conversion properly. The rest of the description of why an image might be smaller (?) is also unclear. Are you following specific publications outlining what you are trying to implement? $\endgroup$
    – A_A
    Jun 23 '18 at 21:08

Your Answer

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

Browse other questions tagged or ask your own question.