Eigen

Purpose

notes for c++ matrix library Eigen

get started

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
#include <iostream>
#include <Eigen/Dense>

using Eigen::MatrixXd;

int main()
{
    MatrixXd m(2,2);
    m(0,0) = 3;
    m(1,0) = 2.5;
    m(0,1) = -1;
    m(1,1) = m(1,0) + m(0,1);
    std::cout << m << std::endl;
}

pillow ---- PIL, pure python image rendering library 纯Python图像处理库

方法

Access a pixel

im.getpixel((row, col))

im.load()

1
2
pixel_data = im.load()
pixel_data = [255,255,255]

im.putpixel((row, col), color)

numpy.array <–> PIL image

PIL image –> numpy.array

1
2
3
4
5
from PIL import Image
import numpy as np
im = Image.open('hopper.jpg')
arr = np.asarray(im)
arr01 = np.array(im)

np.array –> PIL Image

1
im = Image.fromarray(a)