<jupyter_start><jupyter_text>countour detection in only certain area<jupyter_code>valid_cntrs = []

for i,cntr in enumerate(contours):
    x,y,w,h = cv2.boundingRect(cntr)
    if (x <= 300) & (y >= 200) & (cv2.contourArea(cntr) >= 0):
        valid_cntrs.append(cntr)

# count of discovered contours        
len(valid_cntrs)
img = cv2.imread('Photograph.jpg')
dmy =img.copy()

cv2.drawContours(dmy, valid_cntrs, -1, (127,200,0), 2)
cv2.line(dmy, (0, 220),(256,80),(100, 255, 255))
plt.imshow(dmy)
plt.show()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.17318435754189945, 'fraction_numerical': 0.07262569832402235, 'mean_word_length': 5.044943820224719, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '584004', 'license': 'MIT', 'n_tokens_mistral': 265, 'n_tokens_neox': 231, 'n_words': 41, 'path': 'OpenCV/Untitled19 (1).ipynb', 'repo_name': 'VithalGulati/Machine_Learning', 'size': '537'}