How to implement a gravatar-like algorithm? - image-processing

For fun, I would like to implement something that takes an arbitrary string as input and returns a random image that is seeded from the string. It doesn't have to be super robust or anything. I'd love to be able to make something like the unicorn/pony gravatars that SO had a while ago.
If Gravatar were open source and had a plugin architecture for implementing new image types, I'd like to build one. But I wasn't able to find that.
I would like to use Python or Java if possible.

You could look at the code that Stack Overflow itself uses for the unicorns: https://web.archive.org/web/20110224234102/http://unicornify.appspot.com/

Related

Create a bibliography/glossary-like structures in Latex

I'm making a software requirements document in Latex.
I wanted to make something 'somewhat' easy to use since more people will start to do the same in the company if this gets a good reception.
Using the glossaries package we can create structures like
\newglossaryentry{utc}
{
name=UTC,
description=
{
Coordinated Universal Time
}
}
and then, by calling \gls{utc}, it gets compiled and the name field is presented.
(Somewhat like using bibliography)
I was thinking of making structures like this to represent a requirement.
That way, we could create a file with the requirements and then call them in the document.
Something like:
Input:
\newrequirement{
type=Functional
priority=high
description={
app must save the world
}
frame={
detailed description on saving the world
}
}
Output: by calling \printrequirements
Functional requirements:
FR1: App must save the world
Priority: High
frame: detailed description on saving the world
------
FR2:
Priority:
frame:
...
I can't use the glossaries package because it's already in use for the actual glossary.
I've been looking for a way to create such structures with custom fields, so we could decide the print formatting later, but can't say I even know what to look for...
I've created some commands with \newcommand and \newcommandx, is this the way to create something like \newglossaryentry?
I'd appreciate some ideas?
P.S. Now that I wrote the question, I think the best example would be the bibliography package, since it also adds a counter to the entries

Where to find code performing filter in gimp codebase?

I was trying to find code performing https://docs.gimp.org/2.10/de/gimp-filter-snn-mean.html
in gimp codebase, but i am able to find only something looking like UI code (not actual math).
I want to peek at this code , my goal is to recreate this filter in python to implement image-processing-pieline designed by my colegue-artist in GIMP.
Operations like filters are defined in separate repository:
https://gitlab.gnome.org/GNOME/gegl
this particular filter is defined here:
https://gitlab.gnome.org/GNOME/gegl/-/blob/master/operations/common/snn-mean.c

How to use User-Input to address specific variables in Pascal (Eval/Exec?)

I'm trying to do something very specific in the fractal program Apophysis 7X, the scripting language in use is Pascal (the project is written in Delphi).
What I want to do:
Write a script that can dynamically address certain variables. In the program I have so called transforms, and each transform has multiple variations, new variations can be added by plugins, hence I do not know all names there could be.
The variables are addressed like this:
Transform.Linear:=Sin(Pi*(FrameCount / FrameQuantity));
The Variation that is to be changed might not be Linear though, but a dozen other words, like Spherical or Zcone.
If eval would work I'd assume the solution to be something like this:
VariationName:=User-Input;
eval('Transform.' + VariationName + ':=Sin(Pi*(FrameCount / FrameQuantity));')
As far as I know though, there is no such thing like eval or exec in Pascal (Tried: Eval/eval/Exec/exec). Searching other sites and the internet didn't turn up any ideas either.
So the question is how can I use the User-Input to address those variables? Obviously:
Transform.'User-Input':=Sin(Pi*(FrameCount / FrameQuantity));
will not work. Since I don't know all names up front I can't just use an array or anything static either. Any ideas would be greatly welcome.
What you want to do is called Reflection. Delphi does have support for it (they call it Extended RTTI). Give a look at the functions IsPublishedProp and SetPropValue.

OpenCV: Enumerate shapes in binary image?

If I've got an image which look, for example, like this:
0101001
1101101
0101001
Is there any method I can use which will find both of those disconnected blobs? For example, producing something like this:
0102003
1102203
0102003
Like scipy.ndimage.label.
What you need is blob library. There was cvblobslib, it seems outdated. Try cvBlob — looks great.
Also, there is related function in OpenCV cvFloodFill, though you'll have to write code to find and manage connected components.

HMAC-SHA-512 implemention for ActionScript

As mentioned by the title, I would like to find an implementation for HMAC-SHA-512 written for ActionScript. I was able to find a library that provide HMAC-SHA-256 with other functions, however, I am looking for HMAC-SHA-512 specifically.
Thank you
Edit:
Or, since actionscript and javascript have the same origin, can some one port this javascript version into actionscript?
http://pajhome.org.uk/crypt/md5/sha512.html
Edit 2:
I already ported the code from javascript to actionscript. The code can be found in one of the answers in this question
Porting SHA-512 Javascript implementation to Actionscript
Checkout this library:
http://code.google.com/p/as3crypto/
Though only does:
SHA-256,SHA-224,SHA-1,MD5, and MD2
So I guess that doesn't answer your question.
But best Crypto library for actionscript I've seen.
The implementation you link to doesn't seem to be using any features that aren't supported by ActionScript 3. Just surround the whole thing with public class SHA512 { }, and prefix the first five functions with public.
Edit: You will also need to convert function int64 to it's own class (or possibly use Number, though I'm not sure if you will lose precision for 64-bit integers).
Just found all of SHA-2 (SHA-224, SHA-256, SHA-384, SHA-512) implemented at http://code.google.com/p/flame/. Also it provides HMAC implementation. Didn't try it yet but looks what you're looking for.

Resources