how to calculate mean and standard deviation, from the image then subtracted from the original image iteratively using matlab ?

조회 수: 3 (최근 30일)
Is it meant to be the local statistical features mean and standard deviation. or it mean by mean filter or standard deviation fitter

채택된 답변

Image Analyst
Image Analyst 2021년 10월 22일
For local mean, use imfilter, or conv2()
kernel = ones(5)/25;
localMeanImage = conv2(double(grayImage), kernel, 'same');
For local standard deviation, use stdfilt
localSDImage = stdfilt(grayImage, ones(5));

추가 답변 (1개)

yanqi liu
yanqi liu 2021년 10월 23일
local statistical features mean and standard deviation. or it mean by mean filter or standard deviation fitter
sir,may be use blockproc to process, such as
clc; clear all;
im = imread('cameraman.tif');
fun = @(block_struct) [mean2(block_struct.data) std2(block_struct.data)];
res = blockproc(double(im),[64 64],fun);
disp(res)
167.3821 6.8601 153.7048 61.9769 169.9453 31.7836 159.2217 6.5953 126.1189 68.7267 32.4487 46.5268 130.4160 63.4436 155.5337 9.8767 80.6594 67.0647 50.1492 63.4185 126.0491 54.8252 132.7637 40.0863 86.0100 52.7884 86.2617 59.6727 123.4392 30.1970 119.4883 21.3049
  댓글 수: 2
safa
safa 2021년 10월 23일
I copied your code and run it but it gave me the following error :
Unterminated %{ block. Use %} to terminate.
Image Analyst
Image Analyst 2021년 10월 23일
@safa, show your code. Because I don't see %{ in her code. In your code you have a %{ to start a big chunk of code as a comment, but you never have a %} to tell it where you want all those lines of code to stop being a comment. Search for %{ and %} in your code. Do you see the same number of each of them?

댓글을 달려면 로그인하십시오.

Community Treasure Hunt

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

Start Hunting!

Translated by