Command Line Webcam?

  Рет қаралды 40,708

javidx9

javidx9

Күн бұрын

Пікірлер: 115
@skyhorn9070
@skyhorn9070 7 жыл бұрын
friggin awesome! you do things and show how they work from ground-up! i've never imagined that i would see webcam working in the CMD! Love it
@javidx9
@javidx9 7 жыл бұрын
Lol thanks Skyhorn! But I refer you to a previous comment "it is decidedly awe-less! :-D To Be Improved..."
@tophy43
@tophy43 5 жыл бұрын
Even though the colors are not perfect, it's most likely the craziest thing someone has ever done using the standard windows command promt. I love it, anyway.
@harleyspeedthrust4013
@harleyspeedthrust4013 4 жыл бұрын
I was expecting bitshifting at 7:00, but I've never seen unions and I really like this way of doing it. Thanks David!
@andreaprovasi9786
@andreaprovasi9786 4 жыл бұрын
TOTALLY expecting bit mask & shift too but been blown away by this union trick, Awesome!
@eformance
@eformance 6 жыл бұрын
A symbolic way of using a union to access the RGB values would be like this: struct _rgb { unsigned char x, r, g, b; }; union { int pixel; struct _rgb color; } RGB; Then use RGB.color.r to access red, RGB.color.g to access green, and RGB.color.b to access blue. This gives the pixel data symbolic format.
@nonchip
@nonchip 4 жыл бұрын
btw HSV is hue/saturation/value, with luminance going all the way up to white along its axis of the cylindrical colour space, while value is only white where the saturation is 0. essentially max saturation of a colour would be at L=0.5 but V=1. so HSV cuts off the "upper half" of luminance where it begins to tint to white despite the saturation. wikipedia sums it up nicely: "HSV models how paints mix together, while HSL resembles perceptual colours" (as in: V=1 = more vibrant colour, L=1 = brighter light)
@andrewdunbar828
@andrewdunbar828 5 жыл бұрын
Back in the late '90s I wrote a console GIF viewer. I can't remember how I chose the colours for each character block but I was taken aback by how convoluted your method was. I'm guessing I precomputed an RGB value for each character based on its black to white pixel ratio and used Euclidian distance to find the closest match from an image pixel colour to a possible character block colour pair and character. Then again I used to avoid square roots and I was using all printable characters, not just the five greyscale blocks.
@goshisanniichi
@goshisanniichi 5 жыл бұрын
I'd've gone backwards. Start w/ the console color and character and determine the resulting rgb color, i.e.: 25% Red + %75 Cyan = rgb( 63, 191, 191 ) and create a 3D lookup table and use some version k-nearest means or some similar classification algorithm to select the appropriate one.
@BrekMartin
@BrekMartin 7 жыл бұрын
That’s cool :) More people would appreciate it than you’d think I reckon.
@javidx9
@javidx9 7 жыл бұрын
Hey Cheers Brek - It's daft that's for certain.
@BrekMartin
@BrekMartin 7 жыл бұрын
Let’s say it’s not a candidate for Sony PSP :D plus I don’t have the camera again this time round.
@BrekMartin
@BrekMartin 7 жыл бұрын
You got more subs than me, congrats! Got any tip for me on how to KZbin? :D Let’s see if I’m right again... >6K for you within 12 months, and I think the only way I’ll be wrong is if it explodes suddenly.
@javidx9
@javidx9 7 жыл бұрын
Thanks buddy. Let's see now, tips, oh yes - Get lucky and hope that some other great and frankly eccentric youtuber finds your channel early on and motivates you enough to keep on going. :-D
@BrekMartin
@BrekMartin 7 жыл бұрын
Lol after ten years I don’t need that advice :D Actually I know very well how to do it. Just look at the commonality of the videos that get some thousands of views (and they certainly do have something in common), but then I’d not be doing what I enjoy, which has always been more important to me than YT ;)
@spjewkes
@spjewkes 7 жыл бұрын
Nice video. I like the idea of getting three colours into just a foreground and background colour. I was wondering if you'd considered spreading the RGB values across more than one 'pixel'? Although I guess the resolution of the console is so low that the eye wouldn't really blend anything together in the way I'd expect. Hopefully, you'll post up a future video when/if you improve your algorithm.
@javidx9
@javidx9 7 жыл бұрын
Thanks Steve. Yeah I think resolution is the limitation - I also tried flashing alternate combinations of colours between frames for different durations, but that just made me feel sick.
@sfl1986
@sfl1986 4 жыл бұрын
i shed a tear over the Grim Fandango poster
@MrJackojc90
@MrJackojc90 7 жыл бұрын
Great video as always!
@javidx9
@javidx9 7 жыл бұрын
Thanks Jack - I'm less sure about this one, it feels incomplete.
@MrJackojc90
@MrJackojc90 7 жыл бұрын
You're your own worst critic :P
@strayling1
@strayling1 4 жыл бұрын
When you're calculating the dominant colours @21:00-.ish have you tried using the RGB scaling from the greyscale luminance function, or something similar? 40% blue might win over 50% yellow for example. BTW, beware unions and endianness
@Kitulous
@Kitulous 6 жыл бұрын
8:00 is union and char thingy faster than bitwise shifting the integer color value to needed? for example, color = 0xRRGGBB r = color >> 16 & 0xFF g = color >> 8 & 0xFF b = color & 0xFF
@javidx9
@javidx9 6 жыл бұрын
Hi Craftist, I would expect the union to perhaps be a bit faster than bit shifting, but the performance gain would be pretty much negilible. I think it is certainly clearer than bit shifting, and less prone to error.
@Kitulous
@Kitulous 6 жыл бұрын
javidx9 thank you for your answer! I really appreciate that!
@EtherealIntellect
@EtherealIntellect 7 жыл бұрын
Silly question, but why not build a massive rgb lookup table of all the possible color (and black/white) and dither combinations from 2 colors and then search against that (just rgb nearest neighbour or convert to hsv and nearest neighbour and back or whatever)? That's basically what the black/white code does already, it was just simpler to code all the combinatorics by hand
@javidx9
@javidx9 7 жыл бұрын
Hi Ethereal, it's not a silly question at all, and in fact was one of my first approaches, but its quite a large and complex table! It would be easier to work backwards and try all the character combinations and calculate which RGB it approximates. It gets tricky as you need to include luminance, which starts to add discontinuities into the colour space when converting to characters. Even more frustrating is MS in their wisdom did not consider representing their luminance options linearly. Hey, give it a go, I'd love to just use a lookup table - I could play with palette effects and other tricks!
@Hunter725R
@Hunter725R 4 жыл бұрын
Just tried to do this with PixelGameEngine 2 and was able to completely skip the symbols implementation. Though it just looks like a regular webcam feed now.
@Ozuqam
@Ozuqam 6 жыл бұрын
15:18 That's very nice we can see quite a number of shades of gray. ( May be 50 ?)
@javidx9
@javidx9 6 жыл бұрын
lol
@germimonte
@germimonte 4 жыл бұрын
probably wrong, but coudn't you train a small neural network ro convert the 3 input nodes(r,g,b) into 37 output nodes(32 for bg and fg colors and 5 for char), or maybe calculate the rgb equivalent of all bg/fg/char colors and then simply find the closest one for each pixel(may be more computationally intensive, idk how you would even find the closest in 3d space
@javidx9
@javidx9 4 жыл бұрын
Possibly, but in order to train the network, I would need the results anyway, and its likely that the training data would be generated algorithmically, in which case I could just use that.
@burntt999
@burntt999 3 жыл бұрын
9:30 - marker i keep getting some 3 lines of text so small that i can only make out the last one and its "press any key to exit ...." in the windows terminal when I hit debug in VS. at the marker i just put down and I also loaded up the finished product .cpp file from the github and it does the same thing. on both my desktop and laptop. (usually things work better on my laptop for some reason. so yes i'm not sure whats going on. little bummed that even the finished one from javidx9's github has the same problem. give me absolutely no direction to head in with this project. boo :) oh well guess ill code along with a different video
@javidx9
@javidx9 3 жыл бұрын
If you powered up your debugger it would quickly reveal that your monitor is insufficient to display the size of console you are requesting. It's trying it's best to squeeze in the font onto your display and can't as the resolution of your monitor is too low, or the resolution of the console you are creating is too high. Try halving fontw and fonth values in ConstructConsole function. This will likely allow it to fit on the screen, at a sensible font size.
@anonymoussloth6687
@anonymoussloth6687 4 жыл бұрын
Hi, I was following your 8 bits of image processing video and you used escapi there as well, so I found this video to see how to set escapi up. For some reason, I still cant manage to make it work. When I run the program, it just shows a terminal with "Press any key to close the window..." and my webcam doesn't turn on. I downloaded the binaries of escapi, and added the escapi.cpp and escapi.h files to my project. Am I missing anything or doing something wrong?
@javidx9
@javidx9 4 жыл бұрын
Sounds like the console you are making is too large to fit on your display. Try halving the fontw and fonth arguments in ConstructConsole()
@anonymoussloth6687
@anonymoussloth6687 4 жыл бұрын
@@javidx9 I solved this. It was because I was missing the dll files.
@Otakutaru
@Otakutaru 6 жыл бұрын
what if you made a huuuuuuge lookup table?
@javidx9
@javidx9 6 жыл бұрын
Hi Otakutaru, lol yes, you could create a huge one, but in fact you dont need too! Firstly there are far fewer combinations of characters than there are colours in 24-bit space, so you should be able to reduce the table pretty quickly. In fact some viewers did, if you check out my Community Showcase 2018 #1 video I demonstrate some of the awesome algorithms created by this community to solve the problem
@gavinwhite7781
@gavinwhite7781 5 жыл бұрын
@@javidx9 Why do you never link the videos you mention in your comments?
@johnvonhorn2942
@johnvonhorn2942 4 жыл бұрын
"He has the power!" C Man! @ castle grayscale
@il_moddo
@il_moddo 4 жыл бұрын
My setupESCAPI returns NULL, even though I have a built in webcam in my computer and another external one connected to it. What might be the cause of this?
@javidx9
@javidx9 4 жыл бұрын
Have you put the dll file in your working directory/project folder?
@il_moddo
@il_moddo 4 жыл бұрын
@@javidx9 Yes, I tried putting the x64 .dll file in the directory and also putting the entire path of the file in the escapi.cpp file but it didn't work. I have now tried to put the Win32 dll file instead and it seems to work. Thank you anyway for helping me
@hallakim184
@hallakim184 7 жыл бұрын
Have you considered changing CONSOLE_SCREEN_BUFFER_INFOEX.ColorTable?
@javidx9
@javidx9 7 жыл бұрын
Hi Halla, I could, but I don't see what advantage I could gain. I still only have 16 "colours" to choose from, though perhaps there are better combinations. However, I'm unsure if you're able to set the colour table for each character drawn. It's messy, but I've not tested doing that. I think the colour table is applied across the output console.
@hallakim184
@hallakim184 7 жыл бұрын
Yes you're correct. If you change ColorTable[0] to RGB(100, 100, 100) and print out "AAA" with color 0 and then you change ColorTable[0] to RGB(255, 0, 0), eventually previous "AAA" will have color RGB(255, 0, 0). I was thinking it would be nice if one can find the 'mostly used color range' and modify color table to achieve the best output though still your solution looks great enough. Thanks for nice tutorial!
@dimitrykachkovski5513
@dimitrykachkovski5513 4 жыл бұрын
Any chance you have a suggestion as to why my results are running at 6-8fps vs your 30? I have an Intel(R) Core(TM) i7-7820X CPU @ 3.60GHz, so I don't see a reason why this would be happening... Looking at the profiler, seems my CPU usage is minimal, too...
@MuradBeybalaev
@MuradBeybalaev 4 жыл бұрын
But you kinda do have 3 output variables: Background color, foreground color and the visual density of the dithering character. Mapping brightness AND saturation to them is still a tall order still, since both require dithering with only prime hues available. Either way, what you should've probably done is upsample and dither for real.
@VenomousCamel
@VenomousCamel 5 жыл бұрын
With only a limited knowledge of image processing, I presume you could increase the "feel" of the image by interleaving your color-grayscale with a pure greyscale. Theoretically that would put an emphasis on the luminance and increase the number of possible shades. Though if you do this as full frames, you might get a nasty 15-30 Hz flicker. But as alternating interlaced scanlines, that could work.
@devgamez8527
@devgamez8527 2 жыл бұрын
Thanks, i'm learning a lot from your videos. And here i found some interesting i have bit of trouble with classic Console engine every time i stop my program, so i'm using GL version instead. one difference is that its PIXEL_SOLID is more like 95% solid, that gives more color options. 8 shades between color, and in total 28 grayscale colors. Rest of solid and partially solid characters ar also bit different, so if i switch between classic and GL i get different and in this case incorrect results.
@Bonfra04
@Bonfra04 5 жыл бұрын
when i call the initCapture function the program just hold forever.. what can i do?
@aburipon8279
@aburipon8279 4 жыл бұрын
Which Webcam did you use for this video, that show quite clearly your command line? name and model of that webcam pls.
@theairaccumulator7144
@theairaccumulator7144 5 жыл бұрын
This is the greatest bodge in console game engine history.
@orocimarosay1447
@orocimarosay1447 6 жыл бұрын
the initCapture function is not working for me :(
@javidx9
@javidx9 6 жыл бұрын
Escapi requires a few things on your system which perhaps you dont have, such DirectMedia
@orocimarosay1447
@orocimarosay1447 6 жыл бұрын
what is that ?
@landsgevaer
@landsgevaer 4 жыл бұрын
This begs for some dithering across pixels, I think, a topic very much up your video series' alley. Not too complicated when done on RGB channels separately, for instance Floyd-Steinberg. en.m.wikipedia.org/wiki/Floyd%E2%80%93Steinberg_dithering
@javidx9
@javidx9 4 жыл бұрын
You're right Dave, and in fact the community went on to do this with fantastic results, they also implemented gamma correction too XD the results can be seen in the community showcase video that follows this one.
@jonathanmaynard2551
@jonathanmaynard2551 6 жыл бұрын
I know I am commenting about this a lot later, but do we need to add the dll to our project inside of Visual Studio itself along with the cpp file and the h file, because I have tried both, and whenever I type in SimpleCamParams, it comes up with a error
@javidx9
@javidx9 6 жыл бұрын
Hi Mokizel, you only need to include the h and cpp files into your project. What compiler error are you getting? Also make sure the files are in the same folder as your main program code.
@jonathanmaynard2551
@jonathanmaynard2551 6 жыл бұрын
I get a error saying whenever I type in 'SimpleCapParams capture;' "identifier "SimpleCapParams" is undefined". Also thank you for responding to my comment and helping me.
@javidx9
@javidx9 6 жыл бұрын
do you #include "escapi.h" in your source file?
@jonathanmaynard2551
@jonathanmaynard2551 6 жыл бұрын
No, and now that I incorporated it, it did it worked. I can't believe I forgot to put that in, and thank you for helping me.
@anonymoussloth6687
@anonymoussloth6687 4 жыл бұрын
did we need to add the dll file also? if so, how do we add it? Do we just copy paste it in the explorer of the project? Please help me because I have been trying to get this to work for a long time.
@AdvancedSoul
@AdvancedSoul 6 жыл бұрын
christ, why not use bit shifting to extract the values? it's a more portable way of getting the specific color components (you can even use CHAR_BIT if you feel like it)
@javidx9
@javidx9 6 жыл бұрын
Hmmm. The problem here is not extracting colour values, it's deriving a sufficient mapping between the two colour spaces, one of which is contiguous and the other is not. The limited palette of the command prompt requires mixing with shade characters that means you can only form full spectrum by summation of two colours at discrete spectral intervals.
@arf20
@arf20 4 жыл бұрын
Hey, I just done that yesterday not even knowing this video was going to be uploaded! But I did it with OLC:: PGE. And I also used ESCAPI
@arf20
@arf20 4 жыл бұрын
I posted in the show your stuff channel in your discord. I also did it in a client/server architecture, that was the main point, an uncompressed video stream. (With sockets). And the colors were messed up, but not in the way of this video, the color channel were mixed in some way xD
@imranrajjad7028
@imranrajjad7028 4 жыл бұрын
great content, too bad I was not able to make the olcConsoleGameEngine work on Code Blocks + MSYS2/MinGW, as it goes looking for SDL
@javidx9
@javidx9 4 жыл бұрын
You grabbed the wrong one then. CGE original does not use sdl
@imranrajjad7028
@imranrajjad7028 4 жыл бұрын
@@javidx9 thats odd, is this not the right one? github.com/OneLoneCoder/videos/blob/master/olcConsoleGameEngine.h the build failes at github.com/OneLoneCoder/videos/blob/master/olcConsoleGameEngine.h#L1147 with error undefined reference to `__imp_waveOutOpen' Could I have assessed the problem incorrectly?
@TravelingMooseMedia
@TravelingMooseMedia 4 жыл бұрын
Wonder what this looks like in pixel game engine
@javidx9
@javidx9 4 жыл бұрын
Lol. It just looks like a webcam 😂
@TravelingMooseMedia
@TravelingMooseMedia 4 жыл бұрын
@@javidx9 Nice, gonna try and implement it :)
@LiamSwiftTheDog
@LiamSwiftTheDog 5 жыл бұрын
I skipped through the video so you probably mentioned it, but a dithering algorithm could make this look much much better and closer to the source material
@marcus_w0
@marcus_w0 5 жыл бұрын
Yeah, you skipped thru it. Around 11:00 minutes in, he describes the dithering.
@abrarmasumabir3809
@abrarmasumabir3809 2 жыл бұрын
this guy makes me go all out?
@jsflood
@jsflood 6 жыл бұрын
Great video :-)
@TheChodex
@TheChodex 7 жыл бұрын
Are you alien? :O This is awesome! :D
@javidx9
@javidx9 7 жыл бұрын
Thanks Danilo! as far as I know, I'm from this planet.
@delofon
@delofon 4 жыл бұрын
@@javidx9 we can't be 100% sure...
@zoltans3466
@zoltans3466 6 жыл бұрын
May I ask your help please? Got stuck in the beginning - at the first try on black and white testing. The #include "escapi.h" is there, the header and the cpp added to the project. The problem occurs on startup, when escapi cannot load in the setup the escapi.dll (HMODULE capdll = LoadLibraryA("escapi.dll"); Do I need to add something else?
@javidx9
@javidx9 6 жыл бұрын
Do you have escapi.dll in your project folder on disk?
@zoltans3466
@zoltans3466 6 жыл бұрын
Ok, sorry was a bit tired - copied into the wrong folder. Thank you :)
@glowiever
@glowiever 4 жыл бұрын
lol nice. looks paletted. remind me of good ol dos gamw
@jean-naymar602
@jean-naymar602 7 жыл бұрын
wow, that's fucking awesowe !
@javidx9
@javidx9 7 жыл бұрын
Cheers Jean-Nay! However, I respectfully disagree - it is decidedly awe-less! :-D To Be Improved...
@jean-naymar602
@jean-naymar602 7 жыл бұрын
But using the console to display a webcam video is an idea that has to be praised !
@grftaNitro
@grftaNitro 5 жыл бұрын
I can barely make running code and then I see people creating this...
@javidx9
@javidx9 5 жыл бұрын
Everyone has gotta start somewhere buddy!
@nguyenucnghia9304
@nguyenucnghia9304 5 жыл бұрын
i have an error said CL.exe excited with code 2
@witnnileUnity
@witnnileUnity 4 жыл бұрын
You are crazy
@dorjderemnamsraijav5182
@dorjderemnamsraijav5182 5 жыл бұрын
Why you don't use linux?
@javidx9
@javidx9 5 жыл бұрын
I do, just dont find it as fluid as windows.
@0xoldschool17
@0xoldschool17 2 жыл бұрын
Next Step: implementing this in ms dos ega graphics
@BrekMartin
@BrekMartin 7 жыл бұрын
I didn’t get YT notification. Something broke :( Anyone else?
@javidx9
@javidx9 7 жыл бұрын
I think so - I've been missing a few too. One of yours too actually Parts 4 & 5 didn't get announced. Still watched 'em though :)
@BrekMartin
@BrekMartin 7 жыл бұрын
Cool :D I knew conceptually how a retro computer worked with it’s address & data bus, but it took someone else’s practical project to really turn the light on. So now I’ve already ordered a 68030 40MHz CPU for an accelerator, salvaged 2Mb RAM from a bung mainboard, and have already started the parallel port. I’ll keep making a stack till something breaks. I don’t think it’s all YT material though.
@seditt5146
@seditt5146 7 жыл бұрын
Brek, they changed the YT Algorithm to display based on time frame between last time a video was watched from that person, so if a longer time span has gone by they will show you other videos or just not display a notification at all. There has been a lot of bitching about it across the board from YT creators. Game Theory did a decent video on the Algorithm changes and there are some other videos out there explaining it as well.
@yeilmusic
@yeilmusic 4 жыл бұрын
wtf lol xD
Programming & Using Splines - Part#2
20:06
javidx9
Рет қаралды 23 М.
Path Planning - A* (A-Star)
31:18
javidx9
Рет қаралды 162 М.
coco在求救? #小丑 #天使 #shorts
00:29
好人小丑
Рет қаралды 120 МЛН
VIP ACCESS
00:47
Natan por Aí
Рет қаралды 30 МЛН
olcPixelGameEngine
20:17
javidx9
Рет қаралды 164 М.
Simple Code, High Performance
2:50:14
Molly Rocket
Рет қаралды 266 М.
olc::PixelGameEngine 2.0
29:16
javidx9
Рет қаралды 188 М.
Programming & Using Splines - Part#1
23:56
javidx9
Рет қаралды 94 М.
Programming Perlin-like Noise (C++)
27:54
javidx9
Рет қаралды 105 М.
I Designed My Own 16-bit CPU
15:46
AstroSam
Рет қаралды 2,1 МЛН
How to Do 90% of What Plugins Do (With Just Vim)
1:14:03
thoughtbot
Рет қаралды 911 М.
Programming Pseudo 3D Planes aka MODE7 (C++)
27:16
javidx9
Рет қаралды 105 М.