0

I want to detect edges of shelf only to count number of shelves and count of partitions in shelf. I used OpenCV but it detects edges of all objects in images but I don't want to detect edges of other objects except shelves. Any idea how to do this.

# USAGE
import numpy as np
import cv2

def auto_canny(image, sigma=0.33):
    v = np.median(image)
    lower = int(max(0, (1.0 - sigma) * v))
    upper = int(min(255, (1.0 + sigma) * v))
    edged = cv2.Canny(image, lower, upper)
return edged

def main(imagePath):
    image = cv2.imread(imagePath)
    gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
    blurred = cv2.GaussianBlur(gray, (3, 3), 0)
    auto = auto_canny(blurred)
    cv2.imshow("Canny", auto)
    cv2.waitKey(0)

if __name__ == "__main__":
    main("images/shelf_data1.png")
C. Fennell
  • 992
  • 12
  • 20
  • Can you add the code you used, describe what you tried so far, and include a sample image? That will make it a lot of easier to help you. – Craeft Apr 06 '20 at 16:19
  • https://www.google.com/imgres?imgurl=https%3A%2F%2Fs2.reutersmedia.net%2Fresources%2Fr%2F%3Fm%3D02%26d%3D20171026%26t%3D2%26i%3D1207167717%26r%3DLYNXMPED9P21E%26w%3D1280&imgrefurl=https%3A%2F%2Fwww.reuters.com%2Farticle%2Fus-usa-walmart-robots%2Fwal-marts-new-robots-scan-shelves-to-restock-items-faster-idUSKBN1CV1N4&tbnid=7ku0dlaigUmM1M&vet=12ahUKEwjL8vTiptToAhUT7xoKHVaCBjMQMyglegQIARBq..i&docid=m99YdJPdcUAgNM&w=1280&h=712&q=mart%20shelf%20images&client=ubuntu&ved=2ahUKEwjL8vTiptToAhUT7xoKHVaCBjMQMyglegQIARBq – Visualytics AI Apr 06 '20 at 17:17
  • This is image, I want to detect edges only of shelves not of items or people. – Visualytics AI Apr 06 '20 at 17:17
  • Code written above detects edges of all objects in image. – Visualytics AI Apr 06 '20 at 17:21
  • This question might help https://stackoverflow.com/questions/7227074/horizontal-line-detection-with-opencv – Craeft Apr 07 '20 at 01:56
  • Also if you find the gradient of the picture, you can look for peaks in the horizontal component – Craeft Apr 07 '20 at 01:56
  • Link above helps thanks @Craeft – Visualytics AI Apr 07 '20 at 17:47

0 Answers0