Hi,
I'm trying to use the OpenCV histogram function, but get this error:
hist1 = cv2.calcHist([hist_image1], [0], None, [256], [0, 256])
cv2.error: /home/richard/Projeckte/Fischertechnik/ftcommunity-TXT/buildroot/output/build/opencv3-3.3.0/modules/imgproc/src/histogram.cpp error: (-210) in function calcHist
Does this mean I should use cv3 instead of cv2 or is this another issue?
Thanks,
hvn
Error using OpenCV: histogram function
Forumsregeln
Bitte beachte die Forumsregeln!
Bitte beachte die Forumsregeln!
-
- Beiträge: 472
- Registriert: 03 Jan 2018, 22:04
Re: Error using OpenCV: histogram function
Hi Huub,
cfw has some known issues with OpenCV but I don't know if these effect the above mentioned problem.
How do you get the "hist_image1"?
Best regards,
Lars
"import cv2" is still correct with OpenCV 3.3.0, I think the problem has another cause.hvn hat geschrieben: ↑28 Feb 2021, 16:55I'm trying to use the OpenCV histogram function, but get this error:
hist1 = cv2.calcHist([hist_image1], [0], None, [256], [0, 256])
cv2.error: /home/richard/Projeckte/Fischertechnik/ftcommunity-TXT/buildroot/output/build/opencv3-3.3.0/modules/imgproc/src/histogram.cpp error: (-210) in function calcHist
Does this mean I should use cv3 instead of cv2 or is this another issue?
cfw has some known issues with OpenCV but I don't know if these effect the above mentioned problem.
How do you get the "hist_image1"?
Best regards,
Lars
Re: Error using OpenCV: histogram function
Hi Lars,
hist_image1 = cv2.imwrite(filename_res, result)
Which does work...
Thanks,
hvn
hist_image1 = cv2.imwrite(filename_res, result)
Which does work...
Thanks,
hvn
-
- Beiträge: 472
- Registriert: 03 Jan 2018, 22:04
Re: Error using OpenCV: histogram function
Aha! cv2.imwrite() returns a boolean, not an image object.
You've to use cv2.imread() which returns an image, i.e.:
Code: Alles auswählen
success = cv2.imwrite(filename_res, result)
if success:
hist_image1 = cv2.imread(filename_res)
Best regards,
Lars
Re: Error using OpenCV: histogram function
Ah ok, didn't think of that. Previously, I just used cv2.imwrite(...) and only for using histogram, I added hist_image1 to it.