I'am a newer for opencv. I used the next command install the opencv 3.4
py -3 -m pip install open_python-3.4.4.19-cp36-cp36m-win_ame64.whl
and use the code named Image_Thresholding.ipynb process the picture the file Image_Thresholding.ipynb like this:
import cv2
pic = cv2.imread('adult.jpg', 0)
threshold_value = 200
(T_value, binary_threshold) = cv2.threshold(pic, threshold_value, 255, cv2.THRESH_BINARY)
cv2.imshow('binary', binary_threshold)
cv2.waitKey(0)
cv2.destroyAllWindows()
I used pycharm2018.3.1 and set the configurations to use Jupter Notebook to run up code show the processed the picture, It's a white and black picture but I want use the next code
to show the original picture it also show the processed white and black picture
import cv2
img = cv2.imread('adult.jpg', 0)
cv2.imshow('adult', img)
cv2.waitKey(0)
cv2.destoryAllWindows()
How to show the original picture. Is my environment wrong or any else problem ?
You're experiencing such issue because of the 0
flag you use in the imread
function call. That is used to read images in grayscale.
In order to load and display a color image just do:
import cv2
img = cv2.imread('adult.jpg')
cv2.imshow('adult', img)
cv2.waitKey(0)
cv2.destoryAllWindows()
Hope this helps
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.