Since the timestamp will always look about the same. This allows us to crop a sample of each individual number to use as the kernel in ImageCorrelate
(as suggested by @rm-rf).
I use the following method for the image above:
(* Define Where to Crop for kernelImages *)
imageCropRows = {11, 81};
imageCropColumns = {{726, 802}, {15, 46}, {53, 120}, {433, 499}, {280,
345}, {1033, 1105}};
(* Grab Our kernelImages *)
kernelImages =
ImageTake[image, imageCropRows, #] & /@ imageCropColumns
Ultimately, this will give a kernel set that looks like:
(* Apply ImageCorrelate, and make maxima white points *)
imageCorrelations = (ImageCorrelate[image, #, CosineDistance] //
ColorNegate // Binarize[#, 0.989] &) & /@ kernelImages
Returns a list of images that can be further processed to extract the location in order to reassemble the digit sequence, and ultimately the timestamp. Playing with threshold value in Binarize
will help with sensitivity.
Combining MorphologicalComponents
and Position
should work to find where each copy of a kernel is found. For example, say we wanted to extract the location of the 3's (kernel index 4):
(* Use MorpologicalComponents to identify repeated number locations *)
results = MorphologicalComponents[#] & /@ imageCorrelations;
(* Find where each copy is located *)
Mean[#[[All, 2]]] & /@ (Position[results[[4]], #] & /@
Range[1, Max[results[[4]]]])
Once you have the pixel location of all the digits, some logic can sort them, and reconstruct the timestamp.
This can applied to an arbitrary frame with reasonable results.
ImageCorrelate
with all 10 of them and identify which template gives you a max and its position. Since the time stamp has a structure, you can then map the digit sequence back to a time stamp. $\endgroup$ImageCorrelate
now. $\endgroup$ImageCorrelate
will work, thanks again! $\endgroup$TextRecognize
is pretty limited in what it can do. $\endgroup$