cv2.imshow() function throws an assertion error The 2019 Stack Overflow Developer Survey Results Are Incv2.error: OpenCV(4.0.0) error: (-215:Assertion failed) dst.data == (uchar*)dst_ptr in function 'cvShowImage'OpenNI and OpenCV: cv2.imshow() crashes with error: (-215:Assertion failed) dst.data == (uchar*)dst_ptr in function 'cvShowImage'How to flush output of print function?Build Error For cv2.imshow()Python cv2 cv2.imshow() not working in windowsHow to solve cv2.error: (-215)?Python-OpenCV cv2 OpenCV Error: Assertion failedResizing video resolution in OpenCV pythonOpen CV error in motion detectionOpenCV “cv2.omnidir.calibrate” throws an Assertion ErrorWhy does my color detection code cause an OpenCV error?tkinter.root.destroy and cv2.imshow - X Windows system error

Why didn't the Event Horizon Telescope team mention Sagittarius A*?

Falsification in Math vs Science

Why don't hard Brexiteers insist on a hard border to prevent illegal immigration after Brexit?

Will it cause any balance problems to have PCs level up and gain the benefits of a long rest mid-fight?

Accepted by European university, rejected by all American ones I applied to? Possible reasons?

How can I add encounters in the Lost Mine of Phandelver campaign without giving PCs too much XP?

Star Trek - X-shaped Item on Regula/Orbital Office Starbases

Can I have a signal generator on while it's not connected?

Why couldn't they take pictures of a closer black hole?

What does もの mean in this sentence?

Why was M87 targeted for the Event Horizon Telescope instead of Sagittarius A*?

Is it correct to say the Neural Networks are an alternative way of performing Maximum Likelihood Estimation? if not, why?

How to notate time signature switching consistently every measure

Is it safe to harvest rainwater that fell on solar panels?

For what reasons would an animal species NOT cross a *horizontal* land bridge?

Why “相同意思的词” is called “同义词” instead of "同意词"?

What is the meaning of Triage in Cybersec world?

Inverse Relationship Between Precision and Recall

Slides for 30 min~1 hr Skype tenure track application interview

Geography at the pixel level

Can you cast a spell on someone in the Ethereal Plane, if you are on the Material Plane and have the True Seeing spell active?

Why are there uneven bright areas in this photo of black hole?

What does Linus Torvalds mean when he says that Git "never ever" tracks a file?

What is the most efficient way to store a numeric range?



cv2.imshow() function throws an assertion error



The 2019 Stack Overflow Developer Survey Results Are Incv2.error: OpenCV(4.0.0) error: (-215:Assertion failed) dst.data == (uchar*)dst_ptr in function 'cvShowImage'OpenNI and OpenCV: cv2.imshow() crashes with error: (-215:Assertion failed) dst.data == (uchar*)dst_ptr in function 'cvShowImage'How to flush output of print function?Build Error For cv2.imshow()Python cv2 cv2.imshow() not working in windowsHow to solve cv2.error: (-215)?Python-OpenCV cv2 OpenCV Error: Assertion failedResizing video resolution in OpenCV pythonOpen CV error in motion detectionOpenCV “cv2.omnidir.calibrate” throws an Assertion ErrorWhy does my color detection code cause an OpenCV error?tkinter.root.destroy and cv2.imshow - X Windows system error



.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















The above error still persists even after upgrading my opencv library and also uninstalling and reinstalling several times.



Any other tips to fix this error?



This my source code, the cv2.imshow() function started giving me the error.



cap = cv2.VideoCapture(0)
while True:
_, frame = cap.read()

sobelx = cv2.Sobel(frame, cv2.CV_64F, 1, 0, ksize=5)
sobely = cv2.Sobel(frame, cv2.CV_64F, 0, 1, ksize=5)
cv2.imshow('frame', frame)
cv2.imshow('sobelx', sobelx)
cv2.imshow('sobely', sobely)

if cv2.waitKey(5) & 0xFF == 27:
break

cv2.destroyAllWindows()
cap.release()


The Error Message I recieve:



 cv2.imshow('sobelx', sobelx)
cv2.error: OpenCV(4.0.0) C:projects
opencv-pythonopencvmoduleshighguisrcwindow_w32.cpp:1230:
error: (-215:Assertion failed) dst.data == (uchar*)dst_ptr in function 'cvShowImage'


On the other hand the cv2.imshow() function works properly for the below code. Please note: The code below does not apply any filters like laplacian or sobel to the video feed.



cap = cv2.VideoCapture(0)
while True:
_, frame = cap.read()
cv2.imshow('frame', frame)

if cv2.waitKey(5) & 0xFF == 27:
break

cv2.destroyAllWindows()
cap.release()









share|improve this question






















  • Have you reviewed these other posts: stackoverflow.com/q/54336237/9987623, stackoverflow.com/q/54370220/9987623

    – AlexK
    Mar 22 at 5:15

















0















The above error still persists even after upgrading my opencv library and also uninstalling and reinstalling several times.



Any other tips to fix this error?



This my source code, the cv2.imshow() function started giving me the error.



cap = cv2.VideoCapture(0)
while True:
_, frame = cap.read()

sobelx = cv2.Sobel(frame, cv2.CV_64F, 1, 0, ksize=5)
sobely = cv2.Sobel(frame, cv2.CV_64F, 0, 1, ksize=5)
cv2.imshow('frame', frame)
cv2.imshow('sobelx', sobelx)
cv2.imshow('sobely', sobely)

if cv2.waitKey(5) & 0xFF == 27:
break

cv2.destroyAllWindows()
cap.release()


The Error Message I recieve:



 cv2.imshow('sobelx', sobelx)
