From: Raj Kamal on 8 Jul 2010 02:38 I have the code to split a 10bit double frame image to two 8 bit tif images.But i now need to merge them back into a single 10 bit image. I read those 10 bit images using imread and divide them by 4 to get two 8bit images. Does neone knows how to do this? With regards Raj
From: Walter Roberson on 8 Jul 2010 10:17 Raj Kamal wrote: > I have the code to split a 10bit double frame image to two 8 bit tif > images.But i now need to merge them back into a single 10 bit image. > > I read those 10 bit images using imread and divide them by 4 to get two > 8bit images. > > Does neone knows how to do this? You could multiply the 8 bit images by 4 to get a 10 bit image, but the bottom two bits would be 0. If you need the original bottom two bits on the output, you are going to have to change your processing so that you do not discard them.
From: Raj Kamal on 8 Jul 2010 13:13 Walter Roberson <roberson(a)hushmail.com> wrote in message <c6lZn.29$o27.28(a)newsfe08.iad>... > Raj Kamal wrote: > > I have the code to split a 10bit double frame image to two 8 bit tif > > images.But i now need to merge them back into a single 10 bit image. > > > > I read those 10 bit images using imread and divide them by 4 to get two > > 8bit images. > > > > Does neone knows how to do this? > > You could multiply the 8 bit images by 4 to get a 10 bit image, but the > bottom two bits would be 0. > > If you need the original bottom two bits on the output, you are going to > have to change your processing so that you do not discard them. I multiplied the two images with 4 and wrote them on the same file as output i1=i1*4; i2=i2*4; i1=uint16(i1); i2=uint16(i2); imwrite(i1,'C:\img001.tif'); imwrite(i2,'C:\img001.tif'); but i am not getting the desired 10 bit image as when i split it again it gives error
From: Walter Roberson on 8 Jul 2010 14:45 Raj Kamal wrote: > I multiplied the two images with 4 and wrote them on the same file as > output > > i1=i1*4; i2=i2*4; i1=uint16(i1); i2=uint16(i2); > imwrite(i1,'C:\img001.tif'); imwrite(i2,'C:\img001.tif'); > > but i am not getting the desired 10 bit image as when i split it again > it gives error Convert to uint16 *before* multiply by 4 or else your multiplications will sometimes saturate at 255. However, once you had converted those uint8 to uint16, those values would be written "as is" to the .tif file (unless perhaps you are using an old version of Matlab ?), and it should just come out as if the top two bits always happened to be 0. Try using iminfo() on your input files to ensure that your output file is being written with the same parameters. I have just scanned through the TIFF specification, and the supported number of bits per sample is confusing. When I examine each of the supported color formats, I find that the BitsPerSample internal parameter must be 1 or 4 or 8 (not all values are supported for all formats.) On the other hand, when I examine the specifications having to do with compression, 16 bits per sample is shown as acceptable for "no compression" (bit packing), and 5 and 6 and 11 and 12 and 16 bits per sample are also explicitly mentioned in connection with compression. It's like "Do not turn this dial!! But if you do, then always turn it by 1/4 turns!" It does appear that imwrite() does not provide a mechanism to indicate 10 bits per pixel for TIFF files, and will assume 16 bits per pixel if uint16 is supplied. Are your original files possibly in a format other than TIFF ?
|
Pages: 1 Prev: plotting loglog plot with Zero-Order-Hold Next: identification AR filter coefficients |