İçereği Atla
Odoo Menü
  • Portal
  • Ücretsiz deneyin
  • Uygulamalar
    Finans
    • Muhasebe
    • Faturalama
    • Masraf Yönetimi
    • Elektronik Çizelge (BI)
    • Belgeler
    • İmza
    Satış
    • Müşteri İlişkileri Yönetimi (CRM)
    • Satış
    • Satış Noktası Mağaza
    • Satış Noktası Restoran
    • Abonelikler
    • Kiralama
    Web Sitesi
    • Web Sitesi Oluşturucu
    • eTicaret
    • Blog
    • Forum
    • Canlı Sohbet
    • eÖğrenme
    Tedarik Zinciri
    • Envanter
    • Üretim
    • Ürün Yaşam Döngüsü Yönetimi
    • Satın Alma
    • Bakım
    • Kalite
    İnsan Kaynakları
    • Çalışanlar
    • İşe Alım
    • İzin
    • Değerlendirme
    • Referans
    • Filo Yönetimi
    Pazarlama
    • Sosyal Medyada Pazarlama
    • E-posta ile Pazarlama
    • SMS ile Pazarlama
    • Etkinlikler
    • Pazarlama Otomasyonu
    • Anket
    Hizmetler
    • Proje Yönetimi
    • Çalışma Çizelgeleri
    • Saha Hizmeti
    • Yardım Masası
    • Planlama
    • Randevular
    Verimlilik
    • Sohbet
    • Onay
    • Nesnelerin İnterneti
    • VoIP
    • Bilgi Bankası
    • WhatsApp
    Üçüncü taraf uygulamalar Odoo Stüdyo Odoo Bulut Platformu
  • Sektörler
    Perakende satış
    • Kitapçı
    • Giyim Mağazası
    • Mobilya Mağazası
    • Gıda Marketi
    • Hırdavat Dükkanı
    • Oyuncak Dükkanı
    Gıda ve Konaklama
    • Bar ve Pub
    • Restoran
    • Fast Food Restoranı
    • Konuk Evi
    • İçecek Distribütörü
    • Otel
    Gayrimenkul
    • Emlak Acentesi
    • Mimarlık Firması
    • İnşaat
    • Emlak Yönetimi
    • Bahçe Tasarımı
    • Mülk Sahipleri Derneği
    Uzmanlık
    • Muhasebe Firması
    • Odoo Partner
    • Pazarlama Ajansı
    • Hukuk Firması
    • Yetenek Kazanımı
    • Denetim ve Belgelendirme
    Üretim
    • Tekstil
    • Metal
    • Mobilyalar
    • Gıda
    • Bira fabrikası
    • Kurumsal Hediye
    Sağlık ve Spor
    • Spor Kulübü
    • Optik Mağazası
    • Fitness Merkezi
    • Sağlıklı Yaşam Merkezi
    • Eczane
    • Kuaför Salonu
    Ticaret
    • Tamirci
    • BT Donanım & Destek
    • Güneş Enerjisi Sistemleri
    • Ayakkabı İmalatçısı
    • Temizlik Hizmetleri
    • HVAC Hizmetleri
    Diğerleri
    • Kar Amacı Gütmeyen Kuruluş
    • Çevre Ajansı
    • Reklam Panosu Kiralama
    • Fotoğrafçılık
    • Bisiklet Kiralama
    • Yazılım Bayisi
    Tüm Sektörlere Göz Atın
  • Topluluk
    Öğrenim
    • Eğitim Araçları
    • Dokümantasyon
    • Sertifikasyonlar
    • Eğitim Etkinlikleri
    • Blog
    • Podcast
    Eğitim ve Gelişim
    • Eğitim Programı
    • Scale Up! İşletme Oyunu
    • Odoo'yu Ziyaret Edin
    Yazılım
    • İndirin
    • Sürümleri Kıyaslayın
    • Sürümler
    İş Birliği
    • Github
    • Forum
    • Etkinlikler
    • Çeviriler
    • Partner Olun
    • Partnerler için Hizmetler
    • Muhasebe Firmanızı Kaydettirin
    Hizmetler
    • Partner Bulun
    • Muhasebeci Bulun
    • Bir danışmanla görüşün
    • Kurulum Hizmetleri
    • Müşteri Referansları
    • Destek
    • Sürüm Yükseltme
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Demo randevusu alın
  • Fiyatlandırma
  • Yardım

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • Müşteri İlişkileri Yönetimi
  • e-Commerce
  • Muhasebe
  • Envanter
  • PoS
  • Proje Yönetimi
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Etiketler (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Etiketler (View all)
odoo accounting v14 pos v15
About this forum
Yardım

How to read an image in odoo and use it in a face recognition code and then display the result ?

Abone Ol

Get notified when there's activity on this post

Bu soru işaretlendi
functionimagedatabasebuttonsfacedetect
5653 Görünümler
Avatar
feres44

greetings , new Odoo user here 

i have a project for face recognition and want to turn it into an Odoo (v12.0) module ,the code takes a picture (test.jpg) from a folder and compare it to other ones and displays the result in a new windows , but  i want to try and upload an image to my custom module then read that image from the database and compare it to pictures either on my hard-drive (or on the odoo database )
(the face_trigger function is linked to a button that will trigger the whole process)

 how can i read the image from the database and use it as input for the face detection program.
 
my code is shown below , any help will be appreciated 

# -*- coding: utf-8 *-
from odoo import models, fields, _, api
import face_recognition as fr
import os
import cv2
import face_recognition
import numpy as np


class HospitalPatient(models.Model):
    _name = 'hospital.patient'
    _description = 'Patient Record'
    patient_name = fields.Char(string='Name', required='True')
    patient_age = fields.Integer('Age')
    notes = fields.Text(string='Notes')
    image = fields.Binary(string='Image',required='True')
    @api.multi
    def face_trigger(self):
        def get_encoded_faces():
            """
            looks through the faces folder and encodes all
            the faces
            :return: dict of (name, image encoded)
            """
            encoded = {}
            for dirpath, dnames, fnames in os.walk("./faces"):
                for f in fnames:
                    if f.endswith(".jpg") or f.endswith(".png"):
                        face = fr.load_image_file("faces/" + f)
                        encoding = fr.face_encodings(face)[0]
                        encoded[f.split(".")[0]] = encoding
            return encoded
        def unknown_image_encoded(img):
            face = fr.load_image_file("faces/" + img)
            encoding = fr.face_encodings(face)[0]
            

            return encoding
        def classify_face(im):
            """
            will find all of the faces in a given image and label
            them if it knows what they are
            :param im: str of file path
            :return: list of face names
            """
            faces = get_encoded_faces()
            faces_encoded = list(faces.values())
            known_face_names = list(faces.keys())
            img = cv2.imread(im, 1)
            # img = cv2.resize(img, (0, 0), fx=0.5, fy=0.5)
            # img = img[:,:,::-1]
            face_locations = face_recognition.face_locations(img)
            unknown_face_encodings = face_recognition.face_encodings(img,                                                 face_locations)
            face_names = []
            for face_encoding in unknown_face_encodings:
                # See if the face is a match for the known face(s)
                matches = face_recognition.compare_faces(faces_encoded, face_encoding)
                name = "Unknown"
                # use the known face with the smallest distance to the new face
                face_distances = face_recognition.face_distance(faces_encoded,                                                  face_encoding)
                best_match_index = np.argmin(face_distances)
                if matches[best_match_index]:
                    name = known_face_names[best_match_index]
                face_names.append(name)
                for (top, right, bottom, left), name in zip(face_locations,                                                 face_names):
                    # Draw a box around the face
                    cv2.rectangle(img, (left - 20, top - 20), (right + 20, bottom +                                                 20), (255, 0, 0), 2)
                    # Draw a label with a name below the face
                    cv2.rectangle(img, (left - 20, bottom - 15), (right + 20, bottom +                                         20), (255, 0, 0), cv2.FILLED)
                    font = cv2.FONT_HERSHEY_DUPLEX
                    cv2.putText(img, name, (left - 20, bottom + 15), font, 1.0, (255,                                         255, 255), 2)
            # Display the resulting image
            while True:
                cv2.imshow('Video', img)
                if cv2.waitKey(1) & 0xFF == ord('q'):
                    return face_names
        print(classify_face("test.jpg"))

0
Avatar
Vazgeç
Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Üye Ol
İlgili Gönderiler Cevaplar Görünümler Aktivite
interactive buttons on image (graph)
image buttons
Avatar
0
Tem 24
1175
One image for many products
product image database
Avatar
0
Haz 22
2984
What are these functions in my database?
function database hack
Avatar
0
Ara 17
4026
How to generate values when click a button? Çözüldü
function create buttons
Avatar
Avatar
Avatar
Avatar
4
Eki 15
11047
Backup file PDF, image Çözüldü
image database PDF BACKUP
Avatar
Avatar
1
Tem 24
1713
Topluluk
  • Eğitim Araçları
  • Dokümantasyon
  • Forum
Açık Kaynak
  • İndirin
  • Github
  • Runbot
  • Çeviriler
Hizmetler
  • Odoo.sh Hosting
  • Destek
  • Sürüm Yükseltme
  • Özel Geliştirmeler
  • Eğitim
  • Muhasebeci Bulun
  • Partner Bulun
  • Partner Olun
Hakkında
  • Şirketimiz
  • Pazarlama Gereçleri
  • İletişim
  • Kariyer
  • Etkinlikler
  • Podcast
  • Blog
  • Müşteriler
  • Hukuki • Gizlilik
  • Güvenlik
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo, müşteri ilişkileri yönetimi, eTicaret, muhasebe, envanter, satış noktası, proje yönetimi gibi şirketinizin tüm ihtiyaçlarını karşılayan bir açık kaynak işletme uygulamaları paketidir.

Odoo’nun eşsiz değer önermesi, aynı anda hem kullanımının çok kolay olup hem de tamamen entegre olmasıdır.

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now