Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to crop the image? #5

Open
i-am-leo opened this issue Jul 14, 2023 · 4 comments
Open

How to crop the image? #5

i-am-leo opened this issue Jul 14, 2023 · 4 comments

Comments

@i-am-leo
Copy link

When I run your code, I get an error saying that the number of k-means clusters is not valid. I am still not sure how to crop the image. If it is an image with a block size of 6, how should I crop the image?

@JonasSchatz
Copy link
Owner

Ahh yes, the cropping issue :D

First of all, you should have identified the font/font-size that is most likely used. I have not found (meaning I have not looked) a way to automatically determine the symbols that are the "highest" / "lowest" or the letters with biggest ascent and descent, so you have to try out a bit. You have to crop your images in a way that the height and width are obviously multiples of 6, and the height should be so that the highest/lowest letters fit into your cropped image, even if this let some completely white rows at the top and/or bottom.

If you have an example, you can post it here.
If it is this one: https://github.com/i-am-leo/pic/blob/main/response.png it might become difficult, because there is more than just simple pixelation going on.

@i-am-leo
Copy link
Author

I tried this image
image
.This is directly cropped on the sample image, but it prompts me "X has 96 features, but KMeans is expecting 72 features as input". Do you know the reason?

@i-am-leo
Copy link
Author

image

@Xunda821
Copy link

IMG-20240918-WA0242

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants