Skip to content
This repository was archived by the owner on Jan 1, 2024. It is now read-only.

Commit 0901dde

Browse files
author
Uday
committed
lincense update on multiple files
1 parent 2d04ec5 commit 0901dde

File tree

8 files changed

+172
-37
lines changed

8 files changed

+172
-37
lines changed

01 Pi Code/collectData.py

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1+
# @Author: uday
2+
# @Date: 2019
3+
# @Email: udaykumar.1997@gmail.com
4+
# @Last modified by: uday
5+
# @Last modified time: 2019
6+
# @License: apache-2.0
7+
# @Copyright: #
8+
# Copyright 2019 Uday Kumar Adusumilli
9+
#
10+
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
11+
#
12+
# http://www.apache.org/licenses/LICENSE-2.0
13+
#
14+
# Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
15+
16+
17+
118
# setup start
219

320
import sys
@@ -25,7 +42,7 @@ def ic(): #image capture
2542
camera.capture(FILE_NAME)
2643
sleep(1)
2744
camera.stop_preview()
28-
45+
2946
def vc(): #video capture
3047
timestamp = time.strftime('%Y-%m-%d-%H%M%S', time.localtime());
3148
FILE_NAME = ("/home/pi/data/" + timestamp+'.h264')
@@ -93,7 +110,7 @@ def aione(): #image capture, distance, location, all in one
93110
writer = csv.writer(csvFile)
94111
writer.writerow(datarow)
95112
csvFile.close()
96-
113+
97114

98115
if __name__ == '__main__':
99116
# all in one

01 Pi Code/rOne.sh

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,18 @@
1-
python collectData.py
1+
# @Author: uday
2+
# @Date: 2019
3+
# @Email: udaykumar.1997@gmail.com
4+
# @Last modified by: uday
5+
# @Last modified time: 2019
6+
# @License: apache-2.0
7+
# @Copyright: #
8+
# Copyright 2019 Uday Kumar Adusumilli
9+
#
10+
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
11+
#
12+
#http://www.apache.org/licenses/LICENSE-2.0
13+
#
14+
# Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
15+
16+
17+
18+
python collectData.py

01 Pi Code/rTwo.sh

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1+
# @Author: uday
2+
# @Date: 2019
3+
# @Email: udaykumar.1997@gmail.com
4+
# @Last modified by: uday
5+
# @Last modified time: 2019
6+
# @License: apache-2.0
7+
# @Copyright: #
8+
# Copyright 2019 Uday Kumar Adusumilli
9+
#
10+
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
11+
#
12+
#http://www.apache.org/licenses/LICENSE-2.0
13+
#
14+
# Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
15+
16+
17+
118
python collectData.py; echo 1-10; sleep 3;
219
python collectData.py; echo 2-10; sleep 3;
320
python collectData.py; echo 3-10; sleep 3;
@@ -7,4 +24,4 @@ python collectData.py; echo 6-10; sleep 3;
724
python collectData.py; echo 7-10; sleep 3;
825
python collectData.py; echo 8-10; sleep 3;
926
python collectData.py; echo 9-10; sleep 3;
10-
python collectData.py; echo 10-10; sleep 3;
27+
python collectData.py; echo 10-10; sleep 3;

02 Product Counting Pipeline/.segmentation_1.py

Lines changed: 36 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1+
# @Author: uday
2+
# @Date: 2019
3+
# @Email: udaykumar.1997@gmail.com
4+
# @Last modified by: uday
5+
# @Last modified time: 2019
6+
# @License: apache-2.0
7+
# @Copyright: #
8+
# Copyright 2019 Uday Kumar Adusumilli
9+
#
10+
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
11+
#
12+
# http://www.apache.org/licenses/LICENSE-2.0
13+
#
14+
# Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
15+
16+
17+
118
import cv2
219
import numpy as np
320
import argparse
@@ -30,36 +47,36 @@ def get_rectangles(contours):
3047
print("Reading file:", args.input)
3148
frame = cv2.imread(args.input)
3249

33-
hsv = cv2.cvtColor(frame, cv2.COLOR_BGR2HSV)
34-
lower_red = np.array([100,100,100])
35-
upper_red = np.array([179,255,255])
50+
hsv = cv2.cvtColor(frame, cv2.COLOR_BGR2HSV)
51+
lower_red = np.array([100,100,100])
52+
upper_red = np.array([179,255,255])
3653

