View full-text article in PMC Sensors (Basel). 2024 Sep 27;24(19):6261. doi: 10.3390/s24196261 Search in PMC Search in PubMed View in NLM Catalog Add to search Copyright and License information © 2024 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/). PMC Copyright notice Algorithm 1 ROI Correction 1:Input: Points: [63,117,293,346,107,336] 2:Output: Corrected_ROI 3:xa,ya←P336[x],P336[y] 4:xb,yb←P63[x],P63[y] 5:d1←int(distance(P63,P117)) 6:d2←int(distance(P63,P107)) 7:d3←int(distance(P336,P293)) 8:d4←int(distance(P293,P346)) 9:if xa>xb then 10: start_x,end_x←xb,(xa+d3) 11:else 12: start_x,end_x←xa,(xb+d2) 13:end if 14:if ya>yb then 15: start_y,end_y←yb,(ya+d4) 16:else 17: start_y,end_y←ya,(yb+d1) 18:end if 19:if (end_x−start_x)>10 and (end_y−start_y)<400 then 20: start_x,start_y←start_x−10,start_y−10 21: end_x,end_y←end_x+10,end_y+10 22: Corrected_ROI ← [start_y:end_y, start_x:end_x] 23:end if