Image Processing - Stepping on the Pit

Now several popular image processing libraries: matplotlib.pyplot,, scipy.misc, skimage, opencv

The default data format of the above images is uint8 type ( except matplotlib ), but please distinguish the use of the above library from the usage in matlab (the default in matlab is also uint8 type, but it is convenient to convert to float type during processing, in imshow time Note that matlab's default float type image is between 0-1, so sometimes a white image is displayed, check the image matrix type and value range, or directly imshow(img,[])), you can refer to the previous summary of the blog .
write picture description here
Most of the images read by the above libraries are of RGB type, except that the images read by opencv are of BGR type. After reading, you can convert BGR to RGB through fundus=cv2.cvtColor(fundus,cv2.COLOR_BGR2RGB) for processing


The pit I encountered today is my image saving. The image saved by plt is 32-bit by default, and I don't know how to change it to 24-bit (pit!!). ok, there is really no other way to use other libraries. By the way, if you use opencv, remember that when saving images, the order of image channels must be BGR, otherwise there will be unexpected transformations, hehe.

Note: Later, it was found that the picture saved as 32-bit is fine, and it can be read as 24-bit


When drawing under opencv, you need to figure out the coordinate system structure. The coordinate system under opencv is different from the Cartesian coordinate system, the difference is that the Y axis is down and the origin is in the upper left corner.
write picture description here

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325957672&siteId=291194637