Reading Images in Matlab like ImageJ

1 visualizzazione (ultimi 30 giorni)
Rui
Rui il 16 Dic 2014
Risposto: Image Analyst il 16 Dic 2014
Hello, currently I am reading (only) images with Miji (ImageJ) because ImageJ does all the treatment necessary to work with the images after (rgb2gray, etc). When I try to do it with imread it doesn't work. The values of some functions do not match, it's like the image doesn't have the same values as when it is read with ImageJ. One image stays the same and the calculations are well, and I only have to use rgb2gray but the rest of the images give me strange results, like negative positions. Can someone tell me if there is a way do read images in matlab like imagej does?

Risposte (1)

Image Analyst
Image Analyst il 16 Dic 2014
Attach your image, and give an example of one row and column location that does not have the same values in both programs. Neither imread() nor rgb2gray() gives positions, much less negative positions, so I don't know what you're trying to explain with that statement.
The formula that MATLAB gives for conversion of RGB to gray scale is gray = 0.2989 * R + 0.5870 * G + 0.1140 * B. What is the formula ImageJ uses? Accordint to it's web page, it's this: "RGB images are converted to grayscale using the formula gray=(red+green+blue)/3 or gray=0.299red+0.587green+0.114blue if "Weighted RGB to Grayscale Conversion" is checked in Edit>Options>Conversions." so it's the same formula as MATLAB.
So the only way to resolve this is for you to upload an image that gives different values in each program. Use the paper clip icon.

Categorie

Scopri di più su Convert Image Type in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by