I want to resize an image but it turns blue when I use the method.
My venv has:
Python 3.9
opencv-python==4.5.5.64
I'm working on a .ipynb file through Pycharm.
Have this cell after imports:
sns.set_theme(style='whitegrid',
rc={'figure.figsize': (20, 10),
'axes.grid' : False})
Here is my code:
In 1
img = cv2.imread('../sample_img/secret/sample_img_secret.jpeg')
img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
plt.imshow(img);
Out 1
img = cv2.imread('../sample_img/secret/sample_img_secret.jpeg')
img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
img = cv2.resize(img, (100, 100), interpolation=cv2.INTER_AREA)
plt.imshow(img);
Out 2
I can't figure what's happening even diving in the docs and SO. This used to work on an earlier notebook.
Thx in advance!!
Finally found the answer when opening the notebook from VSCode. It's just a PyCharm setting which was creating the mess.
In case you are in the same situation just disable:
Preferences | Languages & Frameworks | Jupyter | Invert image outputs for dark themes
Got the answer from https://youtrack.jetbrains.com/issue/PY-54138
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.