azzhu / EasyFlyTracker

MIT License
11 stars 8 forks source link

cv2 error, fly_seg #10

Open DrinkAstragalus opened 1 year ago

DrinkAstragalus commented 1 year ago

Hi, I met an error recently when the program calculated background image: Traceback (most recent call last): File "", line 198, in _run_module_as_main File "", line 88, in _runcode File "C:\Users\huang\micromamba\envs\mpy\Scripts\easyFlyTracker.exe__main__.py", line 7, in File "C:\Users\huang\micromamba\envs\mpy\Lib\site-packages\easyFlyTracker\cli.py", line 50, in easyFlyTracker f = FlySeg(**params_filter) ^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\huang\micromamba\envs\mpy\Lib\site-packages\easyFlyTracker\src_code\fly_seg.py", line 123, in init self.comp_bg() File "C:\Users\huang\micromamba\envs\mpy\Lib\site-packages\easyFlyTracker\src_code\fly_seg.py", line 286, in comp_bg self.gray_bg_int16 = cv2.cvtColor(bg, cv2.COLOR_BGR2GRAY).astype(np.int16) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cv2.error: OpenCV(4.8.1) d:\a\opencv-python\opencv-python\opencv\modules\imgproc\src\color.simd_helpers.hpp:92: error: (-2:Unspecified error) in function '__cdecl cv::impl::anonymous-namespace'::CvtHelper<struct cv::impl::anonymous namespace'::Set<3,4,-1>,struct cv::impl::A0xd8611878::Set<1,-1,-1>,struct cv::impl::A0xd8611878::Set<0,2,5>,3>::CvtHelper(const class cv::_InputArray &,const class cv::_OutputArray &,int)'

Invalid number of channels in input image: 'VScn::contains(scn)' where 'scn' is 1

It seems there is an error of color channels.

DrinkAstragalus commented 1 year ago

It should be bg = sx[0] in line 278 in fly_seg.py, as 'keepdims' is set to false by default in stats.mode in SciPy v1.11.3.

azzhu commented 1 year ago

Thank you for your feedback! This issue has been fixed, you can update easyFlyTracker and use it: pip install --upgrade easyFlyTrakcer Thanks.