How to find the variance of an image?

75 ビュー (過去 30 日間)
sachin
sachin 2014 年 9 月 12 日
コメント済み: Image Analyst 2018 年 3 月 25 日
i try to find the variance by var function but it shoew the error. I = imread('eight.tif'); var(I)

採用された回答

David Young
David Young 2014 年 9 月 12 日
var requires a double or single argument. This will work:
img = double(imread('eight.tif'));
v = var(img);
But note that will give a vector, with one value for the variance of each column of the image. To get the variance of all the pixels in the image, you'll need
v = var(img(:));

その他の回答 (3 件)

Dheeraj Kuamr Gupta
Dheeraj Kuamr Gupta 2017 年 4 月 2 日
close all; clear all; clc; I = imread('C:\Users\anubh\Pictures\koala.jpg'); A=rgb2gray(I); [r,c]=size(A) b=r*c; s=0; s=sum(sum(A)); mean=a/b; display(mean); d=(A- mean); display(d);

Morteza Hajitabar Firuzjaei
Morteza Hajitabar Firuzjaei 2018 年 1 月 29 日
This code calculates the variance of a RGB image but it's not standard variance, see below:
%------------------------------------------
close all;
clear all;
clc;
I = imread('b.png');
blockSize = [6 6];
varFilterFunction = @(theBlockStructure) var(double(theBlockStructure.data(:)));
blockyImagevar = blockproc(I, blockSize, varFilterFunction);
varianceImage=blockyImagevar(:);
display(varianceImage);
%---------------------------------------
Morteza Hajitabar Firuzjaei

Komal Gaikwad
Komal Gaikwad 2018 年 3 月 25 日
how to display the variance of image in command box
  1 件のコメント
Image Analyst
Image Analyst 2018 年 3 月 25 日
Leave off the semicolon, or use disp() or fprintf().

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeImages についてさらに検索

タグ

タグが未入力です。

Community Treasure Hunt

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

Start Hunting!

Translated by