#garfield Logs

Nov 26 2022

#garfield Calendar

01:06 AM Tom_L: yes
06:06 AM polprog: rue_mohr: no i have loads of work :<
06:07 AM rue_mohr: mhm
06:14 AM rue_mohr: before you work to death with no time to play, ponder where you want to bias the result of your lift
06:14 AM rue_mohr: before you work to death with no time to play, ponder where you want to bias the result of your life
06:22 AM rue_mohr: Hi! [-3.142 -3.1415 -3.141 ... 3.1405 3.141 3.1415]
06:22 AM rue_mohr: hahah python decided not to print all 2000 values in the array
06:23 AM rue_mohr: how polite
06:47 AM polprog: lol
06:47 AM polprog: have you tried ipython?
06:47 AM polprog: its interactive
06:49 AM rue_mohr: heh, this is a big mess of code
06:49 AM rue_mohr: my fourier isn't ... right
06:52 AM polprog: i like your gear counting script
06:52 AM polprog: was it a lot of work to write?
06:52 AM rue_mohr: I'm still working on it
06:52 AM rue_mohr: doing the thing isn't the hard part
06:52 AM rue_mohr: navigating python is
06:53 AM rue_mohr: angles = np.divide(list(range(-1000,1000)), 1000*3.14159265)
06:53 AM polprog: takes a bit of getting used to
06:53 AM rue_mohr: I think thats a list of 2000 points, from -3.14 to 3.14
06:53 AM polprog: besides numpy redefines a lot of concepts
06:53 AM rue_mohr: oh I want to multiple
06:53 AM rue_mohr: no
06:53 AM rue_mohr: arg
06:53 AM polprog: consider using np.linspace(...)
06:54 AM rue_mohr: ooo
06:54 AM polprog: :)
06:54 AM rue_mohr: can you quick do one to do 2000 values from -3.14 to 3.14?
06:54 AM polprog: numpy takes a lot of function names from the old stuff (that i never got to use)
06:54 AM polprog: sure, gimme a sec
06:55 AM polprog: np.linspace(-3.14, 3.14,2000)
06:56 AM rue_mohr: cool!
06:56 AM rue_mohr: so, I have a huge DC offset thats generating a huge spike in the fft
06:56 AM rue_mohr: a value like 775k
06:57 AM rue_mohr: so the actual data is down in the like 100 wehre I cant see it
06:57 AM polprog: hm, you could subtract the average of the signal from it to un-DC it
06:57 AM rue_mohr: I can just blank the first value
06:57 AM polprog: that too
06:57 AM rue_mohr: its the DC, I dont care :]
06:58 AM rue_mohr: OH YEA
06:58 AM rue_mohr: heh
06:58 AM rue_mohr: negative frequency values are on the .... left?
06:58 AM polprog: so you are using fft to find the number of teeth?
06:58 AM polprog: i think?
06:58 AM rue_mohr: yea check this out, 1 sec
06:59 AM rue_mohr: http://ruemohr.org/~ircjunk/tempimage/Figure_3.png
06:59 AM rue_mohr: HUGE spike for the teeth!
07:00 AM polprog: wooow!
07:00 AM polprog: damn
07:00 AM polprog: nice
07:00 AM rue_mohr: I'll kill all the negative frequency stuff and zoom in more
07:00 AM rue_mohr: I need to know what the results mean
07:00 AM polprog: and how do you find the circle on which to run the FFT on?
07:00 AM rue_mohr: they are on fixed angular samples, so over 2Pi, it should have a 1:1 meaning
07:00 AM rue_mohr: polprog, ok SO
07:00 AM rue_mohr: http://ruemohr.org/%7Eircjunk/tempimage/foo.jpg
07:00 AM rue_mohr: there is this picture
07:01 AM polprog: yeah
07:01 AM rue_mohr: I only take the red channel, its got the most contrast
07:01 AM rue_mohr: http://ruemohr.org/~ircjunk/tempimage/image_thres1.jpg
07:01 AM rue_mohr: I run...
07:01 AM rue_mohr: a thresold on brightness
07:01 AM rue_mohr: makes it black and white
07:01 AM rue_mohr: contours, hierarchy = cv2.findContours(image_gray, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE)
07:02 AM rue_mohr: that contours it
07:02 AM rue_mohr: then I go thru what it found
07:02 AM rue_mohr: I have it take each contour and do
07:02 AM rue_mohr: contours_poly[i] = cv2.approxPolyDP(c, 5, True)
07:02 AM rue_mohr: centers[i], radius[i] = cv2.minEnclosingCircle(contours_poly[i])
07:02 AM rue_mohr: circle and polygon
07:02 AM rue_mohr: the circle will be the outside edge of a gear
07:02 AM rue_mohr: the polygon will be an edge trace
07:02 AM polprog: ahh
07:02 AM polprog: clever
07:03 AM rue_mohr: that makes the outter circle and green wiggly
07:03 AM rue_mohr: then I convert the points for the polgon to polar
07:03 AM rue_mohr: I work out the mean amplitude and subtract it
07:03 AM rue_mohr: so I have like a sine wave
07:03 AM rue_mohr: http://ruemohr.org/~ircjunk/tempimage/Figure_2.png
07:04 AM rue_mohr: I amplify it by 6, trim it to +-1
07:04 AM rue_mohr: then remove sequential redundant values
07:04 AM rue_mohr: so I get -1,1,-1,1
07:04 AM rue_mohr: I add 1 to get 2,0,2,0,2,0
07:05 AM polprog: m
07:05 AM polprog: mm
07:05 AM rue_mohr: sum the array, and divide by two
07:05 AM rue_mohr: thats the number of teeth IF there wasn't noise that crossed the mean line
07:05 AM rue_mohr: which is what this gear has
07:05 AM rue_mohr: http://ruemohr.org/~ircjunk/tempimage/image_thres1.jpg
07:05 AM rue_mohr: there is a blip in the top left
07:06 AM rue_mohr: it counts it as a tooth, this gear only has 41 teeth
07:06 AM polprog: yeah
07:06 AM rue_mohr: hence the fft
07:06 AM rue_mohr: I want to compare the results
07:07 AM polprog: What camera do you have?
07:08 AM polprog: the image is quite blue
07:08 AM polprog: maybe you can trim it against the white background
07:08 AM polprog: I'd also maximize the contrast before it's ran throught the detector
07:08 AM polprog: and maybe use black bg for white gears and white for black gears
07:09 AM rue_mohr: pi camera
07:09 AM polprog: yeah but the regular or the NoIR version?
07:09 AM rue_mohr: yea, the white lights and the black background came out blue
07:09 AM rue_mohr: that is really black...
07:11 AM polprog: hm
07:11 AM rue_mohr: yea
07:11 AM rue_mohr: I spent a lot of time today playing with a heap of different colour and lighting configs
07:11 AM rue_mohr: this has to be the onyl time I'v seen red light show up fine on a dark blue surface
07:12 AM rue_mohr: :/
07:12 AM rue_mohr: physics sucks cuase its never there when you need it
07:12 AM polprog: what are you using as the light?
07:13 AM rue_mohr: http://ruemohr.org/%7Eircjunk/tempimage/p1260910.jpg
07:13 AM rue_mohr: I welded something up and splorted some led strips to it
07:13 AM polprog: looks like enough light for me
07:13 AM rue_mohr: I think too much and the black looks white
07:14 AM rue_mohr: but I dont know how the auto:: of the camera messes things up
07:14 AM polprog: autoexposure issues
07:14 AM polprog: if you can, try bumping the autoexposure level down
07:14 AM rue_mohr: I recall there are fixed exposure arguments
07:14 AM rue_mohr: but their complex
07:15 AM rue_mohr: see its a project thats cool
07:15 AM polprog: yeah
07:15 AM rue_mohr: you want to play too
07:15 AM rue_mohr: next is screws!!!
07:15 AM polprog: i want, but i have boring stuff to do
07:15 AM polprog: OO
07:15 AM polprog: screws
07:15 AM rue_mohr: name-that-thread-pitch
07:18 AM polprog: allright, gotta go install the energy meter in the boiler closet
07:18 AM rue_mohr: names = ["fred", "bert", "alice",
07:18 AM polprog: the eBUS did not work out, i hope i can monitor the power usage at least
07:18 AM rue_mohr: you can fix the ebus with a bit more effort
07:18 AM polprog: i know, i even found the bus driver schematics
07:18 AM polprog: i might do that
07:19 AM polprog: just, i dont have time
07:19 AM rue_mohr: I found them...
07:19 AM rue_mohr: haha
07:19 AM polprog: yeah!
07:19 AM rue_mohr: you can easy design a pcb
07:19 AM polprog: and assemble it
07:19 AM polprog: im considering it
07:19 AM rue_mohr: you could have it ready for next winter
07:19 AM polprog: D:
07:19 AM polprog: i need it now
07:19 AM rue_mohr: I know
07:19 AM rue_mohr: I could mail one to you
07:20 AM polprog: okay, im gonna install the magick energy metering box now
07:20 AM rue_mohr: you could have it for next winter
07:20 AM polprog: bbl
07:20 AM polprog: i should just build one
07:22 AM rue_mohr: did you ever check that supply current?
07:22 AM rue_mohr: 50mA max
08:54 AM rue_mohr: polprog, omg!!!!
08:54 AM rue_mohr: I think becasue the samples are always 2Pi, the index of the FFT peak _IS_ the tooth count!!!!
08:54 AM rue_mohr: gnight!
02:37 PM polprog: oh wow
02:37 PM polprog: WOW
02:37 PM polprog: .. youre right
04:22 PM rue_mohr: OOOo fourier just won on a really bad image
04:24 PM rue_mohr: http://ruemohr.org/~ircjunk/tempimage/image_thres1.jpg
04:24 PM rue_mohr: the first count is my alg, the second is the fourier
04:24 PM rue_mohr: the fourier properly counted the 36
04:24 PM rue_mohr: (and the 52)
04:25 PM rue_mohr: I'm sad it didn't get the one partly off screen
04:25 PM rue_mohr: not sure why the circle for it didn't get properly detected
04:26 PM rue_mohr: gonna calculate SNR
04:31 PM rue_mohr: oh, the fourier really doesn't like cut off gears
04:31 PM rue_mohr: makes a whole bunch of low freq noise
04:33 PM rue_mohr: if I zero results from 0 teeth (dc) to 4 teeth...
04:33 PM rue_mohr: I think it properly just counted a cut-off gear
04:33 PM rue_mohr: http://ruemohr.org/~ircjunk/tempimage/image_thres1.jpg
04:33 PM rue_mohr: check this out
04:36 PM rue_mohr: no it was 45, not 44
04:57 PM rue_mohr: http://ruemohr.org/~ircjunk/tempimage/image_thres3.jpg <<-- 40 is right!
05:12 PM rue_mohr: and the 25 is a surprise, it is, it looks identicle to a 26 I already counted
05:44 PM rue_mohr: http://ruemohr.org/~ircjunk/tempimage/image_thres1.jpg
05:49 PM Tom_L: couple broken teeth
05:50 PM rue_mohr: hah
05:50 PM rue_mohr: one of the images had a feather
05:50 PM rue_mohr: the fft correctly got the teeth anyhow
05:57 PM rue_shop3: some of the counts aren't right either way, I'm trying to get a feel for it
06:53 PM rue_mohr: the fft is thrown by interesting things
07:08 PM rue_mohr: aandrew, for a single centered gear, both algs are doing good right now
07:40 PM aandrew: interesting. I have to play a bit and try that polar coordinate thing
07:44 PM rue_mohr: you want a new copy of my code?
07:45 PM rue_mohr: I didn't change the polar part, just the filtering, I'm just using the red channel
07:45 PM rue_mohr: https://paste.debian.net/1261988/
07:46 PM rue_mohr: I can walk you thru what it does if you want
07:46 PM rue_mohr: but it bascially unrolls the gear into a rack
07:47 PM rue_mohr: in a lot of cases the fft comes up with a count, but its hard to tell if its legit or not
08:11 PM rue_mohr: aandrew,
08:12 PM rue_mohr: http://ruemohr.org/%7Eircjunk/tempimage/foo.jpg http://ruemohr.org/~ircjunk/tempimage/image_thres1.jpg
08:12 PM rue_mohr: this is a good one becasue of the offset
08:12 PM rue_mohr: the fft is correct
08:15 PM Tom_L: does it read stacked gears?
08:15 PM rue_mohr: only if I sharpie them and it can see it ok
08:15 PM rue_mohr: I'd say 40% chance of it being right
08:15 PM Tom_L: you should have a green sheet with a hole to put over the gear so solve that
08:16 PM rue_mohr: heh
08:16 PM Tom_L: will up the percent i bet
08:16 PM rue_mohr: it would need a lot of sheets
08:16 PM rue_mohr: I'v sorted about 30 now
08:16 PM rue_mohr: I'm tuning as I go
08:19 PM rue_mohr: er, counted
08:19 PM rue_mohr: some of them go super clearly
08:24 PM aandrew: hm
08:24 PM aandrew: https://ibb.co/zNRwBGt
08:24 PM aandrew: $ python3 gearcount.py rue_offset_gear.jpg
08:24 PM aandrew: found 17 contours:
08:24 PM aandrew: original contour had 2613 points, reduced to 182
08:24 PM aandrew: intersections: [3, 12, 13, 16, 25, 25, 67, 66, 63, 88, 95, 84, 81, 80, 41, 40]
08:24 PM aandrew: number of intersections: 25
08:24 PM aandrew: gear has 12 teeth
08:24 PM rue_mohr: nice
08:24 PM rue_mohr: nice profile tho
08:25 PM rue_mohr: I'm wondering if instead of an overall mean for the middle of the teeth, if its a floating one
08:25 PM Tom_L: put one of your sprockets on there
08:25 PM rue_mohr: oo
08:26 PM aandrew: the mode calcuation is wrong because if there are two with the same number it will pick the lowest
08:27 PM aandrew: it's a known issue but htat's not the issue here
08:28 PM rue_mohr: the visual radius changes
08:30 PM rue_mohr: sorted over 55 gears now
08:31 PM Tom_L: you also shouldn't be manually counting them
08:32 PM aandrew: does that one have 40 teeth?
08:32 PM rue_mohr: no, 53
08:32 PM aandrew: nope 53
08:32 PM aandrew: yeah
08:32 PM aandrew: hm
08:32 PM rue_mohr: the second number is from the FFT, which is more-often correct
08:33 PM rue_mohr: its a lot more resiliant about missing or extra teeth
08:33 PM rue_mohr: becasue its looking at the average tooth spacing and rejecting anything not "popular"
08:36 PM rue_shop3: heh, I'm almost at the point of being about to estimate them by eye
08:42 PM aandrew: if I just look for the maximum number of intersections it gets it right
08:42 PM aandrew: it screws up with my original gear though, says 29 instead of 28
08:43 PM rue_shop3: do you see any reason why?
08:45 PM aandrew: I have to dig into it but at the moment no
08:46 PM rue_mohr: oh no, my alg says 96 teeth, the fft says 95
08:46 PM rue_mohr: I dont really want to count that many teeth
08:47 PM rue_mohr: oh
08:47 PM rue_mohr: and the fft wasn't that sure
08:47 PM rue_mohr: max is: 5517.484144484368
08:47 PM rue_mohr: peak count is: 2
08:47 PM rue_mohr: >>> peaks are: [4619.01441113 5517.48414448] at [95, 96] <<<<
08:47 PM rue_mohr: Toothcount is: 96.0
08:47 PM rue_mohr: the array is from the fft
08:48 PM rue_mohr: at the 75% threshold, says it could be 95 or 96
08:54 PM Tom_L: measure the distance between 2 teeth and the perimeter and some simple math will tell the teeth to test your file
08:54 PM rue_shop3: if your orig measurement is ok
08:54 PM rue_shop3: if you average over a few teeth...
08:55 PM Tom_L: the calipers will give you the chord length
08:55 PM rue_shop3: it'd be great if the camera can just tell us the number
08:56 PM Tom_L: to check your program without counting
08:56 PM rue_shop3: heh
08:57 PM Tom_L: or write a program with 2 inputs
08:57 PM Tom_L: chord length and diameter
08:57 PM rue_shop3: I have 2 algs
09:00 PM Tom_L: that's somewhat how i draw gears with my gear macro on the cad
09:01 PM Tom_L: http://tom-itx.no-ip.biz:81/~webpage/cnc/Smartcam/GEAR1.MCL
09:02 PM Tom_L: i think most will have a pressure angle of 14.5 or 20
09:02 PM rue_shop3: I need to know how to work out pitch diameter
09:03 PM rue_shop3: I suppose if I have two known gears and measure the centers when meshed
09:03 PM Tom_L: http://tom-itx.no-ip.biz:81/~webpage/cnc/Gear_info/p-1930-bg_engineering-info-spur-gears.pdf
09:04 PM Tom_L: it's somewhat of an imaginary circle
09:06 PM Tom_L: you can't really do that because the gear tips won't completely touch the other gear's valley
09:07 PM rue_shop3: two of the same gear, mesh them, measure between centers, divide by two
09:07 PM rue_shop3: and scale for all the other gears of the same pitch?
09:07 PM Tom_L: the presure angle will affect the PD
09:08 PM Tom_L: P4
09:09 PM rue_shop3: I suspect only a handfull of values are used in the gears that I have
09:10 PM Tom_L: most of yours will bet 14.5 degree
09:10 PM rue_shop3: ! :)
09:10 PM Tom_L: be
09:10 PM Tom_L: pressure angle
09:12 PM Tom_L: http://tom-itx.no-ip.biz:81/~webpage/cnc/Gear_info/gear.jpg
09:12 PM rue_shop3: http://ruemohr.org/~ircjunk/tempimage/image_thres1.jpg
09:12 PM rue_shop3: i'm torturing it
09:12 PM Tom_L: the macro in action
09:12 PM rue_shop3: steep
09:13 PM Tom_L: you should have the colors print in different locations
09:13 PM Tom_L: instead of off the gear center
09:13 PM aandrew: ahh I see the issue
09:13 PM aandrew: it has trouble finding the center of the gear
09:14 PM rue_shop3: your not using the circle middle?
09:14 PM aandrew: https://ibb.co/rpLjHPD
09:14 PM aandrew: I am
09:14 PM Tom_L: your PD looks close but visually appears a little closer to the center
09:14 PM aandrew: PD?
09:15 PM rue_shop3: why do you only hit the 14 tho?
09:15 PM aandrew: as it reduces the circle it is more obvious
09:16 PM aandrew: https://ibb.co/HdkWBxM
09:16 PM Tom_L: https://www.youtube.com/watch?v=OtZWybsjtpc
09:16 PM Tom_L: print one of those and see what it does
09:17 PM rue_shop3: that loop on the right probably isn't helping
09:17 PM rue_shop3: http://ruemohr.org/~ircjunk/tempimage/image_thres1.jpg
09:17 PM rue_shop3: hahahahaha
09:17 PM rue_shop3: I'm being evil
09:18 PM rue_shop3: oops
09:18 PM rue_shop3: update
09:19 PM aandrew: heh I printed that exact thing a couple years back
09:21 PM aandrew: yeah playing around with the widths and that helps a bit
09:22 PM rue_shop3: it would almost be nice to sweep them, and see where the values staalize?
09:22 PM aandrew: I think the extra tooth on mine is when it gets down to the minimum it gets a little confused
09:23 PM rue_shop3: my amplitude crosser isn't doing that great, but I'm really torturing it
09:23 PM aandrew: gonna try averaging it a bit too, that really helped in my previous algo
09:24 PM rue_shop3: http://ruemohr.org/~ircjunk/tempimage/image_thres6.jpg
09:24 PM rue_shop3: I wonder, did the fft get the ones cut off right?
09:25 PM rue_shop3: 56 is right
09:25 PM rue_shop3: the 46 isn't right
09:28 PM aandrew: yeah this is kind of goofy
09:29 PM rue_shop3: want to play with the unrolled teeth after a polar conversion?
09:30 PM rue_shop3: I filter the converted data for the fft, but didn't try giving that corrected data to the zero corssing code
09:34 PM rue_shop3: funny thing
09:34 PM rue_shop3: the fft is out by just 1 tooth if the gear is partially off screen
09:34 PM aandrew: actually
09:35 PM aandrew: I bet if I only count contours that are "blobbish" rather than "long" it could get rid of the noise
09:35 PM rue_shop3: ?
09:36 PM aandrew: https://ibb.co/4g6bfv8
09:36 PM aandrew: the contours are all "blobbish"
09:37 PM rue_shop3: ok
09:37 PM aandrew: https://ibb.co/zR5pQbw
09:37 PM aandrew: now they're not, the're more linear, particularly on the right side
09:37 PM aandrew: (because center isn't exact)
09:37 PM rue_shop3: ooo I bet the 50% duty point is the pitch radius...
09:38 PM aandrew: so if I discard the test circles where the distance between points isn't normalish and the shape of the contours isn't circularish, it might help
09:39 PM aandrew: distance between contours might be tricky because I don't know the order they come in
09:39 PM aandrew: but I can monitor the deviation of the minimum distance and that's a clue
09:40 PM rue_shop3: your doing a great job of throwing out noise!
09:43 PM rue_shop3: I ditch things that have "tooth amplitudes" of less than 10 pixels
09:43 PM rue_shop3: circles smaller than 5
09:44 PM rue_shop3: anyhting with less than 5 teeth
09:44 PM rue_shop3: it throws out LOTS of stuff
09:54 PM Tom_L: oh the days of group projects...
09:55 PM rue_shop3: well I'm getting a lot of gears counted
09:55 PM rue_shop3: I'm just dumping handfulls on them under this now
09:55 PM rue_shop3: it hates me
09:55 PM Tom_L: i was testing a bug in linuxcnc
09:55 PM rue_shop3: takes me ages to work out which is which
09:56 PM rue_shop3: http://ruemohr.org/~ircjunk/tempimage/image_thres7.jpg
09:56 PM rue_shop3: wtf numbers are for what? I dont know...
09:57 PM rue_shop3: it takes the pi a while to run the program
09:57 PM Tom_L: color match from the centerpoint
09:57 PM rue_shop3: yes, but I'v got the inner gear count over the outter gear count
09:57 PM Tom_L: 10, 44
09:58 PM Tom_L: 10, 50
09:58 PM Tom_L: 12, 34
09:58 PM Tom_L: first 3 in a clockwise arc
09:58 PM rue_shop3: haha which one?
09:58 PM rue_shop3: hmm
09:59 PM Tom_L: 10, 50 bottom left
09:59 PM Tom_L: you haven't looked at many blueprints...
09:59 PM rue_shop3: heh
10:00 PM rue_shop3: 10:46 at the bottom?
10:00 PM Tom_L: that's what it looks like
10:00 PM Tom_L: i'm telling you to move the colors lower than centerline on some
10:00 PM Tom_L: when they print
10:01 PM rue_shop3: to get the stacked ones, I have to sharpie the inner gear teeth
10:01 PM Tom_L: lt blue print 20 px lower
10:01 PM Tom_L: blue print 20 px higher
10:02 PM rue_shop3: I'm just ploping the text on the middle of the circle
10:02 PM Tom_L: i see that
10:02 PM rue_shop3: I guess it goes by the lower left of the text
10:03 PM Tom_L: all you need to change is the Y (vertical)
10:06 PM rue_shop3: maybe if I set it to the X center, but the y radius?
10:06 PM Tom_L: may move it too far
10:06 PM Tom_L: .5 Y
10:06 PM Tom_L: or .25 Y
10:07 PM Tom_L: try it and see
10:08 PM aandrew: balls
10:08 PM aandrew: $ python3 gearcount.py rue_offset_gear.jpg 5
10:08 PM aandrew: found 17 contours:
10:08 PM aandrew: original contour had 2613 points, reduced to 422
10:08 PM aandrew: radius 513: number of contours: 82: min/max/avg: 0.0/64.5/41.73
10:08 PM aandrew: radius 508: number of contours: 81: min/max/avg: 33.0/105.5/40.83
10:08 PM aandrew: radius 503: number of contours: 86: min/max/avg: 0.0/111.0/38.55
10:08 PM aandrew: radius 498: number of contours: 97: min/max/avg: 0.0/102.0/38.93
10:08 PM aandrew: radius 493: number of contours: 93: min/max/avg: 34.0/127.0/49.53
10:08 PM aandrew: radius 488: number of contours: 80: min/max/avg: 0.0/109.5/56.41
10:08 PM aandrew: radius 483: number of contours: 66: min/max/avg: 34.5/97.5/63.33
10:08 PM aandrew: radius 478: number of contours: 66: min/max/avg: 0.0/76.5/26.66
10:08 PM aandrew: radius 473: number of contours: 25: min/max/avg: 35.0/78.5/40.16
10:08 PM aandrew: radius 468: number of contours: 25: min/max/avg: 34.0/64.0/39.48
10:08 PM aandrew: radiu
10:08 PM aandrew: radius 463: number of contours: 20: min/max/avg: 37.0/89.5/50.88
10:08 PM aandrew: radius 458: number of contours: 13: min/max/avg: 11.0/100.5/84.00
10:09 PM aandrew: radius 453: number of contours: 12: min/max/avg: 7.0/63.0/31.71
10:09 PM aandrew: radius 448: number of contours: 3: min/max/avg: 0.0/1.0/0.33
10:09 PM aandrew: number of intersections: 80
10:09 PM aandrew: gear has 40 teeth
10:09 PM aandrew: it still hates your gear, but it's getting better
10:09 PM rue_shop3: that is an evil gear
10:09 PM rue_shop3: I have 2 more set aside
10:09 PM rue_shop3: oh up is down
10:09 PM rue_shop3: ok
10:10 PM aandrew: nowhere in that list though is 106 intersections which would be the 53 teeth
10:10 PM rue_shop3: http://ruemohr.org/~ircjunk/tempimage/image_thres8.jpg
10:10 PM rue_shop3: tom
10:10 PM aandrew: how are you finding the double-gear gears?
10:11 PM rue_shop3: aandrew, would you like to see the data when flattened out with the polar conversion?
10:11 PM Tom_L: <rue_shop3> to get the stacked ones, I have to sharpie the inner gear teeth
10:11 PM rue_shop3: aandrew, as long as I sharpie or paint the inner gears, its usualy ok
10:14 PM rue_shop3: it missed some on this rount
10:15 PM aandrew: yeah I want to play with that but I'm running out of gas
10:15 PM aandrew: been a LONG day
10:16 PM aandrew: https://pastebin.com/u82D6U4c
10:17 PM rue_shop3: I'm embarrassed, mine is one big blob
10:18 PM aandrew: as I've gotten older I've gotten more picky about being tidy
10:18 PM rue_shop3: imgray = cv.cvtColor(img, cv.COLOR_BGR2GRAY)
10:18 PM aandrew: not all the time, but mess bugs me
10:18 PM rue_shop3: take an image and decompose it in gimp, to RGB layers, see if some of them look more attractive than others
10:19 PM rue_shop3: ooo
10:20 PM rue_shop3: I'm running it on the pi right now, but I see some things from yours I want to try
10:21 PM aandrew: I'll put it on the pi later, it's just way easier to iterate locally
10:22 PM rue_shop3: yea
10:22 PM rue_shop3: I like the progess windows
10:22 PM rue_shop3: I can kinda tell when its going a bit wrong, and these are really nice gears its ok with
10:26 PM aandrew: no real difference when using just R G or B
10:26 PM rue_shop3: do any of the planes have more contrast for you?
10:27 PM aandrew: yes definitely
10:27 PM aandrew: blue seems to have a lot of contrast
10:27 PM rue_shop3: in my setup, the red channel has was better contrast
10:27 PM rue_shop3: heh
10:27 PM aandrew: er green maybe
10:27 PM aandrew: red is darker for sure but I don't know if I'd say it has higher contrast
10:28 PM aandrew: I think the adaptive thresholding I'm using is doing a really good job
10:29 PM rue_shop3: thats one of the thigns I wnt to play with
10:30 PM rue_shop3: whats your setup lookin like?
10:32 PM aandrew: why is your gear so hard for me to count
10:32 PM aandrew: just for shits and giggles can you get a good 5MP picture of it on a black background?
10:34 PM aandrew: rue_shop3: https://ibb.co/fMVgSr4, the bar light is replaced with a ring light right under the camera
11:22 PM rue_shop3: you see its got a step in the thickness that makes the radius look offset
11:28 PM rue_mohr: this is from back as far as I can go to
11:28 PM rue_mohr: so its prettymuch an ideal gear
11:28 PM rue_mohr: you cant eve see the step in the thickness
11:28 PM rue_mohr: http://ruemohr.org/~ircjunk/tempimage/p1260916.jpg
11:38 PM aandrew: 3 gearcount.py rue_53_black.jpg
11:38 PM aandrew: found 16 contours:
11:38 PM aandrew: original contour had 2206 points, reduced to 379
11:38 PM aandrew: radius 445: number of contours: 91: min/max/avg: 35.0/126.0/52.23, delta 56
11:38 PM aandrew: radius 440: number of contours: 107: min/max/avg: 0.0/110.0/40.21, delta 29
11:38 PM aandrew: radius 435: number of contours: 106: min/max/avg: 33.5/55.0/39.29, delta 10
11:38 PM aandrew: radius 430: number of contours: 106: min/max/avg: 33.5/49.0/39.09, delta 4
11:38 PM aandrew: radius 425: number of contours: 76: min/max/avg: 35.5/99.0/59.11, delta 16
11:38 PM aandrew: radius 420: number of contours: 53: min/max/avg: 54.0/102.0/84.91, delta 13
11:38 PM aandrew: radius 415: number of contours: 54: min/max/avg: 0.0/104.5/26.52, delta 51
11:38 PM aandrew: radius 410: number of contours: 9: min/max/avg: 0.0/23.0/7.28, delta 8
11:38 PM aandrew: number of intersections: 106
11:38 PM aandrew: gear has 53 teeth
11:39 PM aandrew: I wonder if there should be an annealing process
11:39 PM aandrew: basically find a count of all values and then in popularity order, anneal values that are +/- 1 of the popular one to be the same as hte popular one
11:40 PM aandrew: that'd get us 3 106 intersections
11:40 PM aandrew: wouldn't help the original pic apparently
11:44 PM rue_shop3: :]
11:44 PM rue_shop3: there are so many goofy thresholds in all this I'm amazed any of it works
11:44 PM rue_shop3: I'm trying to devise a "certainty" factor
11:45 PM rue_shop3: the FFT can give me a kinda "signal to noise" ratio
11:45 PM rue_shop3: but, ...
11:45 PM aandrew: I think a 3d printed cone to rest these on would help a lot in keeping things circular
11:45 PM rue_shop3: a zoom lens set far back too
11:52 PM rue_shop3: small gears with low tooth counts are failing at a high rate