6/20/2023 0 Comments Matlab iwrite![]() ![]() Some viewers may do that by only displaying the low bits, other the high bits, which depending on the image may result in everything black. Since most displays are only 8 bits, viewers have to convert the 16 bits to 8. Support for reading and displaying 16 bit images is also variable. You can also take a look at this documentation to see how printing works without a display. The only ones available to imwrite are JPEG, PNG and TIFF. For example, you can print your figure as an Encapsulated Level 2 Color PostScript with a resolution of 300 dpi by doing the following: print('new_image.eps','-depsc2','-r300') ĮDIT: If you are unable to use IMSHOW (either because you don't have the Image Processing Toolbox or because you are using a MATLAB mode that doesn't allow it), here is an alternative way to create and print the figure: img = imread('peppers.png') %# A sample image However, you can adjust the final resolution of the saved image using the -r option for the PRINT function. One drawback to this solution is that if the image is too big to fit on the screen, IMSHOW will shrink it to fit, which will reduce the on-screen resolution of the image. imwrite (I,'newlena.jpg','Quality',100) I1imread ('newlena.png') As per imwrite documentation ('Quality',100) pair means no compression but I get a psnr around 59. It's weird as when I run the same code in MATLAB desktop, everything works fine. 1 Answer Sorted by: 2 You must specify the BitDepth option when saving JPEG images with more than 8-bits: note that 16-bit only accepts grayscale images img imread ('peppers.png') imwrite (im2uint16 (img), '12bit.jpg', 'BitDepth',12) imwrite (rgb2gray (im2uint16 (img)), '16bit. Print('new_image.eps','-deps') %# Print the figure as a B
0 Comments
Leave a Reply. |