37-
# Here we are defining range of red color in HSV
38-
# This creates a mask of red coloured
39-
# objects found in the frame
40-
mask = cv2.inRange(hsv, lower_red, upper_red)
54+
# Here we are defining range of red color in HSV
55+
# This creates a mask of red coloured
56+
# objects found in the frame
57+
mask = cv2.inRange(hsv, lower_red, upper_red)
4158

42-
# The bitwise and of the frame and mask is done so
43-
# that only the red coloured objects are highlighted
44-
# and stored in res
59+
# The bitwise and of the frame and mask is done so
60+
# that only the red coloured objects are highlighted
61+
# and stored in res
4562

4663
gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
4764

48-
res = cv2.bitwise_and(gray,gray, mask=mask)
65+
res = cv2.bitwise_and(gray,gray, mask=mask)
4966

5067
res = cv2.GaussianBlur(res, (11,11), 0)
5168

5269
kernel = np.ones((11,11),np.uint8)
5370
res = cv2.morphologyEx(res, cv2.MORPH_CLOSE, kernel)
5471

55-
# This displays the frame, mask
56-
# and res which we created in 3 separate windows.
57-
cv2.imshow('frame',frame)
58-
cv2.imshow('mask',mask)
59-
cv2.imshow('res',res)
72+
# This displays the frame, mask
73+
# and res which we created in 3 separate windows.
74+
cv2.imshow('frame',frame)
75+
cv2.imshow('mask',mask)
76+
cv2.imshow('res',res)
6077

6178
cv2.waitKey(0) & 0xFF
62-
cv2.destroyAllWindows()
79+
cv2.destroyAllWindows()
6380

6481
#-------------------- Thresholding -------------------#
6582
thresh = threshold_otsu(res)
@@ -93,9 +110,9 @@ def get_rectangles(contours):
93110
# Resize the selected objects to 28X28
94111
res_obj = resize(roi, (28, 28))
95112

96-
cv2.imshow('Object',res_obj)
113+
cv2.imshow('Object',res_obj)
97114
cv2.waitKey(0) & 0xFF
98-
cv2.destroyAllWindows()
115+
cv2.destroyAllWindows()
99116

100117
res_flat = res_obj.flatten()
101118

@@ -108,4 +125,3 @@ def get_rectangles(contours):
108125
cv2.imshow('Processed image', rose_only)
109126
if cv2.waitKey(0) == 9:
110127
cv2.destroyAllWindows()
111-

02 Product Counting Pipeline/.segmentation_2.py

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1+
# @Author: uday
2+
# @Date: 2019
3+
# @Email: udaykumar.1997@gmail.com
4+
# @Last modified by: uday
5+
# @Last modified time: 2019
6+
# @License: apache-2.0
7+
# @Copyright: #
8+
# Copyright 2019 Uday Kumar Adusumilli
9+
#
10+
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
11+
#
12+
# http://www.apache.org/licenses/LICENSE-2.0
13+
#
14+
# Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
15+
16+
17+
118
import cv2
219
import numpy as np
320
import argparse
@@ -39,11 +56,11 @@ def get_rectangles(contours):
3956

4057
vc=0
4158
oc=0
42-
59+
4360
for contour in contours:
4461
area = cv2.contourArea(contour)
4562
rectContour = get_rectangles([contour])
46-
# print (" -area: ",area, " -contour: ", contour," -rectContour: ", get_rectangles([contour]))
63+
# print (" -area: ",area, " -contour: ", contour," -rectContour: ", get_rectangles([contour]))
4764
if (area > 0.5):
4865
cv2.drawContours(frame, rectContour, -1, (0, 255, 0), 3)
4966
print("Processing contour",rectContour,"with area", area)

02 Product Counting Pipeline/rip.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1+
# @Author: uday
2+
# @Date: 2019
3+
# @Email: udaykumar.1997@gmail.com
4+
# @Last modified by: uday
5+
# @Last modified time: 2019
6+
# @License: apache-2.0
7+
# @Copyright: #
8+
# Copyright 2019 Uday Kumar Adusumilli
9+
#
10+
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
11+
#
12+
#http://www.apache.org/licenses/LICENSE-2.0
13+
#
14+
# Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
15+
16+
17+
118
for file in *.png ; do
219
python3.5 ./.segmentation_2.py --input $file
320
#python3.5 ./.segmentation_1.py --input $file

