Skip to main content
1-Visitor
November 22, 2022
Question

16-bit image processing in Prime 8

  • November 22, 2022
  • 2 replies
  • 6750 views

I have 16-bit TIFF images I need to analyze.  But, it seems that Mathcad Prime 8 (and 7 before) only reads them as 8-bit.  Mathcad 15 read them correctly to their full bit depth, but Prime does not.  Does anyone know how to read 16-bit images to their full depth?  (I also have 12-bit JPGs with the same problem, Prime reading them only as 8-bit.)

 

Thank you, KK

2 replies

21-Topaz II
November 23, 2022

Hi,

Two solutions.

 

A) Use matlab which can read a 16bit TIFF image into a matrix, file the matrix as text, and you can open the text file into Prime.  This option costs a lot of money for matlab

 

B) Use SciLab (free software) with the additional free downloaded computer vision toolbox to read a 16bit TIFF image into a matrix, convert the integers to matrix of doubles, save the matrix of doubles to a text file, open the file in Prime.

 

Note: In Prime the Math | Regions | Image menu inserts a button click on the button and you can open a 16 bit TIFF file and Prime will show it.

Exasperation: There is no imshow(image) statement in the image processing function in Prime you have got to save the image then  insert the image using the above button.

 

If you want more detail on how to do it with the free SciLab give a shout out.

 

Cheers

Terry

1-Visitor
November 23, 2022
Terry,

Thank you for the information you provided about my 16-bit image problem. I do have Matlab, but have not used it in a long time. So, I have installed Scilab as you suggested. It probably will take me quite a while to even get to the simple point of reading and saving an image, however, as I am kinda slow in learning new languages/interfaces. Any advice you can give regarding that will be greatly appreciated.

It is frustrating that Mathcad 15 would let me see the full 16-bit depth, but Prime does not. I did know I could view the actual image in Prime, but thank you for reminding me of that.

I hope your Thanksgiving time is good.

Keith Koenig (currently KK_7610519 on the PTC Community)
kk2@msstate.edu

25-Diamond I
November 24, 2022

In case of the uncompressed TIFFs you posted, the data is there unchanged starting from word #9244 and so the pic easily can be read in in Prime and then turned into the proper matrix.

But you would have to dig into the specifics of the TIFF format to modify the function for pics of different resolution, etc. Its not a generic TIFF reading function!
The rudimentary function I provide will only work with pics of the very same format as the three pics you posted (uncompressed TIFF, 2160x2560, 16 bit, ...).

As we can see in MC15 the result is the same as when we use READ_IMAGE:

Werner_E_0-1669320021787.png

BTW, its a pity that even in MC15 the pics can't be shown with the full range of greyscale. It seems that what Mathcads image operator shows here are the 16 bit values modulo 256. A better display can be achieved by using the "scale" function, turning the pic matrix into a 8-bit grayscale (actually we get float values in the matrix but they are rounded by the image component).

Werner_E_0-1669333782407.png

Even worse that instead of implementing an improved image operator in Prime, PTC decided to leave it away completely.

 

Files in format MC15 and Prime6 attached

EDIT: Replaced files with new version of the function which is shorter and faster

1-Visitor
November 29, 2022

I truly appreciate your help.

 

I understand the constraints you explained regarding the details of the TIFF files.  At least for the thousands of images I currently have, your method works perfectly.

 

Thank you,

Keith