Ask Your Question

[email protected]'s profile - activity

2020-09-26 08:07:05 -0600 received badge  Popular Question (source)
2015-03-03 05:58:18 -0600 commented question cvtColor TypeError:

BGR2GRAY works with my images, and I can imshow, and imwrite the output. However using demosaicing (CV_BayerGR2BGR=49) the out = cv2.cvtColor(img,49,3) syntax does not work because the output does not pass the test for 3 or 4 channels: cv2.error: demosaicing.cpp:1647: error: (-215) scn == 1 && (dcn == 3 || dcn == 4) in function demosaicing Using the alternate form: cv2.cvtColor(img, out, 49) when out is defined as 3 band, passes the test but fails with the TypeError: TypeError: only length-1 arrays can be converted to Python scalars

2015-03-02 13:06:41 -0600 asked a question cvtColor TypeError:

TypeError: only length-1 arrays can be converted to Python scalars

These are the images:

bash-4.1$ rdjpgcom -v Bayer.jpg
JPEG image is 3072w * 2600h, 1 color components, 8 bits per sample
JPEG process: Baseline

bash-4.1$ rdjpgcom -v out.jpg
JPEG image is 3072w * 2600h, 3 color components, 8 bits per sample
JPEG process: Baseline

This is my problem:

bash-4.1$ python3         (same result with python2.7.9, Windows or Linux)
Python 3.4.3 (default, Mar  2 2015, 06:20:41) 
[GCC 4.4.7 20120313 (Red Hat 4.4.7-11)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2;                   # (same result with 2.4.10 or 3.0.0)
>>> image = cv2.imread('Bayer.jpg', 1);
>>> cimage = cv2.imread('out.jpg', 0);
>>> cv2.cvtColor(image, cimage, 49);     #(Same result with other conversion types also)

Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: only length-1 arrays can be converted to Python scalars