Skip to content
Snippets Groups Projects
Commit 3e5625eb authored by Vass Zóra's avatar Vass Zóra
Browse files

Add new file

parent c6f1383f
Branches master
No related tags found
No related merge requests found
function[T_overlap, T_annot, T_algo, Distance] = calculate_overlap(annot_box, algo_box)
annot_xbr=str2double(annot_box.Attributes(4).Value);
annot_xtl=str2double(annot_box.Attributes(5).Value);
annot_ybr=str2double(annot_box.Attributes(6).Value);
annot_ytl=str2double(annot_box.Attributes(7).Value);
algo_xbr=str2double(algo_box.Attributes(4).Value);
algo_xtl=str2double(algo_box.Attributes(5).Value);
algo_ybr=str2double(algo_box.Attributes(6).Value);
algo_ytl=str2double(algo_box.Attributes(7).Value);
T_annot=(annot_xbr-annot_xtl)*(annot_ybr-annot_ytl);
T_algo=(algo_xbr-algo_xtl)*(algo_ybr-algo_ytl);
annot_center_x=(annot_xbr-annot_xtl)/2;
annot_center_y=(annot_ybr-annot_ytl)/2;
algo_center_x=(algo_xbr-algo_xtl)/2;
algo_center_y=(algo_ybr-algo_ytl)/2;
Distance=sqrt((annot_center_x-algo_center_x)*(annot_center_x-algo_center_x)+(annot_center_y-algo_center_y)*(annot_center_y-algo_center_y));%pitagorasz
if (algo_xtl>annot_xbr) || (annot_xtl>algo_xbr) %ha nem találkoznak a téglalapok
T_overlap=0;
elseif (algo_ytl>annot_ybr) || (annot_ytl>algo_ybr)
T_overlap=0;
else %van átfedés
xbr=min([annot_xbr, algo_xbr]);
ybr=min([annot_ybr, algo_ybr]);
xtl=max([annot_xtl, algo_xtl]);
ytl=max([annot_ytl algo_ytl]);
T_overlap=(xbr-xtl)*(ybr-ytl);
end
end
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment