Piezoelectric Rings For Ultrasonic Machining
Ultrasonic processing is a special processing tool that uses ultrasonic frequency to vibrate at small amplitudes, and through the impact of the abrasive free of liquid between it and the workpiece on the processed surface, the surface of the workpiece material is gradually broken.
Yuhai company is engaged in produce high performance piezoelectric elements,
Custom Hifu Piezo Parts,Hifu Ultrasonic Focusing Part,Piezo Crystal For Hifu,Cheap Hifu Transducer Zibo Yuhai Electronic Ceramic Co., Ltd. , https://www.yhpiezo.com
Common data structures and examples for Python machine vision programming
This article summarizes the data structures commonly used in machine vision (image processing) programming using Python, including the following:
**Data Structure**
Sequence operations: indexing, slicing, adding, multiplication, etc.
List: creation, list function, basic operations: assignment, deletion, slice assignment, insertion, sorting, etc.
Tuple: creation, tuple function, basic operations
NumPy array: creating arrays, creating images, getting shapes, dimensions, number of elements, element types, accessing pixels, channel separation, using masks

**1. Data Structures**
Data structures are collections of data elements that are organized in a specific way, such as numbering elements. These data elements can be numbers or characters, or even other data structures. The most basic data structure in Python is the sequence. Each element in the sequence is assigned a sequence number—the position of the element, also known as the index. The index of the first element is 0, the second is 1, and so on.
Python contains six built-in sequences, the two most common types being lists and tuples. The main difference between lists and tuples is that lists can be modified, while tuples cannot. The basic data structure for image processing is an array. Since the built-in arrays in the Python standard library can only handle one-dimensional arrays and provide fewer functions, the NumPy module's array() is often used to represent images when programming.
**2. General Sequence Operations**
All sequences can perform certain operations, including: indexing, slicing, adding, multiplication, and checking whether an element belongs to a sequence member (membership). In addition, Python has built-in functions that calculate the length of the sequence and find the largest and smallest elements.
(1) Index
The number of all elements in the sequence starts from 0.
For example:
```python
greeting = 'Hello'
greeting[0] # 'H'
greeting[1] # 'e'
```
All sequences can get elements this way. The last element is numbered -1.
If a function call returns a sequence, you can index the return sequence directly.
(2) Slicing
Use the slicing operation to access elements within a certain range. Fragmentation is achieved by separating two indexes with a colon.
For example:
```python
tag = 'Python web site'
tag[9:30] # 'http:// '
numbers = [1,2,3,4,5,6,7,8,9,10]
numbers[3:6] # [4,5,6]
```
Note the index boundary: the element at the first index is included in the slice, and the element at the second index is not. If you want to index the last element, use negative indices.
(3) Sequence Addition
Use the + operator to perform sequence concatenation.
For example:
```python
[1,2,3] + [4,5,6] # [1,2,3,4,5,6]
'Hello, ' + 'world!' # 'Hello, world!'
```
Note that sequences of the same type can be joined together; lists and strings cannot be connected.
(4) Multiplication
Multiplying a sequence by a number generates a new sequence. In the new sequence, the original sequence will be repeated that many times.
For example:
```python
'pyhton' * 5 # 'pyhtonpyhtonpyhtonpyhtonpyhton'
[42]*10 # [42, 42, 42, 42, 42, 42, 42, 42, 42, 42]
```
(5) Membership
To check if a value is in a list, use the `in` operator to return a boolean true or false.
For example:
```python
permission = 'rw'
'w' in permission # True
'x' in permission # False
```
(6) Length, Minimum, and Maximum Built-in Functions
Python provides built-in functions like `len`, `min`, and `max` to work with sequences.
For example:
```python
numbers = [100, 34, 678]
len(numbers) # 3
max(numbers) # 678
min(numbers) # 3
```
**3. List**
(1) List Function
Because strings cannot be modified like lists, sometimes it is useful to create lists based on strings.
For example:
```python
list('Hello') # ['H', 'e', 'l', 'l', 'o']
```
(2) List Basic Operations
Element Assignment:
```python
x = [1, 1, 1]
x[1] = 2 # x becomes [1, 2, 1]
```
Delete Element:
```python
x = [1, 2, 3]
del x[1] # x becomes [1, 3]
```
Slice Assignment:
```python
name = list('Perl')
name[2:] = list('ar') # name becomes ['P', 'e', 'a', 'r']
```
Inserting and Deleting Elements by Slice Assignment:
```python
numbers = [1, 5]
numbers[1:1] = [2, 3, 4] # numbers becomes [1, 2, 3, 4, 5]
numbers[1:4] = [] # numbers becomes [1, 5]
```
(3) List Methods
Append: Adds an item to the end of the list.
Count: Counts how many times an item appears in the list.
Extend: Adds multiple items from another sequence to the end of the list.
Index: Finds the index of the first occurrence of a value.
Insert: Inserts an item into the list.
Pop: Removes an item from the list.
Remove: Removes the first occurrence of a value.
Reverse: Reverses the order of elements in the list.
Sort: Sorts the list in place.
Sorted: Returns a sorted copy of the list.
These data structures and operations are essential for working with images and performing various image processing tasks in Python.