Merge branch 'fixf'
[wrf-fire-matlab.git] / detect_ignition / new_likelihood / compute_likelihood.m
blob9f630f7fa2fdd3c023b410a43d0029615e8ad723
1 function [ likelihood ] = compute_likelihood(heat,mask,sig,radius,weight )\r
2 %UNTITLED3 Summary of this function goes here\r
3 %   Detailed explanation goes here\r
4 \r
5 [m n] = size(heat);\r
6 pd = zeros(m,n);\r
7 log_sum = 0;\r
8 \r
9 for i=1:m\r
10     for j=1:n\r
11         pd(i,j) = detection_probability(heat(i,j));\r
12     end \r
13 end\r
18 for i = radius+1:m-radius\r
19     for j = radius+1:m-radius\r
20         pp = 1;\r
21         if mask(i,j)>0\r
22             %pp = compute_pixel_probability(i,j,heat,radius,weight,pd); %old\r
23             pp = compute_pixel_probability(i,j,heat,sig,weight,pd);\r
24             %compute_pixel_probability(pixel_x,pixel_y,heats,sig, weight, detection_probabilities )\r
25         else\r
26             pp = 1;\r
27             %pp = 1 - compute_pixel_probability(i,j,heat,sig,weight,pd);\r
28         end\r
29         \r
30         \r
31         log_sum = log_sum + log(pp);\r
32     end\r
33 end\r
35 likelihood = log_sum;\r
36     \r
37     \r
38 end\r