Isn't Canny edge detection pixel-wise operation?
Hello. cv people.
I have faced a strange behavior of opencv Canny edge detector here.
As you can see the figure below, the results are not the same when the whole image is gone thru Canny edge detection and when its sub image (ROI) is gone thru Canny.
After Canny detection of the whole image, I (memory) copied a ROI of the whole image to another 2D array, then applied the Canny with the same parameters (As you can see the codes below, I did NOT save and re-read the ROI as an image file) . The resulted edge images are not the same (two long lines are missing in the edge image of cropped sub-image as in the figure below).
Isn't the Canny edge detector pixel-wise operation theoretically ?
Does it consider global property of the input image ?
Is this well know issue ?
This is my python codes.
im_gray = cv2.imread('pMat_mask_empty.bmp', 0);
th_low = 50; th_high = 150;
canny_cv = cv2.Canny(im_gray, th_low, th_high);
x_from = 545; width = 577; y_from = 161; height = 285;
x_to = x_from + width; y_to = y_from + height;
im_gray_sub = im_gray[y_from : y_to, x_from : x_to];
canny_cv_sub = cv2.Canny(im_gray_sub, th_low, th_high);
cv2.imshow("smoothed_whole_image", im_gray);
cv2.imshow("cv_canny_whole_image", canny_cv);
cv2.imshow("smoothed_sub_image", im_gray_sub);
cv2.imshow("cv_canny_sub_image", canny_cv_sub);
cv2.imshow("cropped_cv_canny_whole_image", canny_cv[y_from : y_to, x_from : x_to]);