I would like to build an algorithm that turns a picture into a scribble line that resembles the original picture.
An example would be this:
into this:
The second image is drawn by hand with one stroke.
I am not sure where to begin experiments. My intuition would be to desaturate the image and simulate "drawing" a line with some quasi-randomness that draw more lines in places where the image is darker.
Ideally what I would like to get is a vector image in the end with one path.
Thank you
Disclaimer: I have already asked this question on dsp.stackexchange 3, but there was no answer. I am not sure if that was the right place to ask.
I realise this is not purely programming question, but maybe someone can point me in the right direction?
Try this ... not mine, but pretty neat.
The 'files' tab of the code page contains the original image file.
Processing is a fun language for doing this kind of stuff :-)
https://www.openprocessing.org/sketch/486307
Interesting option (less arty than your example =^) :
http://cgv.cs.nthu.edu.tw/projects/Recreational_Graphics/CircularScribbleArtsPoster
https://cgv.cs.nthu.edu.tw/publications
Related
By far the most elegant way to rotate a globe in d3 that I've seen is Jason Davies' version: https://www.jasondavies.com/maps/rotate/
Unfortunately his code is minified, and even if I un-minify it, I can't make heads or tails of it with all the variables and functions named with single letters. (It doesn't help that the page includes code to implement "naive" rotation, and also the zooming, which I don't need.)
Anybody know of a demonstration of this technique that doesn't obfuscate the code?
Try looking here: http://bl.ocks.org/KoGor/5994804. The only thing is that you need to start dragging on a land and not on a water.
You may disregard text in Russian (the code has comments in English), but you may also consider translating it and the linked article.
I'm trying to change an int variable using a hand gesture. I'm trying to turn on the webcam in processing and if you swing your hand to the left the value changes and when you swing your hand to the right the value changes again. Any ideas on how to go about this?
This question is pretty vague for StackOverflow. It's hard to answer general "how do I do this" type questions. It's much easier to answer specific "I tried X, expected Y, but got Z instead" type questions. That being said, I'll try to answer in a general sense.
Break your problem down into smaller steps.
Step 1: Can you write a simple sketch that simply displays the stream from a camera? The video library might be able to help you with that.
Step 2: Once you have that working, can you write code that tracks your hand? Try just drawing a dot on top of your hand. You might use OpenCV for this step.
Step 3: If you have code that can track your hand, then you can keep track of its position. You'll know when the position moves to the left or right, and you can take whatever action you want.
You might have to break these steps down into even smaller sub-steps. If you get stuck, then you can post an MCVE and a specific technical question, and we can go from there. Good luck.
I would like to apply some recursive mathematical operation on an arbitrary photo or image, which yield an interesting animation. I mean the first frame is the original picture and then the pixels are transformed in a way which leads to an interesting animation. For example a fractal animation or diffusion as particles or something similar. What approaches should I follow, what softwares to apply?
This is a very broad question, and it's hard to answer general "how do I do this" type questions. Stack Overflow is designed more for specific "I tried X, expected Y, but got Z instead" type questions. That being said, I'll try to answer in a general sense:
Step 1: Download Processing. You've tagged this with the processing tag, which is for questions about the Processing language. I can't tell whether that was on purpose, but it doesn't matter since Processing happens to be perfect for this task.
Step 2: Create a simple sketch that displays a single image, without any effects or animation. You need to break your problem down into smaller steps.
Step 3: Create a function that takes a PImage or a PGraphics and does the image manipulation for a single iteration of your algorithm. There are plenty of useful functions in the reference for manipulating the pixels in an image.
Step 4: Start with your initial image, and display that for X frames. Then pass that image into the function you created in step 3, and display the result of that for X frames. Then pass the update image back into your function, and repeat that process as many times as you want.
You could also generate every single frame ahead of time. Completely up to you.
There are a bunch of ways to do this, but those steps are the general outline. Please try something out, and break your problem down into smaller steps. Don't try to tackle your whole goal at one time. Instead, ask yourself: what's the smallest, simplest, easiest thing I know I have to do next?
If you get stuck, post an MCVE (note: not your whole sketch, just a small example that shows the problem you're stuck on) and a specific question, and we'll go from there. Good luck.
I just wanna ask you way to do this.
How can auto rotate the house object to the line which is bottom align to the line, when the user moves the house to the line. (see example)
I know black dot and house's coordinates.
I implemented this, following coproc's advice. Unluckily, the code is a little to lengthy to post here, but you can read it and check it working online in wonderfl:
http://wonderfl.net/c/rYYU
Most relevant code lines are commented, the only assumption is that the house's graphic registration point is at its center (in my case I drew a Sprite, but it should work just as well with any MovieClip). I think it accomplishes quite well what you are looking for.
Hope this helps!
I'm trying to make an application that cuts image into jigsaw puzzles. My problem is that I don't know how to do this (any kind of algorithm). I do want to have male and female endings of puzzles, but not in the same place all the time (like in the middle of puzzle border) so this: https://stackoverflow.com/questions/2755389/how-to-create-jigsaw-image-puzzle-using-c solution doesn't fit me.
Is there any kind of "smart" algorithm to make this happens. I was thinking about using bezier curves, but I don't know how to do this right.
You could use a random offset. You store for each side the kind of interaction (ie male or female), the anchor type (you could use a set of different looking "anchors" (don't know the name), and the offset.
This make for easy check : you must have same anchor, same offset and different kind for the two piece to be able to link.
regards
Guillaume
There is a sketch of how I'd approach it here: How to create jigsaw puzzle from an image using javascript
Randomization is your savior! Won't randomizing the position of the curve help?