This is the Python program that I need to write following precisely the directions I wrote this program which is how I am suppose to write it but I am having some problems getting the output I need. import math import stdio import sys from blob_finder import BlobFinder from picture import Picture # Entry point def main(): pixels = int(sys.argv[1]) tau = float(sys.argv[2]) delta = float(sys.argv[3]) frames = (sys.argv[4]) bf = BlobFinder(Picture(frames[0], tau)) prevBeads = bf.getBeads(pixels) for i in range(1, len(frames)): bf = BlobFinder(Picture(frames[i], tau)) currBeads = bf.getBeads(pixels) for currBead in currBeads: closest = math.inf for prevBead in prevBeads: r = currBead.distanceTo(prevBead) if r <= delta and r < closest: closest = r if closest != math.inf: stdio.writef('%4f\n', closest) prevBeads = currBeads stdio.writeln() if __name__ == '__main__': main() Or OI am doing something wrong or I am missing something but this is how I am suppose to write the program no format or anything simple following directions the output I get is: $ python3 bead_tracker.py 25 180.0 data/run_1/frame00000.jpg data/run_1/frame00001.jpg Traceback (most recent call last): File "bead_tracker.py", line 33, in main() File "bead_tracker.py", line 12, in main delta = float(sys.argv[3]) ValueError: could not convert string to float: 'data/run_1/frame00000.jpg' (wrong output) The output I should get is this: $ python3 bead_tracker . py 25 180.0 25.0 data / run_1 / frame00000 . jpg data / run_1 / frame00001 . jpg 7.1833 4.7932 2.1693 5.5287 5.4292 4.3962 P L E A S E help me figure where I did wrong
This is the Python program that I need to write following precisely the directions
I wrote this program which is how I am suppose to write it but I am having some problems getting the output I need.
import math
import stdio
import sys
from blob_finder import BlobFinder
from picture import Picture
# Entry point
def main():
pixels = int(sys.argv[1])
tau = float(sys.argv[2])
delta = float(sys.argv[3])
frames = (sys.argv[4])
bf = BlobFinder(Picture(frames[0], tau))
prevBeads = bf.getBeads(pixels)
for i in range(1, len(frames)):
bf = BlobFinder(Picture(frames[i], tau))
currBeads = bf.getBeads(pixels)
for currBead in currBeads:
closest = math.inf
for prevBead in prevBeads:
r = currBead.distanceTo(prevBead)
if r <= delta and r < closest:
closest = r
if closest != math.inf:
stdio.writef('%4f\n', closest)
prevBeads = currBeads
stdio.writeln()
if __name__ == '__main__':
main()
Or OI am doing something wrong or I am missing something but this is how I am suppose to write the program no format or anything simple following directions
the output I get is:
$ python3 bead_tracker.py 25 180.0 data/run_1/frame00000.jpg data/run_1/frame00001.jpg
Traceback (most recent call last):
File "bead_tracker.py", line 33, in <module>
main()
File "bead_tracker.py", line 12, in main
delta = float(sys.argv[3])
ValueError: could not convert string to float: 'data/run_1/frame00000.jpg'
(wrong output)
The output I should get is this:
$ python3 bead_tracker . py 25 180.0 25.0 data / run_1 / frame00000 . jpg data / run_1 / frame00001 . jpg
7.1833
4.7932
2.1693
5.5287
5.4292
4.3962
P L E A S E help me figure where I did wrong
Trending now
This is a popular solution!
Step by step
Solved in 4 steps