Author Topic: Screenshot Autostitcher  (Read 82813 times)

0 Members and 1 Guest are viewing this topic.

Offline Maxim

  • Hero Member
  • *****
  • Posts: 974
Screenshot Autostitcher
« on: June 17, 2007, 02:15:48 PM »
Edit: newest version lives here:

http://www.smspower.org/maxim/Software/ScreenshotAutostitcher

--------------

Here's a little something I spent a couple of hours (and then some) on this Sunday evening. It's a program that auto-stitches screenshots together. It's designed for high-frame-rate screenshots. I used the "screen shot each frame" feature in Gens to get the images, but other emulators can probably do something similar.

It's horribly slow, by the way. It took about 20 minutes to stitch 1300 images here. I still have a few ideas for speeding it up. I'll release an executable sometime this week if I get it in a user-friendlier state.

Program:





Result:

<img src="http://img114.imageshack.us/img114/7100/image2pb2.png" width="1199" height="1105" alt="User posted image" />



I also need to think of a better name for it.
« Last Edit: October 05, 2010, 01:35:55 PM by Maxim »

Offline TerraEsperZ

  • Hero Member
  • *****
  • Posts: 2286
RE: Autovgmapstitcher
« Reply #1 on: June 17, 2007, 02:33:23 PM »
Wow, interesting. I wonder how the algorithm that determines that two screenshots should go together works. Since you say it's designed for high-frame-rate capture, I assume that two images need to be really close to be associated and it wouldn't be of much use for people who take fewer screenshots and do so by hand, like me.



Anyway, it's great to see homemade applications like this one and Revned's Tile Replacer :) I wish all the programing I learned in college (and forgot afterward) would let me code programs this awesome...



---

"With the first link, the chain is forged. The first speech censored, the first thought forbidden, the first freedom denied, chains us all irrevocably." [...] The first time any man's freedom is trodden on, we're all damaged. - Captain Jean-Luc Picard



B*tch, meet reality. Reality, meet b*tch. - Me
Current project that are on hold because job burnout :
-Drill Dozer (GBA)
-Sonic 3D Blast (Genesis)
-Naya's Quest (PC)

Offline Maxim

  • Hero Member
  • *****
  • Posts: 974
RE: Autovgmapstitcher
« Reply #2 on: June 17, 2007, 02:44:15 PM »
Yes, for the first try it assumes the images are absolutely in the same place and tries ever-increasing distances from that point. I just modified it to assume the same movement as there was between the previous image pair (one of my speed-up ideas) and sure enough, it sped it up a lot. This might then be OK for less high-frame-rate, but still regular, screenshots. Doing it for human-targeted screenshots would be a lot harder.

Offline DarkWolf

  • Hero Member
  • *****
  • Posts: 627
RE: Autovgmapstitcher
« Reply #3 on: June 17, 2007, 02:50:20 PM »
Looks interesting, not sure I'd use it, but there's not exactly an overflow of tools available for mappers, so anything is welcome in my book.



That reminds me, I need to finish Raw Candy one of these days.

Offline Maxim

  • Hero Member
  • *****
  • Posts: 974
RE: Autovgmapstitcher
« Reply #4 on: June 17, 2007, 03:06:05 PM »
The stitch that took 20 minutes in the first post now takes 35 seconds... of course, these are still bases for further work, there's still a lot of skill involved in making the maps look good.

Offline The Ultimate Koopa

  • Hero Member
  • *****
  • Posts: 509
RE: Autovgmapstitcher
« Reply #5 on: June 19, 2007, 11:16:01 AM »
(When) are you going to release this?

Offline Maxim

  • Hero Member
  • *****
  • Posts: 974
RE: Autovgmapstitcher
« Reply #6 on: June 19, 2007, 02:49:17 PM »
Give me a few days. I need to write a doc to describe how to use it effectively. It tends to screw up if you give it certain kinds of input and I have some ideas about how to improve that.

Offline The Ultimate Koopa

  • Hero Member
  • *****
  • Posts: 509
RE: Autovgmapstitcher
« Reply #7 on: June 19, 2007, 03:01:50 PM »
Cool...

