Computer vision turns photographs and video into information a digital system can use. For a digital twin, that might mean extracting a meter reading from a photo or detecting people in a room. The goal is not to retain every image: it is to capture the observations needed for a decision. section 2.3.2 section 2.3.3 section 2.7
Read a photographed meter
A quarterly utility bill may be too infrequent for timely decisions. Photograph an analog meter, crop the digit area, convert it to grayscale, invert it, and pass it to Tesseract OCR. One example returns 42678; store the reading with the photo’s timestamp and location. A camera positioned over the meter could automate repeated readings. section 2.3.2
Listing 2.2 Example code that extracts a reading of an analog meter using OCR
import cv2, pytesseract
import numpy as np
from PIL import Image, ImageOps
def extract_meter_reading(image_path, display_results=True):
img = Image.open(image_path)
crop_box = (1000, 890, 1700, 1030) #1
cropped_img = img.crop(crop_box) #2
gray_img = ImageOps.grayscale(cropped_img) #3
inverted_img = ImageOps.invert(gray_img) #4
meter_reading = pytesseract.image_to_string( #5
inverted_img,
config='--psm 7 -c tessedit_char_whitelist=0123456789'
)
meter_reading = meter_reading.strip() #6
return meter_reading
The listing shows the crop, grayscale conversion, inversion, and digit-only OCR configuration used to turn a meter photo into a reading. section 2.3.2
Video supports a different task: detecting objects frame by frame. An object detector assigns bounding boxes and confidence scores to detections such as people or vehicles. A room’s detections can inform occupancy estimates; an entrance detection can become an event sent to a digital twin. section 2.3.3
Listing 2.3 Using the YOLO model to detect multiple objects in a video stream
import cv2
import numpy as np
from ultralytics import YOLO
def run_webcam_detection():
model = YOLO("yolov8n.pt") #1
cap = cv2.VideoCapture(0) #2
cap.set(cv2.CAP_PROP_FRAME_WIDTH, 640) #3
cap.set(cv2.CAP_PROP_FRAME_HEIGHT, 480)
while True:
ret, frame = cap.read() #4
results = model(frame) #5
annotated_frame = results[0].plot() #6
cv2.imshow("YOLOv8 Detection", annotated_frame) #7
if cv2.waitKey(1) & 0xFF == ord('q'):
break
cap.release()
cv2.destroyAllWindows()
The webcam example loads YOLOv8, processes each captured frame, and displays annotated detections. Sending detection events instead of annotated frames would require an additional step. section 2.3.3
The same extraction goal extends to scanned engineering drawings. Computer vision and vision-capable language models can help turn diagram content into structured data, but revisions, handwriting, overlapping symbols, and ambiguity make those outputs candidates for expert validation—not ground truth. At industrial scale, systematic validation and governance matter as much as extraction. section 2.3.4 section 2.3
For live video, processing near the asset can reduce bandwidth by transmitting derived events rather than a full stream. That choice also brings deployment and maintenance work; video use requires attention to privacy and data management. section 2.3.3







