[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

ITT: we explain algorithms

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 12
Thread images: 2

File: 0bc.jpg (127KB, 1056x587px) Image search: [Google]
0bc.jpg
127KB, 1056x587px
ITT: we explain algorithms

I'll start with Seam Carving (or the Path of Least Resistance or Brutal Pixel Genocide, as the authors should have called it instead):

Suppose you'd want to resize an image without stretching important details, such as persons or other distinct objects.
The basic approach is to find a line of least important pixels, i.e. that isn't adjacent or part of the objects and remove that.
Repeat this until your image has your targeted size and you are done. Those line have to consist of 6-connected pixels, like
\|/
p
/|\

So how does one detect the least important line in an image?
Step 1: calculate the "energy" of the image
Step 2: find the least valuable path in the energy image
(to be continued)
>>
File: f73.jpg (79KB, 624x960px) Image search: [Google]
f73.jpg
79KB, 624x960px
>>58472155
1. The paper is kind of vague what can be used as "energy function". Often, it is some kind of edge detection. Depending on your requirements, some poor mans version of a sobel filter matrix - combined horizontal and vertical may suffice. In that case, you may want to shift the values, so 0 means no edge at all, because sobel usually stores edge directions.
2. Similary, there are multiple possible ways of finding the path.
One simple solution is using an iteration algorith that is "dynamic programming" (should have been called sequential optimization instead: https://www.biostars.org/p/17908/):
Suppose you want to shrink the image horizontally - thus removing a vertical line - you iterate over the rows, beginning from the second row.
For every pixel you check which one of the three pixel above has the smallest energy value. You then add that to the actual pixels energy value.
At the end of the process, the pixel with the smallest value in the last row marks the line you want to remove. When removing, you can either trace back the path or store the path as channel component in the first place.

Bonus: Not only can you remove lines, you can interpolate new ones to enlarge an image.
And you can have an additional layer with weights, which you can draw on to mark objects to preserve or remove, should the energy function fail.
>>
>>58472162
chances are I missed something or was too vague about some details, so feel free to ask
>>
>>58472155
>>58472162
>>58472174
I almost forgot: Before edge detection, you most likely want to turn your image black and white and gaussian blur it to remove stray pixels.
>>
this is a cool thread and im sad its dying but im too retarded to contribute
>>
>>58472731
still a better response than "Faggot, /g/ is for battlestation threads and web pics"
>inb4 "Faggot, /g/ is for battlestation threads and web pics"
>>
>>58472731
Same
>>
>>58472731
>>58472810
dayum

oh well

>here lies thread
>rest in peaces
>>
>>58472162
what the hell is an energy value?
>>
>>58472962
A pixel value that shows if the pixel is important and shouldn't be deleted.
For example, for a simple sobel edge detector that would be a white color value (on an edge), opposed to black (not on an edge).

The basic idea is that after the sobel filter all object contours are shown and a deletion line may not go through them.
>>
This sounds cool, but I really can't visualise how the result would look like. Do you have any before/after pics that are a good demonstration?
>>
>>58473100
Actually, the Wikipedia article is quite better than the paper and has an example. Also, there is the demonstration video of the inventors.
https://en.wikipedia.org/wiki/Seam_carving
https://www.youtube.com/watch?v=6NcIJXTlugc

TL;DW: It works quite good for small grained textures like grass, sand and the sky, but fails for bigger structures.
Thread posts: 12
Thread images: 2


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.