By 'a few days', you do mean 'a few days', don't you <_<... not that it matters, I just hope you're not gonna do a "Toad's Tool 64" thing, where you say it'll be released as early as January 2006, then May 2006, then June 21st 2006, then June 23rd 2006, then June 26th 2006.... and it's June 2007, and it's still not released, for example XD

Offline Maxim

  • Hero Member
  • *****
  • Posts: 974
RE: Autovgmapstitcher
« Reply #8 on: June 20, 2007, 11:58:11 PM »

Offline The Ultimate Koopa

  • Hero Member
  • *****
  • Posts: 509
RE: Autovgmapstitcher
« Reply #9 on: June 21, 2007, 11:26:32 AM »
... I tried it... but I failed.... firstly... the screenshots didn't seem to stitch accurately... secondly.... I got some "index line out of range"... message.. what does this mean?

Oh and.... how ironic.... that no sooner do I mention Toad's Tool 64... that the beta is released.... only today.... 1 pm EST, roughly.... which has already gone (I'm trying it now)... but anyway.... about the Screenshot Stitcher... <_<

Offline The Ultimate Koopa

  • Hero Member
  • *****
  • Posts: 509
RE: Autovgmapstitcher
« Reply #10 on: June 21, 2007, 12:21:10 PM »
Nevermind... I forgot to do the thing about Irfanview or whatever.... <_<

Offline The Ultimate Koopa

  • Hero Member
  • *****
  • Posts: 509
RE: Autovgmapstitcher
« Reply #11 on: June 21, 2007, 01:59:46 PM »
Actually... it just said it again... <_<

Offline Maxim

  • Hero Member
  • *****
  • Posts: 974
RE: Autovgmapstitcher
« Reply #12 on: June 22, 2007, 01:37:21 AM »
That "scanline index out of range" thing needs some debugging, I haven't been able to reproduce it consistently.



I'm waiting on the Gens KMod source code to add some features to avoid the screenshot renaming stage (it has a hard-coded 3-digit naming system) and also to enforce a non-black (or customisable) default colour (for obvious reasons). Then it ought to work even better...

Offline The Ultimate Koopa

  • Hero Member
  • *****
  • Posts: 509
RE: Autovgmapstitcher
« Reply #13 on: June 22, 2007, 03:16:51 AM »
Oh...... also... I did manage to try and make a map of "Turbo Turns" in MM2, but when I done the autostitch thing, the screenshots, for some reason, started squashing into each other.... and a few thousand pixels were 'out of place' according to the  program... <_<

Offline Maxim

  • Hero Member
  • *****
  • Posts: 974
RE: Autovgmapstitcher
« Reply #14 on: June 22, 2007, 04:05:19 AM »
That means you need to either change some of the settings or re-make your screenshots. They tend to squish into each other for one of two reasons:



1. The screenshots are all quite similar - maybe there's vast expanses of black due to disabling some layers, maybe the game is just not very detailed - so an incorrect placement matches enough pixels to go under the "stop looking for a better placement if it matches this well" threshold. Solution: decrease that number (it's the bottom one). Problem is, that makes it go a lot slower. Decreasing the pixel search distance will speed it up again, check the log to see what match distances it needs. Make sure the emulator isn't dropping frames, though.



Try looking at the log for the bits where it was matching OK, and see what kind of match levels there were. Choose a threshold a bit higher than them and try again.



For the next version I hope to make some little graphs for the stitching stats to make it easier to tune the config.



2. There's a little bit of detail on the screen but certain static aspects - the status display, main character, etc - end up being more consistent frame-to-frame than the background details. The solution is to try to re-make the screenshots with sprites turned off, or if there's a status bar (not the case for Micro Machines) get something like Irfanview to crop it out of all the screenshots.



The final option, which is one you probably have to fall back on quite a lot, is to watch what it's doing and hit the Autostitch button as soon as it starts screwing up to stop the process (even better, just before). Then save out the correct stitch, delete the images it used (see the log to see where it got up to) and restart. Then you can manually merge the parts.



After you use it for a while you get a sense for how to grab screenshots that avoid such problems.