Reading Images in Matlab like ImageJ

5 次查看(过去 30 天)
Rui
Rui 2014-12-16
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?

回答(1 个)

Image Analyst
Image Analyst 2014-12-16
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.

类别

Help CenterFile Exchange 中查找有关 Read, Write, and Modify Image 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by