Adding a scrollbar to a group of widgets in Tkinter

I am using Python to parse entries from a log file, and display the entry contents using Tkinter and so far it's been excellent. The output is a grid of label widgets, but sometimes there are more...

Peak detection in a 2D array

I'm helping a veterinary clinic measuring pressure under a dogs paw. I use Python for my data analysis and now I'm stuck trying to divide the paws into (anatomical) subregions. I made a 2D array...

Do not want the Images to load and CSS to render on Firefox in Selenium WebDriver - Python

I am using Selenium 2 with python bindings to fetch some data from our partner's site. But on an average it's taking me around 13 secs to perform this operation. I was looking for a way to disable...

Using python PIL to turn a RGB image into a pure black and white image

I'm using the Python Imaging Library for some very simple image manipulation, however I'm having trouble converting a greyscale image to a monochrome (black and white) image. If I save after...

Flask: Get the size of request.files object

I want to get the size of uploading image to control if it is greater than max file upload limit. I tried this one: @app.route("/new/photo",methods=["POST"]) def newPhoto(): form_photo =...

How to write text on a image in windows using python opencv2

I want to put some text on an Image. I am writing the code as: cv2.putText(image,"Hello World!!!", (x,y), cv2.CV_FONT_HERSHEY_SIMPLEX, 2, 255) It gives ERROR, saying 'module' object has no...

Load just part of an image in python

This might be a silly question, but... I have several thousand images that I would like to load into Python and then convert into numpy arrays. Obviously this goes a little slowly. But, I am...

How to subtract the background from an image - python , opencv

How to subtract the background in a still image? IF the issue is with videos then we can use cv2.createBackgroundSubtractorMOG(). I tried to manipulate the function, but I got AttributeError This...

how to reconstruct in 3d of a scene from two images

I wish to make a 3D reconstruction of a scene. For that, I have 2 images of the scene taken from two different angles. Is there a library that does that? (I work in python) if not, what are the...

Transparent Backgrounds on Buttons in Tkinter

I have a Button with a button image but when it is in my window the background of the button clashes with the background of the window. It is a .png image but tkinter seems to want to keep the...

How do I use Python PIL to save an image to a particular directory?

For example I want to manipulate some image and then save it to a particular directory. How do I save to a specific directory other than the one I am in? I understand that this will save to the...

How can one display an image using cv2 in Python

I've been working with code to display frames from a movie. The bare bones of the code is as follows: import cv2 import matplotlib.pyplot as plt # Read single frame avi cap =...

Read a pgm file in python

I am interested in reading a pgm file in python as a numerical file/matrix Right now I open the file with f = open('/home/matthew/NCM/mdb001.pgm', 'rb') When I read the first line, it looks as...

How to stream the logs in docker python API?

I am building an image from a Dockerfile using the docker python API. import os import sys import os.path import docker client = docker.from_env() try: here = os.path.dirname(__file__) ...

Python Telegram Api. How to pick a random image from directory?

I figure out how to pick a specific picture in a directory. bot.send_photo(chat_id=chat_id, photo=open('/Users/Iamawesome/Desktop/test/599d6f972525a.jpg', 'rb')) But how can I pick a random...

How to base64 encode an image using python

I have a stream of data that comes from a device and I need to convert it into a jpeg and then base64 encode it to transfer it over the network. My Python 2.7 code so far looks like this: from PIL...

How to calculate eigenfaces in python?

I'm trying to calculate eigenfaces for a set of images using python. First I turn each image into a vector using: list(map(lambda x:x.flatten(), x)) Then I calculate covariance matrix (after...

Weasyprint get undefined property at invoking write_pdf: "AttributeError: 'PosixPath' object has no attribute 'read_text'"

I'm running weasyprint project on ubuntu 18.04 and I try to create a a pdf. The problem started when I try to set a footer image. I'm running on python 3.6.7 This is my code invoking...

Merge the Bounding boxes near by into one

I am new in python and I am using Quickstart: Extract printed text (OCR) using the REST API and Python in Computer Vision for text detection in Sales Fliers.So this algorithm is given has a...

How to check if PDF is scanned image or contains text

I have a large number of files, some of them are scanned images into PDF and some are full/partial text PDF. Is there a way to check these files to ensure that we are only processing files which...

PyTorch - Getting the 'TypeError: pic should be PIL Image or ndarray. Got <class 'numpy.ndarray'>' error

I am getting the error TypeError: pic should be PIL Image or ndarray. Got <class 'numpy.ndarray'> when I try to load a non-image dataset through the DataLoader. The versions of torch and...

Images not standardizing in Keras

I am following a 2017 tutorial on deep learning in Python, and I am trying to standardize some images from the well-known MNIST dataset. The author has the following to say about the piece of code...

Mapping sets of points with affine transformation

There are 2 sets of points: The points are in separate pandas dataframes (python 3), stored as the points in rows and the values of the x and y positions in columns: Centroid X µm Centroid Y...

How to receive images from Raspberry Pi over ZeroMQ PUB/SUB in Python?

I want to send images taken by Picamera on Raspberry Pi to my windows computer. I wrote some code, as follows (they are simplified here), but it gets stuck in frame = footage_socket.recv_string()...

VSCODE - PYTHON - Pandas DataFrame - Intellisense doesn't show Attributes/methods of the object

After importing Pandas, when creating a pandas dataframe, Intellisense doesn't show the available attributes/methods of the created object.(Image 2, where I try to use the .head() function). It...

OCR confidence score from Google Vision API

I am using Google Vision OCR for extracting text from images in python. Using the following code snippet. However, the confidence score always shows 0.0 which is definitely incorrect. How to...

Twitter Scraper, not showing result

I'm a student and completely new to mining or scraping and my English not really good. I want to take a 'tweet' from a specific date. I followed a tutorial step by step, but in the end, the result...

How can i run pyqt5 on my mac with M1chip

now. when i run it. the error conmes ImportError: dlopen(/Users/vihanmy/Library/Python/3.8/lib/python/site-packages/PyQt5/QtWidgets.abi3.so, 2): no suitable image found. Did find: ...

Import "discord" could not be resolved

I have programmed a discord bot with python and I installed all discord.py libraries. the problem is when I run the script it said no module found but I already install everything the errors are:...

Improving accuracy in Python Tesseract OCR

I am using pytesseract along with openCV in a simple django application in Python to extract text in Bengali language from image files. I have a form that lets you upload an image and on clicking...