cv2.error: OpenCV(4.0.0) C:projects
opencv-pythonopencvmoduleshighguisrcwindow_w32.cpp:1230:
error: (-215:Assertion failed) dst.data == (uchar*)dst_ptr in function 'cvShowImage'


On the other hand the cv2.imshow() function works properly for the below code. Please note: The code below does not apply any filters like laplacian or sobel to the video feed.



cap = cv2.VideoCapture(0)
while True:
_, frame = cap.read()
cv2.imshow('frame', frame)

if cv2.waitKey(5) & 0xFF == 27:
break

cv2.destroyAllWindows()
cap.release()









share|improve this question






















  • Have you reviewed these other posts: stackoverflow.com/q/54336237/9987623, stackoverflow.com/q/54370220/9987623

    – AlexK
    Mar 22 at 5:15













0












0








0








The above error still persists even after upgrading my opencv library and also uninstalling and reinstalling several times.



Any other tips to fix this error?



This my source code, the cv2.imshow() function started giving me the error.



cap = cv2.VideoCapture(0)
while True:
_, frame = cap.read()

sobelx = cv2.Sobel(frame, cv2.CV_64F, 1, 0, ksize=5)
sobely = cv2.Sobel(frame, cv2.CV_64F, 0, 1, ksize=5)
cv2.imshow('frame', frame)
cv2.imshow('sobelx', sobelx)
cv2.imshow('sobely', sobely)

if cv2.waitKey(5) & 0xFF == 27:
break

cv2.destroyAllWindows()
cap.release()


The Error Message I recieve:



 cv2.imshow('sobelx', sobelx)
cv2.error: OpenCV(4.0.0) C:projects
opencv-pythonopencvmoduleshighguisrcwindow_w32.cpp:1230:
error: (-215:Assertion failed) dst.data == (uchar*)dst_ptr in function 'cvShowImage'


On the other hand the cv2.imshow() function works properly for the below code. Please note: The code below does not apply any filters like laplacian or sobel to the video feed.



cap = cv2.VideoCapture(0)
while True:
_, frame = cap.read()
cv2.imshow('frame', frame)

if cv2.waitKey(5) & 0xFF == 27:
break

cv2.destroyAllWindows()
cap.release()









share|improve this question














The above error still persists even after upgrading my opencv library and also uninstalling and reinstalling several times.



Any other tips to fix this error?



This my source code, the cv2.imshow() function started giving me the error.



cap = cv2.VideoCapture(0)
while True:
_, frame = cap.read()

sobelx = cv2.Sobel(frame, cv2.CV_64F, 1, 0, ksize=5)
sobely = cv2.Sobel(frame, cv2.CV_64F, 0, 1, ksize=5)
cv2.imshow('frame', frame)
cv2.imshow('sobelx', sobelx)
cv2.imshow('sobely', sobely)

if cv2.waitKey(5) & 0xFF == 27:
break

cv2.destroyAllWindows()
cap.release()


The Error Message I recieve:



 cv2.imshow('sobelx', sobelx)
cv2.error: OpenCV(4.0.0) C:projects
opencv-pythonopencvmoduleshighguisrcwindow_w32.cpp:1230:
error: (-215:Assertion failed) dst.data == (uchar*)dst_ptr in function 'cvShowImage'


On the other hand the cv2.imshow() function works properly for the below code. Please note: The code below does not apply any filters like laplacian or sobel to the video feed.



cap = cv2.VideoCapture(0)
while True:
_, frame = cap.read()
cv2.imshow('frame', frame)

if cv2.waitKey(5) & 0xFF == 27:
break

cv2.destroyAllWindows()
cap.release()






python-3.x opencv4






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 22 at 4:39









Carlton RodriguesCarlton Rodrigues

1




1












  • Have you reviewed these other posts: stackoverflow.com/q/54336237/9987623, stackoverflow.com/q/54370220/9987623

    – AlexK
    Mar 22 at 5:15

















  • Have you reviewed these other posts: stackoverflow.com/q/54336237/9987623, stackoverflow.com/q/54370220/9987623

    – AlexK
    Mar 22 at 5:15
















Have you reviewed these other posts: stackoverflow.com/q/54336237/9987623, stackoverflow.com/q/54370220/9987623

– AlexK
Mar 22 at 5:15





Have you reviewed these other posts: stackoverflow.com/q/54336237/9987623, stackoverflow.com/q/54370220/9987623

– AlexK
Mar 22 at 5:15












1 Answer
1






active

oldest

votes


















0














In this Github issue discussion, it was mentioned that this bug was fixed in OpenCV 4.0.1. Based on the error you received, it looks like you have 4.0.0, so another upgrade may be needed.






share|improve this answer























    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
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55293015%2fcv2-imshow-function-throws-an-assertion-error%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









    0














    In this Github issue discussion, it was mentioned that this bug was fixed in OpenCV 4.0.1. Based on the error you received, it looks like you have 4.0.0, so another upgrade may be needed.






    share|improve this answer



























      0














      In this Github issue discussion, it was mentioned that this bug was fixed in OpenCV 4.0.1. Based on the error you received, it looks like you have 4.0.0, so another upgrade may be needed.






      share|improve this answer

























        0












        0








        0







        In this Github issue discussion, it was mentioned that this bug was fixed in OpenCV 4.0.1. Based on the error you received, it looks like you have 4.0.0, so another upgrade may be needed.






        share|improve this answer













        In this Github issue discussion, it was mentioned that this bug was fixed in OpenCV 4.0.1. Based on the error you received, it looks like you have 4.0.0, so another upgrade may be needed.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Mar 22 at 5:07









        AlexKAlexK

        441111




        441111





























            draft saved

            draft discarded
















































            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.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55293015%2fcv2-imshow-function-throws-an-assertion-error%23new-answer', 'question_page');

            );

            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







            Popular posts from this blog

            Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

            Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

            Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript