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")