Let $Y$ be a measured (noisy) image $Y= X+ noise$, where $X$ is an image contains $0$(Background) and $200$(object). I need to create a decision rule that determines whether the true pixel value was $0$ or $200$ given the image $Y$.
the noise is Gaussian with mean=0 and standard deviation=sigma
I_true = [zeros(50,140);zeros(60,40),(ones(60,60)*200),zeros(60,40);zeros(50,140)];
[nrows ncolumns] = size(I_true);
sigma = 63.246;
gaussian_noise = sigma*randn(size(I_true));
I_noisy = I_true + gaussian_noise;
After adding the Gaussian noise to the true image the PDF of the intensity of a background pixel will be Gaussian with mean = $0$ and variance= $63.2462^2$ and the PDF of the intensity of an object pixel will be Gaussian with mean = $200$ and variance= $63.2462^2$
I used MAP rule and assumed that $P(Y=0)=P(Y=200)$
Likelihood ratio
$(P(Y=j|X=200))/(P(Y=j|X=0))≥P(X=0)/(P(X=200))=1$
$exp((400Y−(200)^2)/(2σ^2))≥1$
$Y≥100$
so if $Y≥100$ the pixel will be considered as object.
my questions are :.
1) is my solution is right?
2) in the case of two objects with gray levels $150$ and $200$ what will be the steps of Map decision rule?