Azzera filtri
Azzera filtri

Using MATLAB for median, quartil, interquartil span and resolution.

8 visualizzazioni (ultimi 30 giorni)
0 down vote favorite I have a picture in MATLAB and decompositioned it to R, G and B channel. And now I need to figure out resolution, median, upper and lower quartil, interquartil span and modus.
Here is the code I use for it:
I = imread('image_S006_I0000.jpg');
imshow(I)
[R S T] = size(I);
Red(:,:,1)=I(:,:,1);
Red(:,:,2)=zeros(R,S);
Red(:,:,3)=zeros(R,S);
Green(:,:,1)=zeros(R,S);
Green(:,:,2)=I(:,:,1);
Green(:,:,3)=zeros(R,S);
Blue(:,:,1)=zeros(R,S);
Blue(:,:,2)=zeros(R,S);
Blue(:,:,3)=I(:,:,1);
[x1 y1 z1] = size(I);
% MEDIAN.
imgmedianR = median (Red(:))
imgmedianG = median (Green(:))
imgmedianB = median (Blue(:))
%QUARTIL
r025 = quantile(Red,0.25)
r075 = quantile(Red,0.75)
g025 = quantile(Green,0.25)
g075 = quantile(Green,0.75)
b025 = quantile(Blue,0.25)
b075 = quantile(Blue,0.75)
%INTERQUARTIL SPAN
r_iqr = iqr(Red)
g_iqr = iqr(Green)
b_iqr = iqr(Blue)
modus_Red = mode(Red(:))
modus_Green = mode(Green(:))
modus_Blue = mode(Blue(:))
MEDIAN: When I try to count MEDIAN, it gives me a bunch of numbers (actually matlab prints out a number for each column separately). I need one number only. What have I done wrong there?
QUARTIL: The same problem as I have in code for MEDIAN. I need one number only. What have I done wrong there?
INTERQUARTIL SPAN: Matlab prints out subsequent error: Mixed integer class inputs are not supported. What have I done wrong?
RESOLUTION: I need to find out a resolution of the image using Matlab. I have tried out funciton imfinfo, but the info isn't included. How can I find such an information using any kind of Matlab function?
Thank you very much in advance!

Risposte (0)

Categorie

Scopri di più su Mathematics 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