Chapter III Loading,Displaying,and Saving
用opencv读图片 然后显示出来
运行这个代码,会出现未响应 不知道是不是jupyter的原因强行关了这张图 会导致jupyter notebook的kernel重新运行,image的numpy表示是(# of rows,# of columns,# of channels)
https://ppao.pyimagesearch.com/lessons/ppao-chapter-3-loading-displaying-and-saving/ 康康扩展包
用matplotlib来display图像:
用matplotlib读,用matplotlib展示一开始用cv2读图片 用matplotlib来显示,显示的不同于原图像,原因是
OpenCV represents RGB images as multi-dimensional NumPy arrays…but in reverse order!
This means that images are actually represented in BGR order rather than RGB!
通过cvtColor进行处理就好了对于no module named PIL 搜了一下 貌似是缺少pillow的数据包,conda install pillow 问题就解决了
PIL(Python Imaging Library)是python图像处理库,Pillow是一个对PIL友好的分支.
Chapter IV Image Basics
操作像素,用slicing来显示图像的左上角100 * 100的图片,这么小的图片用cv2imshow 还是会崩,还是用matplotlib来plot好
读出(0,0)位置的像素 修改左上角的像素对比两张图 发现,slicing 前面一组是y坐标(也就是上下) 后面一组是x坐标(也就是左右)
https://ppao.pyimagesearch.com/lessons/ppao-chapter-4-image-basics/ 来康康扩展包
Even though we specify pixels in terms of (x, y)-coordinates, when it comes to writing code, we access the individual pixel values as image[y, x] . Why does the y-coordinate come first? Well, keep in mind that an image is defined as a matrix. We define a matrix in terms of number of rows and number of columns. Therefore, to access an individual pixel located at (x, y), we first supply y, the row number, followed by x, the column number
网友评论