Home>
I want to assign an image file name to a variable and open the image using the variable
I know that you can just substitute'lena.jpg'.
I want to assign it to a variable.
It may be difficult to understand, but thank you.
Image not assigned to im2
Corresponding source code
import os
import sys
from PyQt5.QtWidgets import *
from PyQt5.QtCore import *
from PyQt5.QtGui import QImage, QPalette, QPixmap
import datetime
from PIL import Image
import cv2
import tkinter.filedialog as fd
a = "'"
b = "lena.jpg"
c = "'"
im1 = a + b + c
print (im1)
im2 = cv2.imread (str (im1))
print (im2)
Output result
'lena.jpg'
None
-
Answer # 1
Related articles
- python - error in image binarization using cv2adaptivethreshold function
- python 3x - when saving an image using python, it cannot be saved (output) again with the same file name
- python - i want to know how to assign the image file name in the same directory to a variable and read the image from there
- python - image display from the variable to which the file name is assigned
- python - image recognition using cnn keras multiple inputs
- python - i want to create a contour image
- about batch change of file name using python
- python - i want to get the same result as assigning a variable and writing it directly in a function
- python - i want to divide the read image into pixels and label them
- python 3x - i want to save the value of a variable in memory
- python - i want to read an image and display it
- python - i want to display an image with pysimplegui, but an error occurs
- python 3x - i want to get the nth array with an argument using python3 argparse
- python - i want to convert a black and white image to an arbitrary color image
- css - image does not resize well when using "position: absolute"
- python 3x - how to rename a folder created using jupyternotebook
- how to save the image ocr result file in python
- about image output of python
- python 3x - processing to jump to the link destination using chrome driver in python
Related questions
- How can I create a second visual state for the QLabel of the PyQt5 module that this widget will assume when the mouse is clicked
- python : Run a function from the line
- python : Changing the color of the standard scroll bar of the QListWidget widget
- python : How to pass through the signal into the PYQT5 stream?
- python : How to locate FullScreen widget center screen?
- python : PYQT QSPINBOX negative number
- python : Function to create a new file
- python : Crashes if you do not enter anything in Qlineedit, how to eliminate?
- python : I can not connect the button to the code (pyqt5)
- python : QTableWidget. Incorrect display of the number of the line in which the button is pressed
It was because I was trash.
b = lenna.jpg
It was possible by substituting this b.
Addition in vain
It didn't have to be im1 ='lena.jpg'.
I'm sorry I asked you a question like garbage.