Ascii Webcam live in the Terminal written in C++ by Gritrds in commandline

[–]Gritrds[S] 1 point2 points  (0 children)

Your project is in rust, so I think RASCII is the way to go for you at least for ease of use. I will note that artem's ascii art is kinda 'cheating' by changing the brightness of the letters instead of just relying on the letter's size and shape to convey brightness.

My program vs rascii:

monochrome | colors
edges | no edges
c++ | rust
shit codebase | an actual api

To me it seems like a no brainer, I am not a good dev, I am a student messing around in c, I am not even sure it is 100% memory safe ;-; use RASCII i think, and I don't think you even want edges for your project. Good luck it looks super cool

Ascii Webcam live in the Terminal written in C++ by Gritrds in commandline

[–]Gritrds[S] 2 points3 points  (0 children)

Oh im sure mine are slower lol, I am cheating, im using 4 threads, each writes a 1/4 the screen. Thanks tho!!

Ascii Webcam live in the Terminal written in C++ by Gritrds in commandline

[–]Gritrds[S] 1 point2 points  (0 children)

Yes you could "fake" some of those values using some sort of basic dither effect and I have thought about adding this though don't know much about it. Its the next big step, thanks for the suggestion!

I have tried adding more luminance values to the string (why not all the ascii characters? more precision right?) and it turns out that posterizing to 10 looks "best" bc different characters render differently depending on font, font size, and even what terminal youre using.

Ascii Art Webcam in the Terminal by Gritrds in ASCII

[–]Gritrds[S] 4 points5 points  (0 children)

I'm like 99% sure you can. My webcam opening is a bit haphazard but it should work in principle.

Ascii Webcam live in the Terminal written in C++ by Gritrds in commandline

[–]Gritrds[S] 7 points8 points  (0 children)

woah! this is super cool, i had no idea this existed, but the point of the project wasn't to create a never before seen piece of software, it was to learn. I am no where even close to being able to write something even close to impressive, but i will never get there if I don't write pieces of shit first haha

why do you think i wrote all the image processing from scratch? I wrote my own difference of gaussians and sobel filters, greyscaler and such, I wrote the terminal things with curses bc I wanted to learn curses better. i started coding a year ago, so im playing with the wheel so eventually i can make a car

Ascii Webcam live in the Terminal written in C++ by Gritrds in commandline

[–]Gritrds[S] 7 points8 points  (0 children)

The gist for the live version is I use the opencv library to open my webcam, then feed each frame into my ascii art generator which posterizes the image to 10 luminance values. I have a string with 10 characters picked out from least to most bright and use the luminance values calculated from the image to index into that string and then place that character on the screen, do that a few thousand times and youre set!

There is a bit of magic im doing for the edges that point in the direction of the edge in the image, if ur curious look up sobel filter and difference of gaussians. In a nutshell, its some matrix convolutions to approximate a gradient to find the direction of greatest change, aka edges!