
Explore building a lightweight machine vision engine from scratch using Python and OpenCV, connect it to a PLC via OPC UA or Modbus TCP, and perform bottle labeling quality control.
Explore a Python-based machine vision engine that uses OPC UA to read and write PLC variables, grab frames, classify bottles, and optionally switch to Modbus TCP.
Install Anaconda with Spyder, install OPC UA and OpenCV libraries, and download UA Expert and codices to test your code for the machine vision engine.
Learn to build a basic machine vision engine using binary thresholding and find contours in OpenCV, converting images to grayscale to maximize object-background contrast, demonstrated on a bottle image.
Explore adaptive thresholding in OpenCV, with mean and Gaussian types and grayscale input, which preserves details like barcodes and cap shapes for binary thresholding.
Learn to detect object outlines by thresholding images and extracting contours with OpenCV's findContours, including hierarchy, drawing contours on the original color image, and handling contour lists.
Filter noise by contour area to remove small dots and frame, then approximate contours to four corners to detect labels via check_label, triggering PLC ejection for no-label bottles.
Sketches Python program structure to communicate with OPC UA PLC server, defining prototypes for connect OPC UA, check tensor, activate eject, grab frame, and classify camera image, with main loop.
Configure PLC code to communicate with a Python OPC UA server, using ladder logic in Codices to manage a proximity sensor, bottle detected flag, and eject timer two seconds.
Set up an OPC UA server in the Codices project, expose selected variables for a Python client to read, and build the server for immediate operation.
Set up and start the emulated plc using the Goddesses Control systray, log in from the desktop, and run a live plc with an IP address for two hours.
Use UA expert to connect to the Codesys PLC, view tags, and verify OPC UA communication by toggling exit script and proximity; then control the PLC from a Python script.
Create a Python OPC UA client and connect to the server. Store the server nodes in a global object and read the root node; troubleshoot PLC emulator issues if needed.
Read the proximity sensor via OPC UA in Python by building the PLC variable path, accessing the bottle detected flag, and reading its value for one second.
Demonstrates how to write a PLC OPC UA function to activate the eject bottle by setting the eject variable, with automatic variable type detection via the PLC.
Merge core image processing and classification, reading images, applying adaptive thresholding, and detecting contours to classify labels; activate ejection when no label is found.
Learn to grab a frame from a file or camera using OpenCV or the camera library, store it in a global original variable, and switch image names for labeling.
Glue together the main loop, OPC UA connection, and vision logic to classify bottle images, verify the sensor, and eject unlabeled bottles, while debugging and preparing PLC Python synchronization.
Compare python and PLC scan times to trigger a session using a session counter and proximity sensing. Read session numbers via OPC UA to activate the actuator on new sessions.
Design an hmi in codices to control image-processing based machine vision using proximity sensors, ejection status, and accept/reject visuals with an image pool and boolean logic.
Again with another course that there isn't any source on the internet will teach you about.
PLC Basic Machine Vision From Scratch.
Note that There is NO need for any license or Camera, everything will b emulated.
Ever wondered how those a production line uses cameras to classify which products are defected, and which are good to go?
Well, Then this is the right place for you. Because I'll show you, step by step how to :
Create your own Machine Vision Classification and Detection Engine
Use any PLC (in our case CODESYS Based) to exchange information with the Camera
Establish Camera PLC Communication
Create criteria to Reject or Accept a product after the camera snaps an image of it
The course is a lite introduction and will give you a chance to know exactly what to look for when you want to create larger Machine Vision applications.
We will create a Step by Step Project to teach you all the details, by getting directly to the point and learning exactly what you need to comprehend the basics of Machine Vision.
Why do you need this course?
To gain an advantage in this competitive sector!
Bare with me:
Cameras and Machine vision makes around 50% of the industrial automation sector.
Only handful of people in this sector are informed about how to use Machine Vision tools
These techniques can be applied to wide variety of production lines
You will enhance your knowledge arsenal by learning to integrate many technologies together
To progress in this Please note that you need:
Windows machine
Basic knowledge in Python (Check out my Python course in my profile if you don't know where to start)
Basic knowledge in PLC Programming