I have a question about how to show the cv2.imshow()
without a title bar.
This is what I have now, it still has a minimize, maximize, and close button. I want to remove them. My cropped image Any solution will be very helpful.
I already tried Python OpenCV - remove title bar, toolbar, and status bar but it didn't work.
I think its outdated.
This is the code :
import numpy as np
import cv2
import pickle
width = 640
height = 480
threshold =0.0
maxProb = 0
resultClass = ""
cam = cv2.VideoCapture(0)
cam.set(3,width)
cam.set(4,height)
pickle_in = open("model_trained.101sgd","rb")
model = pickle.load(pickle_in)
def PreProcessing(img):
img = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)
img = cv2.equalizeHist(img)
img = img/255
return img
while True: success, imgOriginal = cam.read() img = np.asarray(imgOriginal)
img = cv2.resize(img,(32,32))
img = PreProcessing(img)
cv2.imshow("Processed Image",img)
img = img.reshape(1,32,32,1)
#Predict
classIndex = int(model.predict_classes(img))
#print(classIndex)
predictions = model.predict(img)
#print(predictions)
probVal = np.amax(predictions)
# if probVal > maxProb:
# maxProb = probVal
# resultClass = classIndex
if probVal >threshold:
cv2.putText(imgOriginal,str(classIndex) + " " +str(probVal),(50,50),cv2.FONT_HERSHEY_COMPLEX,
1,(0,0,255),1 )
cv2.imshow("Original Image", imgOriginal)
if cv2.waitKey(1) & 0xFF == ord('q'):
break