03 Leaf Disease Detection Pipeline/load_bb.py

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1+
# @Author: uday
2+
# @Date: 2019
3+
# @Email: udaykumar.1997@gmail.com
4+
# @Last modified by: uday
5+
# @Last modified time: 2019
6+
# @License: apache-2.0
7+
# @Copyright: #
8+
# Copyright 2019 Uday Kumar Adusumilli
9+
#
10+
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
11+
#
12+
# http://www.apache.org/licenses/LICENSE-2.0
13+
#
14+
# Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
15+
16+
17+
118
import cv2
219
import io
320
import random
@@ -9,14 +26,14 @@
926
#old_stdout= sys.stdout
1027
#sys.stdout = buf = StringIO()
1128

12-
# Returns true if two rectangles overlap
29+
# Returns true if two rectangles overlap
1330
def doOverlap(t1, t2):
14-
rect1_x1 = t1[0]
31+
rect1_x1 = t1[0]
1532
rect1_x2 = t1[2]
1633
rect1_y1 = t1[1]
1734
rect1_y2 = t1[3]
1835

19-
rect2_x1 = t2[0]
36+
rect2_x1 = t2[0]
2037
rect2_x2 = t2[2]
2138
rect2_y1 = t2[1]
2239
rect2_y2 = t2[3]
@@ -29,7 +46,7 @@ def doOverlap(t1, t2):
2946
if (rect2_y1 <= rect1_y1 <= rect2_y2 or rect2_y1 <= rect1_y2 <= rect2_y2):
3047
return True
3148

32-
return False;
49+
return False;
3350

3451
def checkAllOverlap(l_bbs, rect):
3552
for bb in l_bbs:
@@ -51,9 +68,9 @@ def genRandRect(l_bbs, inp_rect):
5168
res = False
5269

5370
while( not res ):
54-
x1, y1, x2, y2 = inp_rect
55-
h = y2 - y1
56-
w = x2 - x1
71+
x1, y1, x2, y2 = inp_rect
72+
h = y2 - y1
73+
w = x2 - x1
5774

5875
y3 = random.randint(0, max_h-h)
5976
x3 = random.randint(0, max_w-w)

03 Leaf Disease Detection Pipeline/segmentation_2.py

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1+
# @Author: uday
2+
# @Date: 2019
3+
# @Email: udaykumar.1997@gmail.com
4+
# @Last modified by: uday
5+
# @Last modified time: 2019
6+
# @License: apache-2.0
7+
# @Copyright: #
8+
# Copyright 2019 Uday Kumar Adusumilli
9+
#
10+
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
11+
#
12+
# http://www.apache.org/licenses/LICENSE-2.0
13+
#
14+
# Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
15+
16+
17+
118
import cv2
219
import numpy as np
320
import argparse
@@ -11,9 +28,9 @@
1128

1229
# Worked on:
1330
'''
14-
python3.5 ./segmentation_2.py --input ./dataset/2019-05-04-115147.png
15-
python3.5 ./segmentation_2.py --input ./dataset/2019-05-04-114702.png
16-
python3.5 ./segmentation_2.py --input ./dataset/2019-05-04-113838.png
31+
python3.5 ./segmentation_2.py --input ./dataset/2019-05-04-115147.png
32+
python3.5 ./segmentation_2.py --input ./dataset/2019-05-04-114702.png
33+
python3.5 ./segmentation_2.py --input ./dataset/2019-05-04-113838.png
1734
'''
1835

1936
parser = argparse.ArgumentParser(description='Extract roses')
@@ -40,7 +57,7 @@
4057

4158
for contour in contours:
4259
area = cv2.contourArea(contour)
43-
x,y,w,h = cv2.boundingRect(contour)
60+
x,y,w,h = cv2.boundingRect(contour)
4461

4562
# draw a red 'nghien' rectangle
4663
if (30000.0 > area > 300.0):

0 commit comments

Comments
 (0)