Skip to content
Advertisement

Tag: image

Faster bit-level data packing

An 256*64 pixel OLED display connected to Raspberry Pi (Zero W) has 4 bit greyscale pixel data packed into a byte (i.e. two pixels per byte), so 8192 bytes in total. E.g. the bytes become Converting these bytes either obtained from a Pillow (PIL) Image or a cairo ImageSurface takes up to 0.9 s when naively iterating the pixel data,

Display an image in a label without saving it

The following lines are in my script: from PyQt5 import QtGui, QtWidgets, QtCore from PyQt5.QtGui import QIcon, QPixmap from PyQt5.Widgets import * import cv2 def positioningCross(Dy, Dx, center, imgCross): if(center[1,0]>=center[0,0]): Dy2 = center[0,0] + np.absolute(Dy) else: Dy2 = center[1,0] + np.absolute(Dy) if(center[0,1]>=center[1,1]): Dx2 = center[1,1] + np.absolute(Dx)/2 else: Dx2 = center[0,1] + np.absolute(Dx)/2 P1 = (center[0,1]/2,center[0,0]/2) P2 = (center[1,1]/2,center[1,0]/2) P3

Check if files in dir are the same

I have a folder of 5000+ images in jpeg/png etc. How can I check if any of the images are the same. The images were collected through web scraping and have been sequentially renamed so I cannot compare file names. I am currently checking if the hashes are the same however this is a very long process. I am currently

Adding a border to and Image in my code

Help, I need to put a border on the image displayed from the code below. How do I do this? The code below pulls up the image, and now i need a border. Help.. All of this code is Python Answer Just create a slightly larger array that is black and fill the central pixels with your image.

Advertisement