Image Processing; converting images

10 Ansichten (letzte 30 Tage)
Damian Wierzbicki
Damian Wierzbicki am 6 Jul. 2017
Hi guys. I have images in .im7 format. I've loaded them into Matlab using PivMat and ReadIMX, then formatted them into .mat files ( images ? ). Now, I'm trying to covert them to either .jpg , .tif , .png , .bmp using imwrite but I cannot do so because 'type was struct'. Can I efficiently go from 'structure' format to any of the formats that imwrite recognizes ?
  2 Kommentare
KSSV
KSSV am 6 Jul. 2017
You have to extract the required pixel information from the structure and use imwrite.
Damian Wierzbicki
Damian Wierzbicki am 6 Jul. 2017
Thank you. If you don't mind me asking: what information would that be ? x ( 1x2048 double ) and y ( 1x2048 double ) and also w ( 2048x2048 double) also the unitx and unity are 'mm' - how'd I deal with that ? These are probably really stupid question, but I just want to make sure if I'm doing it wright.

Melden Sie sich an, um zu kommentieren.

Antworten (2)

KSSV
KSSV am 6 Jul. 2017
You need to pick the matrix 2048*2048 and use imwrite
  8 Kommentare
Thorsten
Thorsten am 6 Jul. 2017
Bearbeitet: Thorsten am 6 Jul. 2017
Imwrite assumes double input data to be in the range [0, 1]. Everything above 1 will be mapped to 1, resulting in an all-white image. So you have to map your data to the range [0, 1].
Damian Wierzbicki
Damian Wierzbicki am 6 Jul. 2017
Thank you Thorsten, used mapminmax to map my data to desired range, not sure if that's what you meant ? It now displays the image ok, but with horizontal black thin lines ? There are also, hardly visible, white thin vertical lines along the image ? Any idea what might be causing it ?

Melden Sie sich an, um zu kommentieren.


Image Analyst
Image Analyst am 6 Jul. 2017
Try this:
storedStructure = load(filename) % Don't use semicolon
% Now extract the image field into its own variable.
rgbImage = storedStructure.myImage; % Or whatever the field for the image is called.
imwrite(rgbImage, 'my RGB image.PNG');
  1 Kommentar
Damian Wierzbicki
Damian Wierzbicki am 6 Jul. 2017
Thank you. I get the same using this method, a white rectangle.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Convert Image Type finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by