How to find the variance of an image?

조회 수: 73 (최근 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 CenterFile Exchange에서 Images에 대해 자세히 알아보기

태그

아직 태그를 입력하지 않았습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by