last day (15 days later) » 

4:29 PM
0
Q: Why do I obtain black .img images in MATLAB?

user3611812I am running this code to generate 100 .img images, but they are all black: loc = '/Users/Adrian/Documents/Foam_Data/ssd0/2013-10-25_09-01-12/000007/'; srcFiles = dir([loc '*.img']); the location of my images for i = 1:100 % length(srcFiles) filename = srcFiles(i).name; fid = fope...

 
Thank you for your answers. I tried imshow(image,[]), but the images are still not distinguishable.
 
That's very fishy... how you're able to do it individually but not in a loop. So when you say individually, if you were to replace that loop and set i to a number.... you're saying that you would be able to see one image, and that image is distinguishable?
Does that happen for every single image that's in your directory? Did you try changing the filename for different images? Do you get the same results regardless of the input image you specify?... what I mean to say is that does it work for the first few, but then it doesn't work for the others? I don't really have a lot of information here to diagnose your problem.
 
@rayryeng I meant when I do it individually, by writing down each .img file, not from a directory and not in a loop.
 
can you do a disp([loc filename]) right before the fopen call in your loop? Does it successfully print out all of the image names? I'm having a hard time understanding why this doesn't work.
 
@rayryeng Yes, it does display all the files. I really don't know why it doesn't work either. I ran out of ideas. I also tried image=imadjust(image);, and the images are no longer totally black, but noisy.
 
4:29 PM
Try doing a histeq on the image: image = histeq(image);. This is seriously bothering me. I can't figure out why they're all black.
 
It's exactly the same. I would like to show the image to you, but I don't know how to add it here. What does histeq do?
 
histeq histogram equalizes the image. It basically boosts the contrast of the image.
could you give me a few of those files? I want to simulate trying to show all of these in a loop.
Yeah we can't attach anything here. Try putting your stuff on a public sharing website and provide a link.
 
4:47 PM
I'll get back to you in a while. Thanks a lot for your interest.
Yes, imadjust increases the contrast as well, but I only get a noisy image.
 
 
2 hours later…
7:10 PM
yeah imadjust only does a minor contrast enhancement. It linearly stretches the dynamic range of the image.
Ping me when you have something. Just use @ then my username to get my attention when you come back to this chat.
 

  last day (15 days later) »