Skip to content

Commit

Permalink
Create Dielmar
Browse files Browse the repository at this point in the history
  • Loading branch information
Dielmar052006 committed Sep 1, 2024
1 parent f3c5bb3 commit 97ffb08
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions Dielmar
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
from kivy.app import App
from kivy.uix.button import Button
from kivy.uix.image import Image
from kivy.uix.boxlayout import BoxLayout
from kivy.graphics.texture import Texture
import cv2

class DielmarApp(App):
def build(self):
self.camera = cv2.VideoCapture(0)
layout = BoxLayout(orientation='vertical')

self.img1 = Image()
layout.add_widget(self.img1)

capture_button = Button(text="Capture Selfie", size_hint=(1, 0.1))
capture_button.bind(on_press=self.capture_selfie)
layout.add_widget(capture_button)

return layout

def capture_selfie(self, *args):
ret, frame = self.camera.read()
if ret:
buffer = cv2.flip(frame, 0).tobytes()
texture = Texture.create(size=(frame.shape[1], frame.shape[0]), colorfmt='bgr')
texture.blit_buffer(buffer, colorfmt='bgr', bufferfmt='ubyte')
self.img1.texture = texture

def on_stop(self):
self.camera.release()

if __name__ == '__main__':
DielmarApp().run()
def apply_filter(self, image):
# Convert to grayscale
gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
# Apply GaussianBlur
filtered = cv2.GaussianBlur(gray, (15, 15), 0)
return filtered

0 comments on commit 97ffb08

Please sign in to comment.