OpenCV Python: can not pass UMat to calcHist
everyone!
I'm trying to pass cv2.UMat object to cv2.calcHist function:
a = np.arange(10, dtype=np.uint8)
b = cv2.UMat(a)
cv2.calcHist([b], [0], None, [10], [0, 10])
and I'm getting the error
TypeError: images is not a numpy array, neither a scalar
but it seems like cpp version of OpenCV allows using UMat as source image.
Is it me doing something wrong or python OpenCV doesn't allow using UMat as source image for calcHist?
python opencv
add a comment |
everyone!
I'm trying to pass cv2.UMat object to cv2.calcHist function:
a = np.arange(10, dtype=np.uint8)
b = cv2.UMat(a)
cv2.calcHist([b], [0], None, [10], [0, 10])
and I'm getting the error
TypeError: images is not a numpy array, neither a scalar
but it seems like cpp version of OpenCV allows using UMat as source image.
Is it me doing something wrong or python OpenCV doesn't allow using UMat as source image for calcHist?
python opencv
add a comment |
everyone!
I'm trying to pass cv2.UMat object to cv2.calcHist function:
a = np.arange(10, dtype=np.uint8)
b = cv2.UMat(a)
cv2.calcHist([b], [0], None, [10], [0, 10])
and I'm getting the error
TypeError: images is not a numpy array, neither a scalar
but it seems like cpp version of OpenCV allows using UMat as source image.
Is it me doing something wrong or python OpenCV doesn't allow using UMat as source image for calcHist?
python opencv
everyone!
I'm trying to pass cv2.UMat object to cv2.calcHist function:
a = np.arange(10, dtype=np.uint8)
b = cv2.UMat(a)
cv2.calcHist([b], [0], None, [10], [0, 10])
and I'm getting the error
TypeError: images is not a numpy array, neither a scalar
but it seems like cpp version of OpenCV allows using UMat as source image.
Is it me doing something wrong or python OpenCV doesn't allow using UMat as source image for calcHist?
python opencv
python opencv
edited Nov 13 '18 at 8:51
Daniel Sakhapov
asked Nov 13 '18 at 8:46
Daniel SakhapovDaniel Sakhapov
12
12
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
IU guess the reason for that error can be found in the documentation of decode from pyzbar:
def decode(image, symbols=None, scan_locations=False):
"""Decodes datamatrix barcodes in `image`.
Args:
image: `numpy.ndarray`, `PIL.Image` or tuple (pixels, width, height)
symbols (ZBarSymbol): the symbol types to decode; if `None`, uses
`zbar`'s default behaviour, which is to decode all symbol types.
scan_locations (bool): If `True`, results will include scan
locations.
Decode expects an image or a matrix containing the data in a specific order, which is fullfilled by a mat-instance supported by OpenCV. The UMat-format does not fullfil this requirement and so the error will be occur.
thanks for answering, but what does pyzbar.decode have in common with cv2.calcHist?
– Daniel Sakhapov
Nov 13 '18 at 8:57
i think this is help you madebyollin.github.io/opencv-python-docs
– omair issa
Nov 13 '18 at 9:00
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53277026%2fopencv-python-can-not-pass-umat-to-calchist%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
IU guess the reason for that error can be found in the documentation of decode from pyzbar:
def decode(image, symbols=None, scan_locations=False):
"""Decodes datamatrix barcodes in `image`.
Args:
image: `numpy.ndarray`, `PIL.Image` or tuple (pixels, width, height)
symbols (ZBarSymbol): the symbol types to decode; if `None`, uses
`zbar`'s default behaviour, which is to decode all symbol types.
scan_locations (bool): If `True`, results will include scan
locations.
Decode expects an image or a matrix containing the data in a specific order, which is fullfilled by a mat-instance supported by OpenCV. The UMat-format does not fullfil this requirement and so the error will be occur.
thanks for answering, but what does pyzbar.decode have in common with cv2.calcHist?
– Daniel Sakhapov
Nov 13 '18 at 8:57
i think this is help you madebyollin.github.io/opencv-python-docs
– omair issa
Nov 13 '18 at 9:00
add a comment |
IU guess the reason for that error can be found in the documentation of decode from pyzbar:
def decode(image, symbols=None, scan_locations=False):
"""Decodes datamatrix barcodes in `image`.
Args:
image: `numpy.ndarray`, `PIL.Image` or tuple (pixels, width, height)
symbols (ZBarSymbol): the symbol types to decode; if `None`, uses
`zbar`'s default behaviour, which is to decode all symbol types.
scan_locations (bool): If `True`, results will include scan
locations.
Decode expects an image or a matrix containing the data in a specific order, which is fullfilled by a mat-instance supported by OpenCV. The UMat-format does not fullfil this requirement and so the error will be occur.
thanks for answering, but what does pyzbar.decode have in common with cv2.calcHist?
– Daniel Sakhapov
Nov 13 '18 at 8:57
i think this is help you madebyollin.github.io/opencv-python-docs
– omair issa
Nov 13 '18 at 9:00
add a comment |
IU guess the reason for that error can be found in the documentation of decode from pyzbar:
def decode(image, symbols=None, scan_locations=False):
"""Decodes datamatrix barcodes in `image`.
Args:
image: `numpy.ndarray`, `PIL.Image` or tuple (pixels, width, height)
symbols (ZBarSymbol): the symbol types to decode; if `None`, uses
`zbar`'s default behaviour, which is to decode all symbol types.
scan_locations (bool): If `True`, results will include scan
locations.
Decode expects an image or a matrix containing the data in a specific order, which is fullfilled by a mat-instance supported by OpenCV. The UMat-format does not fullfil this requirement and so the error will be occur.
IU guess the reason for that error can be found in the documentation of decode from pyzbar:
def decode(image, symbols=None, scan_locations=False):
"""Decodes datamatrix barcodes in `image`.
Args:
image: `numpy.ndarray`, `PIL.Image` or tuple (pixels, width, height)
symbols (ZBarSymbol): the symbol types to decode; if `None`, uses
`zbar`'s default behaviour, which is to decode all symbol types.
scan_locations (bool): If `True`, results will include scan
locations.
Decode expects an image or a matrix containing the data in a specific order, which is fullfilled by a mat-instance supported by OpenCV. The UMat-format does not fullfil this requirement and so the error will be occur.
answered Nov 13 '18 at 8:52
omair issaomair issa
14
14
thanks for answering, but what does pyzbar.decode have in common with cv2.calcHist?
– Daniel Sakhapov
Nov 13 '18 at 8:57
i think this is help you madebyollin.github.io/opencv-python-docs
– omair issa
Nov 13 '18 at 9:00
add a comment |
thanks for answering, but what does pyzbar.decode have in common with cv2.calcHist?
– Daniel Sakhapov
Nov 13 '18 at 8:57
i think this is help you madebyollin.github.io/opencv-python-docs
– omair issa
Nov 13 '18 at 9:00
thanks for answering, but what does pyzbar.decode have in common with cv2.calcHist?
– Daniel Sakhapov
Nov 13 '18 at 8:57
thanks for answering, but what does pyzbar.decode have in common with cv2.calcHist?
– Daniel Sakhapov
Nov 13 '18 at 8:57
i think this is help you madebyollin.github.io/opencv-python-docs
– omair issa
Nov 13 '18 at 9:00
i think this is help you madebyollin.github.io/opencv-python-docs
– omair issa
Nov 13 '18 at 9:00
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53277026%2fopencv-python-can-not-pass-umat-to-calchist%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown