Multicore Processing¶
Multicore Processing Support in eVision¶
Since release 2.7, eVision supports multicore processing and some algorithms and operations are optimized to take advantage of modern multicore CPUs.
By default, parallel processing is disabled. That means, all operations run on a single core.
To enable parallel processing in your current thread, use Easy::SetMaxNumberOfProcessingThreads .NET Python.
Use with a value greater than 1.
The maximal value is the number of physical core of the CPU on which the application will run (not including hyper-threading).
It is a good idea to choose a lower thread count to reserve some processing power for other applications.
Note
Easy::SetMaxNumberOfProcessingThreads .NET Python only sets the maximum number of processing threads for the thread in which the function is called.
Thread Safety for eVision Types¶
eVision supports simultaneous execution by multiple (unlimited) threads on the same CPU, but data can only be accessed by one thread at a time. So independent tasks can execute simultaneously in your application, but access to each piece of shared data must be synchronized so that only one thread uses it at a time.
The following rules avoid data corruption, crashes and misbehaving programs.
Pixel Structures¶
Pixel types have no restrictions regarding the use (read and write) from different threads. This includes the following types: EColor .NET Python, EPeak .NET Python, EISH .NET Python, ELAB .NET Python, ELCH .NET Python, ELSH .NET Python, ELUV .NET Python, EBW8 .NET Python, EBW8Path .NET Python, EBW16 .NET Python, EBW16Path .NET Python, EBW32 .NET Python, EC24 .NET Python, EC24A .NET Python, EC24Path .NET Python, EPath .NET Python, ERGB .NET Python, ERGBColor .NET Python, EVSH .NET Python, EXYZ .NET Python, EYIQ .NET Python, EYSH .NET Python, EYUV .NET Python, EDepth8 .NET Python, EDepth16 .NET Python and EDepth32f .NET Python.
Pixel Collection Classes¶
Collection classes have no read restrictions. However, write operations should be synchronized. Read operations should not happen when a write operation is on-going. This includes the following types: EColorLookup .NET Python, EPseudoColorLookup .NET Python, EPeakVector .NET Python, EBW8Vector .NET Python, EBWHistogramVector .NET Python, EBW8PathVector .NET Python, EBW16PathVector .NET Python, EBW16Vector .NET Python, EBW32Vector .NET Python, EC24Vector .NET Python, EPathVector .NET Python, EColorVector .NET Python, EColorLookup .NET Python and EC24PathVector .NET Python.
Image Classes¶
Image classes have no read restrictions. However, write operations should be synchronized. Read operations should not happen when a write operation is on-going. This includes the following types: EImageBW8 .NET Python, EImageBW16 .NET Python, EImageBW32 .NET Python, EImageC24 .NET Python, EImageC24A .NET Python, EImageBW32 .NET Python, EFourierImage .NET Python and EImageBW32f .NET Python.
3D Map Classes¶
3D map classes have no read restrictions. However, write operations should be synchronized. Read operations should not happen when a write operation is on-going. This includes the following types: EDepthMap8 .NET Python, EDepthMap16 .NET Python, EDepthMap32f .NET Python, EZMap8 .NET Python, EZMap16 .NET Python and EZMap32f .NET Python.
ROI Classes¶
Concerning ROI, the read and write operations should be classified in two categories:
Read and write operations on the configuration of the ROI itself such as its dimensions and origin.
These have no read restrictions. However, write operations should be synchronized. Read operations should not happen when a write operation is on-going.
Read and write operations on the attached image.
Read operations should take into account the fact that another ROI could be attached to the same image and that write operations could be on-going.
This concerns the following types: EROIBW8 .NET Python, EROIBW16 .NET Python, EROIBW32 .NET Python, EROIC24 .NET Python, EROIC24A .NET Python.
Region Classes¶
Region classes have no read restrictions. However, write operations should be synchronized. Read operations should not happen when a write operation is on-going. It must be taken into account that a region could have been submitted to an algorithm and that modifying the region during the execution of the algorithm is forbidden.
This concerns the following types: ERegion .NET Python, ERectangleRegion .NET Python, ECircleRegion .NET Python, EEllipseRegion .NET Python and EPolygonRegion .NET Python.
Utility Classes¶
Utility classes are classes that cannot be instantiated, and are used through their static methods. This concerns EasyImage .NET Python and EasyColor .NET Python. The methods of these utility classes can be used from any thread, assuming the threading rules for their arguments are respected.
Geometric Classes¶
Geometric classes have no read restrictions. However, write operations should be synchronized. Read operations should not happen when a write operation is on-going.
This includes the following types: EFrame .NET Python, EPoint .NET Python, ECircle .NET Python, ELine .NET Python, ERectangle .NET Python and EWedge .NET Python.
EasyGauge¶
Multiple gauges may perform measurements on the same image from different threads. A single instance cannot be read or modified from multiple threads. Geometric results can be read from multiple threads, write operations should be synchronized.
This concerns the following classes: EBaseGauge .NET Python, ECircleGauge .NET Python, ELineGauge .NET Python, EPointGauge .NET Python, EPolygonGauge .NET Python, ERectangleGauge .NET Python, EWedgeGauge .NET Python.
EasyMatch and EasyFind¶
Multiple finders and matchers may perform matching on the same image from different threads. A single instance cannot be read or modified from multiple threads. Matched results can be read from multiple threads, write operations should be synchronized.
This concerns the following classes: EMatcher .NET Python, EMatchPosition .NET Python, EPatternFinder .NET Python and EFoundPattern .NET Python.
EasyOCR, EasyOCR2 and EasyDeepOCR¶
Multiple text readers may perform reading on the same image from different threads. A single instance cannot be read or modified from multiple threads. Read results can be read from multiple threads, write operations should be synchronized.
This concerns the following classes: EOCR .NET Python, EOCR2 .NET Python and ETextReader .NET Python.
EasyMatrixCode and EasyMatrixCode2¶
A matrix code reader cannot be used from multiple threads. The returned matrix code cannot be used in multiple threads.
This concerns the following classes: EMatrixCodeReader .NET Python and EasyMatrixCode2.EMatrixCodeReader .NET Python.
EasyQRCode¶
A QR code reader cannot be used from multiple threads. The returned QR code cannot be used in multiple threads.
This concerns the following class: EQRCodeReader .NET Python.
EasyBarCode and EasyBarCode2¶
A barcode reader cannot be used from multiple threads. The returned barcode cannot be used in multiple threads.
This concerns the following class: EBarCode .NET and EBarCodeReader .NET Python.
EasyObject¶
Image encoder: Multiple image encoders may process the same image from different threads. A single instance cannot be used from multiple threads simultaneously. Encoded results can be read from multiple threads, but write operations should be synchronized.
This concerns the following classes: EImageEncoder .NET Python, ECodedImage2 .NET Python and EObjectSelection .NET Python.
EChecker: Multiple checkers may verify the same image from different threads. A single instance cannot be used from multiple threads simultaneously. Verification results can be read from multiple threads, but write operations should be synchronized.
Easy3D¶
Multiple Easy3D tool instances may operate on the same data from different threads. A single instance cannot be used from multiple threads simultaneously. Results can be read from multiple threads, but write operations should be synchronized.
This concerns the following classes: EPointCloud .NET Python, EPlaneFitter .NET Python, EPlaneFinder .NET Python, ESphereFitter .NET Python, Easy3DMatch::E3DAligner .NET Python, E3DMatcher .NET Python, E3DComparer .NET Python, EPrincipalAxisExtractor .NET Python, EPhotometricStereoImager .NET Python and Easy3DLaserLine::ELaserLineExtractor .NET Python.
EasyDeepLearning¶
Deep learning tools may perform operations on the same image from different threads. A tool instance cannot be used from different threads. Using Easy::SetMaxNumberOfProcessingThreads .NET Python to increase the number of CPU cores used by eVision greatly improves the processing speed.
This concerns the following classes: EClassifier .NET Python, ELocator .NET Python, ESupervisedSegmenter .NET Python and EUnsupervisedSegmenter .NET Python.
EasySpotDetector¶
Multiple spot detectors may perform detection on the same image from different threads. A single instance cannot be used from multiple threads simultaneously. Detection results can be read from multiple threads, but write operations should be synchronized.
This concerns the following classes: ESpotDetector .NET Python and ESpot .NET Python.