Use of a high speed counter is not really what you need, you need an input interrupt, for example everytime a pulse from the encoder is true the program interrupts, & runs a routine that moves the data in a shift register, you can use an encoder & perhaps after so many pulses shift the data in the shift register.
It seems you only need a reject signal so a bit shift register would do i.e. if a bottle is to be rejected then a true bit is inserted into the bit shift register, when this bit reaches the reject position the reject mechanism rejects the bottle, now there are a number of things to consider, the speed of the transport conveyor, the encoder resolution, size of the bottles (not too important) etc.
You could use a simple proximity & toothed wheel on the conveyor drive, this would have to be sized so you get x number of pulses per bottle or at the very least one pulse per bottle. without knowing the actual application then it is difficult to give you any real code as I have not got Omron IDE at the moment. but the following may help you.
Using the interrupt say on input 0 (cannot remember how the inputs are addressed) then first create an array of bits for example (cannot remember omron addresses if they still use them) My_Array [0..1000] of bit
So every time an interrupt occurs on input 0 the following code is executed.
A Reject_Sig out (My_array[0]) // if we get a reject signal then set the first bit in the array to a one.
A Int_Pulse Shift left 1 My_Array // Shift the array of bits left one place
So you now have a representation of the bottles & if it is a reject or not that represents a set length of the conveyor.
Example:
<this is the start of where the reject is detected This is reject>
00000001000000100000000000010010011000100000100001
Lets assume the number of pulses generated from the reject detection point is 50 then you need a bit shift of at least say 5 plus (good idea to make it bigger)
So you get a reject signal at the camera station you load a "1" into bit 0 of the shift register, every pulse the data is shifted left one place while the conveyor is running at the reject station then if a one is detected (let's assume bit 50) then it rejects the bottle.
It is almost as simple as that, however, it will depend on many factors i.e. distance between camera & reject station, speed of conveyor how many pulses (perhaps 2-3 pulses per bottle width) etc. Have done this many times using this method but mainly using words/double words for bar codes.
with upto 17 divert stations.