How to find the variance of an image?
Show older comments
i try to find the variance by var function but it shoew the error. I = imread('eight.tif'); var(I)
Accepted Answer
More Answers (3)
Dheeraj Kuamr Gupta
on 2 Apr 2017
0 votes
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
on 29 Jan 2018
0 votes
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
on 25 Mar 2018
0 votes
how to display the variance of image in command box
1 Comment
Image Analyst
on 25 Mar 2018
Leave off the semicolon, or use disp() or fprintf().
Categories
Find more on Morphological Operations in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!