Ask Your Question

Revision history [back]

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

click to hide/show revision 2
No.2 Revision

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.

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 #(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

click to hide/show revision 3
No.3 Revision

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

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

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