Open CV Mat




- Mat::empty needed
- Save
> - vector field
> - point cloud
> - histogram
> - ... usually 2d  video data
- mat(vector) return 1 col  → need to .t


- MatExpr
> [What is the purpose of cv::MatExpr?](https://stackoverflow.com/questions/39964583/what-is-the-purpose-of-cvmatexpr)



# Create


```typeMat((row, col), type, s(B, G, R) or (data, (padding byte)))```
- eye
- one
- zero
- create, setTo (init)



[OpenCV Mat Edit](https://texonom.com/opencv-mat-edit-af680cedd99b4b3fb325b4bc4fcefff0)



# Copy


= is shallow copy (share pixel data)
> - ~mat inverts pixcel data
- copyTo, clone is deep copy


# Get


- roi(region of interest)  = Rect or (rowRange, colRange)
- colRange - shallow
- rowRange- shallow
- row - shallow
- col - shallow
### Pixel
- at<uchar>(**y, x**) - **Slow**
- ptr<>(y) return start pointer uchar* can access by p[i] - **Faster**
- MatIterator - **Slow**
> - mat::begin() - first pixel location
> - mat::end() - next of final pixel location


# Normalization


- convertTo - data by alpha and beta
- reshape - new row or or channel
- resize - new row and initialize
- pop_back - nelem remove row count



# Data


- Scalar sum
- Scalar mean 
- minMAxLoc(ation)










