Perl 6 - the future is here, just unevenly distributed

IRC log for #openframeworks, 2014-10-17

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

All times shown according to UTC.

Time Nick Message
00:37 admsyn joined #openframeworks
00:54 darthdeus joined #openframeworks
01:33 neue_ joined #openframeworks
02:13 vade joined #openframeworks
03:16 vade joined #openframeworks
03:17 r618 joined #openframeworks
03:20 micr0 joined #openframeworks
04:31 w4ffles joined #openframeworks
04:57 TimF joined #openframeworks
05:06 r618 joined #openframeworks
05:49 micr0 joined #openframeworks
06:03 micr0 joined #openframeworks
06:55 r618 joined #openframeworks
08:02 fuerstP joined #openframeworks
08:40 Joel_re joined #openframeworks
08:43 r618 joined #openframeworks
08:45 Joel_re joined #openframeworks
09:07 neue joined #openframeworks
09:22 Joel_re joined #openframeworks
09:38 r618 joined #openframeworks
09:43 Joel_re joined #openframeworks
09:52 r618 joined #openframeworks
09:53 r618 joined #openframeworks
09:57 kikko_fr joined #openframeworks
10:32 Eibx joined #openframeworks
11:20 yu1ch1 joined #openframeworks
11:44 fuerstP joined #openframeworks
11:52 neue joined #openframeworks
12:25 fuerstP joined #openframeworks
12:42 fuerstP joined #openframeworks
12:57 fuerstP joined #openframeworks
13:04 fuerstP joined #openframeworks
13:29 w4ffles joined #openframeworks
13:45 admsyn joined #openframeworks
13:54 darthdeus joined #openframeworks
14:46 mst1228 joined #openframeworks
14:50 w4ffles joined #openframeworks
15:20 mst1228 my cursor keeps disappearing when toggling between fullscreen and not fullscreen
15:21 mst1228 even with a forced ofShowCursor() right after I can't get it to stay visible.
15:46 mhashmi joined #openframeworks
16:17 w4ffles joined #openframeworks
16:26 w4ffles joined #openframeworks
16:34 kenobicho joined #openframeworks
16:36 kenobicho quit
17:25 admsyn joined #openframeworks
17:26 w4ffles joined #openframeworks
17:36 w4ffles joined #openframeworks
17:50 GuidovanPossum joined #openframeworks
18:11 sheva_29 joined #openframeworks
18:18 w4ffles joined #openframeworks
18:37 mst1228 joined #openframeworks
18:53 ShrewdSpirit joined #openframeworks
18:53 ShrewdSpirit hello
19:02 admsyn joined #openframeworks
19:06 sheva_29 joined #openframeworks
20:14 mst1228 does anyone know how i can scale a shape i've made with ofPolyline given a new bounding box?
20:15 admsyn there's a few ways, are you talking about scaling the points or just a rendered line?
20:15 mst1228 i can scale the shape with a single value and that scales the whole shape keeping it's aspect
20:15 mst1228 the points, i eventually want to use them to create a Box2d polygon
20:16 admsyn you could just loop through all the points and use ofMap to map their original min/max to the bounding box min/max
20:16 admsyn though that might be a tad slow if you've got tons of lines every frame
20:18 mst1228 yeah so i have a single ofPolyline that contains all the points of my shape. i'm using that shape to create custom box2d polygons that are all the same shape, but different sizes
20:18 mst1228 i'm trying to just scale and translate the shape each time i need to create the new box2d polygon
20:18 admsyn ok, the fastest way might be to normalize your original line (so instead of values from like 0 - 1920 they're just 0 - 1)
20:19 mst1228 so, i wouldn't need to do it every frame by any means, only when a new poly needs to be added
20:19 admsyn then multiply every point by an ofVec2f that represents the bounding box size
20:19 admsyn and add by another ofVec2f that translates the points into place
20:19 mst1228 ok, i think that makes sense
20:19 admsyn which should be faster than doing tons and tons of ofMaps
20:19 admsyn how math-y are you feeling? :)
20:20 mst1228 does ofPolyline have that normalize method, or I just need to figure that out?
20:20 mst1228 it's a pretty simple shape, so either way
20:20 admsyn you'd figure it out, but it should just be a simple division
20:20 mst1228 typically pretty math-y, but had a few beers at lunch today ;)
20:20 mst1228 sweet
20:20 sheva_29 joined #openframeworks
20:20 admsyn so, for instance, if you're getting your ofPolylines based on a camera that's 320/240, you'd normalize by diving each of the ofVec2f's by 320/240
20:21 mst1228 so could i just find the bounding box of my shape how i have it, and divide all the ofVec2f's by that?
20:21 mst1228 or just the w/h of that box
20:22 admsyn yeah, so you've got your ofPolylines in some space (say 320x240) and you want to map them to say some bounding box that's 640x480
20:23 admsyn you divide each point in the polyline by 320/240 and then multiply by 640/480
20:23 mst1228 alright awesome, i'm gonna play around with that and see what happens
20:23 admsyn or rather, make a *new* polyline that's normalized (the division) then do the multiply for each duplicate
20:24 mst1228 thanks for the tips, much appreciated!
20:24 admsyn there's a bunch of ways to do it :)
20:24 admsyn np, good luck
20:25 admsyn also you'll probably want to through in a resampledBySpacing() at some point :) box2d might die if you feed it a ton of high-res polylines
20:25 admsyn *throw in
20:46 mst1228 these are 13 verts each
20:46 mst1228 i was actually starting to wonder if it wouldn't just be easier to construct the same shape out of rectangles
20:46 mst1228 its just like a + symbol
20:46 mst1228 so all straight lines
20:48 admsyn oh you'll be fine then
20:49 admsyn I think ofxBox2d has a thing for triangulating your polylines
20:49 admsyn which is handy if you want them to act like solid shapes
20:51 sheva_29 IS  there any way with an Addon or something to map the z-position of an object in the Kinect to a flat surface such a projection in the Y axis?
20:51 admsyn sheva_29: you just asked this in the forum right?
20:51 sheva_29 yeah
20:51 sheva_29 I did, don't know if it makes sense
20:52 admsyn I wasn't sure from your description but it sounds like you either want a quad warp or to calibrate your camera
20:52 admsyn there's ofxQuadWarp for the former
20:52 admsyn for the latter see ofxCv and its Calibration class
20:52 admsyn (which involves cracking out a printed checkboard and waggling it in front of the camera)
20:53 admsyn actually I glossed over the Kinect part :) I think you probably want the quad warp
20:54 sheva_29 yeah I'm looking a video memo arken did I didn't wrap my head around it since the area would be super flat, but I think that's a great start
20:55 mst1228 admsyn: yes, super handy thing for triangulating my polylines
20:55 admsyn sheva_29: what you're looking for is similar to projector keystoning, but for your kinect image?
20:56 sheva_29 right exactly
20:56 admsyn yeah that's your quad warp :)
20:56 sheva_29 keystonig is something that I first looked into
20:56 admsyn should do nicely
20:56 sheva_29 keystoning*
20:56 admsyn ofxQuadWarp wraps it up nicely, but it's basically just one function in opencv/ofxCv
20:56 admsyn cv::warpPerspective (like 99% sure)
20:57 sheva_29 but when I divided my projection surface in quadrants and draw the straight lines, the lines were curves :(
20:57 admsyn you don't divide your projection into quadrants to do quad warping though? unless I'm missing something again
20:58 admsyn sheva_29: -> https://github.com/julapy/ofxQuadWarp
20:58 sheva_29 Ok if I understood what you are saying is that, the image that I am passing to the kinect..atdistance(some.x,some.y) would be that warped image?
20:59 admsyn I think what's tripping me up a bit is that you're saying you're passing an image *to* the kinect
20:59 admsyn you mean your getting an image from the kinect, and you need to project it back out so warped so it lines up with your wall?
21:04 sheva_29 hahaha sorry.
21:05 sheva_29 let me start from the beginning I think perhaps is harder to explain than I thought
21:06 sheva_29 so I have a projection wall and on top of that I have a kinect that is looking down to check for the hand. I made a barn door so that it only looks at the area where the finger is in the wall. clear so far?
21:06 sheva_29 perhaps a drawing would be more helpful
21:06 admsyn yepp
21:06 admsyn noI get it
21:06 sheva_29 ok cool
21:07 sheva_29 now let's say that I want to calibrate my threshold (z index) to the Y of the projection wall? so far good?
21:07 admsyn yepp
21:07 sheva_29 so the problem that I have is that
21:10 sheva_29 when I look at the image in my app that the kinect is giving me, is basically and offset on the x axis. Meaning when I place my finger on the top left of the projection that finger is going to be at the edge of the kinect image so it would return me 1 for both X in the Kinect and the wall. That's good but let's say that when I go to the bottom left of the wall which is is my furtherest point of the Z index, there's an offs
21:10 sheva_29 so I have to account for that offset
21:11 admsyn ah ok
21:11 admsyn so the math you're looking for is basically the same thing as the quad warp, just a little different than how it's usually used
21:11 sheva_29 right
21:12 sheva_29 that's why it kind of sparked something in my mind when I saw the example
21:13 admsyn if you have a bit of time to dig into the math, it'd be worth looking into the opencv portion of what ofxQuadWarp is doing
21:14 admsyn the confusing bit is that the terminology is usually referring to pixels in an image, but you're working with points in space
21:14 sheva_29 I have some time
21:14 admsyn but the math is basically the same
21:14 sheva_29 right
21:14 sheva_29 although those points are being translated into pixels location basically
21:14 admsyn you get your 4 key points and then map all the points in your quad to a proper rectangle
21:15 admsyn so look into cv::findHomography
21:15 admsyn one sec I just did a similar thing for a different project
21:15 sheva_29 ok cool
21:16 admsyn there's probably *some* way to get ofxQuadWarp to do what you want, but it might be worthwhile to figure out how it really works if you've got a day or two
21:17 sheva_29 I do have the weekend to spend on it
21:17 sheva_29 one concern is that those offset were curved lines
21:17 sheva_29 let me show you
21:19 mst1228 admsyn: i have that ofPolyline math working out to scale and position how i would like, but when i create the box2d polygon from the vertices of the ofPolyline, they're kinda messed up
21:19 admsyn mst1228: how so?
21:19 mst1228 like they look close the the right shape, just as is someone had done a terrible drawing of that
21:20 admsyn is it possible you're converting the points from floats to ints and back again?
21:21 mst1228 it is possible
21:21 admsyn if you share a screenshot it'll be easier to diagnose :)
21:21 admsyn and/or code
21:21 mst1228 working on it
21:22 mst1228 http://oi62.tinypic.com/xandzq.jpg
21:22 mst1228 the big shape is what it should look like, just a blocky plus symbol
21:22 admsyn and what's the un-filled one up top?
21:22 mst1228 the outline is the ofPolyline that was used to create the box2d polygon on the floor
21:23 mst1228 (it fell to the ground with gravity)
21:23 admsyn I'd guess that's triangulation acting up
21:23 admsyn can you post your ofPolyline -> ofxBox2d polygon code?
21:23 mst1228 yeah
21:24 sheva_29 @admsyn there you go
21:24 sheva_29 http://i.imgur.com/vf3fxio.png?1
21:24 sheva_29 those are supposed to be straight lines on the wall
21:25 sheva_29 when I mapped them to a wall they were a bit curved :(
21:25 mst1228 https://gist.github.com/thors​onmscott/97b7d20514fc2f4fb158
21:25 admsyn sheva_29:  yeah it's possibly you've got a bit of fisheye going on
21:25 admsyn sheva_29: it might be fine after a warp though, unless you need to be *really* close
21:26 admsyn sheva_29: if you need to correct for radial distortion it's not the worst thing, though most of the workflows are based around a normal camera that can see a pattern (i.e. a printed checkerboard)
21:27 admsyn IMO do the quad warp first and then find out if you need to do the distortion correction as well
21:27 sheva_29 yeah I mean it is a kinect if I can get away 90% with it meaning there's and offset at the end of less than 1cm I'm good to go
21:27 admsyn yeah just do the quad warp stuff first
21:27 admsyn so basically what you're looking at is cv::findHomography
21:28 admsyn you feed it four points representing the "messed up" quad, and then 4 points of the space you're trying to map to
21:28 sheva_29 right exactly
21:28 sheva_29 thanks for the lead will look into that
21:29 admsyn and then that'll give you a matrix, and you take all your raw kinect points and feed them through your matrix to get your corrected point
21:29 admsyn "feed them through" means point * matrix
21:30 admsyn quad warping is just doing that every pixel in an image, but you just need to do it for some arbitrary points
21:30 sheva_29 right
21:31 admsyn yeah mst1228 I think it's just triangulation acting up
21:31 admsyn mst1228: try actually adding points with resampledBySpacing
21:39 mst1228 admsyn: how does that work exactly?
21:40 mst1228 or where would i add that?
21:40 admsyn at the ofPolyline stage
21:40 admsyn so ofPolyline resampled = polyline.getResampledBySpacing(someNumber);
21:41 admsyn oh, or don't .simplify()
21:41 admsyn your shapes are pretty simple as is :)
21:42 mst1228 and what is that number doing?  just adding points every few units?
21:42 admsyn yeah
21:43 admsyn also you don't need poly.get()-> just poly->
21:49 mst1228 still about the same
21:50 mst1228 it might be a tinnny bit better, but doesn't seem like it
21:50 admsyn what if you take out .simplify() and triangulate() ?
21:50 mst1228 i'm doing ofPolyline resampled = polyline.getResampledBySpacing(100);
21:50 admsyn just direct ofPolyline -> box2d polygon
21:51 mst1228 that one doesn't work because my shape is not convex
21:51 mst1228 well it works, but shows up as more of an octagon than that plus
21:52 mst1228 but the poly generated by that is smooth and looks good
21:52 mst1228 it's just not the right shape
21:53 admsyn huh
21:53 mst1228 one thing is that you can see in my setup() method i'm creating one box2d poly the exact same way
21:53 admsyn at this point I'd be looking into what ofxBox2d is doing with your points, I'm not really sure
21:53 mst1228 and that one looks perfect
21:53 mst1228 but at that time, the point data is still clean, whole numbers
21:54 admsyn oh ok
21:54 mst1228 so i wonder if it's something with the normalization changing all the points to 0-1 with decimals, then the scaling which multiplies those decimals
21:55 mst1228 if the triangulation is just hard with those decimals and trying to render the shape to sub pixels?
21:56 admsyn yeah that's possible
22:00 mst1228 yeah, so for example if i don't do the normalize() and scale() functions before creating the box2d poly, just leaving the shape it's initial size, they're all clean and look good
22:01 admsyn alright then
22:01 admsyn maybe it's time to splurge on some doubles :)
22:07 mst1228 oh hey, also i was looking at the docs for getResampledBySpacing()
22:07 mst1228 that looks like it takes points away?
22:10 admsyn yeah it builds a new polyline by resampling the old one at an arbitrary sampling space
22:10 admsyn it makes way more sense if you've got some crazy twisty polyline from e.g. opencv instead of a neat and tiny polygon
22:21 lavirgenmarea joined #openframeworks
22:31 w4ffles joined #openframeworks
23:31 w4ffles joined #openframeworks
23:51 sebllll_ joined #openframeworks

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