bhcli

A TUI for chatting on LE PHP Chats (onion)
git clone https://git.dasho.dev/n0tr1v/bhcli.git
Log | Files | Refs | README

commit 53308f6fb956ee8d01ae73e094177afed62c0ff3
parent 2a452002e9f542031889ee0fa9be09d40f823e5b
Author: n0tr1v <n0tr1v@protonmail.com>
Date:   Sat,  1 Apr 2023 00:38:15 -0700

cleanup

Diffstat:
Msrc/lechatphp/mod.rs | 12++----------
1 file changed, 2 insertions(+), 10 deletions(-)

diff --git a/src/lechatphp/mod.rs b/src/lechatphp/mod.rs @@ -202,24 +202,17 @@ fn find_letters(img: &DynamicImage) -> Result<HashSet<Letter>, CaptchaErr> { for y in 0..IMAGE_HEIGHT-LETTER_HEIGHT { for x in 0..IMAGE_WIDTH-LETTER_WIDTH { let letter_img = img.crop_imm(x, y, LETTER_WIDTH, LETTER_HEIGHT); - // We know that minimum amount of pixels on to form a letter is 21 // We can skip squares that do not have this prerequisite - if count_px_on(&letter_img) < MIN_PX_FOR_LETTER { - continue - } - // Check middle pixels for red, if no red pixels, we can ignore that square - if !has_red_in_center_area(&letter_img) { - continue + if count_px_on(&letter_img) < MIN_PX_FOR_LETTER || !has_red_in_center_area(&letter_img) { + continue; } - 'alphabet_loop: for c in ALPHABET1.chars() { let good_letter_img = get_letter_img(c); if !img_contains_letter(&letter_img, &good_letter_img) { continue; } - // "w" fits in "W". So if we find "W" 1 px bellow, discard "w" for (a, b, x, y) in vec![('w', 'W', x, y+1), ('k', 'K', x+1, y+1)] { if c == a { @@ -230,7 +223,6 @@ fn find_letters(img: &DynamicImage) -> Result<HashSet<Letter>, CaptchaErr> { } } } - letters_set.insert(Letter::new(Point::new(x, y), c)); break; }