Skip to content

Commit cfd313f

Browse files
committed
Some improvements from last and this year.
1 parent fd6d9eb commit cfd313f

File tree

3 files changed

+18
-2
lines changed

3 files changed

+18
-2
lines changed

image_processing_course/ipc_s01e05.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,16 @@ def ex_0():
1414
print(f'{len(keypoints_no_supression)=}')
1515
fast_supression = cv2.FastFeatureDetector_create(threshold=threshold, nonmaxSuppression=True)
1616
keypoints_supression : List[cv2.KeyPoint] = fast_supression.detect(img_gray)
17+
18+
orb = cv2.ORB_create()
19+
sift = cv2.xfeatures2d.SIFT_create()
20+
21+
keypoints_sift = sift.detect(img_gray)
22+
keypoints_orb = orb.detect(img_gray)
23+
24+
img_with_keypoints_sift = cv2.drawKeypoints(img, keypoints_sift, None, color=(255, 0, 0))
25+
img_with_keypoints_orb = cv2.drawKeypoints(img, keypoints_orb, None, color=(255, 0, 0))
26+
1727
print(f'{len(keypoints_supression)=}')
1828
img_with_keypoints = cv2.drawKeypoints(img, keypoints_supression, None, color=(255, 0, 0))
1929

@@ -22,7 +32,9 @@ def ex_0():
2232
print(f'{kp.angle=}')
2333
print(f'{kp.response=}')
2434

25-
cv2.imshow('point feature detector', img_with_keypoints)
35+
cv2.imshow('point feature detector fast', img_with_keypoints)
36+
cv2.imshow('point feature detector orb', img_with_keypoints_orb)
37+
cv2.imshow('point feature detector sift', img_with_keypoints_sift)
2638
cv2.waitKey(0)
2739
cv2.destroyAllWindows()
2840

@@ -59,6 +71,7 @@ def ex_1():
5971
detector = cv2.AKAZE_create()
6072
# detector = cv2.FastFeatureDetector_create(threshold=30, nonmaxSuppression=True)
6173
# descriptor = cv2.ORB_create()
74+
# descriptor = cv2.xfeatures2d.SIFT_create()
6275
descriptor = cv2.xfeatures2d.BriefDescriptorExtractor_create()
6376
# descriptor = cv2.AKAZE_create()
6477
# descriptor = cv2.BRISK_create()

image_processing_course/ipc_s01e08.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ def task_1():
66
def empty(_):
77
pass
88

9+
# tomatoes - H: 0-6, S: 90-...
10+
# apples - H: 25-50, S: 90-...
11+
912
image = cv2.imread('./../_data/s01e08/tomatoes_and_apples.jpg')
1013
image = cv2.resize(image, (image.shape[0] // 2, image.shape[1] // 2), interpolation=cv2.INTER_AREA)
1114

@@ -29,7 +32,6 @@ def empty(_):
2932
high_s = cv2.getTrackbarPos('high S', 'image')
3033
low_v = cv2.getTrackbarPos('low V', 'image')
3134
high_v = cv2.getTrackbarPos('high V', 'image')
32-
# H: 25-50, S: 80-255, V: 0;255
3335
threshold = cv2.inRange(image_hsv, (low_h, low_s, low_v), (high_h, high_s, high_v))
3436
cv2.imshow('threshold', threshold)
3537
key = cv2.waitKey(10)

vision_systems/s01e05.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ def ex_1():
6363
print(f'{img_prewitt_x[100:105, 100:105]}')
6464
print(f'{abs(img_prewitt_x[100:105, 100:105])}')
6565
print(f'{img_prewitt_x[100:105, 100:105].astype(np.uint8)}')
66+
print(f'{abs(img_prewitt_x[100:105, 100:105]).astype(np.uint8)}')
6667
print(f'{img_prewitt_x_int[100:105, 100:105]}')
6768

6869
img_gradient = cv2.sqrt(cv2.pow(img_prewitt_x, 2) + cv2.pow(img_prewitt_y, 2))

0 commit comments

Comments
 (0)