This is a solution to problem 32 on the hard interview questions node. If you have not read the question, the following will make no sense to you:

Well, you can do it with two cameras:

If you fix the two cameras on two points on the disc right next to each other (but at the same distance from the center of the disc), then as the disc spins, one camera will observe the color changing just before the other. From this you can easily deduce which direction the disc is spinning.

But, you really only need one camera:

Start by fixing the camera on any point on the disc. As the disc spins, the camera will observe the color alternating between black and white. Now, move the camera around to allow the point the camera is observing to move clockwise with respect to the center of the disc, and note the rate the color changes. Move the camera in the other direction, and again note the rate the color changes. The slower rate indicates the direction the disc is spinning.

Perhaps, having solved a very similar problem using an actual video camera on an actual spinning disk, I took the problem too literally. But I will not let this dissuade me from offering my critique of your answers. :)

Video cameras do not record a continuous stream of motion; instead they merely take many still pictures one right after the other. For either of your answers to work, the revolutions per second of the disk must be significantly less than the frames per second of the video camera. For example, with the two-camera solution, how can you tell whether the the disk spun 1 degree clockwise or 364 degrees counterclockwise in the frame interval before the color change?

For the one-camera solution, there is the additional problem that the rate of spin of the disk must be constant. But I suppose we can assume that from the wording.

As far as I know, the problem as it's worded cannot be solved no matter how many cameras you throw at it.

The question doesn't assume an ordinary video camera. In fact, it calls for a "special video camera".

If I extend the definition of camera to a more generic sense of light sensor with some sort of recording mechanism, you can get a near-continuous feed, rather than a discrete one. You can think of a single photo-transistor as a degenerate case.

In this case, you'd have to spin the disc faster than the sensing element can detect the light level, the electrons to transmit that info, a buffer to store the previous light level, a comparator to indicate a change, etc.

You'd have to be spinning the disk at ludicrous speed for that to be an issue.

In the case where continuity is an issue, you'd likely need 2 cameras near each other since you wouldn't likely be able to spin the cameras near enough to the disk speed to be able to infer direction from that.

Also, with 2 cameras, you can eliminate some buffering and increase the maximum RPM you can reliably detect.

 

Then again it didn't specify the camera needed to determine the direction, it only implied it... I can look at the spinning disk and determine the direction with 0 cameras for a wide range of sizes and RPMs.

Log in or register to write something here or to contact authors.