Camelia, the Perl 6 bug

IRC log for #openframeworks, 2013-10-24

| Channels | #openframeworks index | Today | | Search | Google Search | Plain-Text | summary

All times shown according to UTC.

Time Nick Message
00:20 jacres joined #openframeworks
00:21 Seich_ joined #openframeworks
00:34 Seich_ joined #openframeworks
00:35 jmw joined #openframeworks
00:37 somtd joined #openframeworks
00:47 admsyn joined #openframeworks
00:54 Seich_ joined #openframeworks
01:01 Seich_ joined #openframeworks
01:12 Seich_ joined #openframeworks
01:28 workergnome joined #openframeworks
01:45 Seich_ joined #openframeworks
01:46 jmw joined #openframeworks
02:09 admsyn joined #openframeworks
02:13 Seich_ joined #openframeworks
02:47 jvcleave joined #openframeworks
03:11 Seich_ joined #openframeworks
03:33 pizthewiz joined #openframeworks
03:36 Seich_ joined #openframeworks
04:01 jacres joined #openframeworks
04:08 Seich_ joined #openframeworks
04:12 Seich_ joined #openframeworks
04:27 DrCode joined #openframeworks
04:37 Seich_ joined #openframeworks
04:38 Seich_ joined #openframeworks
05:01 Seich_ joined #openframeworks
05:48 Seich_ joined #openframeworks
06:29 Seich_ joined #openframeworks
07:00 Seich_ joined #openframeworks
07:27 Seich_ joined #openframeworks
08:19 Seich_ joined #openframeworks
09:39 jmw joined #openframeworks
11:21 tapout joined #openframeworks
12:13 somtd joined #openframeworks
12:20 jacres joined #openframeworks
12:41 motoishmz joined #openframeworks
12:50 superFluid joined #openframeworks
13:02 jacres joined #openframeworks
13:10 somtd joined #openframeworks
13:25 jmw joined #openframeworks
13:33 lmccart joined #openframeworks
13:38 jacres joined #openframeworks
14:18 jmw joined #openframeworks
14:30 somtd joined #openframeworks
14:34 somtd_ joined #openframeworks
15:11 jvcleave 10.9? Yes/No/ Maybe?
15:11 tgfrerer been good so far. nice opengl4 stuff =)
15:11 jvcleave you on a MBP?
15:11 tgfrerer yep
15:11 tgfrerer late 2011
15:12 tgfrerer ati card
15:12 jvcleave that's around my MBP era as well
15:13 jvcleave I'll probably try that one first
15:26 lmccart joined #openframeworks
15:54 admsyn joined #openframeworks
16:00 admsyn1 joined #openframeworks
16:14 lmccart joined #openframeworks
16:17 lmccart joined #openframeworks
16:23 lmccart joined #openframeworks
16:27 lmccart joined #openframeworks
16:28 lmccart joined #openframeworks
16:30 lmccart joined #openframeworks
16:34 lmccart_ joined #openframeworks
16:44 lmccart joined #openframeworks
17:08 GuidovanPossum joined #openframeworks
17:24 admsyn joined #openframeworks
17:32 somtd joined #openframeworks
17:43 admsyn joined #openframeworks
17:43 admsyn left #openframeworks
17:44 lmccart joined #openframeworks
17:47 pizthewiz joined #openframeworks
17:56 lmccart joined #openframeworks
18:15 jedahan joined #openframeworks
18:24 rdavis joined #openframeworks
18:32 somtd joined #openframeworks
18:33 admsyn joined #openframeworks
18:47 dgegd joined #openframeworks
19:05 jvcleave joined #openframeworks
19:31 admsyn what's up #openframeworks?
19:33 somtd joined #openframeworks
19:34 lmccart joined #openframeworks
19:46 admsyn you all seen http://chat.meatspac.es/ ? It's like…live gif chat
19:46 lmccart joined #openframeworks
19:54 roxlu admsyn: haha :)
19:55 thefinal joined #openframeworks
19:55 roxlu in a couple of weeks I'm putting a site online for a streaming lib that can directly stream OF to e.g. justin.tv (or any other streaming server)
19:55 admsyn niiiice
19:56 lmccart joined #openframeworks
19:56 admsyn so do you just pipe out raw data in a certain codec? How's that work
19:57 roxlu I'm encoding it with x264 (or getting h264 directly from supported webcams), then muxing it in flv and sending it over rtmp
19:57 admsyn cools
19:58 lmccart_ joined #openframeworks
19:58 admsyn so you can you basically have a stream of ofPixels that you push out every update() ?
19:59 superFluid joined #openframeworks
20:01 thefinal left #openframeworks
20:33 somtd joined #openframeworks
20:43 jmw joined #openframeworks
20:45 jacres joined #openframeworks
20:46 jacres joined #openframeworks
21:00 lmccart joined #openframeworks
21:25 lmccart joined #openframeworks
21:25 superFluid joined #openframeworks
21:34 superFluid joined #openframeworks
21:34 somtd joined #openframeworks
21:38 thefinal joined #openframeworks
21:41 superFluid joined #openframeworks
21:50 sss__ joined #openframeworks
22:34 somtd joined #openframeworks
22:35 jmw joined #openframeworks
22:39 lmccart joined #openframeworks
22:53 bagul joined #openframeworks
22:55 bagul hi guys, i'm trying to manipulate a unsigned char array of pixels in opencv. How do I access each individual color channel?
22:56 admsyn the pixels will probably be interleaved in RGB format, so your unsigned char array would be like:
22:56 admsyn unsigned char red = array[0]
22:56 admsyn unsigned char green = array[1]
22:56 admsyn etc
22:57 admsyn if you show the code you're working with it'll be easier to demonstrate, though :)
22:58 bagul it's a huge file, so i'm just going to give you a snippet of what i've isolated to
22:58 bagul it to
22:58 bagul if that's okay.
22:58 admsyn yepp
22:58 admsyn use something like pastebin.com
22:59 bagul http://pastebin.com/D054tCLH
22:59 bagul been forever sincei've been on irc haha. Forgive me if i've forgotten etiquette.
22:59 admsyn you're doin it right :)
22:59 admsyn yeah so the format of the array will be like R G B R G B R G B etc
23:00 bagul so ehre's what it's returning though
23:00 bagul i'll give you an image
23:00 admsyn so how you have it right now, it's not actually hitting every pixel though right?
23:00 bagul it's kind of hard for me to explain what it's doing
23:00 bagul so i'm gonna put an img on photobucket : P
23:03 bagul http://postimg.org/image/9n0o2mbi7/
23:03 admsyn yeah, so you see how it's only hitting the first 1/3 of the image?
23:03 bagul now if i change the data type from a colorimage to a grayscale image it's perfect
23:03 bagul yeah
23:03 admsyn that's because the actual size of your pix array is camWidth * camWidth * 3
23:04 admsyn so, if change your for loop to for(int i = 0;i<camWidth*camHeight*3;i++){ you should get all the pixels
23:04 bagul yeahp
23:04 bagul just did it
23:04 bagul like a charm
23:05 admsyn I think the canonical oF way to do a loop like that would be to have  the i<camWidth*camHeight condition you had before
23:05 bagul now i just gotta keep it frm doing the three split imgs
23:05 admsyn but then for every pixel, do like:
23:05 admsyn red = pix[i + 0]
23:05 admsyn green = pix[i + 1]
23:05 admsyn blue = [pix i + 2]
23:06 admsyn err I messed that up
23:06 bagul yeah the only thing i've confused about is that how would i recombine the three into that same pixela rray
23:06 admsyn what do you mean by recombine?
23:06 bagul in that image i showed you, my faceis split into three different images
23:07 bagul and it looks like they're all subscribed to a different color channel
23:07 bagul what i don't understand is why they aren't being recombined
23:07 admsyn I think I need to see more code to know what you mean :)
23:08 admsyn if you feed the pix array directly into opencv, it's probably going to assume it's grayscale and do weird things
23:09 somtd joined #openframeworks
23:09 bagul hrm how would i properly feed it? I'd show you more code, but none of it is really tackling this particular situation
23:10 admsyn well, it's probably something to do with going back and forth between a grayscale format and the interleaved R G B R G B format
23:10 admsyn or opencv thinking what you're giving it is grayscale when it's actually interleaved or etc
23:14 bagul yeah, i'm just confused = P. I mean, what gets me is that i'm going from a color live stream to a color image
23:15 admsyn things might work more automatically if you use ofPixels / ofPixelsRef instead of the unsigned char * way
23:16 admsyn ofPixels carries some metainfo about itself (like whether it's interleaved) and then ofxCv or ofxOpenCV can use that metainfo to make everything "just work"
23:16 admsyn you should be able to do the same pix[i] = 255; thing on an ofPixels
23:16 bagul ah gotcha, the reason i went with the char thing is cause setfrompixels requires an unsigned char array
23:17 admsyn setFromPixels should be able to take an ofPixels, actually
23:17 admsyn and if not you can get an unsigned char * out of an ofPixels if you need to :)
23:17 bagul awesome!
23:17 bagul i'm gonna give it a try
23:17 bagul thank you sir
23:17 admsyn np, good luck
23:20 LadyK joined #openframeworks
23:34 superFluid joined #openframeworks
23:36 bagul yeah, i tried switching it to a ofpixels array and writing it on to a ofImage instead of a cvimage and i get the same output
23:36 bagul i don't get it = P
23:36 admsyn can you at least give me pseudocode if the code itself is too much>
23:36 admsyn *?
23:37 admsyn or just describe what you're doing in steps
23:37 mathisonian joined #openframeworks
23:38 bagul http://pastebin.com/Fc3zcLnM there we go, i just condensed it down
23:39 admsyn on line 42, you should do i+=3
23:40 admsyn or else you'll end up writing to the same pixel a few times every time through
23:40 admsyn err wait, why are you doing pix[i] = pix[i] etc?
23:43 bagul i don't totally know come to think of it
23:44 bagul it returns the same regardless though
23:44 admsyn alright, you're trying to color all of the parts of your face white, right?
23:45 admsyn ok, so if you take that for loop out entirely, you get the same thing?
23:45 bagul oh no,
23:45 bagul i'm just trying to extract a colored version of my features
23:45 bagul which it's doing
23:45 bagul but not in color
23:46 admsyn oh I see, so everything that's not a feature you want white, and everything that is you just leave it alone?
23:46 bagul if grayscale it works perfectly, and i don't get these three different versions of myself
23:46 bagul exactly
23:48 admsyn ok, well if you take the for loop right out, and just go from ofPixels pix = cam.getPixelsRef() straight to testimg.setFromPixels(pix) do you get the same messed up image?
23:49 bagul nope
23:49 admsyn ok so it has to do with the for loop
23:49 bagul yeah
23:49 admsyn and it looks like your x and y checks are off
23:49 admsyn x wouldn't be i % camWidth unless it was grayscale
23:50 admsyn you probably want x = i % (camWidth * 3) or something like that
23:50 bagul oh holy shit balls, i'm an idiot.
23:50 bagul yup
23:50 bagul you're right
23:50 admsyn same with y
23:50 admsyn ok cool :)
23:50 admsyn solved \o/
23:51 admsyn you can take out the pix[i] = pix[i] bits too
23:51 bagul yeah now i just need to figure out how to get my color corrected
23:52 admsyn and for style points it'd probably be best to turn that big if into something bool isInside = (<that long string of checks>)
23:52 admsyn and then just do if (!isInside) pix[i] = 255;
23:52 admsyn because it's easier to read and spot where the real errors are :)
23:52 bagul yeah, good call.
23:54 bagul thanks dude!
23:54 admsyn np

| Channels | #openframeworks index | Today | | Search | Google Search | Plain-Text | summary