Content Aware Scaling in C

  Рет қаралды 26,995

Tsoding Daily

Tsoding Daily

Ай бұрын

More Episodes: • Seam Carving
References:
- Wikipedia - Seam Carving - en.m.wikipedia.org/wiki/Seam_...
- Shai Avidan, Ariel Shamir - Seam carving for content-aware image resizing - dl.acm.org/doi/10.1145/127580...
- Wikipedia - Sobel Operator - en.wikipedia.org/wiki/Sobel_o...
- Stack Overflow - Luminance Formula - stackoverflow.com/questions/5...
- Morten Rieger Hannemose - Recreated Lena Picture - mortenhannemose.github.io/lena/
- Tsoding - Seam Carving Implementation - github.com/tsoding/seam-carving

Пікірлер: 89
@angelcaru
@angelcaru Ай бұрын
Really appreciate you putting chat messages in subtitles
@U20E0
@U20E0 Ай бұрын
WHAT?!
@cherloire7978
@cherloire7978 Ай бұрын
I wonder if its something he programmed to do automatically from the vod
@angelcaru
@angelcaru Ай бұрын
?​@@U20E0
@CoolestPossibleName
@CoolestPossibleName Ай бұрын
​​@@cherloire7978 No I'm pretty sure he did it manually. That's all he does in his free time
@Kitulous
@Kitulous Ай бұрын
piggy backing so that @tsoding can potentially see it: please at least put 3 to 5 comments at the same time, otherwise it's very hard to keep track of the history of the comments. btw why did he (you if tsoding is reading this) remove the chat window? I've recently seen some of his older videos and the twitch chat was on the right, it was super convenient
@Cmanorange
@Cmanorange Ай бұрын
thank you for using ethically sourced lena, it wouldn't have been nearly as funny
@gummansgubbe6225
@gummansgubbe6225 Ай бұрын
Watson-Watts said it like this: "Give them your third best solution. The second best comes to late, the best never comes". He was a pioner in radar development before WWII.
@diegorocha2186
@diegorocha2186 Ай бұрын
You really need to have balls to refactory code like you does lol I really like to commit a save point first, because if I get lost during the refactory I don't like to depend on undo. But I think this is a skill issue lol thanks for the great content Mr. Zozin!
@anon_y_mousse
@anon_y_mousse Ай бұрын
All of the failures before you finally succeeded were hilarious. One suggestion there is to make a video of all the intermediate images. I'll have to remember that about the chat, because sometimes they say useful things. As far as memmove() and memcpy(), I think the biggest reason that so many people have problems with them is because C tries to make arrays friendlier to use by scaling your indices by the sizeof the base type of the array, yet when you call one of these functions they expect the element count in bytes. It might be more useful for people if we had an arrmove() or arrcpy() function that took the base pointers to move/copy to/from and then expected an element count. I suppose you could just wrap the calls to memmove() and memcpy() with a macro and call them with sizeof(*a)*(elem_count) for the last argument.
@hugoviala7365
@hugoviala7365 Ай бұрын
@TsodingDaily if you liked working with energy on an article, I have a fond memories of implementing "As-Rigid-As-Possible Surface Modeling" by Olga Sorkine and Marc Alexa. It’s easy to find online. It uses another energy minimization approach but to compute animations. It works in 2D and 3D and, from what I remember, is not _that_ hard to implement (you might need (or implement yourself) a matrix algebra library though). Thanks again for you videos, always enjoy them !
@SeishukuS12
@SeishukuS12 Ай бұрын
That's really awesome how well that works for something so simple, thanks for the video!
@linuxlover1718
@linuxlover1718 Ай бұрын
Tsoding myaahn, u r an inspiration. *salute*
@bigmiraclewhips
@bigmiraclewhips Ай бұрын
this was a great video. really interesting concept for a programming session.
@ar_xiv
@ar_xiv Ай бұрын
I’ve used this feature in photoshop (and kept the result) like… maybe once in 10 years lol. It is a cool algorithm though.
@user-ec3rm9wr1n
@user-ec3rm9wr1n Ай бұрын
He should focus on security...
@ar_xiv
@ar_xiv Ай бұрын
@@user-ec3rm9wr1n nah I support random projects like this it’s cool
@LuizFernandoSoftov
@LuizFernandoSoftov Ай бұрын
Hi, always a great content... Have you ever done or thought about doing anything related to LPR? License Plate Recognition?
@user-uf4rx5ih3v
@user-uf4rx5ih3v Ай бұрын
Damn ethically sourced Lena looking even better! Looking forward to the video game in ada video!
@Czeckie
@Czeckie Ай бұрын
1:23:22 that formula is wrong. If the value for dx=-1 is smaller you never actually check for dx=+1. Also, I think the direction of the seem could be already computed in the dynamical programming step for each pixel. Another cool idea is to do the re computations only locally along the seem, since most the picture haven't changed.
@apppples
@apppples Ай бұрын
specifically he biased it towards moving to the left and thats why the images were getting distorted
@matthias916
@matthias916 Ай бұрын
The twitch subtitles is a really nice touch
@aldutran
@aldutran Ай бұрын
Every time I think dead internet theory isn't real I get reminded of your twitch chat
@ecosta
@ecosta Ай бұрын
Yo... That algorithm is almost a thunderstorm simulator with all of that energy and path of least resistance talk.
@artemiasalina1860
@artemiasalina1860 Ай бұрын
I wonder if it could be extended to add space, and if it could also be extended to add/reduce space vertically.
@Eugensson
@Eugensson Ай бұрын
QOI (Quite Okay Image) and QOA (Quite Okay Audio) formats implementations when?
@SimGunther
@SimGunther Ай бұрын
We definitely need QOC (Quite Okay Compiler) ASAP!
@Eugensson
@Eugensson Ай бұрын
@@SimGunther qcc
@ndrechtseiter
@ndrechtseiter Ай бұрын
@@SimGunther we would surely love to have some QOC!
@kjetilindrehus6794
@kjetilindrehus6794 Ай бұрын
How do you find so many cool papers😮
@weekipi5813
@weekipi5813 Ай бұрын
Why don't you code GIT (the notorious version control system) from scratch in C? It'd be a very interesting topic.
@juanfranPP
@juanfranPP Ай бұрын
I beg to differ this algorithm "works perfectly on faces" this is amazing!!🤣
@saiyamjain772
@saiyamjain772 Ай бұрын
when are you doing it in assembly sir ?
@SlinkyD
@SlinkyD Ай бұрын
I read the description as "Sean Carving".and thought "R.I.P. just killed with code".
@multicoloredwiz
@multicoloredwiz Ай бұрын
Ronaldo fink mullen... taken too soon
@kossboss
@kossboss Ай бұрын
that was pretty classno bratan. ya learning ochin good s taboy.
@xProsek
@xProsek Ай бұрын
Do you have a video with Mutex Locking | Thread Synchronization? I need that for my project
@xProsek
@xProsek Ай бұрын
nvm found something :D
@Bloodthirst
@Bloodthirst 22 күн бұрын
@47:30 shouldn't that be "mn + (mat[i] / (mx - mn))" ? you're including the min offset into the division when it shouldn't
@alihanyalcn7073
@alihanyalcn7073 Ай бұрын
Damn, my current hw for computer vision is exactly this topic.
@shizoor
@shizoor Ай бұрын
Excellent work. I've not watched all of it yet but will have to to get my head round your awesome code. Dropping the scale down factor from 2/3 to 1/2 then using it both horizontally and vertically has most hilarious looking effects on pompous right wing politicians.
@NyanCoder
@NyanCoder Ай бұрын
@TsodingDaily 42:23 I'd recommend to just assign the first element's value to min and max
@sanjaux
@sanjaux Ай бұрын
1:51 Man being able to choose a topic for recreational coding and having to worry about it using AI is truly a sign of the times
@Mufozon
@Mufozon Ай бұрын
The problem is that the way you calculate the gradient. The selection then really loves the left most column.
@Dayanto
@Dayanto Ай бұрын
He fixed that with the help of chat near the end. The bigger issue is that he made the algorithm completely color blind.
@monad_tcp
@monad_tcp 22 күн бұрын
20:41 oh I remember the rant from Acerola, I now always use Oklab instead of that shite
@caiolicinio7018
@caiolicinio7018 Ай бұрын
So why FLT_MAX instead of 0.0 was a problem? 0.0 would make a low gradient on the borders making the algorithm prefer borders ?
@classawarrior
@classawarrior Ай бұрын
Exactly. He was assigning a cost of zero to out-of-bounds pixels, which meant a seam straight down the left or right border of the image would have zero cost. You can see this as a dark area at the sides when he shows dp.png
@RandomGeometryDashStuff
@RandomGeometryDashStuff Ай бұрын
01:07:20 out of bounds 0.0 is not correct when: grad is 1x2 table: { {1.0}, {1.0} } after your algorithm dp is: { {1.0}, {1.0} } but dp should be: { {1.0}, {2.0} } edit: chat noticed 02:24:46
@MrKristian252
@MrKristian252 Ай бұрын
This is super cool
@AlameenAdeyemi
@AlameenAdeyemi Ай бұрын
How can i join the discord server?
@colinmaharaj50
@colinmaharaj50 Ай бұрын
I love this
@hubstrangers3450
@hubstrangers3450 Ай бұрын
Thank you....
@kossboss
@kossboss Ай бұрын
also now make reverse so it adds pixels and you have stable diffusion
@koktszfung
@koktszfung Ай бұрын
ah so this is how those big eyes memes are made
@user-ec3rm9wr1n
@user-ec3rm9wr1n Ай бұрын
👀
@alexanderkovalev391
@alexanderkovalev391 Ай бұрын
jpeg encoding would be enough but way more faster. png is for pictures with large regions of same pixels like screenshots
@jeezusjr
@jeezusjr Ай бұрын
I'm going to rewrite in rust.
@skeleton_craftGaming
@skeleton_craftGaming 25 күн бұрын
Well no technically 2005 was not before AI, AI technology dates back to the '70s and '80s
@monad_tcp
@monad_tcp 22 күн бұрын
15:44 I still believe in an pure algorithmic approach than statistical/AI. AI is just brute forcing things, it not "intelligent", its actually very stupid. I believe in that so much that I actually have a computing vision company where I'm betting on this. The YOLO algorithm on OpenCV still bets on that, it is not AI, one the best algorithms out there outperform the AI ones, and it is used in the industry because its reliable, AI is not reliable, just like humans. We want computers to be machines, not humans. (although I have an algorithm that I hand optimized that outperforms the last YOLO, its obviously proprietary because I need to pay my bills, sorry)
@RandomGeometryDashStuff
@RandomGeometryDashStuff Ай бұрын
23:25 0xFF000000|(value*0x010101)
@leastexpected3115
@leastexpected3115 Ай бұрын
zozin nooo don't die тwт
@user-ec3rm9wr1n
@user-ec3rm9wr1n Ай бұрын
Not nice joke...
@leastexpected3115
@leastexpected3115 Ай бұрын
@@user-ec3rm9wr1n at the very start he said that he dies
@user-ec3rm9wr1n
@user-ec3rm9wr1n Ай бұрын
@@leastexpected3115 we all going to die one day ......
@leastexpected3115
@leastexpected3115 Ай бұрын
@@user-ec3rm9wr1n :(
@GoodHomeVideos
@GoodHomeVideos Ай бұрын
if (working) twerking = true;
@bibliusz777
@bibliusz777 Ай бұрын
May I ask why you prefer C over Rust?
@hendrikd2113
@hendrikd2113 Ай бұрын
The reason russian government likes Tsoding, is because of him shit talking the NSA.
@nomadvagabond1263
@nomadvagabond1263 Ай бұрын
best wasted 2hours 36minutes, was all worth it for the last 2 minutes, 2:34:36
@dutchdykefinger
@dutchdykefinger Ай бұрын
it's perfect
@aqcherprof6985
@aqcherprof6985 Ай бұрын
Привет человек я ваш поклоник 😊. Язык 👅 что ты придумал думую лучше не использовать его без сокращений, в цели соответствии с русским. А так ты крут, подержать тебя у меня пока не получится держись.
@user-ec3rm9wr1n
@user-ec3rm9wr1n Ай бұрын
Baba C# ......
@rogo7330
@rogo7330 Ай бұрын
I like my data dream linux command (dd if=/dev/null of=/dev/sda)
@JoseDaviCorreiaPassos
@JoseDaviCorreiaPassos Ай бұрын
First
@ecosta
@ecosta Ай бұрын
I hate to double-comment, but this in action makes me remember when Twitter tried to add something like that with fancy AI stuff - if I recall correctly, someone tested with images containing Obama and Biden and the AI was always removing Obama from the picture. This algorithm is definitely much cheaper than any "modern AI" and works much better.
@doce3609
@doce3609 Ай бұрын
4 views in 37 seconds. Damn you fell off
@petrhoracek8658
@petrhoracek8658 Ай бұрын
52:10 I also say, it is not about programming language, it is about well written libraries and basic knowledge of the problematics
@dickheadrecs
@dickheadrecs Ай бұрын
CASoding
ThePrimeagen Hacks My Productivity
3:30
Scott Macchia
Рет қаралды 32 М.
Building a Realtime Video and Chat App in React Native with Stream
3:59:43
I regret doing this...
1:20:07
Tsoding Daily
Рет қаралды 62 М.
Wait, but Who's Debugging the Debugger?!
59:53
Tsoding Daily
Рет қаралды 33 М.
Will Ada Replace C/C++?
44:57
Tsoding
Рет қаралды 79 М.
Why Rust is NOT a Passing Fad...
8:54
Travis Media
Рет қаралды 25 М.
Newton's Method in C
1:33:17
Tsoding Daily
Рет қаралды 18 М.
Teaching myself C so I can build a particle simulation
11:52
Gradience
Рет қаралды 170 М.
I hope FFmpeg's Twitter won't Cancel me for This...
2:27:17
Tsoding Daily
Рет қаралды 21 М.
Let's Create a Compiler (Pt.1)
1:11:03
Pixeled
Рет қаралды 463 М.
Hiding Data Inside of Executable Files
1:55:14
Tsoding Daily
Рет қаралды 24 М.
What percentage of charge is on your phone now? #entertainment
0:14
Эволюция телефонов!
0:30
ТРЕНДИ ШОРТС
Рет қаралды 6 МЛН
Выложил СВОЙ АЙФОН НА АВИТО #shorts
0:42
Дмитрий Левандовский
Рет қаралды 1,5 МЛН
cool watercooled mobile phone radiator #tech #cooler #ytfeed
0:14
Stark Edition
Рет қаралды 7 МЛН
Теперь это его телефон
0:21
Хорошие Новости
Рет қаралды 1,8 МЛН