localdevices / pyorc

Surface velocity, object tracking, and river flow measurements in an open-source API
GNU Affero General Public License v3.0
129 stars 31 forks source link

problem and error in using pyorc #152

Closed amirdastgheib closed 7 months ago

amirdastgheib commented 7 months ago

How did you install pyopenrivercam (mamba / conda or pip)

[pip]

What is the problem?

[I was using pyorc 0.5.2 and yesterday I updated the pyorc and since then I am getting error for getting the first frame. The code:

uncomment line below if you want to view coordinates interactively

%matplotlib notebook video_file = r'C:\Users\amerecosystem\Desktop\Amir\TU GRAZ\LSPIV\Field Work\Oberwolz\26-09-2023\Videos\Digital Camera\DSC_1380.MOV' video = pyorc.Video(video_file, start_frame=0, end_frame=1) # we only need one frame frame = video.get_frame(0, method="rgb")

plot frame on a notebook-style window

f = plt.figure(figsize=(10, 6)) plt.imshow(frame)

The error: AttributeError Traceback (most recent call last) Cell In[2], line 4 1 # uncomment line below if you want to view coordinates interactively 2 # %matplotlib notebook 3 video_file = r'C:\Users\amerecosystem\Desktop\Amir\TU GRAZ\LSPIV\Field Work\Oberwolz\26-09-2023\Videos\Digital Camera\DSC_1380.MOV' ----> 4 video = pyorc.Video(video_file, start_frame=0, end_frame=1) # we only need one frame 5 frame = video.get_frame(0, method="rgb") 7 # plot frame on a notebook-style window

AttributeError: module 'pyorc' has no attribute 'Video' and also I install again by: !pip install git+https://github.com/localdevices/pyorc.git and I got this error: IndexError Traceback (most recent call last) Cell In[3], line 4 2 get_ipython().run_line_magic('matplotlib', 'notebook') 3 video_file = r'C:\Users\amerecosystem\Desktop\Amir\TU GRAZ\LSPIV\Field Work\Oberwolz\26-09-2023\Videos\Digital Camera\DSC_1380.MOV' ----> 4 video = pyorc.Video(video_file, start_frame=0, end_frame=1) # we only need one frame 5 frame = video.get_frame(0, method="rgb") 7 # plot frame on a notebook-style window

File ~\AppData\Roaming\Python\Python311\site-packages\pyorc\api\video.py:121, in Video.init(self, fn, camera_config, h_a, start_frame, end_frame, freq, stabilize, rotation) 119 end_frame = self.frame_count 120 # extract times and frame numbers as far as available --> 121 time, frame_number = cv.get_time_frames(cap, start_frame, end_frame) 122 # check if end_frame changed 123 if frame_number[-1] != end_frame:

File ~\AppData\Roaming\Python\Python311\site-packages\pyorc\cv.py:683, in get_time_frames(cap, start_frame, end_frame) 680 break 682 n += 1 --> 683 time[0] = 0 684 return time, frame_number

IndexError: list assignment index out of range ]

How can we reproduce this? (What steps trigger the problem? What parameters are you using for processing? Include screenshots. If you are having issues processing a video, if possible include a copy of your dataset uploaded on Dropbox, Google Drive, or other)

[Type answer here]

amirdastgheib commented 7 months ago

is my problem clear?

hcwinsemius commented 7 months ago

I have tried to reproduce your problem with the same pip install command but cannot reproduce it. Can you try the following:

then try your first lines of code again.

amirdastgheib commented 7 months ago

Ok Thank you for your help.

hcwinsemius commented 7 months ago

Did this work? Please let me know so I can close the issue.

amirdastgheib commented 7 months ago

I did so and at the same time I changed the videos folder to a complete different address and it works for now. Thank you.