python: "read out" the contrast of a JPG image
Hello, I'm new to OpenCV,
short to the problem:
I have an object in which a JPG image is stored to be more specific a slide with black text and white background now I would like to show if there is enough space on the slide at the bottom right of a video stream.
My idea is to read out the contrast in the image and then subtract the value of the entire length of the image to see if there is enough space ... if so then the video should be displayed otherwise.
first question:
would that be possible with OpenCV?
second question:
if so, how should I go there the best?
Thank you very much
Felix
method:
from wand.image import Image as wa
from slide import Slide
class Presentation:
"""Class that divides a PDF into individual images and converts them to jpg"""
def __init__(self):
"""Constructor of the class"""
print('Image erstellt')
pass
def convert(self, path, filename):
"""a method that takes a path and a PDF file, converts them to JPG, and then saves the individual images"""
pdf = wa(file=path + filename, resolution=300)
pdf_images = pdf.convert("jpeg")
page_number = 1
for img in pdf_images.sequence:
page = wa(image=img)
slide = []
slide.append(Slide(page_number, page))
page_number += 1
object:object:
This object is the starting point for OpenCV
class Slide:
"""Constructor that saves the current page and page number"""
def __init__(self, page_number, page):
self.page_number = page_number
self.page = page