From fad821e87d85bbab86c1ab27372f45a9213b6d43 Mon Sep 17 00:00:00 2001 From: Alpaca-zip Date: Tue, 12 Dec 2023 21:36:19 +0900 Subject: [PATCH] add check for surrounding pixels in line crossing function --- map/vgraph.png | Bin 7066 -> 7794 bytes scripts/vgraph_planner.py | 12 +++++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/map/vgraph.png b/map/vgraph.png index fd47cfb0f33c20a3604500ea579af397c24e6292..79eca65f2044751aeee91f4fc4d921d81ab24740 100644 GIT binary patch literal 7794 zcmaiZcQl+|(EsW!O7ujJ5@MAQV)-H=LUhqqS*#kY9xb9~kytHyVkIO*!eaFvcJ(fz ztlkNh1W{I5zs>K@_nh~<&pFRI_nDc`+7H^zqAjPy6@0RRBw6P-s-0RXZA z(wk08PNMX-mL~uJ{Gca~9-4(9cjvAAR~uL#LwkSl92^m|myVMQ&-3pnCJK=`>H{_r z$xPYQ30Zyi-$WkVq#&XH=fk}&w0QYatp`N|cz&?I|HEh5Unl4#6rjXQ#{g(eMFU0| z{`ba!dbK40zlC=p)ZR>rAEgxD)|Gii5kG4w@Vxni?l=*$^zqa%I zEgB&qZFVWTRtQje$$X$~Ju}f~SQDPlVD{aZvRx8tUMr zsUMXbYSi1sz`CT?eD1Q=B|+bAx7bc|<2vrYsL>+Q>)tq;~^kyBlA)_j$Z_p>D)V$a<3q-jYx^w zag~e}s?)|!_R~!x5wx_-saz_8#;-No@t(LYns^N^&NV6uT;sU=?g?yHtp3ReFH7Nmhq z*1W-hjDv(zp07YO-sqAsz~bP1338lD^ydUhj7BC&H8Y(`?}T`MBGoX)P%YlHoTS+1 z7W6iWz_dSt=TPcZ0ay4>5Zrt|e*CClbVVSz*NU}+z7}kJ)&k%Y;C#D~CcCSTt;zu9 zThRC>Wi-IBeL*cLudY)XEgFQU!^4V90I)X+DK92fOC1K5hny>_5Nunne!qjtn=Dn&UQ4;FMP`3V%tNGV zNx~klt__OiCz`Juz5Jedok-y?TU>e$Wb6IUkNs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ihA{o!%F3R}1r>{^Tv5E`ev|XJr{cyTFbOyh#6ACyc!R$EkI7J6YpSD~ z@8D!HwV1KKo#a1SXYb}ktx~`r9!OwW`jOtSMTTj;6XC9wb*eaPD&}pe*1BF#qze%) zt$RX*5e>3zjVa2%hte}^J4U0&w`HfRiAv9^QO(f)rV z8c*fa{(gJb%<^x3^lVY;TYvYQ7@>K@VNkWaZDloeQCWZZXn9iIF4OLLpKb1x8PS%z z>zxD2r=w}gS_3+6bAeSY=@~hbPvX!4%28XBFBR6?B&P%eR_|Txrx0=HOmsk8w8!q% zsp@zJ-*@j z1ymAzMLj7d{=9G27H13_->AZvo|dUwOjBEG&SxrI{r>rLYh=U>pNm48I>Z@QI}_}n z&OHvSoEwWq)@m!q{@;Q%RF%gPftw~#<-<2MpIuANw=L|uJ{N9049nqh9!Cd&wGd~s zsNXdx{8?soZM4H!N=@r_HrCX)clhqgxqPwI=#^8hIT5||$i*}-$QX>UAmE;G^6@8u^fsWb-$Zq83&czh(1#I1^J zGsaHL#chbdDSiK89I#MK}-g;!{|W@6XGtLHFbuCO$gh&gCeI~nY9x& zHpy5Zy*BO>nYC+?MaHn7GHUV)ky1fa7zk3RP;>FlK^+UES5JVOb4UKc>2(l8#e06`B|F{HRFcl!pq!G% z7RcVSb%$41+ppB%s_CcadqG<{HKM?C#>F=JR+v{H9;*=5(GTh~-zjqoXyV3sdM_boqWEN diff --git a/scripts/vgraph_planner.py b/scripts/vgraph_planner.py index c3ad987..2078d5e 100755 --- a/scripts/vgraph_planner.py +++ b/scripts/vgraph_planner.py @@ -91,6 +91,8 @@ def draw_lines_between_corners(self, image, corners): return rgb_image def check_line_crossing(self, image, start, end): + start_pixels = self.get_surrounding_pixels(start) + end_pixels = self.get_surrounding_pixels(end) x0, y0 = start x1, y1 = end dx = abs(x1 - x0) @@ -103,7 +105,7 @@ def check_line_crossing(self, image, start, end): not_all_white = False is_horizontal_or_vertical = x0 == x1 or y0 == y1 while True: - if (x, y) != start and (x, y) != end: + if (x, y) not in start_pixels and (x, y) not in end_pixels: pixel = image.getpixel((x, y)) if pixel != 0: not_all_black = True @@ -136,6 +138,14 @@ def check_line_crossing(self, image, start, end): if not is_horizontal_or_vertical: not_all_black = True return not_all_black and not_all_white + + def get_surrounding_pixels(self, point): + x, y = point + pixels = [] + for i in range(-1, 2): + for j in range(-1, 2): + pixels.append((x + i, y + j)) + return pixels def main():