Acne Detection OpenCV [closed]

asked 2018-02-21 02:53:21 -0500

updated 2020-05-26 06:57:24 -0500

supra56 gravatar image

I'm working on an acne detection problem. So far I have applied a canny edge detector and want to find the five pimples on the cheek. I've been trying to use a HoughCircle detector but I can't seem to have any luck. Please let me know if y'all have a solution:

import sys
import cv2
import numpy as np
from skimage import io
from skimage import feature

def main(argv):

    right_cheek_pic =  "right_cheek.jpg"
    right_file = argv[0] if len(argv) > 0 else right_cheek_pic
    # Loads an image
    src1 = cv2.imread(right_file, cv2.IMREAD_COLOR)

    gray = cv2.cvtColor(src1, cv2.COLOR_BGR2GRAY)
    gray = cv2.medianBlur(gray, 7)

    edges = cv2.Canny(gray,40,90)

    rows = gray.shape[0]
    circles = cv2.HoughCircles(edges, cv2.HOUGH_GRADIENT, 2,rows/16,
                               param1=200, param2=100,
                               minRadius=10, maxRadius=60)

    right_cheek_counter = 0
    if circles is not None:

        circles = np.uint16(np.around(circles))
        for i in circles[0, :]:
            right_cheek_counter += 1
            center = (i[0], i[1])
            # circle center
  , center, 1, (0, 100, 100), 3)
            # circle outline
            radius = i[2]
  , center, radius, (255, 0, 255), 3)

    print (right_cheek_counter, "pimple(s) found on right cheek")

    cv2.imshow("right_cheek_pimples.jpg", edges)

    #cv2.imshow("left_cheek_pimples.jpg", src3)
    return 0
if __name__ == "__main__":


edit retag flag offensive reopen merge delete

Closed for the following reason question is not relevant or outdated by sturkmen
close date 2020-10-15 13:03:52.579658