POV-Ray : Newsgroups : povray.general : Counting gear teeth : Re: Counting gear teeth Server Time
18 Apr 2024 18:38:10 EDT (-0400)
  Re: Counting gear teeth  
From: scott
Date: 15 Jun 2017 03:14:33
Message: <594233d9$1@news.povray.org>
> A difference of all the pixels...  a difference of ---  the rgb/gray values?

Yes, if you have a colour image then I'd probably do the pythagorean 
distance between the two RGB values. It probably doesn't matter too much.

>> As you increase angle A from zero you will get a different total error,
>> the angle that gives the minimum error will be your tooth angle. You can
>> use whatever algorithm you want to search for the A with the minimum error.
> 
> Or, I suppose the maximum would yield essentially the same result, if I
> correctly understand how this all works.

When you've found the correct angular spacing, the rotated image should 
have all the teeth lining up with the original image, so the difference 
between the two images (in terms of summing up the differences between 
every pixel) should be very small. As you rotate the 2nd image so the 
teeth are not quite lined up, you'll get bigger errors where there is 
"gear" in one image and "background" in the other image.

The maximum total error might give you exactly half the angular spacing 
of the teeth, as this would probably be where the "tooth" in the rotated 
image exactly lined up with the "gap" in the original.

> With regard to the Fourier transform and its inverse - what are you using to
> implement that?  Is it part of a proprietary software package?  A C library?  I
> think I've been able to get the 1D version working fairly well, but I haven't
> been able to spend enough uninterrupted time with the 2D variation to match up
> the output to what I see in online examples.

All of my stuff is in C#. As for the FFT I just found a library from 
Google that seemed to work well. This is the one:

https://gerrybeauregard.wordpress.com/2011/04/01/an-fft-in-c/


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.