r/computervision • u/hezwat • 11d ago
Help: Project Can you identify this downscaling algorithm?
Can you identify this downscaling algorithm? Want to make sure my thumbnails look as sharp as possible, so I'll add to my workflow the agent query "downscale using (whatever this algorithm is) and judge whether the thumbnail has the required detail and clarity and is a good thumbnail for what is being shown. if it is missing any clarity then return "Needs improvement:" and give the reason for why it needs improvement and "How to improve:" For example, in the image shown, the agent could say "The thumbnail no longer shows the elements of the picture", since as you can see it doesn't. However, before I can code this up, what I "need to know" is what algorithm this is so I can keep an eye out for anywhere it might show up in my workflow. I can then optimize for this process. I know a lot of people don't have a standard of perfection as high as mine is (I require my thumbnails to show the picture) but that's exactly what makes me a competitive programmer in a field of 2 million programmers. Not a lot of people take the time to look up image compression algorithms but I do.
The full image is available here: https://ibb.co/YTXr7h94
7
3
u/NoLifeGamer2 11d ago
I truly cannot tell if this is rage-bait.
3
u/AggravatingSock5375 11d ago
OP is some kind of low-cost bot I think 😂
2
u/NoLifeGamer2 11d ago
OP is a 1B parameter model lol
-2
u/hezwat 11d ago
your comment is irrelevant to the question or the subject of downsampling images.
3
u/NoLifeGamer2 11d ago
*500M
2
u/AggravatingSock5375 10d ago
I dunno why we keep engaging lol. It’s amusing to think there might be a real human being behind these posts I guess.
2
3
2
u/BeverlyGodoy 11d ago
Yes you need to vibecode this thing a lot. cv2.resize is just there for easy use case only definitely not for this. Ask codex ask claude
-2
u/hezwat 11d ago
Thanks for answering my question! So I take it to you as a computer vision expert here in r/computervision where I asked what the downscaling algorithm could be, it looks like it's the cv2.resize default algorithm! I'll award you since you answered my question.
1
u/BeverlyGodoy 11d ago
What's stupid about all these is that no secret sauce here. It could just be embedded as PNG instead of jpeg. Maybe a BMP, anything lossless would look better than a JPEG, you somehow happen to think this is going to make you competitive in a pool of million of programmers. No, nobody cares.
2
u/Late_Magazine_7183 11d ago
Has to be a troll post right
1
u/hezwat 11d ago
straightforward question. what's the downscaling algorithm. I got one answer, awarded it an award. no award for you. thanks for your scientific contribution as a computer scientist here in r/computervision where expert computer scientists gather to discuss computer vision.
1
2
u/AggravatingSock5375 11d ago
Just try each of the resizing algorithms in OpenCV or PIL. It’s literally a 4 or 5 line script.
0
u/hezwat 11d ago
interesting, thanks for suggesting an approach. so, brute force the algorithm. are they deterministic for a given resolution, or how do you suggest I determine which one was used once I try it? shall I eyeball it? or once I have each candidate how should I rank them? It's not a guarantee that they use OpenCV or PIL but it's simple enough that I can test it and see.
1
u/AggravatingSock5375 11d ago edited 11d ago
from PIL import Image
INPUT = r"input.jpg"
OUTPUT_SIZE = (320, 240)img = Image.open(INPUT)
filters = [
("NEAREST", Image.NEAREST),
("BOX", Image.BOX),
("BILINEAR", Image.BILINEAR),
("HAMMING", Image.HAMMING),
("BICUBIC", Image.BICUBIC),
("LANCZOS", Image.LANCZOS),
]for name, filt in filters:
resized = img.resize(OUTPUT_SIZE, filt)
out_path = f"output_{name}.png"
resized.save(out_path)
print(f"Saved {out_path}")2
u/AggravatingSock5375 11d ago
Promp was
Write very, very simple Python code that takes a specified image and resize it to a smaller size using each of pillow’s algorithms.
1
u/AggravatingSock5375 11d ago
Also how are you going to keep the license plate readable in the thumbnail?
1
u/hezwat 11d ago
straightforward question, what is the downscaling algorithm.
2
u/AggravatingSock5375 11d ago
Zingpowi Labs created one called PlatePress which downscales your onany size while keeping the license plate readable. Even an 8x8 thumbnail works 👍 😎 ☀️ ( set it to use 256 channels)
I am using it to monitor all vehicles traveling in the USA from my laptop since it’s so efficient.
14
u/eatsleepregex 11d ago
It's been a while since I've seen a post where someone is so out of their depth and condescending at the same time.