ACASS28 / Image-To-Text-For-PunchCards

simple python script to convert black and white 24 pixel wide images to x's and -'s
3 stars 1 forks source link

Lines with only white show as x/black stitches #1

Open LtanHonor opened 1 month ago

LtanHonor commented 1 month ago

After making a simple pattern: {represented in text}

-x-x-x-x-x-x-x-x-x-x-x-x
x-x-x-x-x-x-x-x-x-x-x-x-
------------------------
------------------------
------------------------
x-x-x-x-x-x-x-x-x-x-x-x-
-x-x-x-x-x-x-x-x-x-x-x-x

The image is loaded correctly and is displayed with white space in between the pattern's top and bottom, but the exported text is:

-x-x-x-x-x-x-x-x-x-x-x-x
x-x-x-x-x-x-x-x-x-x-x-x-
xxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxx
x-x-x-x-x-x-x-x-x-x-x-x-
-x-x-x-x-x-x-x-x-x-x-x-x

This is not what is expected... Is this the intended resulting text file?

LtanHonor commented 1 month ago

It looks as though the default labels do not export the colors expected. When White is changed to Label 2 and Black is changed to Label 1 then the resulting text output is achieved.

-x-x-x-x-x-x-x-x-x-x-x-x
x-x-x-x-x-x-x-x-x-x-x-x-
------------------------
------------------------
------------------------
x-x-x-x-x-x-x-x-x-x-x-x-
-x-x-x-x-x-x-x-x-x-x-x-x

I would like to suggest that the code at line 115 be changed from:

if user_labels[cluster_idx] == "Label 1":

to

if user_labels[cluster_idx] == "Label 2":

As the default input is that Black is the pattern with White as the background

ACASS28 commented 1 month ago

Thank you for letting me know I will look into the problem.

LtanHonor commented 1 month ago

I'm not sure if GitHub alerts you to edits, I had edited my previous comment pretty close after your comment. If you have seen the edit, please disregard this message of the obvious.

Cheers!