#garfield Logs
Jan 02 2019
#garfield Calendar
06:17 PM zhanx: rue_mohr, I got kids man, I dont have the time you do
07:05 PM RonoldoMoon: the amount of times people say that to Rue, HOLY BALLS XD
07:06 PM zhanx: RonoldoMoon, but its true
07:07 PM zhanx: ok doing a test print 5 layers down first, 300% speed after that 50% infill
07:51 PM rue_shop1: zhanx, so I have 4G of images from my scanner
07:51 PM rue_shop1: 1/2 with laser on, half off
08:26 PM RonoldoMoon: 4GB?
08:54 PM rue_mohr: yea
08:54 PM rue_mohr: zippo:/files/programming/c/SDL2/diffJPGImage/scan# du -h
08:54 PM rue_mohr: 3.8G .
08:55 PM rue_mohr: http://ruemohr.org/~ircjunk/images/3dscanner/out.png
08:55 PM rue_mohr: but my diff alg has some noise
08:56 PM rue_mohr: thats where I failed/stopped 16 years ago
08:57 PM rue_mohr: I bought a laminator
08:57 PM rue_mohr: who wants to do pcb transfers>?
09:02 PM rue_mohr: https://archive.google.com/pigeonrank/
09:02 PM rue_mohr: huh
09:03 PM RonoldoMoon: out.png is my new wallpaper
09:04 PM RonoldoMoon: right now im testing hydra against my SSHDummy
09:04 PM furrywolf: that noise would respond really well to a standard despeckle agorithm
09:04 PM furrywolf: median filter
09:04 PM RonoldoMoon: [STATUS] 5911.43 tries/min, 41380 tries in 00:07h, 11839996 to do in 33:23h, 1 active
09:07 PM rue_mohr: I'm wondering If I shoudl use a NN to find the line, give it one scanline
09:07 PM furrywolf: no
09:08 PM rue_mohr: dropping the green channel cleans it up a lot
09:08 PM furrywolf: an intelligent design would look at areas, not just one scanline.
09:08 PM rue_mohr: I need to know where the laser is for each scanline
09:09 PM furrywolf: yes. but it's much easier to tell the laser apart from noise if you don't throw away all the useful clues on other scanlines.
09:10 PM furrywolf: a median filter with r=4 gets rid of most of your noise
09:10 PM furrywolf: I think you also have too much gain at some step of the difference process
09:11 PM furrywolf: r=5 is even better
09:11 PM furrywolf: but I think you need to get rid of some of the extra gain
09:12 PM furrywolf: got the two source images that made that diff somewhere?
09:19 PM rue_mohr: the line wont be straight
09:19 PM rue_mohr: it'll be all over the place
09:20 PM rue_mohr: yea, I literally subtract one from the other
09:20 PM rue_mohr: its unsigned/unsigned tho, so I think there is a rollover issue
09:20 PM furrywolf: that might explain the broken-looking noise too. :P
09:21 PM rue_mohr: I pondered doing it signed and using the absolut result
09:21 PM furrywolf: do it signed and throw away all negative results
09:21 PM rue_mohr: ok lets try that
09:21 PM furrywolf: because you only want to find what got brighter with the laser on
09:21 PM rue_mohr: RUE WAKE UP
09:21 PM rue_mohr: RUE WAKE UP
09:21 PM rue_mohr: RUE
09:21 PM furrywolf: anything that got dimmer when you turned the laser on is not helping. :)
09:21 PM rue_mohr: ooooh, wait, your right
09:21 PM rue_mohr: I didn't even think of that
09:22 PM rue_mohr: limit(A-B, 0, 255)
09:22 PM rue_mohr: furry genious
09:22 PM rue_mohr: RUE WAKE THE HELL UP WE NEED TO DO CODING AND THAT MEANS YOU
09:23 PM furrywolf: it's ok to talk to yourself... just don't get into an argument.
09:23 PM rue_mohr: *(p3+i) = *(p1+i) - *(p2+i);
09:23 PM rue_mohr: ok, so
09:23 PM * rue_mohr goes back to sleep
09:25 PM rue_mohr: v = *(p1+i);
09:25 PM rue_mohr: v -= *(p2+i);
09:25 PM rue_mohr: *(p3+i) = limit(v, 0, 255);
09:27 PM rue_mohr: ? its just black
09:27 PM rue_mohr: #define Limit(v,l,h) (((v) > (h)) ? (h) : ((v) < (l)) ? (l) : (v))
09:27 PM furrywolf: did you subtract them in the wrong order?
09:28 PM rue_mohr: well there shoudl eb SOME noise
09:28 PM furrywolf: you might need to add a lot of gain to see the noise
09:28 PM furrywolf: and you have limit and Limit
09:29 PM rue_mohr: got that fixed
09:29 PM rue_mohr: oooo
09:29 PM rue_mohr: image is *almost* black
09:29 PM rue_mohr: I had the subtract the wrong way around
09:30 PM furrywolf: <furrywolf> did you subtract them in the wrong order?
09:30 PM furrywolf: :P
09:30 PM rue_mohr: it does need gain
09:30 PM rue_mohr: ooooh
09:30 PM rue_mohr: furry genious
09:30 PM rue_mohr: crap man
09:30 PM rue_mohr: you should see this
09:31 PM furrywolf: kat is really good at stuff like this too...
09:31 PM furrywolf: I can't see it if you don't upload it somewhere. :P
09:31 PM rue_mohr: ok, a *bit* of noise on my horrid sample iamges
09:32 PM rue_mohr: I'm trying to make it look perfect so I can get the grant
09:32 PM furrywolf: a median filter can work really well for cleaning up that kind of noise
09:32 PM rue_mohr: gees man
09:32 PM rue_mohr: no see this
09:32 PM furrywolf: grant?
09:32 PM rue_mohr: isn't that what people do?
09:33 PM rue_mohr: fake all the data to make things look good and get the grant?
09:33 PM furrywolf: ... I thought this was your own project?
09:33 PM rue_mohr: http://ruemohr.org/~ircjunk/images/3dscanner/out.png
09:33 PM rue_mohr: it is
09:33 PM * furrywolf stops helping
09:33 PM rue_mohr: dude, thats the same input data
09:33 PM rue_mohr: there is no grant...
09:33 PM rue_mohr: not that I know of
09:33 PM rue_mohr: BUT LOOK AT THAT RESULT!!!!
09:33 PM furrywolf: that looks much more like what I expected a diff to look like
09:34 PM rue_mohr: that is AWESOME
09:34 PM rue_mohr: so, lets try it with real scan images!
09:34 PM rue_mohr: choose an integer angle in degrees!
09:35 PM rue_mohr: cmon...
09:35 PM rue_mohr: 42, ok
09:36 PM rue_mohr: damnit, wish it would just pick 24 or 32 bpp and stick to it
09:39 PM Tom_itx: rue_mohr needs a grant to build his new shop/house
09:39 PM rue_mohr: yea, thats a good point
09:40 PM rue_mohr: so I can put up furrywolf to live in the spare room, and pay him food to mind the shop
09:40 PM rue_mohr: furrywolf, did you see that result?
09:41 PM rue_mohr: http://ruemohr.org/~ircjunk/images/3dscanner/out.png
09:42 PM rue_mohr: ^^^ check it!!!
09:43 PM Tom_itx: looks like an eclipse on mars
09:43 PM furrywolf: <furrywolf> that looks much more like what I expected a diff to look like
09:44 PM rue_mohr: http://ruemohr.org/~ircjunk/images/3dscanner/out.png
09:44 PM rue_mohr: there is a real scan image
09:49 PM rue_mohr: ?
09:49 PM furrywolf: http://fw.bushytails.net/tmp/rue-out2-filter01.png
09:49 PM rue_mohr: :)
09:49 PM rue_mohr: luma?
09:49 PM furrywolf: nope
09:49 PM rue_mohr: thres?
09:50 PM furrywolf: transform to HSV, filter the HSV to only red-like, then multiply all three together.
09:50 PM furrywolf: and a median filter
09:50 PM furrywolf: trying random things. :)
09:50 PM rue_mohr: hmm
09:50 PM rue_mohr: i left out the green in that output
09:51 PM rue_mohr: green channel should be 0
09:51 PM furrywolf: I can't make anything out from that actual image at al.
09:51 PM furrywolf: all
09:51 PM rue_mohr: :) I think I have to fix things in the real world to make it work
09:52 PM furrywolf: you may need to do some pre-capture image improvements
09:52 PM furrywolf: yep
09:52 PM furrywolf: lol
09:52 PM furrywolf: possibly multiple laser power settings, or a tighter beam
09:52 PM rue_mohr: I was trying to think how to get the pi to be able to dial down the laset brightness
09:52 PM furrywolf: don't randomly delete channels. the green is helpful for filtering out noise
09:52 PM rue_mohr: I think most of the width is ccd saturation
09:53 PM furrywolf: PWM the laser, decrease camera exposure time, turn laser on partway through exposure
09:54 PM furrywolf: do you have the full-color laser-on image somewhere?
09:54 PM furrywolf: (the one you subtracted from)
09:54 PM rue_mohr: image1 and image2
09:55 PM rue_mohr: :) the monitor in the background doesn't technically help
09:56 PM furrywolf: subtracting does a good job de-monitoring it. :)
09:56 PM furrywolf: is this scanner huge? why is the camera so far away?
09:56 PM rue_mohr: na, its a 12" table
09:57 PM rue_mohr: those pi cameras are stupid-wide angle
09:57 PM furrywolf: so mount it closer. lol. the only thing in frame should be the scan area...
09:57 PM rue_mohr: its supposed to have a backdrop
09:58 PM furrywolf: if you let the ccd saturate, it's going to make finding the line a lot harder... so you'll need to lower the power somehow. do you have control over the camera exposure time?
09:59 PM rue_mohr: the camera has auto-everything
09:59 PM rue_mohr: so, thats a problem anyhow
10:00 PM furrywolf: get a better camera
10:00 PM furrywolf: that one seems kinda crappy in general
10:01 PM rue_mohr: its waaay better than a cheap webcam
10:01 PM rue_mohr: 5MP
10:01 PM rue_mohr: but I can control the auto stuff
10:01 PM furrywolf: it's waaaay inferior than a low-end mirrorless or dslr or industrial imager or even most point-and-shoots. :P
10:02 PM rue_mohr: yea, that is so far over the project budget
10:02 PM furrywolf: look at the DIY book scanner people. they have a custom firmware for canon point-and-shoots that they use for book scanning.
10:03 PM furrywolf: you re-flash the camera and even a cheapo point-and-shoot gets every feature needed for book scanning
10:03 PM rue_mohr: yea, that is so far over the project budget
10:03 PM furrywolf: (i.e. a $10 ebay camera)
10:04 PM rue_mohr: this pi camera is so much better than anything I'v bought or had before
10:04 PM rue_mohr: I been working on this since like 2002
10:05 PM rue_mohr: thats when I made the table
10:05 PM rue_mohr: but I couldn't get my hands on a laser line gen
10:06 PM rue_mohr: and I couldn't get software to find even an ideal line in a synthetic image
10:06 PM furrywolf: if you can't manually control the exposure time, the camera isn't suitable for this project.
10:06 PM rue_mohr: I can
10:06 PM rue_mohr: but I cant know how to adjust them right
10:06 PM rue_mohr: the pi isn't doing the processing
10:06 PM rue_mohr: its not got enough space or horsepower
10:06 PM rue_mohr: I have it in a loop
10:07 PM rue_mohr: laser off; send image; laser on; send image; rotate 1 degree
10:07 PM furrywolf: do exposure bracketing, then. take ten shots at different exposures. :)
10:08 PM rue_mohr: oh I can only control exposure "mode"
10:08 PM rue_mohr: but I dont have a feedback path
10:08 PM rue_mohr: the pi is just shipping off the images
10:09 PM rue_mohr: --sharpness, -sh Set image sharpness (-100 to 100)
10:09 PM furrywolf: 0
10:09 PM rue_mohr: --contrast, -co Set image contrast (-100 to 100)
10:09 PM furrywolf: 0
10:09 PM rue_mohr: --brightness, -br Set image brightness (0 to 100)
10:09 PM furrywolf: 100
10:09 PM rue_mohr: --saturation, -sa Set image saturation (-100 to 100)
10:09 PM furrywolf: 0
10:09 PM rue_mohr: --ISO, -ISO Set capture ISO
10:09 PM rue_mohr: --ev, -ev Set EV compensation
10:09 PM furrywolf: that could be handy, but only if you can manually control exposure too
10:10 PM furrywolf: ev compensation can do it too, but ideally you don't want auto-anything.
10:10 PM rue_mohr: --exposure, -ex Set exposure mode off auto night backlight...
10:10 PM rue_mohr: yea I know
10:11 PM rue_mohr: I'll play
10:11 PM rue_mohr: BUT
10:11 PM rue_mohr: I want to play with my force feedback stuff
10:11 PM furrywolf: I'd suggest stopping down the aperture, but I doubt it has either a setting or a knob for that...
10:11 PM rue_mohr: this is sweet progress, I'm greatfull for the help and push!
10:11 PM rue_mohr: I can dial down the laser too
10:12 PM furrywolf: try -ev -2 or something
10:12 PM rue_mohr: the lack of feedback thing is still an issue, but I'd bet a static level even just lower than what it is would be good
10:12 PM furrywolf: dialing down the laser will cause the camera to either increase the exposure time or the iso, and give the same image, but even shittier.
10:12 PM rue_mohr: it'll drive it into saturation less tho
10:13 PM furrywolf: no, it won't.
10:13 PM furrywolf: it'll make it worse, actually.
10:13 PM rue_mohr: ok...
10:13 PM rue_mohr: writing down your suggested settings to try later
10:13 PM rue_mohr: it took 2 hours to do the scan I have
10:14 PM furrywolf: the camera will compensate by exposing longer, saturating it just as badly, but making everything else worse too. :)
10:14 PM rue_mohr: hmm
10:14 PM furrywolf: look up what the valid ISOs are, try a lower one. when you get to the lowest one, try negative -ev values
10:14 PM rue_mohr: --ev, -ev Set EV compensation
10:14 PM rue_mohr: Set the EV compensation of the image. Range is -10 to +10,
10:14 PM rue_mohr: default is 0.
10:15 PM furrywolf: ev is a way to adjust the exposure time indirectly. a negative ev value means "figure out what the automatic exposure value should be, then make it shorter"
10:16 PM rue_mohr: ok
10:16 PM furrywolf: but first try lowering the ISO. low ISO reduces noise too
10:16 PM rue_mohr: --ISO, -ISO Set capture ISO
10:16 PM rue_mohr: Sets the ISO to be used for captures. Range is 100 to 800.
10:16 PM furrywolf: use 100
10:18 PM furrywolf: ideally you'd have something with a diaphragm and a real shutter. :)
10:36 PM rue_mohr: haha my old goldfish is 9"
10:56 PM rue_mohr: ok, I'm gonna work on the force feedback a bit
10:56 PM rue_mohr: I'm gonna do it
10:56 PM rue_mohr: right now
10:56 PM rue_mohr: ...after I start supper....
11:15 PM furrywolf: bbl, wolfy bedtime