This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import cv2 | |
def calculate_lab_mean(img): | |
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) | |
t, mask = cv2.threshold(gray, 0, 255, cv2.THRESH_BINARY) | |
lab = cv2.cvtColor(img, cv2.COLOR_BGR2LAB) | |
l, a, b = cv2.mean(lab, mask)[:3] | |
return l * 100 / 255, a - 128, b - 128 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from flask import Flask, request, send_from_directory | |
from werkzeug.utils import secure_filename | |
import os | |
import cv2 | |
UPLOAD_FOLDER = './teeth_img' | |
ALLOWED_EXTENSIONS = {'png', 'jpg', 'jpeg'} | |
app = Flask(__name__) | |
app.config['UPLOAD_FOLDER'] = UPLOAD_FOLDER |